Reputation: 9739
I'd like to have a Jenkins build step which just downloads a given URL into the workspace. Is there a simple way to do that?
(I currently use an Ant script which does a simple <get/>
. But that means I need to have that script in SVN somewhere, and check it out during the build. I find that cumbersome.)
Update: To clarify, I'd like to download a URL without installing additional software on the build system or using an additional script. (A Jenkins plugin is fine, of course.) Preferably I don't want to depend on the build slave being Linux, Windows, or whatever.
Upvotes: 19
Views: 51645
Reputation: 1303
In case you don't want to meddle with installing plugins or running shell commands (e.g. there might be no curl
on windows), you may do this programmatically:
file_text = new URL ("https://some.site.com/some_file.html").getText()
writeFile(file: 'file.html', text: file_text)
To run this you will need to make some in-process script approvals as usual with custom code in Jenkins.
In cause you need to configure actual request, check this for getText()
parameters.
Based on this gist and this answer
Upvotes: 9
Reputation: 4348
How Download file with Jenkins HTTP Request Plugin. How to download file into Jenkins workspace. I was downloading a tar.gz file from our Nexus (Artifactory) which is a local repository into work-space of a Jenkins build steps. Steps to be done:
Upvotes: 12
Reputation: 10240
This plugin works great to do a get/put/post/delete on any REST type url: HTTP Request Plugin - on the Jenkins Wiki ; https://wiki.jenkins-ci.org/display/JENKINS/HTTP+Request+Plugin
Upvotes: 0
Reputation: 21130
The simplest way is just to have a shell script build step that does a wget or curl on your URL. But the plugins that @Bernard suggests will probably give you additional functionality.
Upvotes: 6