Pass variables into docker container
Problem to solve
pass variables into docker container in gitlab-ci-yml
Further details
Here is a job from my configuration (without the variables section, PROXY_HOST_NAME and BASE_DIR are empty in the docker container):
linkchecker:
stage: linkchecker
image:
name: linkchecker/linkchecker
entrypoint: [""]
variables:
PROXY_HOST_NAME: ${PROXY_HOST_NAME}
BASE_DIR: ${BASE_DIR}
script:
- linkchecker --no-status --no-robots --no-warnings --check-extern https://${PROXY_HOST_NAME}/${BASE_DIR}/
when: manual
How can I pass variables ${PROXY_HOST_NAME} and ${BASE_DIR} into the Docker container? In the current configuration the variables are passed on as strings:
[…]
Start checking at 2018-10-03 10:36:27+000
URL `https://${PROXY_HOST_NAME}/${BASE_DIR}/'
Real URL https://%24%7bproxy_host_name%7d/%24%7BBASE_DIR%7D/
Check time 0.020 seconds
Result Error: ConnectionError: HTTPSConnectionPool(host='%24%7bproxy_host_name%7d', port=443): Max retries exceeded with url: /%24%7BBASE_DIR%7D/ (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5...
[…]
Proposal
Pass the value of the variables and not the name
What does success look like, and how can we measure that?
(If no way to measure success, link to an issue that will implement a way to measure this)
Links / references
Edited by Andreas Böttger