Commit ab22295f authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'sast-support-multiline' into 'master'

SAST ci template to support multi line env vars by using -e instead of .env file

See merge request gitlab-org/gitlab!24108
parents f1cff0ee 14b09495
---
title: Fix multiline issue when loading env vars from DinD in SAST
merge_request: 24108
author:
type: fixed
......@@ -37,11 +37,8 @@ sast:
fi
fi
- |
printenv | grep -E '^(DOCKER_|CI|GITLAB_|FF_|HOME|PWD|OLDPWD|PATH|SHLVL|HOSTNAME)' | cut -d'=' -f1 | \
(while IFS='\\n' read -r VAR; do unset -v "$VAR"; done; /bin/printenv > .env)
- |
docker run \
--env-file .env \
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' ' '`
docker run "$ENVS" \
--volume "$PWD:/code" \
--volume /var/run/docker.sock:/var/run/docker.sock \
"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