karthikeayan
karthikeayan

Reputation: 5030

API support for manual approval of promoted builds in Jenkins?

Is there any way to programmatically approve the Jenkins promoted build? In job configuration it has been set to "Only when manually approved".

Upvotes: 4

Views: 2178

Answers (2)

Crude Oil
Crude Oil

Reputation: 61

I too got into the same situation. There is no documentation/help found nowhere. But after some serious plug n play below command made it work. Hope it helps. Please refer below URL API (curl)Command to Approve a promoted build Job in Jenkins

I know it is almost 2 years since the post published, but thought it could help some others with the same issue. Thanks

Upvotes: 0

Federico
Federico

Reputation: 1731

Yes! Although I haven't found any documentation for it and so it might not be a stable solution. I found this using the browser developer tools. Make sure "Only when manually approved" is checked.

Here's an example:

curl 'https://jenkins/job/z-promotion-test/3/promotion/promotionProcess/promotion_test/promotionCondition/hudson.plugins.promoted_builds.conditions.ManualCondition/approve' --data 'json=%7B%7D&Submit=Approve'

Authenticated version

curl 'http://<user>:<token>@jenkins/job/z-promotion-test/3/promotion/promotionProcess/promotion_test/promotionCondition/hudson.plugins.promoted_builds.conditions.ManualCondition/approve' --data 'json=%7B%7D&Submit=Approve'

See

  1. http://jenkins/me/configure
  2. https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API

Upvotes: 4

Related Questions