CI: allow use of trigger with scripts

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Release notes

  • CI scripts may now trigger other pipelines after completion

Problem to solve

We have a deployment task which uses a template to run deployments against a particular environment. Currently, there is no way to say that you would like it to trigger a pipeline in a different project after completing the appropriate deployment without doing something kludgy like creating a new pipeline stage and duplicating all of your rules to make sure the trigger isn't scheduled when the deployment also isn't.

.deploy:
  stage: deploy
  extends: .ansible-container
  resource_group: $CI_ENVIRONMENT_SLUG
  interruptible: false
  script:
    - ansible-playbook -i "${CI_ENVIRONMENT_SLUG}.aws_ec2.yaml" deploy.yaml

deploy_development:
  extends: .deploy
  only:
    refs:
      - development
  environment:
    name: development

deploy_testing:
  

Proposal

Ideally, GitLab would let you express the intention of triggering the pipeline immediately after the relevant job by using the trigger keyword on a task which also has a script:

deploy_development:
  extends: .deploy
  only:
    refs:
      - development
  environment:
    name: development
  trigger:
    project: path/to/other/project
    strategy: depend
    branch: $CI_ENVIRONMENT_SLUG

Intended users

Does this feature require an audit event?

No

Edited by 🤖 GitLab Bot 🤖