0

I have a Jenkins multibranch pipeline and I am using a Jenkinsfile for CI flow. Now in my Jenkinsfile I would like to get the user who stopped pipeline in Jenkins Blueocean UI.

I have tried it using this:

try {
   inputsubmitter = input message: 'Click Proceed to start Release for Branch ' + "${env.BRANCH_NAME}", submitter: 'jenkinusers', submitterParameter: 'submitters'
   echo "${inputsubmitter}"                        
}
catch(Exception ex) {
   def user = ex.getCauses()[0].getUser()
   echo "Aborted by ${user} hello" 
   throw ex
}

But the result was:

aborted by system

How can I get the user in this context?

ssc-hrep3
  • 15,024
  • 7
  • 48
  • 87
deenbandhu
  • 599
  • 5
  • 18
  • Perhaps you are able to narrow down the problem by trying a no-multibranch Pipeline job without Blue Ocean. Your example did work (Jenkins 2.67), after approving several methods and defining `env.BRANCH_NAME`. – Stefan Hanke Jul 05 '17 at 18:41
  • But how does it matter if i am using multibranch or blueocean it should behave same right ?? – deenbandhu Jul 06 '17 at 04:49
  • This is only a suggestion. It could very well be that it does not work either way. In complex systems, you can't be sure. BTW the output really is _aborted by system_, without mentioning the _hello_ at the end? – Stefan Hanke Jul 06 '17 at 05:04
  • no hello is also there at the end – deenbandhu Jul 06 '17 at 06:45
  • 1
    I've found another hint [here](https://stackoverflow.com/questions/39451358/how-to-know-which-user-answered-a-jenkins-pipeline-input-step), leading me to [there](https://github.com/TYPO3-infrastructure/jenkins-pipeline-global-library-chefci/blob/288ec26cee53c4062ed2e987d2f95b39ef289a6b/src/org/typo3/chefci/helpers/JenkinsHelper.groovy#L50-L91): maybe its a timeout issue. I've not checked this. – Stefan Hanke Jul 06 '17 at 16:24

0 Answers0