Updated CI/CD variables are not being updated in pipelines

Hi,

I have a modified auto-devops pipeline that writes CI variables to a file in my app and deploys the app to kubernetes.
The variables are not set as protected due to this being a test version.
When a variable is changed in the CI/CD settings of gitlab.com and the pipeline is rerun, the value does not update in the pipeline. It still shows the old value.

So for example if foo was equal to bar and then you were to change it to baz the value would still be bar instead of the new value of baz.

Here is the .gitlab-ci.yml for reference

include:
    - template: Auto-DevOps.gitlab-ci.yml

build:
    before_script:
        - echo "FOO=$BAR" >> .env

When I access the pod shell and read the file FOO is equal to the old value not the new one.

Here is a list of things I’ve tried:

  • Clearing the runner cache
  • Clearing the cluster cache
  • Deleting all of the deployments related to the app
  • Deleting artifacts and containers in the GitLab registry
  • Manually entering in the variables during manual trigger of pipeline
  • Creating a new branch
  • Searching forums
  • Aging 30 years and losing hair
  • Cutting out gluten

Only creating a new branch updated the value in the file.

I really don’t want to have to create a new branch every single time a variable value gets changed.
I would think that updating the variable in the variables would allow the next run to use the updated value.
I’m very confused with this behavior and I don’t know if this is a bug, or if it is something I just don’t understand.
Some help could be greatly appreciated, thanks.

1 Like

I have observed a similar behavior.

  • Branch with a new .gitlab-ci yaml file (default branch has non)
  • Branch has a predefined variable for CI_DEBUG_TRACE with a default value of “false”
  • Manually running the branch pipeline, and setting that variable to true (no quotes in the field) the value is not preserved in my child pipelines (parent pipeline just references child one so I can’t see if it is set in the parent)

I’m sorry I don’t have a solution for you - but I do have some added information that may suggest your observation is related to the child pipeline manual inheritance bug that Gitlab has. Parent/Child: variable defined in manually triggered pipeline UI should be sent to children (#213729) · Issues · GitLab.org / GitLab · GitLab

Interesting. Thanks I’ll take a look at that.

My workaround for now is to manually delete and re-enter the variable in the .gitlab-ci.yml file. I’m hoping that I don’t have to keep doing that though because it’s extremely annoying.

1 Like

I’m also facing this issue

Faced same issue - i solved it with

before_script:
        - sed -i "$ a\FOO=${BAR}" .env