jenkins
Changing Jenkins build number
If you have access to the script console (Manage Jenkins -> Script Console), then you can do this following: Jenkins.instance.getItemByFullName(“YourJobName”).updateNextBuildNumber(45)
What are the differences on the logon types choices on jenkins?
I suggest reading the old installation documentation, the new installer updates, the actual Install on Windows doc, as well as MS Doc Using the LocalSystem Account as a Service Logon Account, S/O explanation The difference between the ‘Local System’ account and the ‘Network Service’ account? and S/O explanation Why running a service as Local System … Read more
Cancel queued builds and aborting executing builds using Groovy for Jenkins
I haven’t tested it myself, but looking at the API it should be possible in the following way: import hudson.model.* import jenkins.model.Jenkins def q = Jenkins.instance.queue q.items.findAll { it.task.name.startsWith(‘my’) }.each { q.cancel(it.task) } Relevant API links: http://javadoc.jenkins-ci.org/jenkins/model/Jenkins.html http://javadoc.jenkins-ci.org/hudson/model/Queue.html
How to invoke a jenkins pipeline A in another jenkins pipeline B
Following solution works for me: pipeline { agent { node { label ‘master’ customWorkspace “${env.JobPath}” } } stages { stage(‘Start’) { steps { sh ‘ls’ } } stage (‘Invoke_pipeline’) { steps { build job: ‘pipeline1’, parameters: [ string(name: ‘param1’, value: “value1”) ] } } stage(‘End’) { steps { sh ‘ls’ } } } } Adding … Read more
How to get the API token for Jenkins
Since Jenkins 2.129 the API token configuration has changed: You can now have multiple tokens and name them. They can be revoked individually. Log in to Jenkins. Click you name (upper-right corner). Click Configure (left-side menu). Use “Add new Token” button to generate a new one then name it. You must copy the token when … Read more
How to get a list of installed Jenkins plugins with name and version pair
You can retrieve the information using the Jenkins Script Console which is accessible by visiting http://<jenkins-url>/script. (Given that you are logged in and have the required permissions). Enter the following Groovy script to iterate over the installed plugins and print out the relevant information: Jenkins.instance.pluginManager.plugins.each{ plugin -> println (“${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}”) } It will print … Read more