I’m guessing this is known behavior, but I have several variables defined project-level that aren’t passed to a service within a job. Unless I specifically and explicitly redefine them within the job. Which is tedious. Is this a bug?
Example below. There is no global variables
section. (I thought maybe that was masking my job-level variables, but it’s not.) If I remove the variables
section from this job, the service will not start correctly.
It’s also worth noting that the env
command output shows the project-level variables correctly set even when the variables
section is removed.
cypress_click_test:
stage: test
####### What I'd like to remove... #######
variables:
BASE_URL: ${BASE_URL}
...
SERVICE_ACCOUNT: ${SERVICE_ACCOUNT}
##########################################
services:
- name: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}
alias: my-app-ui
image: cypress/base:10
script:
- env
- . run_click_tests.sh http://my-app-ui/
So it seems like the project-level variables are applied sometime after the services start but before the script(s?) are run.
This could be a security feature to protect some off-the-shelf Docker image from accessing $KINGDOM_KEYS
without my explicit permission. But alternatively, having to set VAR=$VAR
for 10 different project-level variables is - as I said - tedious.