I have the following Job to build Images in my gitlab-ci.yml
dockerize:
stage: containerize
before_script:
- eval $($CONTEXT_SCRIPT_PATH)
environment:
name: $CONTEXT
url: XXX
image:
name: gcr.io/kaniko-project/executor:debug-v0.23.0
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_DOCKER_REGISTRY_URL\":{\"username\":\"$CI_DOCKER_REGISTRY_USER\",\"password\":\"$CI_DOCKER_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_DOCKER_REGISTRY_URL/portal/frontend:$CONTEXT-$CI_PIPELINE_IID --build-arg VERSION_TAG=$CONTEXT-$CI_PIPELINE_IID --build-arg COMMIT_TIME=$COMMIT_TIME
- echo "Pushed to Registry - $CI_DOCKER_REGISTRY_URL/portal/frontend:$CONTEXT-$CI_PIPELINE_IID"
retry: 2
In the before_script section the env $CONTEXT gets set. $CONTEXT_SCRIPT_PATH is set in a global variables section:
variables:
CONTEXT_SCRIPT_PATH: "${CI_PROJECT_DIR}/Scripts/get_context.sh"
But if the Job is running, it can't find the script.
/busybox/sh: eval: line 90: /builds/portal/portal-frontend/Scripts/get_context.sh: not found
It works in other Jobs, so is Kaniko running in some separate environment? How do I specify the right Path?