def previousJiraBuildAction = baseBuild.getAction(JiraBuildAction.class)
if (previousJiraBuildAction != null) {
echo "issues to log: " + previousJiraBuildAction.issues.length
for (int i=0; i < previousJiraBuildAction.issues.length; i++ ) {
//create a Jira Comment with the version number for the Issues found previously
try {
echo "adding comment to " + previousJiraBuildAction.issues[i].id
jiraComment([issueKey : previousJiraBuildAction.issues[i].id, body : "New build created for ${component} with version ${version}"])
} catch (Exception e) {
//log error and carry on
//this only seems to work if its not in a NonCPS method, otherwise the jiraComment call exits the loop, without an error
echo "error " + e
}
}
echo "after loop"
}Probably https://issues.jenkins-ci.org/browse/JENKINS-31314
It's currently unsupported to call DSL steps from NonCPS code.
Cheers
--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0d9fde56-abe3-4ade-a2e7-72e3cd38f418%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
And I think you can remove the 'currently' from my sentence. What's 'currently' definitely missing is that it should immediately fail with a clear error.
Indeed, what Continuation passing style (CPS) gives you is the durability of your pipeline.
Said differently, it means each step (in the general meaning) is checkpointed, in case of a crash for example to be able to restart from where it left.
So calling non CPS code from CPS one is going to be something like "OK, call that thing if you will, I'll stay there waiting for you. If you never back, well we'll restart from where I am now" (which is BTW already typically the case each time you call a shell step and so on: if your shell script takes one hour of complex things and fail, it will simply get back to the beginning of it. Not where that script left).
If you think about it, the other way, calling CPS code from non CPS is probably weirder: you are in a non serializable place (non CPS code), and you call something designed to take care of what it did and where it left.
Note this is my understanding of all that. Jesse will probably correct me soon if I'm wrong :).
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.