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

In a declarative jenkins pipeline – can I set the agent label dynamically?

Here is how I made it: mix scripted and declarative pipeline. First I’ve used scripted syntax to find, for example, the branch I’m on. Then define AGENT_LABEL variable. This var can be used anywhere along the declarative pipeline def AGENT_LABEL = null node(‘master’) { stage(‘Checkout and set agent’){ checkout scm ### Or just use any … Read more