8

I want to ask, If I use jenkins. How can I get all artifacts list and download it, but not from jenkins web interface. I want to make my own web interface for certain goals.

Is there any jenkins API to do this?

CSchulz
  • 10,882
  • 11
  • 60
  • 114
Kenny Basuki
  • 625
  • 4
  • 11
  • 27

2 Answers2

9

According to this answer: https://superuser.com/questions/587426/download-a-file-from-the-latest-stable-jenkins-build

You can use the Jenkins API to get the list of artifacts: http://your.jenkins.server/job/your.job/lastStableBuild/api/xml?tree=artifacts%5BrelativePath%5D

With a script, you can extract the artefact relative path:

enter image description here

Next, you can build your download URLs like: http://your.jenkins.server/job/your.job/lastStableBuild/artifact/relativePath

Community
  • 1
  • 1
Bruno Lavit
  • 10,184
  • 2
  • 32
  • 38
8

you can download created artifacts with curl:

curl -u "${USR}":"${PWD}" $JENKINS'/job/'"${NAM}"/"{$JOB}"'/artifact/*zip*/archive.zip' --output "${NAM}_{$JOB}_archive.zip"
Jerry
  • 966
  • 2
  • 13
  • 28
lolo
  • 81
  • 1
  • 1