CICD variables set on the UI not expanded in services section

Hi,
Recently I tried to build a pipeline with Gitlab CI which runs several service containers. One of the service containers I try to configure needs an API token, by following the docs(here) I set the token and for some odd reason it seems any “dynamic” variable set via the UI is completely ignored by Gitlab.

See a snippet from my gitlab-ci file below:

image: ...

stages:
...

variables:
...

services:
...
  - name: localstack/localstack-pro:latest
    alias: localstack
    variables:
      LOCALSTACK_AUTH_TOKEN: '${LS_AUTH_TOKEN}'
      DOCKER_HOST: tcp://docker:2375
      DOCKER_TLS_VERIFY: "false"

And a screenshot of the secret:

(wanted to upload it here but it was hanging at 0%)

So far I’ve tried to:

  • move the variable into the global variables
  • move the services into a job
  • put the var reference between braces, quotes or apostrophes, like '${DEBUG}'
  • set a static value for the debug one (this gave the idea that it’s not expanded)

Env details:
Gitlab: SaaS
Runner: shared one, this is the latest: #12270840 (-AzERasQr) 5-blue.saas-linux-small-amd64.runners-manager.gitlab.com/default

Has anyone encountered similar behaviour? If so how did you work it around? Or am I missing something here?

Thanks for your time and any help in advance.

Hello! Did you manage to resolve this? I’m currently facing a similar issue where my gitlab variables are not getting transported into the service containers that my gitlab-runner spins up…