Jenkins how to create pipeline manual step

JenkinsGroovyJenkins Pipeline

Jenkins Problem Overview


Prior Jenkins2 I was using Build Pipeline Plugin to build and manually deploy application to server. Old configuration: jenkins-pipeline-plugin

That works great, but I want to use new Jenkins pipeline, generated from groovy script (Jenkinsfile), to create manual step.

So far I came up with input jenkins step.

Used jenkinsfile script:

node {
   stage 'Checkout'
   // Get some code from repository

   stage 'Build'
   // Run the build
}

stage 'deployment'
input 'Do you approve deployment?'
node {
    //deploy things
}

But this waits for user input, noting that build is not completed. I could add timeout to input, but this won't allow me to pick/trigger a build and deploy it later on:

jenkins-pipeline

How can I achive same/similiar result for manual step/trigger with new jenkins-pipeline as prior with Build Pipeline Plugin?

Jenkins Solutions


Solution 1 - Jenkins

This is a huge gap in the Jenkins Pipeline capabilities IMO. Definitely hard to provide due to the fact that a pipeline is a single job. One solution might be to "archive" the workspace as an "artifact" (tar and archive */ as 'workspace.tar.gz'), and then have another pipeline copy the artifact and and untar it into the new workspace. This allows the second pipeline to pickup where the previous one left off. Of course there is no way to gauentee that the second pipeline cannot be executed out of turn or more than once. Which is too bad. The Delivery Pipeline Plugin really shines here. You execute a new pipeline right from the view - instead of the first job. Anyway - not much of an answer - but its the path I'm going to try.

EDIT: This plugin looks promising:

https://github.com/jenkinsci/external-workspace-manager-plugin/blob/master/doc/PIPELINE_EXAMPLES.md

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionZigacView Question on Stackoverflow
Solution 1 - JenkinsMichael AndrewsView Answer on Stackoverflow