Skip to content

Dynamically generate child pipeline from artifact

Fabio Pitino requested to merge add-trigger-include-artifact into master

What does this MR do?

Related to: #35632 (closed)

  • Introduce trigger:include:artifact syntax which will allow a bridge job triggering a child pipeline to use the content of an artifact as CI configuration
  • Pass parent pipeline to Gitlab::Ci::Config and to the External::Context so that we can define whether a pipeline is being created as child of another pipeline
  • Add new Gitlab::Ci::Config::External::File::Artifact class which is responsible for fetching and validating the content to include

What does this MR NOT do?

  • check if the job containing the referenced artifacts is in the dependency path for the trigger job. This will be tackled in a separate MR. See !23790 (comment 289387012)

Demo

Demo of the feature: https://www.youtube.com/watch?v=nMdfus2JWHM

Feature flag

ci_dynamic_child_pipeline off by default.

Screenshots

stages:
  - build
  - test

# supposed we have a script or service that dynamically
# generates CI configurations
generate-config:
  stage: build
  script: my-ci-generator.sh > generated-config.yml
  artifacts:
    paths:
      - generated-config.yml

run-generated-child:
  stage: test
  trigger:
    include:
      - artifact: generated-config.yml
        job: generate-config

image

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Kamil Trzciński

Merge request reports