Can Jenkins build access to archived artifacts from himself?

I use Jenkins and take the step “Archive artifacts” at the end of my collections to archive them in a zip file.

Instead of using this step, I would like to use a script to move artifacts to a remote server at the end of the build. The server I click on uses the REST API / HTTP PUT request in the script to upload files.

Please note that I am looking for access to an artifact created in the same assembly. Therefore, if I am at assembly number 5, I need artifacts from assembly number 5, and not assembly number 4.

Is there a way to access this zip file using a script in the same assembly in which it was created?

I need to download this zip remotely and do not want to create another task for this.

+5
source share
3 answers

Unable to find access to the “Archive artifacts” package of the assembly that generates it. This step is always the last in the assembly. Accessing the URL before the build is complete (for example, during build via a script) creates an empty zip file. To get around this limitation, I am doing a second related build task to capture zip and run my script to deploy it.

+1
source

You can install one of the Publish Over ... plugins to load your artifacts at the end of the build.

The goal of Publish Over plugins is to provide a consistent set of functions and behavior when sending assembly artifacts ... somewhere.

. "" .

+4

Like @Christopher, you can use any of the plugins Publish Overon the Jenkins plugins page to load an artifact into any of

If you want to access the archived zip file from the assembly itself, you can use the following link to access it:

http://<server>/job/${JOB_NAME}/lastSuccessfulBuild/artifact/<artifact name w/folder>

For instance:

  • server = myserver.com
  • job title = myproject
  • artifact = del/project.zip

Your URL will look like this:

http://myserver.com/job/myproject/lastSuccessfulBuild/artifact/del/project.zip

EDIT: The question has been changed. In any case, this will work to access the artifact of the previous assembly in the current one.

+4
source

All Articles