Update Repo plugin to use convert_mapping_to_xml
- Update doc options to have default values - Update mapping to use single quote syntax Change-Id: I6d06f7120eaec81c785230dd524de0178be88c00 Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
parent
12cab0e30f
commit
a34bd67ef7
@ -611,19 +611,19 @@ def repo(parser, xml_parent, data):
|
|||||||
Specifies the repo SCM repository for this job.
|
Specifies the repo SCM repository for this job.
|
||||||
Requires the Jenkins :jenkins-wiki:`Repo Plugin <Repo+Plugin>`.
|
Requires the Jenkins :jenkins-wiki:`Repo Plugin <Repo+Plugin>`.
|
||||||
|
|
||||||
:arg str manifest-url: URL of the repo manifest
|
:arg str manifest-url: URL of the repo manifest (required)
|
||||||
:arg str manifest-branch: The branch of the manifest to use (optional)
|
:arg str manifest-branch: The branch of the manifest to use (default '')
|
||||||
:arg str manifest-file: Initial manifest file to use when initialising
|
:arg str manifest-file: Initial manifest file to use when initialising
|
||||||
(optional)
|
(default '')
|
||||||
:arg str manifest-group: Only retrieve those projects in the manifest
|
:arg str manifest-group: Only retrieve those projects in the manifest
|
||||||
tagged with the provided group name (optional)
|
tagged with the provided group name (default '')
|
||||||
:arg list(str) ignore-projects: a list of projects in which changes would
|
:arg list(str) ignore-projects: a list of projects in which changes would
|
||||||
not be considered to trigger a build when pooling (optional)
|
not be considered to trigger a build when pooling (default '')
|
||||||
:arg str destination-dir: Location relative to the workspace root to clone
|
:arg str destination-dir: Location relative to the workspace root to clone
|
||||||
under (optional)
|
under (default '')
|
||||||
:arg str repo-url: custom url to retrieve the repo application (optional)
|
:arg str repo-url: custom url to retrieve the repo application (default '')
|
||||||
:arg str mirror-dir: Path to mirror directory to reference when
|
:arg str mirror-dir: Path to mirror directory to reference when
|
||||||
initialising (optional)
|
initialising (default '')
|
||||||
:arg int jobs: Number of projects to fetch simultaneously (default 0)
|
:arg int jobs: Number of projects to fetch simultaneously (default 0)
|
||||||
:arg int depth: Specify the depth in history to sync from the source. The
|
:arg int depth: Specify the depth in history to sync from the source. The
|
||||||
default is to sync all of the history. Use 1 to just sync the most
|
default is to sync all of the history. Use 1 to just sync the most
|
||||||
@ -643,7 +643,7 @@ def repo(parser, xml_parent, data):
|
|||||||
:arg bool show-all-changes: When this is checked --first-parent is no
|
:arg bool show-all-changes: When this is checked --first-parent is no
|
||||||
longer passed to git log when determining changesets (default false)
|
longer passed to git log when determining changesets (default false)
|
||||||
:arg str local-manifest: Contents of .repo/local_manifest.xml, written
|
:arg str local-manifest: Contents of .repo/local_manifest.xml, written
|
||||||
prior to calling sync (optional)
|
prior to calling sync (default '')
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
@ -653,43 +653,27 @@ def repo(parser, xml_parent, data):
|
|||||||
scm = XML.SubElement(xml_parent,
|
scm = XML.SubElement(xml_parent,
|
||||||
'scm', {'class': 'hudson.plugins.repo.RepoScm'})
|
'scm', {'class': 'hudson.plugins.repo.RepoScm'})
|
||||||
|
|
||||||
if 'manifest-url' in data:
|
|
||||||
XML.SubElement(scm, 'manifestRepositoryUrl').text = \
|
|
||||||
data['manifest-url']
|
|
||||||
else:
|
|
||||||
raise JenkinsJobsException("Must specify a manifest url")
|
|
||||||
|
|
||||||
mapping = [
|
mapping = [
|
||||||
# option, xml name, default value
|
# option, xml name, default value
|
||||||
("manifest-branch", 'manifestBranch', ''),
|
('manifest-url', 'manifestRepositoryUrl', None),
|
||||||
("manifest-file", 'manifestFile', ''),
|
('manifest-branch', 'manifestBranch', ''),
|
||||||
("manifest-group", 'manifestGroup', ''),
|
('manifest-file', 'manifestFile', ''),
|
||||||
("destination-dir", 'destinationDir', ''),
|
('manifest-group', 'manifestGroup', ''),
|
||||||
("repo-url", 'repoUrl', ''),
|
('destination-dir', 'destinationDir', ''),
|
||||||
("mirror-dir", 'mirrorDir', ''),
|
('repo-url', 'repoUrl', ''),
|
||||||
("jobs", 'jobs', 0),
|
('mirror-dir', 'mirrorDir', ''),
|
||||||
("depth", 'depth', 0),
|
('jobs', 'jobs', 0),
|
||||||
("current-branch", 'currentBranch', True),
|
('depth', 'depth', 0),
|
||||||
("reset-first", 'resetFirst', False),
|
('current-branch', 'currentBranch', True),
|
||||||
("quiet", 'quiet', True),
|
('reset-first', 'resetFirst', False),
|
||||||
("force-sync", 'forceSync', False),
|
('quiet', 'quiet', True),
|
||||||
("no-tags", 'noTags', False),
|
('force-sync', 'forceSync', False),
|
||||||
("trace", 'trace', False),
|
('no-tags', 'noTags', False),
|
||||||
("show-all-changes", 'showAllChanges', False),
|
('trace', 'trace', False),
|
||||||
("local-manifest", 'localManifest', ''),
|
('show-all-changes', 'showAllChanges', False),
|
||||||
|
('local-manifest', 'localManifest', ''),
|
||||||
]
|
]
|
||||||
|
convert_mapping_to_xml(scm, data, mapping, fail_required=True)
|
||||||
for elem in mapping:
|
|
||||||
(optname, xmlname, val) = elem
|
|
||||||
val = data.get(optname, val)
|
|
||||||
# Skip adding xml entry if default is empty string and no value given
|
|
||||||
if not val and elem[2] is '':
|
|
||||||
continue
|
|
||||||
xe = XML.SubElement(scm, xmlname)
|
|
||||||
if type(elem[2]) == bool:
|
|
||||||
xe.text = str(val).lower()
|
|
||||||
else:
|
|
||||||
xe.text = str(val)
|
|
||||||
|
|
||||||
# ignore-projects does not follow the same pattern of the other parameters,
|
# ignore-projects does not follow the same pattern of the other parameters,
|
||||||
# so process it here:
|
# so process it here:
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
<noTags>false</noTags>
|
<noTags>false</noTags>
|
||||||
<trace>false</trace>
|
<trace>false</trace>
|
||||||
<showAllChanges>false</showAllChanges>
|
<showAllChanges>false</showAllChanges>
|
||||||
|
<localManifest/>
|
||||||
<ignoreProjects class="linked-hash-set">
|
<ignoreProjects class="linked-hash-set">
|
||||||
<string/>
|
<string/>
|
||||||
</ignoreProjects>
|
</ignoreProjects>
|
||||||
|
Loading…
Reference in New Issue
Block a user