Ales Komarek | e5a1ed6 | 2016-08-27 12:02:48 +0200 | [diff] [blame] | 1 | {%- from "jenkins/map.jinja" import client with context %} |
| 2 | {%- set job = salt['pillar.get']('jenkins:client:job:'+job_name) -%} |
Ales Komarek | daf31f7 | 2016-08-29 11:00:13 +0200 | [diff] [blame^] | 3 | {%- macro load_groovy_file() %} |
| 4 | {%- set groovy_file='_jenkins/jobs/'+job.script_file %} |
| 5 | {%- include groovy_file %} |
| 6 | {%- endmacro %} |
Ales Komarek | e5a1ed6 | 2016-08-27 12:02:48 +0200 | [diff] [blame] | 7 | <?xml version='1.0' encoding='UTF-8'?> |
| 8 | <flow-definition plugin="workflow-job@2.5"> |
| 9 | <description>{{ job.get('description', 'Salt generated, do not edit.') }}</description> |
| 10 | {%- if job.display_name is defined %} |
| 11 | <displayName>{{ job.display_name }}</displayName> |
| 12 | {%- endif %} |
| 13 | <keepDependencies>false</keepDependencies> |
| 14 | <properties> |
| 15 | <org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty> |
| 16 | <triggers/> |
| 17 | </org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty> |
| 18 | {%- if job.param is defined %} |
| 19 | <hudson.model.ParametersDefinitionProperty> |
| 20 | <parameterDefinitions> |
| 21 | {%- for param_name, param in job.param.iteritems() %} |
| 22 | <hudson.model.{{ client.param[param.type] }}ParameterDefinition> |
| 23 | <name>{{ param_name }}</name> |
| 24 | <description>{{ param.get('description', '')|e }}</description> |
| 25 | {%- if param.type == "choice" %} |
| 26 | <choices class="java.util.Arrays$ArrayList"> |
| 27 | <a class="string-array"> |
| 28 | {%- for choice in param.choices %} |
| 29 | <string>{{ choice|e }}</string> |
| 30 | {%- endfor %} |
| 31 | </a> |
| 32 | </choices> |
| 33 | {%- endif %} |
Ales Komarek | daf31f7 | 2016-08-29 11:00:13 +0200 | [diff] [blame^] | 34 | {%- if param.default is defined %} |
Ales Komarek | e5a1ed6 | 2016-08-27 12:02:48 +0200 | [diff] [blame] | 35 | <defaultValue>{{ param.default|e }}</defaultValue> |
Ales Komarek | daf31f7 | 2016-08-29 11:00:13 +0200 | [diff] [blame^] | 36 | {%- endif %} |
Ales Komarek | e5a1ed6 | 2016-08-27 12:02:48 +0200 | [diff] [blame] | 37 | </hudson.model.{{ client.param[param.type] }}ParameterDefinition> |
| 38 | {%- endfor %} |
| 39 | </parameterDefinitions> |
| 40 | </hudson.model.ParametersDefinitionProperty> |
| 41 | {%- endif %} |
| 42 | </properties> |
| 43 | <definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workflow-cps@2.12"> |
Ales Komarek | daf31f7 | 2016-08-29 11:00:13 +0200 | [diff] [blame^] | 44 | <script>{% if job.script_file is defined %}{{ load_groovy_file()|e }}{% else %}{{ job.script|e }}{% endif %}</script> |
Ales Komarek | e5a1ed6 | 2016-08-27 12:02:48 +0200 | [diff] [blame] | 45 | <sandbox>true</sandbox> |
| 46 | </definition> |
| 47 | <triggers> |
| 48 | </triggers> |
| 49 | </flow-definition> |