Skip to main content
Skip table of contents

Configuring a Hotfix Trigger

This page describes how to trigger a workflow (build pipeline) in various build systems.

GitHub Actions

CODE
on:
  push:
    branches:
    - master
    - 'releases/**'
  pull_request:
    branches:
    - master
    - 'releases/**'

See Events that trigger workflows.

GitLab

To trigger a pipeline on the main branch of project-B when a tag is created in project-A, add the following job to project A’s .gitlab-ci.yml file:

CODE
trigger_pipeline:
  stage: deploy
  script:
    - 'curl --fail --request POST --form token=$MY_TRIGGER_TOKEN --form ref=main "https://gitlab.myorg.com/api/v4/projects/123456/trigger/pipeline"'
  rules:
    - if: $CI_COMMIT_TAG
  environment: production

In this example:

  • 123456 is the project ID for the project ID in which you want to trigger a pipeline (the Project ID is displayed at the top of every project’s landing page.)

  • The rules clause describes the conditions that cause the job to run - in this case every time a tag is added to the project.

  • MY_TRIGGER_TOKEN is a masked CI/CD variable that contains the trigger token.

See CI/CD YAML syntax reference and Trigger pipelines with the API.

Jenkins

If your Git platform isn’t configured to trigger a specific pipeline on branch creation you can use Jenkins to interrogate the commit trigger. E.g. (for a production deployment)

CODE
stage("Step 3: Production Deployment"){
    when {
        allOf {
            expression { env.BRANCH_NAME == "origin/master" }
            expression { params.merged == true }
            expression { params.current_status == "closed" }
        }
    }
    steps{
        echo 'Do some branch-specific stuff here!'
    } 
}

Bitbucket

CODE
pipelines:
  branches:          
    master:
    - step: *Build
    - step: 
        <<: *Deploy
        name: Deploy to Prod
        deployment: prod
        trigger: manual

  tags:
    '*.*.*': # Tagged Release Version - automatically build, ready for manual deployment to Prod
      - step: *Build
      - step: 
          <<: *Deploy
          name: Deploy to Prod
          deployment: prod
          trigger: manual

See Pipeline start conditions.

Azure DevOps

To trigger the pipeline when a new branch is created, you need to remove the path filter and only set branch filter.

CODE
trigger:
  branches:
    include:
    - main
    - releases/*
    - feature/*
    exclude:
    - releases/old*
    - feature/*-working

See Build Azure Repos Git or TFS Git repositories.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.