Hi Mike,
AFAIK currentBuild.result is never set automatically in pipeline jobs.
You have to explicitly set it with something like
try {
// do something
currentBuild.result = 'SUCCESS'
} catch (Exception err) {
currentBuild.result = 'FAILURE'
}
it may explain why it is null in your post build task
On Mon, Jun 13, 2016 at 8:52 PM, Mike <[email protected]> wrote:
> Hi,
>
> I'm looking to try and setup a post build groovy script event with my
> Jenkinsfile for my multibranch job. Is this possible? I'm looking to try
> and update the build display name with the svn revision number used at the
> time of the build. This is the jenkinsfile script im using:
>
> node()
> {
> stage 'SVN'
> checkout scm
> stage 'Compile Win32'
> //bat 'call make\\jenkins\\jenkins_build_win32.bat'
> stage 'Archive Artifacts'
> //archive '_archive/**'
> stage 'Post Build'
> echo 'Result: ' + manager.build.result.toString()
> //if (manager.build.getResult() == 'SUCCESS')
> //{
> def buildNum = manager.build.number
> def buildRev = manager.build.envVars['SVN_REVISION']
> def buildSvn = manager.build.envVars['SVN_URL']
> def buildUrl = manager.build.envVars['BUILD_URL']
> def buildLabel = manager.build.getDisplayName()
> echo 'Num: ' + buildNum + ' Rev: ' + buildRev + ' SVN Url: ' + buildSvn + '
> URL: ' + buildUrl
>
> manager.build.setDisplayName(buildLabel + ' - Revision: ')
> //}
>
>
> }
>
>
> manager.build.result is always null. I imagine its because the build has
> not completed. both buildRev and buildSvn are also null at this time.
>
> Any help would be appreciated.
>
> Mike
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/8cd195b3-07c8-49fe-8df1-440b9a8294e0%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/8cd195b3-07c8-49fe-8df1-440b9a8294e0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
-----
Arnaud Héritier
http://aheritier.net
Mail/GTalk: aheritier AT gmail DOT com
Twitter/Skype : aheritier
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/CAFNCU-9N1Wn8hf7_F-O%3DR-FYO7ctnMHEb%2BoxMRURvAKiW11HnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.