Is there any Jenkins API to get artifacts name and download it? [closed]

南楼画角 提交于 2019-12-06 02:05:15

问题


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?


回答1:


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:

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




回答2:


you can download created artifacts with curl:

curl -u "${USR}":"${PWD}" $JENKINS'/job/'"${NAM}"/"{$JOB}"'/artifact/*zip*/archive.zip' --output "${NAM}_{$JOB}_archive.zip"


来源:https://stackoverflow.com/questions/35920756/is-there-any-jenkins-api-to-get-artifacts-name-and-download-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!