How to Trigger an Automation Script

2.5.4. How to Trigger an Automation Script#

  • Triggering Pipelines:

    • Pipelines can be triggered by various events.

    • Rules can be set to determine if an event should initiate actions.

  • Defining Pipeline Rules: Use the rules key under the top-level workflow key to define rules for the entire Pipeline.

    workflow:
      rules:
        - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    
  • Defining Job Rules: The rules keyword can also be used for individual jobs.

    job1:
      script:
        - echo "This is a merge request"
      rules:
        - if: $CI_PIPELINE_SOURCE == "merge_request_event"