From 2a6dab97d931bff88a9c276a480f158865300429 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philippe=20Lafoucri=C3=A8re?= <plafoucriere@gitlab.com>
Date: Wed, 19 Jun 2019 06:31:22 +0000
Subject: [PATCH] Fix Container Scanning job with K8S runners

---
 changelogs/unreleased/11448-fix-cs-with-k8s-runners.yml      | 5 +++++
 .../ci/templates/Security/Container-Scanning.gitlab-ci.yml   | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
 create mode 100644 changelogs/unreleased/11448-fix-cs-with-k8s-runners.yml

diff --git a/changelogs/unreleased/11448-fix-cs-with-k8s-runners.yml b/changelogs/unreleased/11448-fix-cs-with-k8s-runners.yml
new file mode 100644
index 00000000000..191e64df4f1
--- /dev/null
+++ b/changelogs/unreleased/11448-fix-cs-with-k8s-runners.yml
@@ -0,0 +1,5 @@
+---
+title: Fix Container Scanning job timeout when using the kubernetes executor
+merge_request: 29706
+author: 
+type: fixed
diff --git a/lib/gitlab/ci/templates/Security/Container-Scanning.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/Container-Scanning.gitlab-ci.yml
index 5372ec6cceb..d1a34c515fa 100644
--- a/lib/gitlab/ci/templates/Security/Container-Scanning.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/Container-Scanning.gitlab-ci.yml
@@ -30,7 +30,7 @@ container_scanning:
   services:
     - docker:stable-dind
   script:
-    - if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then { export DOCKER_SERVICE="localhost" ; export DOCKER_HOST="tcp://${DOCKER_SERVICE}:2375" ; } fi
+    - if [[ -n "$KUBERNETES_PORT" ]]; then { export DOCKER_SERVICE="localhost" ; export DOCKER_HOST="tcp://${DOCKER_SERVICE}:2375" ; } fi
     - |
       if [[ -n "$CI_REGISTRY_USER" ]]; then
         echo "Logging to GitLab Container Registry with CI credentials..."
-- 
2.30.9