Jenkins build with no resources

We had a task to solve - the continuous deployment pipeline to wait for human approvals before some crucial steps. But we did not want to waste resources on something just sitting there, waiting for a slow human to click a button in the UI.

And using the Jenkins 2.x scripted pipeline we managed to do it. The trick is simple. We just stash the files that we are still going to need on the next stage and close the node tag.

The next stage has no node, it runs on master, but it only has the button. It all looks great and works great.

Here is the snippet:

node {
  stage('first step') {
    // ... do something automatically, build, test, deploy to dev...
    stash name: 'usemelater'

stage('Human approval') {
  timestamps {
    input 'Approved to proceed?'

node {
  stage('further steps') {
    unstash 'usemelater'
    // ... do the rest of the CD

All that is used by Jenkins while it is waiting for approval is a bit of disk space on master for the archive with the stashed files. And it records who and when approved the rest of the CD to progress forward.

Of course any organization wants to have a fully automated CD process with no humans involved. But in my experience getting to that state is not for the lighthearted. Developers are worried about loosing the tight control over the deployment even when it means less work for them. I found that having to click a button in the UI between the stages is very useful for people. And removing the human judgment steps later on is trivial.

This works with both the Classic UI and the Blue Ocean.

Posted On


Tags: / /