13

I would like to have the following workflow in Jenkins:

  • user clicks 'Build Now'
  • user fills out build parameters
  • user clicks 'Build'
  • information is generated (via a script) and presented to user along with 'Continue' button
  • user clicks 'Continue' button which simply triggers another job

How can this be done?

Noel Yap
  • 18,822
  • 21
  • 92
  • 144
  • Possible duplicate of [Jenkins pipeline plugin: set the build description](https://stackoverflow.com/questions/36501203/jenkins-pipeline-plugin-set-the-build-description) –  Oct 01 '18 at 16:38

6 Answers6

5

in Jenkins Pipeline method use as

script{ currentBuild.displayName = Build_Display (this will be overwrite the Job number) currentBuild.description = Build_description }

Amit AB
  • 51
  • 1
  • 3
4
  1. Use the Execute shell action to create a shell script that sets an environment variable. For example: echo "BUILD_DESCRIPTION=example" >BUILD_DESCRIPTION.setting.

  2. Use the Inject environment variables action to execute the shell script.

  3. Use the Set build description action to set the build description to the variable that was set by the shell script (eg ${BUILD_DESCRIPTION}).

Noel Yap
  • 18,822
  • 21
  • 92
  • 144
  • 1
    I got it to work using this plugin: https://plugins.jenkins.io/description-setter/. The build description is exposed to the environment via DESCRIPTION_SETTER_DESCRIPTION. You use it in a Post Build action. – Atafar Mar 18 '20 at 10:29
  • Please add more details, I need this without installing any plugins. – OfusJK Jul 21 '22 at 04:26
3

Alternatively to solution with groovy script plugin, you may generate information together with button with REST command using Rich Text Publisher Plugin - you just don't have to write groovy script, only markup.

It adds a custom html markup to build page after build had been executed. It allows to configure a message using file, or environment variables.

OndroMih
  • 7,280
  • 1
  • 26
  • 44
2

Create an 'Execute system Groovy script' that updates the build description. See How to submit Jenkins job via REST API? which creates a button in the build description.

Community
  • 1
  • 1
Noel Yap
  • 18,822
  • 21
  • 92
  • 144
  • 1
    One issue would be that the description also shows up in the list of builds on the left, so the text can't be very big, otherwise that list of builds becomes unusable. It would be wonderful if there was another field that could be set from a system groovy script and which would be rendered live. – Christian Goetze Sep 30 '15 at 22:03
  • Just the first few chars in the build description appears in the builds list on the left. We set build description with initial short summary e.g. version under test and append more information which can be seen in the build summary. e.g. set from file in workspace: `def cb = Thread.currentThread().executable def ws = manager.build.workspace.getRemote() String desc = new File(ws + "/VERSION.txt").text cb.setDescription(desc)` – gaoithe Feb 20 '18 at 16:15
  • what's the variable to update for the build description? –  Oct 01 '18 at 16:37
  • Did you click on the "How to submit Jenkins job via REST API?" link? It has an example of how to set the build description. – Noel Yap Oct 02 '18 at 00:25
  • I've also added another answer. – Noel Yap Oct 02 '18 at 00:49
1

If I understand correctly, you want a 'Confirmation Button', or a 'Are you Sure' button:

In Jenkins pipeline, you can do that by asking for user input.

timeout(time: 15, unit: "MINUTES") {
    input message: 'Are the info correct?'
}

The problem with this approach is that you keep a Jenkins worker (or process) running for a maximum X minute if the user doesn't take any action, this can make Jenkins create a long queue of builds.

Here is the documentation.

Joao Vitorino
  • 2,976
  • 3
  • 26
  • 55
0

If i get what you want to do right (more from the caption and less from the description) you should just use this Publisher Plugin:

if it doesn't help please try adding more information to your question.

Community
  • 1
  • 1
eyossi
  • 4,230
  • 22
  • 20
  • 4
    I looked at that plugin. All it does is create a link from the build page. I want to display info directly on the build page. – Noel Yap May 30 '12 at 22:09