0

I am using a Jenkins pipeline script but am having trouble getting the tag. I realise you cant use the when{ buildingTag() } inside the post{} section. Is there an alternative for this ?

code I would like to write

pipeline {
  ...
  post {
    success {
      when {
        branch 'master'
        not { buildingTag() }

        ...
      }
    }
  }
}
Matt
  • 487
  • 1
  • 6
  • 16
  • 2
    I am not sure what you are asking. Do you just want to access the git tag (in a variable for example?) or do you want to execute something in your post stage depending on a specific git tag? – Michael Kemmerzell Jun 06 '19 at 05:03
  • possible duplicate: https://stackoverflow.com/questions/1404796/how-to-get-the-latest-tag-name-in-current-branch-in-git – Michael Kemmerzell Jun 06 '19 at 05:05
  • I want to execute something if the build was kicked off via a git tag. – Matt Jun 12 '19 at 06:21
  • I tried looking at a global variable but even that is not allowed in the post {} section of a pipeline – Matt Jun 12 '19 at 06:21

0 Answers0