Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins how to create pipeline manual step

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?

like image 630
Zigac Avatar asked Oct 07 '16 09:10

Zigac


People also ask

How do I manually run Jenkins pipeline?

To create a simple pipeline from the Jenkins interface, perform the following steps: Click New Item on your Jenkins home page, enter a name for your (pipeline) job, select Pipeline, and click OK. In the Script text area of the configuration screen, enter your pipeline syntax.

What are the steps to create a Jenkins pipeline?

Step 1: Log into Jenkins and select 'New item' from the dashboard. Step 2: Next, enter a name for your pipeline and select 'pipeline' project. Click on 'ok' to proceed. Step 3: Scroll down to the pipeline and choose if you want a declarative pipeline or a scripted one.


1 Answers

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

like image 114
Michael Andrews Avatar answered Sep 26 '22 06:09

Michael Andrews