Download artifacts from Jenkins using wget or curl

I am trying to load an artifact from a Jenkins project using a dos script package. The reason this is more than trivial is because my artifact is a zip file that includes the Jenkins build number in its name, so I don't know the exact file name.

My current attack plan is to use wget pointing to: / lastSuccessfulBuild / artifact / to do some sort of recursive / mirror loading.

If I do the following:

wget -r -np -l 1 -A zip --auth-no-challenge --http-user=**** --http-password=**** http://*.*.*.*:8080/job/MyProject/lastSuccessfulBuild/artifact/ 

(* s are the characters I changed to publish to SO)

I never get a zip file. If I omit the -A zip option, I get index.html, so I think authorization works if there is no problem with any session caching?

With -A zip, I get as part of the answer:

Removing ... + 8080 / job / MyProject / lastSuccessfulBuild / artifact / index.html as it should be rejected.

So, I'm not sure, maybe this is deleting this file and therefore should not follow its links? but doing -A zip, html doesn't work either.

I tried several wget options and also curled, but didn't get anywhere.

I don't know if I have the wrong wget options or if there is anything special about Jenkins authentication.

Any help appreciated. Thanks.

+7
curl batch-file jenkins wget artifacts
source share
1 answer

You can add /*zip*/desired_archive_name.zip to any artifact location folder.

If your zip code is the only artifact in which the work archives are stored, you can use:
http://*.*.*.*:8080/job/MyProject/lastSuccessfulBuild/artifact/*zip*/myfile.zip
where myfile.zip is just the name that you assign to the downloaded archive, it can be anything.

If you have several artifacts in the archive, you can either get the zip of all of them, or deal with the individual ones when extracting. Or put the artifact you want in a separate folder and apply /*zip*/ to that folder.

+3
source share

All Articles