blob: 84b06bbe9ecb9506f668408523858cfaddb34867 [file] [log] [blame]
{%- from "jenkins/map.jinja" import client with context %}
{%- set job = salt['pillar.get']('jenkins:client:job:'+job_name) -%}
{%- macro load_groovy_file() %}
{%- set groovy_file='_jenkins/jobs/'+job.script_file %}
{%- include groovy_file %}
{%- endmacro %}
<?xml version='1.0' encoding='UTF-8'?>
<flow-definition plugin="workflow-job@2.5">
<description>{{ job.get('description', 'Salt generated, do not edit.') }}</description>
{%- if job.display_name is defined %}
<displayName>{{ job.display_name }}</displayName>
{%- endif %}
<keepDependencies>false</keepDependencies>
<properties>
<org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
<triggers/>
</org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
{%- if job.param is defined %}
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
{%- for param_name, param in job.param.iteritems() %}
<hudson.model.{{ client.param[param.type] }}ParameterDefinition>
<name>{{ param_name }}</name>
<description>{{ param.get('description', '')|e }}</description>
{%- if param.type == "choice" %}
<choices class="java.util.Arrays$ArrayList">
<a class="string-array">
{%- for choice in param.choices %}
<string>{{ choice|e }}</string>
{%- endfor %}
</a>
</choices>
{%- endif %}
{%- if param.default is defined %}
<defaultValue>{{ param.default|e }}</defaultValue>
{%- endif %}
</hudson.model.{{ client.param[param.type] }}ParameterDefinition>
{%- endfor %}
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
{%- endif %}
</properties>
<definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workflow-cps@2.12">
<script>{% if job.script_file is defined %}{{ load_groovy_file()|e }}{% else %}{{ job.script|e }}{% endif %}</script>
<sandbox>true</sandbox>
</definition>
<triggers>
</triggers>
</flow-definition>