gitlab-ci-local icon indicating copy to clipboard operation
gitlab-ci-local copied to clipboard

Jobs with trigger, should automatically spawn the generated pipeline

Open firecow opened this issue 3 years ago • 6 comments

This missing feature can be "circumvented" by using the --file parameter

gitlab-ci-local
gitlab-ci-local --file yml-generated-by-first-run.yml

firecow avatar Mar 14 '21 08:03 firecow

I'm not sure if this is why I can't trigger pipelines.

I'm trying to do something like

.gitlab-ci.yml

trigger_job:
  variables:
    MY_VAR: world
  trigger:
     include: path/to/local-pipeline.yml

`path/to/local-pipeline.yml``

child-job:
  script:
    - echo "Hello $MY_VAR"

I would expect the jobs in the child pipeline to run and echo "Hello world" I don't understand how this workaround would help with trigger jobs.

jsnordhealth avatar Aug 04 '22 15:08 jsnordhealth

Variables aren't passed as normal, since the trigger instruction isn't implemented yet..

firecow avatar Aug 04 '22 15:08 firecow

Right. I see. Thanks for confirming that.

jsnordhealth avatar Aug 05 '22 02:08 jsnordhealth

Hello Is it in your plans to add this feature here?

dimitriskr avatar Nov 15 '23 10:11 dimitriskr

@firecow perhaps with a rough description of what needs to be done this could be implemented by someone else :) Would you be be able to give a rough outline of how one a would go about this?

bbrala avatar Nov 26 '23 12:11 bbrala

We need to implement code in gitlab-ci-local that understands the Gitlab CI/CD trigger keyword.

Things to consider

  • Print trigger identifier on each log output line
  • Make sure variables from one pipeline can be passed to the child pipeline
  • Read and understand Gitlab CI/CD docs about triggered pipelines https://docs.gitlab.com/ee/ci/pipelines/downstream_pipelines.html

We are not interested in supporting that gitlab-ci-local can trigger pipelines in other projects, but child pipelines should be doable.

Here is an example that should be working, when this feature is implemented.

variables:
  VERSION: "1.0.0"

staging:
  variables:
    ENVIRONMENT: staging
  stage: deploy
  trigger:
    include:
      - local: path/to/child-pipeline.yml

firecow avatar Nov 26 '23 12:11 firecow