0

I am configuring a Gitlab C/I that will trigger several child pipelines in another project.

Each one of the child projects and pipelines needs two variables (foo and bar) and I want to trigger them in parallel, with a matrix job.

The number of child projects and pipelines will change, and I want to keep the configuration simple. If a new project needs to be added, I only want to add the two needed variables in a file and nothing else.

So, I imagined this configuration:

First the file where the variables will be stored:

# variables.yml
matrix_variables:
  - foo: "single value for foo"
    bar: "single value for bar"
  - foo: "another single value for foo"
    bar: "antoher single value for bar"

Then, the .gitlab-ci.yml:

# .gitlab-ci.yml
    include:
      - local: variables.yml
    stages:
      - example
        example_job:
     stage: example
     script:
      - echo "foo is $foo"
      - echo "bar is $bar"
    parallel:
     matrix:
      - extends: matrix_variables

But when pushing and run on my gitlab project, I get the following error labelled with "YAML invalid" and "error":

jobs matrix variables config should implement a script: or a trigger: keyword

I then tried to add a dummy script to my variables.yml and even inside the matrix job in the .gitlab-ci.yml, but still the same error.

My question is: Is what I am trying to achieve even possible, if yes, how ?

My gitlab instance is running with the Community Edition 15.91.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.