azure-devopsazure-pipelinessemantic-release

Azure Devops pipeline does not trigger on tags when they are created by semantic release


I have two pipelines in an Azure Devops environment.

The first pipeline runs on branch main and does semantic versioning of the code: if fix or feat commits are present, it pushes another commit by changing the version in the proper file and also pushes the new tag (v{major}.{minor}.{patch}). This pipeline works fine. The semantic release process is managed through the python package commitizen.

The second pipeline builds a docker image. I want it to run only when the semantic-release tag is created. By reading the docs, I think the correct trigger should be:

trigger:
  tags:
    include:
    - v*

This does not trigger the pipeline when the semantic-release tag is created. But it works if I manually create the tag.

I also tried to allow all tags (by including '*'), and also tried this and this solutions, again without success.

Why the manually created and semantic-release created tags behave differently? Am I missing something in the semantic-release or pipeline process functioning?

EDIT: I add the details of the semantic release pipeline.

trigger:
- main

variables:
  IS_MAIN: $[eq(variables['build.sourceBranch'], 'refs/heads/main')]
  CI_USERNAME: "CI Bot"
  CI_EMAIL: ci-bot@azure.com

jobs:
- job: 'semantic_release'
  pool:
    vmImage: 'ubuntu-latest'
  strategy:
    matrix:
      Python39:
        python.version: '3.9'

  steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: '$(python.version)'

  - checkout: self
    fetchDepth: "0"
    persistCredentials: "true"
    clean: "true"

  - script: |
      git config --global user.email "$(CI_EMAIL)" && git config --global user.name "$(CI_USERNAME)"
      pip install commitizen
      cz bump --check-consistency --changelog --yes
      git push --tags origin HEAD:main
    condition: eq(variables.IS_MAIN, true)
    displayName: 'Bump package version number'

This is the relevant output of the commitizen semantic-release step: enter image description here

Configuration for commitizen in pyproject.toml is the following (note in particular that the [skip ci] message is due to the config):

tag_format = "v$major.$minor.$patch"
annotated_tag = true
bump_message = "release $current_version -> $new_version [skip ci]"

Solution

  • You need to remove the [skip ci] from the commit message, because it pushed with the tag Azure DevOps skipping the ci.

    You can find the list of "skip" messages here.