user8711691
user8711691

Reputation: 1

How to set "Last successful build" value for a job through Jenkins API?

Regarding the data displayed in the "Permalinks" section of the Job Status page in Jenkins, I know there are methods to get the values. For example ...

jenkins.instance.getItemByFullName("<job>").getLastSuccessfulBuild()

However, I can't find any method to change the "Last successful build" value on the screen.
Editing the symbolic link $HOME/.jenkins/jobs/<job>/builds/lastSuccessfulBuild, then running jenkins.instance.doReload() does not cause the gui screen display to be updated.

Is there a way to do this through the API?

Thanks.

Upvotes: 0

Views: 1222

Answers (1)

Daniel Majano
Daniel Majano

Reputation: 1116

This is the call for get the value using the API:

http://$host/job/$jobname/lastSuccessfulBuild/api/json

You can try to modificate the json and to do a POST with the new Json after.

Upvotes: 1

Related Questions