Allow to set refspec for salt-generated jobs
Change-Id: I07f61ee7ca981ae3bd588de995aa48c93123892b
Related-task: #PROD-23187 (PROD:23187)
diff --git a/jenkins/files/jobs/workflow-scm.xml b/jenkins/files/jobs/workflow-scm.xml
index 5998ff2..6bce799 100644
--- a/jenkins/files/jobs/workflow-scm.xml
+++ b/jenkins/files/jobs/workflow-scm.xml
@@ -10,6 +10,12 @@
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
+ {%- if job.scm.remote_name is defined %}
+ <name>{{ job.scm.remote_name }}</name>
+ {%- endif %}
+ {%- if job.scm.refspec is defined %}
+ <refspec>{{ job.scm.refspec }}</refspec>
+ {%- endif %}
<url>{{ job.scm.url }}</url>
{%- if job.scm.credentials is defined %}
<credentialsId>{{ job.scm.credentials }}</credentialsId>
@@ -41,6 +47,9 @@
<honorRefspec>{{ job.scm.clone.get('honor_refspec', False)|lower }}</honorRefspec>
</hudson.plugins.git.extensions.impl.CloneOption>
{%- endif %}
+ {%- if job.scm.get('wipe_workspace', False) %}
+ <hudson.plugins.git.extensions.impl.WipeWorkspace/>
+ {%- endif %}
</extensions>
</scm>
{%- endif %}
diff --git a/tests/pillar/client.sls b/tests/pillar/client.sls
index d1078a5..37b4a7a 100644
--- a/tests/pillar/client.sls
+++ b/tests/pillar/client.sls
@@ -29,6 +29,9 @@
url: https://github.com/jenkinsci/docker.git
branch: master
script: Jenkinsfile
+ remote_name: origin
+ refspec: "$ref"
+ wipe_workspace: true
github:
url: https://github.com/jenkinsci/docker
name: "Jenkins Docker Image"
@@ -48,6 +51,10 @@
type: boolean
description: true/false
default: true
+ ref:
+ type: string
+ description: ref
+ default: ""
string_param:
type: string
description: 1 liner