Search code examples
gitjenkinsazure-devopspolling

Can Jenkins Git polling be made tag aware?


I've got to connect Jenkins with an Azure Devops repository. Unfortunately, the Jenkins is behind corporate bars and can't be webhooked from the repository upon a change.

So, I ended up with the good ol' polling in my pipeline job. Since the project uses a gradle scm workflow plugin that calculates the version number and the creation of a release from the git structure, I need to have the jenkins polling react to a tag push.

So, is it anyhow possible to make the jenkins polling be aware of tag pushes at a remote, which means, no additional commit has been done?


Solution

  • It is possible to make jenkins polling be aware of tags by setting refspec and branch specifier as below. But it is not working if no changes is committed in the source. See this open issue.

    refspec: +refs/tags/*:refs/remotes/origin/tags/*
    
    branch specifier: **
    

    You might need to create two jenkins pipelines, first pipeline will run every N minutes to execute git tag as a shell command and get the all tags from git, And writing the tag in the some property file, And then compare with tags from the last time. If there is a new tag, then trigger the second the pipeline. See the comment to this answer