From 96ebea2e8f53e536d88f2b0e739d369bf01ed1eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Ollivier?= Date: Mon, 24 Jun 2019 17:21:29 +0200 Subject: [PATCH] Set proxies in Cloudify container MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit add_proxy.sh now modifies Cloudify containers to allow proxies. It follows "Update and enable Cloudify-based testcases" [1] [1] https://gerrit.opnfv.org/gerrit/#/c/66909/ Co-Authored-By: Thierry ALLENO Change-Id: I54cfcd73685695c5f66f24acd32f126786acf48e Signed-off-by: Cédric Ollivier (cherry picked from commit f246dd3889df5302756c9c73d70b346695aca146) --- functest/ci/add_proxy.sh | 56 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/functest/ci/add_proxy.sh b/functest/ci/add_proxy.sh index 3244f246a..f815ef09b 100644 --- a/functest/ci/add_proxy.sh +++ b/functest/ci/add_proxy.sh @@ -4,28 +4,32 @@ set -e pushd "${1:-/home/opnfv/functest/images}" > /dev/null +http_proxy=${http_proxy:-http://proxy:8080} +https_proxy=${https_proxy:-${http_proxy:-http://proxy:8080}} +ftp_proxy=${ftp_proxy:-${http_proxy:-http://proxy:8080}} +no_proxy=${no_proxy:-"10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"} + images=${images-"\ -cloudify-manager-premium-4.0.1.qcow2 \ ubuntu-14.04-server-cloudimg-amd64-disk1.img \ ubuntu-16.04-server-cloudimg-amd64-disk1.img"} add_proxy () { cat << EOF >> "$1" -http_proxy=${http_proxy:-http://proxy:8080} -HTTP_PROXY=${http_proxy:-http://proxy:8080} -https_proxy=${https_proxy:-${http_proxy:-http://proxy:8080}} -HTTPS_PROXY=${https_proxy:-${http_proxy:-http://proxy:8080}} -ftp_proxy=${ftp_proxy:-${http_proxy:-http://proxy:8080}} -FTP_PROXY=${ftp_proxy:-${http_proxy:-http://proxy:8080}} -no_proxy=${no_proxy:-"10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"} -NO_PROXY=${no_proxy:-"10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"} +http_proxy=${http_proxy} +HTTP_PROXY=${http_proxy} +https_proxy=${https_proxy} +HTTPS_PROXY=${https_proxy} +ftp_proxy=${ftp_proxy} +FTP_PROXY=${ftp_proxy} +no_proxy=${no_proxy} +NO_PROXY=${no_proxy} EOF } add_proxy_apt () { cat << EOF >> "$1" -Acquire::http::Proxy "${http_proxy:-http://proxy:8080}"; -Acquire::https::Proxy "${https_proxy:-http://proxy:8080}"; +Acquire::http::Proxy "${http_proxy}"; +Acquire::https::Proxy "${https_proxy}"; EOF } @@ -37,17 +41,35 @@ for image in $images; do fi guestmount -a "${image}" -i --rw "${tmpdir}" add_proxy "${tmpdir}/etc/environment" - if [[ ${image} == *"cloudify-manager"* ]]; then - echo >> "${tmpdir}/etc/sysconfig/cloudify-mgmtworker" - add_proxy "${tmpdir}/etc/sysconfig/cloudify-mgmtworker" - echo >> "${tmpdir}/etc/sysconfig/cloudify-restservice" - add_proxy "${tmpdir}/etc/sysconfig/cloudify-restservice" - fi if [[ ${image} == "ubuntu"* ]]; then add_proxy_apt "${tmpdir}/etc/apt/apt.conf" fi guestunmount "${tmpdir}" done +sudo docker load -i cloudify-docker-manager-community-19.01.24.tar +dockerfile=${tmpdir}/Dockerfile +cat << EOF > $dockerfile +FROM docker-cfy-manager:latest +ENV HTTP_PROXY "${http_proxy}" +ENV HTTPS_PROXY "${https_proxy}" +ENV NO_PROXY "${no_proxy}" +EOF +for f in /etc/sysconfig/cloudify-mgmtworker /etc/sysconfig/cloudify-restservice; do \ + cat << EOF >> $dockerfile +RUN echo >> $f +RUN echo "http_proxy=${http_proxy}" >> $f +RUN echo "https_proxy=${https_proxy}" >> $f +RUN echo "HTTP_PROXY=${http_proxy}" >> $f +RUN echo "HTTPS_PROXY=${https_proxy}" >> $f +RUN echo "no_proxy=${no_proxy}" >> $f +EOF +done +sudo docker build -t docker-cfy-manager -f $dockerfile ${tmpdir} +sudo docker save \ + docker-cfy-manager > cloudify-docker-manager-community-19.01.24.tar +sudo docker rmi docker-cfy-manager + +rm "${dockerfile}" rmdir "${tmpdir}" popd > /dev/null -- 2.16.6