Add support for "prune-tags" in git scm
"prune-tags" removes tags from the local workspace before fetch if they no longer exist on the remote. Support for this was added to the git plugin in JENKINS-40529. Change-Id: I204fd0a508944fecba8a3a26527793cdf37234f8
This commit is contained in:
parent
2a907c9ab0
commit
18ec0ba6af
@ -307,6 +307,7 @@ def git(registry, xml_parent, data):
|
||||
* **per-build-tag** (`bool`) - Create a tag in the workspace for every
|
||||
build. (default is inverse of skip-tag if set, otherwise false)
|
||||
* **prune** (`bool`) - Prune remote branches (default false)
|
||||
* **prune-tags** (`bool`) - Prune tags if they no longer exist on the remote (default false)
|
||||
* **scm-name** (`string`) - The unique scm name for this Git SCM
|
||||
(optional)
|
||||
* **shallow-clone** (`bool`) - Perform shallow clone (default false)
|
||||
@ -763,6 +764,15 @@ def git_extensions(xml_parent, data):
|
||||
ext = XML.SubElement(tr, "extension", {"class": ext_name})
|
||||
else:
|
||||
ext = XML.SubElement(xml_parent, ext_name)
|
||||
prune = str(data.get("prune-tags", False)).lower()
|
||||
if prune == "true":
|
||||
ext_name = impl_prefix + "PruneStaleTag"
|
||||
if trait:
|
||||
trait_name = "PruneStaleTagTrait"
|
||||
tr = XML.SubElement(xml_parent, trait_prefix + trait_name)
|
||||
ext = XML.SubElement(tr, "extension", {"class": ext_name})
|
||||
else:
|
||||
ext = XML.SubElement(xml_parent, ext_name)
|
||||
ignore_notify_commits = str(data.get("ignore-notify", False)).lower()
|
||||
if not trait and ignore_notify_commits == "true":
|
||||
XML.SubElement(xml_parent, impl_prefix + "IgnoreNotifyCommit")
|
||||
|
@ -110,6 +110,9 @@
|
||||
<jenkins.plugins.git.traits.PruneStaleBranchTrait>
|
||||
<extension class="hudson.plugins.git.extensions.impl.PruneStaleBranch"/>
|
||||
</jenkins.plugins.git.traits.PruneStaleBranchTrait>
|
||||
<jenkins.plugins.git.traits.PruneStaleTagTrait>
|
||||
<extension class="hudson.plugins.git.extensions.impl.PruneStaleTag"/>
|
||||
</jenkins.plugins.git.traits.PruneStaleTagTrait>
|
||||
<jenkins.plugins.git.traits.WipeWorkspaceTrait>
|
||||
<extension class="hudson.plugins.git.extensions.impl.WipeWorkspace"/>
|
||||
</jenkins.plugins.git.traits.WipeWorkspaceTrait>
|
||||
|
@ -71,6 +71,7 @@ scm:
|
||||
after: true
|
||||
before: true
|
||||
prune: true
|
||||
prune-tags: true
|
||||
local-branch: true
|
||||
sparse-checkout:
|
||||
paths:
|
||||
|
Loading…
x
Reference in New Issue
Block a user