Conditional step/stage in Jenkins pipeline

Doing the same in declarative pipeline syntax, below are few examples: stage(‘master-branch-stuff’) { when { branch ‘master’ } steps { echo ‘run this stage – ony if the branch = master branch’ } } stage(‘feature-branch-stuff’) { when { branch ‘feature/*’ } steps { echo ‘run this stage – only if the branch name started with … Read more

How to remove a TFS Workspace Mapping?

From VS: Open Team Explorer Click Source Control Explorer In the nav bar of the tool window there is a drop down labeled “Workspaces”. Extend it and click on the “Workspaces…” option (yeah, a bit un-intuitive) The “Manage Workspaces” window comes up. Click edit and you can add / remove / edit your workspace From … Read more

Jenkins Pipeline Wipe Out Workspace

Like @gotgenes pointed out with Jenkins Version. 2.74, the below works, not sure since when, maybe if some one can edit and add the version above cleanWs() With, Jenkins Version 2.16 and the Workspace Cleanup Plugin, that I have, I use step([$class: ‘WsCleanup’]) to delete the workspace. You can view it by going to JENKINS_URL/job/<any … 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

Jenkins Host key verification failed

Change to the jenkins user and run the command manually: git ls-remote -h git@bitbucket.org: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