Improve image building to get closer to support zuul package mirrors Change-Id: I57285b242ddc50e8e902ad2820982a2d4b351bc3changes/82/587582/7
parent
7b6af1bdc9
commit
812cef9335
@ -1,9 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Install host-level package dependencies
|
||||
# needed for local testing
|
||||
set -x
|
||||
|
||||
if [[ ! -z $(uname -a | grep Ubuntu) ]]
|
||||
then
|
||||
apt install -y --no-install-recommends $(grep -v '^#' requirements-host.txt)
|
||||
apt update
|
||||
installed_pkgs=$(apt list --installed | cut -d'/' -f1)
|
||||
set -a added_pkgs
|
||||
for reqfile in $(ls requirements-host*.txt)
|
||||
do
|
||||
for l in $(grep -vE '(^ *#)|(^$)' "${reqfile}")
|
||||
do
|
||||
# Do extra magic to support a list of alternative packages separated by '|'
|
||||
# none of the packages are found, install the first one listed
|
||||
IFS='|' read -a pkgalts <<< "${l}"
|
||||
pkgfound=0
|
||||
for a in "${pkgalts[@]}"
|
||||
do
|
||||
if grep -qE "^${a}$" <<< "${installed_pkgs}"
|
||||
then
|
||||
pkgfound=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ "${pkgfound}" -eq 0 ]]
|
||||
then
|
||||
added_pkgs+=("${pkgalts[0]}")
|
||||
fi
|
||||
done
|
||||
done
|
||||
if [[ ${#added_pkgs[@]} -gt 0 ]]
|
||||
then
|
||||
apt install -y --no-install-recommends "${added_pkgs[@]}"
|
||||
fi
|
||||
else
|
||||
echo "Only support testing on Ubuntu hosts at this time."
|
||||
fi
|
||||
|
@ -0,0 +1,5 @@
|
||||
# These are host packages needed for Drydock
|
||||
# that don't come on a minimal Ubuntu install
|
||||
python-tox
|
||||
docker.io|docker-ce
|
||||
plantuml
|
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
UBUNTU_REPO=${UBUNTU_REPO:-""}
|
||||
TRUSTED_UBUNTU_REPO=${TRUSTED_UBUNTU_REPO:-"no"}
|
||||
ALLOW_UNATHENTICATED=${ALLOW_UNAUTHENTICATED:-"false"}
|
||||
PIP_INDEX_URL=${PIP_INDEX_URL:-""}
|
||||
PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST:-""}
|
||||
|
||||
ADDL_BUILD_ARGS=""
|
||||
|
||||
if [[ ! -z "${UBUNTU_REPO}" ]]
|
||||
then
|
||||
ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS} --build-arg UBUNTU_REPO=${UBUNTU_REPO}"
|
||||
ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS} --build-arg TRUSTED_UBUNTU_REPO=${TRUSTED_UBUNTU_REPO}"
|
||||
ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS} --build-arg ALLOW_UNAUTHENTICATED=${ALLOW_UNAUTHENTICATED}"
|
||||
fi
|
||||
|
||||
if [[ ! -z "${PIP_INDEX_URL}" ]]
|
||||
then
|
||||
ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS}| --build-arg PIP_INDEX_URL=${PIP_INDEX_URL}"
|
||||
ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS}| --build-arg PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST}"
|
||||
fi
|
||||
|
||||
docker build --network host -t ${IMAGE} --label ${LABEL} -f images/drydock/Dockerfile \
|
||||
${ADDL_BUILD_ARGS} \
|
||||
--build-arg http_proxy=${http_proxy} \
|
||||
--build-arg https_proxy=${https_proxy} \
|
||||
--build-arg HTTP_PROXY=${HTTP_PROXY} \
|
||||
--build-arg HTTPS_PROXY=${HTTPS_PROXY} \
|
||||
--build-arg no_proxy=${no_proxy} \
|
||||
--build-arg NO_PROXY=${NO_PROXY} .
|
||||
|
Loading…
Reference in new issue