"keep this build forever" via rest api?

1,039 views
Skip to first unread message

Chris Withers

unread,
Jan 31, 2013, 3:30:12 PM1/31/13
to Jenkins Users
Hi All,

What url would I hit to make sure a build of a job is marked as "keep
forever"?

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

Bruno Cunha

unread,
Feb 2, 2013, 9:43:52 AM2/2/13
to jenkins...@googlegroups.com, ch...@simplistix.co.uk
Hello Chris.

The /toggleLogKeep URL in the job can do that.

For example:
http://[url]/job/[JOB-NAME]/20/toggleLogKeep

This URL will change the lock status of the build 20.


There's an interesting thing that you can use too: you can list all the keep forever builds by using this URL:
http://[url]/api/xml?depth=2&xpath=/hudson/job/build[keepLog=%22true%22]/url&wrapper=forever


Hope this helps.

Regards,
Bruno Candido Volpato da Cunha

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Chris Withers

unread,
Feb 4, 2013, 2:36:08 AM2/4/13
to Bruno Cunha, jenkins...@googlegroups.com
Hi Bruno,

On 02/02/2013 14:43, Bruno Cunha wrote:
> The /toggleLogKeep URL in the job can do that.
>
> For example:
> http://[url]/job/[JOB-NAME]/20/toggleLogKeep
>
> This URL will change the lock status of the build 20.

Thanks for this, it's almost what I want.

The problem with the above is that I need to check what state the build
is in before calling toggle.

Is there any way, through the REST api, that I can *ensure* the build is
kept forever?

cheers,

LnT

unread,
Jul 22, 2022, 8:00:17 AM7/22/22
to Jenkins Users
Hello Team,
Thanks for the inputs.
I get gone with toggleLogKeep in My old Jenkins ver. 2.190.1 
Now upgraded to Jenkins 2.332.3
Stopped now with ERROR 403 No valid crumb was included in the request
what could be the issue ?
Thanks in Advance.
Regards,
LnT

Dirk Heinrichs

unread,
Jul 22, 2022, 9:22:56 AM7/22/22
to jenkins...@googlegroups.com
Am Freitag, dem 22.07.2022 um 05:00 -0700 schrieb LnT:

I get gone with toggleLogKeep in My old Jenkins ver. 2.190.1 
Now upgraded to Jenkins 2.332.3
Stopped now with ERROR 403 No valid crumb was included in the request
what could be the issue ?

If you were using username/pw to access the REST API in your old Jenkins, you might need to switch to username/api-token now. Or, even simpler, switch to the built-in SSH server:

% ssh -p 2222 -i path/to/keyfile user@jenkins-host help keep-build
java -jar jenkins-cli.jar keep-build NAME BUILD#
Mark the build to keep the build forever.
NAME   : Item name
BUILD# : Build number

HTH...

Dirk
-- 
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

LnT

unread,
Jul 25, 2022, 2:18:32 AM7/25/22
to Jenkins Users
Thanks a lot. This works.
java -jar jenkins-cli.jar keep-build <JobName> <BUILD#>

Reply all
Reply to author
Forward
0 new messages