I am using the Pipeline plugin in Jenkins by Clouldbees (the name was Workflow plugin before), I am trying to get the user name in the Groovy script but I am not able to achieve it.
stage 'checkout svn' node('master') { // Get the user name logged in Jenkins }
Within CloudBees Jenkins the cause of any Build for a particular job should be listed in the UI by navigating to said job and selecting the Build number in question from the left hand column. For example the UI on the build page will show: Branch indexing , Started by user $USER .
1. The checkout step will checkout code from source control; scm is a special variable which instructs the checkout step to clone the specific revision which triggered this Pipeline run.
Step 4) Go to your Jenkins dashboard and create a view by clicking on the “+” button. Select the Build Pipeline View option and click OK. Step 5) Under Pipeline view configuration, locate Pipeline Flow. Under Pipeline flow, select the initial job to run.
I have a Jenkins job which does some unit-testing for some code. It can be started in two possible ways: By the scheduler - it polls the Perforce server, and starts the job when it detects a code change. By a user, on demand - it downloads a shelved/stashed code change, and checks whether it breaks the tests.
Did you try installing the Build User Vars plugin? If so, you should be able to run
node { wrap([$class: 'BuildUser']) { def user = env.BUILD_USER_ID } }
or similar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With