Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manual post-build action missing in jenkins 2.0

This option was available when I was on jenkins 1.65. Today I moved to jenkins 2.0 with a fresh install on a new machine. I don't see this option.

This option is necessary for our delivery pipeline view. So pipeline has 2 steps:

  1. When a new commit is made in github, a suit of tests run.
  2. If above passes, then manual deployment step will have a play button. Else not.

We were able to achive this in earlier version of jenkins but not in 2.0.

Please guide what could be missing or suggest any other viable alternative.

Post-build Actions

like image 730
rajya vardhan Avatar asked Apr 27 '16 21:04

rajya vardhan


People also ask

What is post build task in Jenkins?

This feature allows user to associate shell or a batch scripts that perform some tasks on Jenkins depending on the build log output. If the log text has a match some where in the build log file, the script will execute and the post build log will append to the project build log. Java regular expression are allowed.

How do I enable build Pipeline in Jenkins?

On the Manage Jenkins page for your installation, navigate to Manage Plugins. Find Pipeline Plugin from among the plugins listed on the Available tab. (You can do this by scrolling through the plugin list or by using “Pipeline” as a term to filter results) Select the checkbox for Pipeline Plugin.

How do you resolve build failure in Jenkins?

In Jenkins, in the pipeline where the failure occurred, in the navigation pane, click Rebuild. In the Rebuild page, select the ReRun check box , and click Rebuild.


2 Answers

Solved. It has got nothing to do with Jenkins version.

We need to have Build Pipeline plugin installed as well. This plugin adds manual step support. And then Delivery pipeline shows Trigger manual build (▶) for the manual steps.

enter image description here

like image 170
rajya vardhan Avatar answered Sep 17 '22 22:09

rajya vardhan


[Updated answer for those looking at this after 2018]

The Post-Build Actions button only show up on "Freestyle" jobs. However, it is not recommended to use the Post-Build Actions (or the old "Build Pipeline" and "Delivery Pipeline" plugins) for a build or delivery pipeline. Rather, it is now recommended to use the "Pipeline Plugin" and the "Pipeline" job type.

With this method, the hook for triggering the next job in the pipeline is defined in the Pipeline Script. Below is an example using the "Declarative Pipeline" syntax (preferred).

#!/usr/bin/env groovy
pipeline {
    agent any
    stages {
        stage('Invoking some other Jenkins job') {
            steps {
                echo "Building my-other-job-name"
                build job: 'my-other-job-name', parameters: [string(name: 'OTHER_JOB_PARAM_KEY', value: "OTHER_JOB_PARAM_VALUE")]
            }
        }
    }
}

You can daisy-chain your jobs in this manner, or have a single pipeline job that chains a bunch of build/deploy jobs together.

like image 31
Nejuf Avatar answered Sep 19 '22 22:09

Nejuf