Unable to access custom variables in helper scripts

I have a number of custom CI/CD variables set up for my project, group and globally. There’s a mix of masked, protected, and ‘none of the above’ for testing. My runners are self-hosted, docker based.

$ gitlab-runner --version
Version:      15.3.0
Git revision: bbcb5aba
Git branch:   15-3-stable
GO version:   go1.17.9
Built:        2022-08-19T22:41:11+0000
OS/Arch:      linux/amd64

Exec’ing in to the spawned runner for the pipeline, none of the custom variables exists as an environment variable in the environment. All of the gitlab internal variables do seem to be there.

I found a /scripts-*/ folder (the number changes every run) with a “get_sources” script in there that contains a lengthy snippet with a number of variable exports, that have my custom variables, but the spawned runner doesn’t have a number of binaries that this script wants to successfully run (git for starters). Not sure if this is supposed to run to populate the environment, or if something else is missing.

I can access my custom variables within the pipeline yaml bash command, but I have a custom script that needs to run and thus needs to have those variables properly exist within the runner environment scope.

Within the gitlab runner pipeline:

$ echo $DOCKER_REGISTRY_SERVER
example.docker.registry.server

From within the runner container:

root@runner-uq1vdagd-project-34-concurrent-09gvqb:/# echo $DOCKER_REGISTRY_SERVER

root@runner-uq1vdagd-project-34-concurrent-09gvqb:/# env |grep -i DOCKER_REGISTRY_SERVER
root@runner-uq1vdagd-project-34-concurrent-09gvqb:/#