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

Jenkins pipeline: agent vs node?

The simple answer is, Agent is for declarative pipelines and node is for scripted pipelines. In declarative pipelines the agent directive is used for specifying which agent/slave the job/task is to be executed on. This directive only allows you to specify where the task is to be executed, which agent, slave, label or docker image. … Read more

How to restart Jenkins manually?

To restart Jenkins manually, you can use either of the following commands (by entering their URL in a browser): (jenkins_url)/safeRestart – Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete. (jenkins_url)/restart – Forces a restart without waiting for builds to complete.

Jenkins Host key verification failed

Change to the jenkins user and run the command manually: git ls-remote -h [email protected]:person/projectmarket.git HEAD You will get the standard SSH warning when first connecting to a new host via SSH: The authenticity of host ‘bitbucket.org (207.223.240.181)’ can’t be established. RSA key fingerprint is 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40. Are you sure you want to continue connecting (yes/no)? Type … Read more