We are setting up the job to generate executable file by gathering different components (All these tagged) , We need a way to get these components based on the name of the build, I know copy artifacts will do but i would like to put this on script, Is there way (Api or something else) can download archived artifacts? once all these components present it is easy to create a installer

I have tried there are multiple curl and wget commands which accept username and password , But I need something without username and password as script runs on jenkins workspace we dont need to pass the password

1 Answers

user3328336 On

If you want to interact with Jenkins via scripts there are two ways:

1. Jenkinspipeline

With Jenkinspipelines you can define the builds with Groovy scripts whereby you can use copyArtifact via the Groovy DSL. Its not actually a script its a build definition defined with a Groovy DSL. This should be the way when a Jenkins Job is gathering stuff from other Jobs.


2. Jenkins CLI

With the Jenkins CLI you can interact with Jenkins via a shell script. This should be the way when you want to gather stuff from outside of Jenkins.


If Jenkins is secured then I think you will have to provide credentials when using the Jenkins CLI. With Jenkinspipelines you don't need credentials, because they are executed in Jenkins. But you need to define permissions on the Jenkins Jobs (or in the Pipelines) so that Jenkins Jobs can access Artifacts of other Jobs. (CopyArtifactPermission)