Child pipeline and predefined variables

Demo project - Artem Sheveliukhin / downstream pipeline · GitLab

ci file - .gitlab-ci.yml · master · Artem Sheveliukhin / downstream pipeline · GitLab

child ci file - generated-ci.yml · master · Artem Sheveliukhin / downstream pipeline · GitLab


  1. Default value for variable PREDEFINED_VARIABLE - “predefined”
    Run pipeline with parameters -

  2. Check env vars in fake-generate (parent) job. Env vars - image

  3. Check env vars in test (child) job. Env vars - image

Example of a pipeline - Pipeline · Artem Sheveliukhin / downstream pipeline · GitLab

Why in the child pipeline PREDEFINED_VARIABLE has its default value and ANOTHER_VALUE is missing ?

Hmm. The docs are a bit confusing, but this suggests that you need to define the variables in the parent .gitlab-ci.yml where the child pipeline is triggered:

  stage: child
      - local: generated-ci.yml
        job: fake-generate
    strategy: depend

When you define variables in UI you define them for parent pipeline only. As @snim2 pointed out you have to pass the variables to child pipeline. Child pipeline is considered as another pipeline and it does not inherit things from ‘parent’ pipeline automatically.
You should also look at GitLab CI/CD variables | GitLab. Variables passed to child pipelines are currently 5th - Inherited variables.

@snim2 @balonik
My main question is why prefilled variable from ci file of the parent pipeline is passing to the child pipeline
Also create ticket - Prefilled values of the variables in a `ci` file of a parent pipeline are passing to a child pipeline (#327834) · Issues · / GitLab · GitLab