Right now, using Jenkins to build releases is much harder than it should be. For every git repo I need to create two jobs. One to build branches and one to build tags. This is less than ideal, but works around the limitation that Jenkins hates git tags.

      This works decently on the other git plugin, but completely impossible with this plugin. I think it would be fantastic to have this plugin build tags, and communicate with github about the build data.

          [JENKINS-34395] Support for building tags

          George Shammas created issue -
          Manuel Recena Soto made changes -
          Assignee Original: Jesse Glick [ jglick ] New: Manuel Recena Soto [ recena ]

          georgemb Build tags? AFAIK tags are something static and this plugin is designed to build branches and PR, concepts that involve changes in our source code.

          Manuel Recena Soto added a comment - georgemb Build tags? AFAIK tags are something static and this plugin is designed to build branches and PR, concepts that involve changes in our source code.
          Jesse Glick made changes -
          Link New: This issue is duplicated by JENKINS-34520 [ JENKINS-34520 ]

          There needs to be a way to build a "release". The two obvious patterns are:

          1. Somehow tell Jenkins this should be release and have it create a tag.
          2. Have Jenkins detect that a tag was set and build it as a release (like Travis does).

          Christian Höltje added a comment - There needs to be a way to build a "release". The two obvious patterns are: Somehow tell Jenkins this should be release and have it create a tag. Have Jenkins detect that a tag was set and build it as a release (like Travis does).

          With pipeline (aka Jenkinsfile) situation is much more worse: you can't checkout specified tag (parameters don't pass to branch specifier as environment variables).
          But pipeline script (Jenkinsfile) loaded immediatly after checkout and you can't checkout right commit via Jenkinsfile and restart pipeline. So, I did not find correct solution for this situation.
          For workaround my problem I use patched git-plugin (https://github.com/jenkinsci/git-plugin/pull/408).

          Artem V. Navrotskiy added a comment - With pipeline (aka Jenkinsfile) situation is much more worse: you can't checkout specified tag (parameters don't pass to branch specifier as environment variables). But pipeline script (Jenkinsfile) loaded immediatly after checkout and you can't checkout right commit via Jenkinsfile and restart pipeline. So, I did not find correct solution for this situation. For workaround my problem I use patched git-plugin ( https://github.com/jenkinsci/git-plugin/pull/408 ).
          Jesse Glick made changes -
          Link New: This issue is duplicated by JENKINS-34176 [ JENKINS-34176 ]

          recena Sorry that I missed your initial reply.

          Tag building is around releases. Under almost every workflow of git, when someone creates a tag they are marking some sort of release. It would be great if Jenkins would know about this common work flow and do a build. Added logic to the build script could be added to perform extra actions when building a release.

          Github has a releases page for every project. Integration of builds on tags could populate the releases tab with information/assets from the build.

          Jenkin's has the ability to create tags on every build (useless), and the ability to create a tag on a particular build. The latter is sometimes useful, however under almost all circumstances is not adequate.

          George Shammas added a comment - recena Sorry that I missed your initial reply. Tag building is around releases. Under almost every workflow of git, when someone creates a tag they are marking some sort of release. It would be great if Jenkins would know about this common work flow and do a build. Added logic to the build script could be added to perform extra actions when building a release. Github has a releases page for every project. Integration of builds on tags could populate the releases tab with information/assets from the build. Jenkin's has the ability to create tags on every build (useless), and the ability to create a tag on a particular build. The latter is sometimes useful, however under almost all circumstances is not adequate.

          Jonas Falck added a comment -

          We also need the ability to tell jenkins to build a tag. Impossible with multibranch pipeline.

          Currently i need to have 3 jobs of same application:
          1. multibranch pipeline
          2. single branch pipeline
          3. singlebranch pipeline with custom groovy script

          1 is for building all commits in all branches (running tests etc).
          2 is for building and pushing docker image to registry
          3 is to notify 2 to build specific commit (by selecting a tag using input

          node('go'){
              
              stage 'Notify other job'
              def gitUrl = 'ssh://git@URL'
          
              git([url: gitUrl, branch: 'master', credentialsId: 'asdf'])
          
              sh('git show-ref --tags > tags')
              def tags = readFile('tags').trim()
              def userInput = input([ message: 'Please select git tag', parameters: [[$class: 'ChoiceParameterDefinition', choices: tags, description: '', name: 'Tag']]])
          
              echo ("selected tag: "+userInput)
              def sha1 = userInput.split(' ')[0]
              echo ("selected sha1: "+ sha1)
              
              sh("curl \"http://URL:8080/git/notifyCommit?url="+gitUrl+"&sha1="+sha1+"\"")
          }
          

          Why cant the multibranch job listen to notifyCommits with sha1?
          Another solution is to fix the parameters so they could be sent to a multibranch pipeline script which then do git checkout based on tag.

          Jonas Falck added a comment - We also need the ability to tell jenkins to build a tag. Impossible with multibranch pipeline. Currently i need to have 3 jobs of same application: 1. multibranch pipeline 2. single branch pipeline 3. singlebranch pipeline with custom groovy script 1 is for building all commits in all branches (running tests etc). 2 is for building and pushing docker image to registry 3 is to notify 2 to build specific commit (by selecting a tag using input node( 'go' ){ stage 'Notify other job' def gitUrl = 'ssh: //git@URL' git([url: gitUrl, branch: 'master' , credentialsId: 'asdf' ]) sh( 'git show-ref --tags > tags' ) def tags = readFile( 'tags' ).trim() def userInput = input([ message: 'Please select git tag' , parameters: [[$class: 'ChoiceParameterDefinition' , choices: tags, description: '', name: ' Tag']]]) echo ( "selected tag: " +userInput) def sha1 = userInput.split( ' ' )[0] echo ( "selected sha1: " + sha1) sh( "curl \" http: //URL:8080/git/notifyCommit?url= "+gitUrl+" &sha1= "+sha1+" \"") } Why cant the multibranch job listen to notifyCommits with sha1? Another solution is to fix the parameters so they could be sent to a multibranch pipeline script which then do git checkout based on tag.
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 170500 ] New: JNJira + In-Review [ 183929 ]

            cloudbees CloudBees Inc.
            georgemb George Shammas
            Votes:
            91 Vote for this issue
            Watchers:
            90 Start watching this issue

              Created:
              Updated:
              Resolved: