Commit 14b09495 authored by Zach Rice's avatar Zach Rice

Load env vars with -e in sast template

parent 691b83eb
---
title: Fix multiline issue when loading env vars from DinD in SAST
merge_request: 24108
author:
type: fixed
...@@ -37,11 +37,8 @@ sast: ...@@ -37,11 +37,8 @@ sast:
fi fi
fi fi
- | - |
printenv | grep -E '^(DOCKER_|CI|GITLAB_|FF_|HOME|PWD|OLDPWD|PATH|SHLVL|HOSTNAME)' | cut -d'=' -f1 | \ ENVS=`printenv | grep -vE '^(DOCKER_|CI|GITLAB_|FF_|HOME|PWD|OLDPWD|PATH|SHLVL|HOSTNAME)' | sed -n '/^[^\t]/s/=.*//p' | sed '/^$/d' | sed 's/^/-e /g' | tr '\n' ' '`
(while IFS='\\n' read -r VAR; do unset -v "$VAR"; done; /bin/printenv > .env) docker run "$ENVS" \
- |
docker run \
--env-file .env \
--volume "$PWD:/code" \ --volume "$PWD:/code" \
--volume /var/run/docker.sock:/var/run/docker.sock \ --volume /var/run/docker.sock:/var/run/docker.sock \
"registry.gitlab.com/gitlab-org/security-products/sast:$SAST_VERSION" /app/bin/run /code "registry.gitlab.com/gitlab-org/security-products/sast:$SAST_VERSION" /app/bin/run /code
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment