Gitlab CI Child pipeline - TagMerge
3Gitlab CI Child pipelineGitlab CI Child pipeline

Gitlab CI Child pipeline

Asked 1 years ago
1
3 answers

You can use rules:changes with a glob pattern and only run a certain job if anything changes in the specific app folder:

appA1:
  stage: child-pipelines
  trigger:
    include:
      - local: applicationA/appA1/gitlab-ci.yml
    strategy: depend
  rules:
    - if: '$APPNAME == "appA1" && $CI_PIPELINE_SOURE == "web"'
      changes:
        - Main/applicationsA/appA1/**/*

Source: link

0

This is the name of the function we’ll call later in this post, with its 3 parameters: cloud , env , workspace. Those will be populated, but for now act as placeholders.
plan(cloud, env, workspace)::{}

Source: link

0

The simplest case is triggering a child pipeline using a local YAML file to define the pipeline configuration. In this case, the parent pipeline triggers the child pipeline, and continues without waiting:
microservice_a:
  trigger:
    include: path/to/microservice_a.yml
You can include multiple files when composing a child pipeline:
microservice_a:
  trigger:
    include:
      - local: path/to/microservice_a.yml
      - template: Security/SAST.gitlab-ci.yml
In GitLab 13.5 and later, you can use include:file to trigger child pipelines with a configuration file in a different project:
microservice_a:
  trigger:
    include:
      - project: 'my-group/my-pipeline-library'
        file: 'path/to/ci-config.yml'
Similar to multi-project pipelines, we can set the parent pipeline to depend on the status of the child pipeline upon completion:
microservice_a:
  trigger:
    include:
      - local: path/to/microservice_a.yml
      - template: Security/SAST.gitlab-ci.yml
    strategy: depend
Set the trigger job to run on merge requests:
# parent .gitlab-ci.yml
microservice_a:
  trigger:
    include: path/to/microservice_a.yml
  rules:
    - if: $CI_MERGE_REQUEST_ID

Source: link

Recent Questions on gitlab

    Programming Languages