diff options
author | Philippe Lafoucrière <plafoucriere@gitlab.com> | 2019-03-30 19:05:13 +0300 |
---|---|---|
committer | Philippe Lafoucrière <plafoucriere@gitlab.com> | 2019-03-31 15:58:01 +0300 |
commit | 6a25f8bc794d42a744082ae09d7fc4bbbaa5e5a4 (patch) | |
tree | b463a743eb8f2a9b84efb60b6869e18da94e85dd /lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml | |
parent | 50a1e01fa8959b08df8bfc18940f9310876873b3 (diff) |
Fix Container Scanning for Kubernetes Runners
closes https://gitlab.com/gitlab-org/gitlab-ee/issues/6636
closes https://gitlab.com/gitlab-org/gitlab-ee/issues/5763
Diffstat (limited to 'lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml')
-rw-r--r-- | lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml index 78872b3bbe3..3116f1a136b 100644 --- a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml @@ -531,8 +531,8 @@ rollout 100%: touch clair-whitelist.yml retries=0 echo "Waiting for clair daemon to start" - while( ! wget -T 10 -q -O /dev/null http://docker:6060/v1/namespaces ) ; do sleep 1 ; echo -n "." ; if [ $retries -eq 10 ] ; then echo " Timeout, aborting." ; exit 1 ; fi ; retries=$(($retries+1)) ; done - ./clair-scanner -c http://docker:6060 --ip $(hostname -i) -r gl-container-scanning-report.json -l clair.log -w clair-whitelist.yml ${CI_APPLICATION_REPOSITORY}:${CI_APPLICATION_TAG} || true + while( ! wget -T 10 -q -O /dev/null http://${DOCKER_SERVICE}:6060/v1/namespaces ) ; do sleep 1 ; echo -n "." ; if [ $retries -eq 10 ] ; then echo " Timeout, aborting." ; exit 1 ; fi ; retries=$(($retries+1)) ; done + ./clair-scanner -c http://${DOCKER_SERVICE}:6060 --ip $(hostname -i) -r gl-container-scanning-report.json -l clair.log -w clair-whitelist.yml ${CI_APPLICATION_REPOSITORY}:${CI_APPLICATION_TAG} || true } function code_quality() { @@ -800,10 +800,15 @@ rollout 100%: kubectl version --client } + # With the Kubernetes executor, 'localhost' must be used instead + # https://docs.gitlab.com/runner/executors/kubernetes.html function setup_docker() { if ! docker info &>/dev/null; then if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then export DOCKER_HOST='tcp://localhost:2375' + export DOCKER_SERVICE="localhost" + else + export DOCKER_SERVICE="docker" fi fi } |