Reputation: 63
I am trying to trigger a build in Azure pipelines when a new tag is pushed to my github repository in the following way (dev being the name of the tag):
git tag dev
git push --tags
The build should not be triggered by any push of a specific commit to a repo, only when a tag is pushed.
I have tried various configurations of the trigger section of my azure-pipelines.yml file with no success:
trigger:
- master
- refs/tags/dev
trigger:
branches:
include:
- master
- refs/tags/dev
trigger:
branches:
include:
- master
tags:
include:
- dev
I also tried by replacing 'dev' with wildcards but also nothing. This should be possible according to the docs but I cannot seem to make it work.
Thanks in advance for any help or suggestions
Here is my full azure-pipelines.yml just in case:
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
branches:
include:
- master
tags:
include:
- dev
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'dotnet publish $(buildConfiguration)'
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: True
- task: PublishBuildArtifacts@1
Upvotes: 4
Views: 4379
Reputation: 120
For anyone who's hitting this issue, there is a thread over on the VS developercommunity forum here:
The TLDR; is that MS is chasing it. Something appears to have broken some time after Friday, July 19th, 2019... the approach was working up-to and including that Friday.
While I'm here, one gotcha that hit me while I had this working is that I needed to explicitly exclude '*'
in the pr:
section in addition to my trigger / tag config... otherwise PRs were also triggering my pipeline when I only wanted it triggered by tag pushes.
Upvotes: 2