How to get the appropriate Jenkins artifact builds?

I am creating Jenkins jobs using the hudson.cli.CLI jar . I selected " Archive artifacts" in the "Post-step steps" section. It archives artifacts for every successful build. I am using jenkins api remote access http://localhost:8080/job/job_name/api/json to get detailed information about jobs . and http://localhost:8080/job/job_name/job_number/api/json to get detailed information about assemblies .

When I delete an assembly, the corresponding archive artifacts are not deleted. I would like to make sure they are deleted.

When I use jenkins api remote access http://localhost:8080/job/[job_name]/[job_number]/api/json for assembly, it returns json data that contains all previously archived artifacts (other successful assembly artifacts) with this (working assembly) assembly artifact. How to get the associated assembly artifact (a successful assembly should return its artifact, and not all previous successful artifacts). Any suggestions or ideas?

+4
source share
2 answers

I suspect that you do not clear your workspace between assemblies and archive all artifacts found there, including from previous collections.

+4
source

An assembly without archived artifacts will have this json output:

 "artifacts":[] 

In an assembly with archived artifacts, this would be json output:

 "artifacts":[{"displayPath":"output","fileName":"output","relativePath":"output"}] 

This artifact can be seen at http://localhost:8080/job/[job_name]/[job_number]/artifact/

+4
source

Source: https://habr.com/ru/post/1398232/


All Articles