Load job steps template from file or URI
textgoeshere opened this issue · 4 comments
It would be handy to be able to supply a file or URI to use as the job steps config template.
Existing builtin templates would be untouched: if the parameter to --template
option is one of VALID_JOB_TEMPLATES
then the config is built as per usual.
However if the parameter is not one of VALID_JOB_TEMPLATES
, then new behaviour occurs. If the parameter looks like a URI, the content of the response is used. Otherwise, it's assumed to be the file, and the file contents are used.
Scenario: Create job with steps from file (jenkins create --template mytemplate.xml)
Scenario: Create job with steps from URI (jenkins create --template http://example.com/template)
Happy to contribute code if there's an appetite for this.
It would be nice to connect this full circle and try to detect templates from a project working tree or source repository too. That way you could not only manually select a template, but it would do its best to auto-detect one.
What would be the convention? config.xml
in the root of the project?
I think it would vary from project to project. By default, it shouldn't require any configuration, and will choose a reasonable set up for you. I guess what I'm driving at is some sort of 'plugin' system for the project templating system.
Closing, pull request at #32