blob: 84b06bbe9ecb9506f668408523858cfaddb34867 [file] [log] [blame]
Ales Komareke5a1ed62016-08-27 12:02:48 +02001{%- from "jenkins/map.jinja" import client with context %}
2{%- set job = salt['pillar.get']('jenkins:client:job:'+job_name) -%}
Ales Komarekdaf31f72016-08-29 11:00:13 +02003{%- macro load_groovy_file() %}
4{%- set groovy_file='_jenkins/jobs/'+job.script_file %}
5{%- include groovy_file %}
6{%- endmacro %}
Ales Komareke5a1ed62016-08-27 12:02:48 +02007<?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 Komarekdaf31f72016-08-29 11:00:13 +020034 {%- if param.default is defined %}
Ales Komareke5a1ed62016-08-27 12:02:48 +020035 <defaultValue>{{ param.default|e }}</defaultValue>
Ales Komarekdaf31f72016-08-29 11:00:13 +020036 {%- endif %}
Ales Komareke5a1ed62016-08-27 12:02:48 +020037 </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 Komarekdaf31f72016-08-29 11:00:13 +020044 <script>{% if job.script_file is defined %}{{ load_groovy_file()|e }}{% else %}{{ job.script|e }}{% endif %}</script>
Ales Komareke5a1ed62016-08-27 12:02:48 +020045 <sandbox>true</sandbox>
46 </definition>
47 <triggers>
48 </triggers>
49</flow-definition>