Update SCM Git Clean configuration to use new extensions style
Use the extensions style configuration for setting the SCM Git clean configuration. With this format we deprecate the older (clean: bool) configuration format and replace it with this format: clean: after: bool before: bool The older configuration is still supported so users who did not update their YAML files can upgrade without updating all their YAML files first. Change-Id: I1cfc0e2951c2b4de5e67bcb8abdf0b8c070e7fc6 Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
This commit is contained in:
parent
d7c37c89a8
commit
7d44c58aa2
@ -72,6 +72,9 @@ remoteName/\*')
|
||||
:arg bool shallow-clone: Perform shallow clone (default false)
|
||||
:arg bool prune: Prune remote branches (default false)
|
||||
:arg bool clean: Clean after checkout (default false)
|
||||
|
||||
.. deprecated:: 1.1.1. Please use clean extension format.
|
||||
|
||||
:arg bool fastpoll: Use fast remote polling (default false)
|
||||
:arg bool disable-submodules: Disable submodules (default false)
|
||||
|
||||
@ -111,6 +114,11 @@ remoteName/\*')
|
||||
* **branch** (`string`) - name of the branch to create
|
||||
create changelog against (default 'master')
|
||||
|
||||
:arg dict clean:
|
||||
:clean:
|
||||
* **after** (`bool`) - Clean the workspace after checkout
|
||||
* **before** (`bool`) - Clean the workspace before checkout
|
||||
|
||||
:arg dict submodule:
|
||||
:submodule:
|
||||
* **disable** (`bool`) - By disabling support for submodules
|
||||
@ -162,7 +170,6 @@ remoteName/\*')
|
||||
("recursive-submodules", 'recursiveSubmodules', False),
|
||||
(None, 'doGenerateSubmoduleConfigurations', False),
|
||||
("use-author", 'authorOrCommitter', False),
|
||||
("clean", 'clean', False),
|
||||
("wipe-workspace", 'wipeOutWorkspace', True),
|
||||
("prune", 'pruneBranches', False),
|
||||
("fastpoll", 'remotePoll', False),
|
||||
@ -279,6 +286,24 @@ remoteName/\*')
|
||||
change_branch = data['changelog-against'].get('branch', 'master')
|
||||
XML.SubElement(opts, 'compareRemote').text = change_remote
|
||||
XML.SubElement(opts, 'compareTarget').text = change_branch
|
||||
if 'clean' in data:
|
||||
# Keep support for old format 'clean' configuration by checking
|
||||
# if 'clean' is boolean. Else we're using the new extensions style.
|
||||
if isinstance(data['clean'], bool):
|
||||
clean_after = data['clean']
|
||||
clean_before = False
|
||||
logger.warn("'clean: bool' configuration format is deprecated, "
|
||||
"please use the extension style format to configure "
|
||||
"this option.")
|
||||
else:
|
||||
clean_after = data['clean'].get('after', False)
|
||||
clean_before = data['clean'].get('before', False)
|
||||
if clean_after:
|
||||
ext_name = 'hudson.plugins.git.extensions.impl.CleanCheckout'
|
||||
ext = XML.SubElement(exts_node, ext_name)
|
||||
if clean_before:
|
||||
ext_name = 'hudson.plugins.git.extensions.impl.CleanBeforeCheckout'
|
||||
ext = XML.SubElement(exts_node, ext_name)
|
||||
if 'submodule' in data:
|
||||
ext_name = 'hudson.plugins.git.extensions.impl.SubmoduleOption'
|
||||
ext = XML.SubElement(exts_node, ext_name)
|
||||
|
@ -28,7 +28,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -28,7 +28,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -28,7 +28,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -28,7 +28,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -28,7 +28,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
@ -80,7 +79,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -28,7 +28,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
@ -80,7 +79,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -30,7 +30,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
@ -68,7 +67,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -42,7 +42,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -28,7 +28,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
42
tests/scm/fixtures/git-clean01.xml
Normal file
42
tests/scm/fixtures/git-clean01.xml
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<scm class="hudson.plugins.git.GitSCM">
|
||||
<configVersion>2</configVersion>
|
||||
<userRemoteConfigs>
|
||||
<hudson.plugins.git.UserRemoteConfig>
|
||||
<name>origin</name>
|
||||
<refspec>+refs/heads/*:refs/remotes/origin/*</refspec>
|
||||
<url>https://github.com/openstack-infra/jenkins-job-builder.git</url>
|
||||
</hudson.plugins.git.UserRemoteConfig>
|
||||
</userRemoteConfigs>
|
||||
<branches>
|
||||
<hudson.plugins.git.BranchSpec>
|
||||
<name>**</name>
|
||||
</hudson.plugins.git.BranchSpec>
|
||||
</branches>
|
||||
<excludedUsers/>
|
||||
<buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
|
||||
<disableSubmodules>false</disableSubmodules>
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
<gitTool>Default</gitTool>
|
||||
<submoduleCfg class="list"/>
|
||||
<relativeTargetDir/>
|
||||
<reference/>
|
||||
<gitConfigName/>
|
||||
<gitConfigEmail/>
|
||||
<skipTag>false</skipTag>
|
||||
<scmName/>
|
||||
<useShallowClone>false</useShallowClone>
|
||||
<ignoreNotifyCommit>false</ignoreNotifyCommit>
|
||||
<extensions>
|
||||
<hudson.plugins.git.extensions.impl.CleanCheckout/>
|
||||
<hudson.plugins.git.extensions.impl.CleanBeforeCheckout/>
|
||||
<hudson.plugins.git.extensions.impl.WipeWorkspace/>
|
||||
</extensions>
|
||||
</scm>
|
||||
</project>
|
6
tests/scm/fixtures/git-clean01.yaml
Normal file
6
tests/scm/fixtures/git-clean01.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
scm:
|
||||
- git:
|
||||
url: https://github.com/openstack-infra/jenkins-job-builder.git
|
||||
clean:
|
||||
after: true
|
||||
before: true
|
@ -20,7 +20,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>true</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
@ -35,6 +34,7 @@
|
||||
<useShallowClone>false</useShallowClone>
|
||||
<ignoreNotifyCommit>true</ignoreNotifyCommit>
|
||||
<extensions>
|
||||
<hudson.plugins.git.extensions.impl.CleanCheckout/>
|
||||
<hudson.plugins.git.extensions.impl.WipeWorkspace/>
|
||||
</extensions>
|
||||
</scm>
|
||||
|
@ -20,7 +20,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>true</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
@ -35,6 +34,7 @@
|
||||
<useShallowClone>false</useShallowClone>
|
||||
<ignoreNotifyCommit>false</ignoreNotifyCommit>
|
||||
<extensions>
|
||||
<hudson.plugins.git.extensions.impl.CleanCheckout/>
|
||||
<hudson.plugins.git.extensions.impl.WipeWorkspace/>
|
||||
</extensions>
|
||||
</scm>
|
||||
|
@ -20,7 +20,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>true</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
@ -35,6 +34,7 @@
|
||||
<useShallowClone>false</useShallowClone>
|
||||
<ignoreNotifyCommit>false</ignoreNotifyCommit>
|
||||
<extensions>
|
||||
<hudson.plugins.git.extensions.impl.CleanCheckout/>
|
||||
<hudson.plugins.git.extensions.impl.WipeWorkspace/>
|
||||
</extensions>
|
||||
</scm>
|
||||
|
@ -26,7 +26,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -21,7 +21,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>true</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
@ -36,6 +35,7 @@
|
||||
<useShallowClone>true</useShallowClone>
|
||||
<ignoreNotifyCommit>false</ignoreNotifyCommit>
|
||||
<extensions>
|
||||
<hudson.plugins.git.extensions.impl.CleanCheckout/>
|
||||
<hudson.plugins.git.extensions.impl.WipeWorkspace/>
|
||||
</extensions>
|
||||
</scm>
|
||||
|
@ -20,7 +20,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>true</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
@ -35,6 +34,7 @@
|
||||
<useShallowClone>false</useShallowClone>
|
||||
<ignoreNotifyCommit>false</ignoreNotifyCommit>
|
||||
<extensions>
|
||||
<hudson.plugins.git.extensions.impl.CleanCheckout/>
|
||||
<hudson.plugins.git.extensions.impl.WipeWorkspace/>
|
||||
</extensions>
|
||||
</scm>
|
||||
|
@ -20,7 +20,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>true</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
@ -35,6 +34,7 @@
|
||||
<useShallowClone>false</useShallowClone>
|
||||
<ignoreNotifyCommit>false</ignoreNotifyCommit>
|
||||
<extensions>
|
||||
<hudson.plugins.git.extensions.impl.CleanCheckout/>
|
||||
<hudson.plugins.git.extensions.impl.WipeWorkspace/>
|
||||
</extensions>
|
||||
</scm>
|
||||
|
@ -18,7 +18,6 @@
|
||||
<buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -23,7 +23,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -23,7 +23,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -20,7 +20,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -20,7 +20,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -20,7 +20,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
@ -28,7 +28,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>true</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>true</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
@ -43,6 +42,7 @@
|
||||
<useShallowClone>false</useShallowClone>
|
||||
<ignoreNotifyCommit>false</ignoreNotifyCommit>
|
||||
<extensions>
|
||||
<hudson.plugins.git.extensions.impl.CleanCheckout/>
|
||||
<hudson.plugins.git.extensions.impl.WipeWorkspace/>
|
||||
</extensions>
|
||||
<browser class="hudson.plugins.git.browser.GitWeb">
|
||||
|
@ -28,7 +28,6 @@
|
||||
<recursiveSubmodules>false</recursiveSubmodules>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<authorOrCommitter>false</authorOrCommitter>
|
||||
<clean>false</clean>
|
||||
<wipeOutWorkspace>true</wipeOutWorkspace>
|
||||
<pruneBranches>false</pruneBranches>
|
||||
<remotePoll>false</remotePoll>
|
||||
|
Loading…
Reference in New Issue
Block a user