How can I set Jenkins build description while triggering build via curl?

http://stackoverflow.com/questions/28503736/how-can-i-set-jenkins-build-description-while-triggering-build-via-curl

You can always have a variable and pass the build description into the variable on the initial invocation. Then at the end of your build, output the variable to console and catch with Description Setter plugin.

Edit to clarify:

  • Install Description Setter plugin.
  • In the Job Configuration, configure a String parameter, call it "MyDescription", leave defaults blank.
  • Somewhere in the build steps, either "Execute Shell" or "Execute Windows Batch Command" type echo Desc: $MyDescription or echo Desc: %MyDescription%, depending on your OS.
  • In the Post-Build steps, select "Set Build Description".
    • Set Regular expression as ^Desc: (.*)
    • Set Description as \1
  • From command line trigger by:

curl -v -X POST --data-urlencode "MyDescription=This is my desc" "http://[myServer]/job/[jobName]/buildWithParameters"

For those interested in using the Jenkins UI, I'm trying:

  1. https://wiki.jenkins-ci.org/display/JENKINS/Build+Name+Setter+Plugin
  2. https://wiki.jenkins-ci.org/display/JENKINS/Groovy+Postbuild+Plugin

The Postbuild plugin is much more powerful, but requires Groovy tinkering and perms

相关推荐