Plugin Idea - download multiple files to workspace via HTTP requests

24 views
Skip to first unread message

Vince Webb

unread,
Jul 13, 2015, 8:07:11 AM7/13/15
to jenkin...@googlegroups.com
I want a plugin that will read URLs, and filenames from a file in the workspace, request each URL and store the content as the given filename in the workspace.

If these files existed in source control then obviously I would pull them from GIT, SVN or whatever. If they existed in Maven then I would pull them from there but these are files which we want to pull using HTTP or HTTPS from a list of URLs.

I have written a toy town version of this as a bash script:
/////

while read -r filename url

do

curl -o $filename $url

done < url_list.txt

/////

It works but I want to replace the script with a plugin for the following reasons:
  • We need to repeat it in multiple Jenkins projects
  • It needs to have good error reporting
  • Needs to do HTTPS as well as HTTP

Has anybody written a plugin similar to this ?

I am a complete newbie when it comes to both Maven and writing Jenkins plugins but I will give it a go if there is nothing else out there.

domi

unread,
Jul 13, 2015, 8:25:55 AM7/13/15
to Jenkins Developers
seems like a very specific use case - I would not write a plugin, but use the “managed scripts plugin” to share the script within different jobs:
/Domi

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c3152928-f9f0-456d-9b2b-a4620785c4ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Beck

unread,
Jul 13, 2015, 8:37:39 AM7/13/15
to jenkin...@googlegroups.com
I know this isn't an answer to your question, but: I don't think this needs to be made into a plugin. That requires quite a bit of effort, for basically no gain.

> • We need to repeat it in multiple Jenkins projects

A script stored in SCM seems like the perfect place for this. Shared between projects, or even between Jenkins instances.

> • It needs to have good error reporting

Write to standard out/standard error, and maybe use something like Groovy Postbuild Plugin to appropriately make the build unstable/failed if certain keywords appear in the log.

> • Needs to do HTTPS as well as HTTP

It's not clear why a script cannot do this.

Remember, a Jenkins plugin comes with downsides -- like extra development effort (obviously), and the inability to modify its behavior without restarting Jenkins.
Reply all
Reply to author
Forward
0 new messages