Merge "Added code for lightweight-checkout"

This commit is contained in:
Zuul 2018-04-06 19:18:59 +00:00 committed by Gerrit Code Review
commit b25a501947
4 changed files with 10 additions and 3 deletions

View File

@ -40,6 +40,9 @@ interpreted by the python str.format() command.
source code repository
* **script-path**: path to the Groovy file containing the job's steps
(optional, default: ``Jenkinsfile``)
* **lightweight-checkout** (`bool`): If selected, try to obtain the
Pipeline script contents directly from the SCM without performing a
full checkout. (optional, default: ``false``)
Note that ``dsl`` and ``pipeline-scm`` parameters are mutually exclusive.

View File

@ -1422,9 +1422,11 @@ class PipelineSCM(jenkins_jobs.modules.base.Base):
raise JenkinsJobsException("'scm' missing or empty")
elif scms_count == 1:
self.registry.dispatch('scm', definition_parent, scms[0])
XML.SubElement(definition_parent, 'scriptPath'
).text = pipeline_dict.get('script-path',
'Jenkinsfile')
mapping = [('script-path', 'scriptPath', 'Jenkinsfile'),
('lightweight-checkout', 'lightweight', None,
[True, False])]
convert_mapping_to_xml(definition_parent, pipeline_dict,
mapping, fail_required=False)
else:
raise JenkinsJobsException('Only one SCM can be specified '
'as pipeline-scm')

View File

@ -11,6 +11,7 @@
<disableChangeLog>false</disableChangeLog>
</scm>
<scriptPath>Jenkinsfile.groovy</scriptPath>
<lightweight>true</lightweight>
</definition>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>

View File

@ -8,4 +8,5 @@
url: http://hg.example.org/test_job
clean: true
script-path: Jenkinsfile.groovy
lightweight-checkout: true