Extend multibranch pipeline project gerrit scm
Support was previously added for the other multibranch pipeline scms, but not for gerrit. This change makes adds support for available git extensions to the gerrit multibranch pipeline scm. Previous review: https://review.opendev.org/c/jjb/jenkins-job-builder/+/601323 Change-Id: Ie7553ff310e844bbe912b694b09f97450c609491 Signed-off-by: Pat Long <pllong@arista.com>
This commit is contained in:
parent
d352ed9656
commit
46082807fa
@ -637,7 +637,7 @@ def bitbucket_scm(xml_parent, data):
|
|||||||
|
|
||||||
|
|
||||||
def gerrit_scm(xml_parent, data):
|
def gerrit_scm(xml_parent, data):
|
||||||
"""Configure Gerrit SCM
|
r"""Configure Gerrit SCM
|
||||||
|
|
||||||
Requires the :jenkins-plugins:`Gerrit Code Review Plugin
|
Requires the :jenkins-plugins:`Gerrit Code Review Plugin
|
||||||
<gerrit-code-review>`.
|
<gerrit-code-review>`.
|
||||||
@ -670,6 +670,41 @@ def gerrit_scm(xml_parent, data):
|
|||||||
'SCHEME' or 'ID'.
|
'SCHEME' or 'ID'.
|
||||||
query-string: Value of the query operator.
|
query-string: Value of the query operator.
|
||||||
|
|
||||||
|
:extensions:
|
||||||
|
|
||||||
|
* **clean** (`dict`)
|
||||||
|
* **after** (`bool`) - Clean the workspace after checkout
|
||||||
|
* **before** (`bool`) - Clean the workspace before checkout
|
||||||
|
* **prune** (`bool`) - Prune remote branches (default false)
|
||||||
|
* **shallow-clone** (`bool`) - Perform shallow clone (default false)
|
||||||
|
* **sparse-checkout** (dict)
|
||||||
|
* **paths** (list) - List of paths to sparse checkout. (optional)
|
||||||
|
* **depth** (`int`) - Set shallow clone depth (default 1)
|
||||||
|
* **do-not-fetch-tags** (`bool`) - Perform a clone without tags
|
||||||
|
(default false)
|
||||||
|
* **submodule** (`dict`)
|
||||||
|
* **disable** (`bool`) - By disabling support for submodules you
|
||||||
|
can still keep using basic git plugin functionality and just have
|
||||||
|
Jenkins to ignore submodules completely as if they didn't exist.
|
||||||
|
* **recursive** (`bool`) - Retrieve all submodules recursively
|
||||||
|
(uses '--recursive' option which requires git>=1.6.5)
|
||||||
|
* **tracking** (`bool`) - Retrieve the tip of the configured
|
||||||
|
branch in .gitmodules (Uses '\-\-remote' option which requires
|
||||||
|
git>=1.8.2)
|
||||||
|
* **parent-credentials** (`bool`) - Use credentials from default
|
||||||
|
remote of parent repository (default false).
|
||||||
|
* **reference-repo** (`str`) - Path of the reference repo to use
|
||||||
|
during clone (optional)
|
||||||
|
* **timeout** (`int`) - Specify a timeout (in minutes) for
|
||||||
|
submodules operations (default 10).
|
||||||
|
* **timeout** (`str`) - Timeout for git commands in minutes (optional)
|
||||||
|
* **use-author** (`bool`): Use author rather than committer in Jenkin's
|
||||||
|
build changeset (default false)
|
||||||
|
* **wipe-workspace** (`bool`) - Wipe out workspace before build
|
||||||
|
(default true)
|
||||||
|
* **lfs-pull** (`bool`) - Call git lfs pull after checkout
|
||||||
|
(default false)
|
||||||
|
|
||||||
Minimal Example:
|
Minimal Example:
|
||||||
|
|
||||||
.. literalinclude::
|
.. literalinclude::
|
||||||
@ -749,6 +784,18 @@ def gerrit_scm(xml_parent, data):
|
|||||||
checks_trait, checks, checks_source_mapping, fail_required=True
|
checks_trait, checks, checks_source_mapping, fail_required=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# handle the default git extensions like:
|
||||||
|
# - clean
|
||||||
|
# - shallow-clone
|
||||||
|
# - timeout
|
||||||
|
# - do-not-fetch-tags
|
||||||
|
# - submodule
|
||||||
|
# - prune
|
||||||
|
# - wipe-workspace
|
||||||
|
# - use-author
|
||||||
|
# - lfs-pull
|
||||||
|
git_extensions(traits, data)
|
||||||
|
|
||||||
|
|
||||||
def git_scm(xml_parent, data):
|
def git_scm(xml_parent, data):
|
||||||
r"""Configure Git SCM
|
r"""Configure Git SCM
|
||||||
|
@ -51,6 +51,63 @@
|
|||||||
<queryOperator>SCHEME</queryOperator>
|
<queryOperator>SCHEME</queryOperator>
|
||||||
<queryString>jenkins</queryString>
|
<queryString>jenkins</queryString>
|
||||||
</jenkins.plugins.gerrit.traits.FilterChecksTrait>
|
</jenkins.plugins.gerrit.traits.FilterChecksTrait>
|
||||||
|
<jenkins.plugins.git.traits.CleanAfterCheckoutTrait>
|
||||||
|
<extension class="hudson.plugins.git.extensions.impl.CleanCheckout"/>
|
||||||
|
</jenkins.plugins.git.traits.CleanAfterCheckoutTrait>
|
||||||
|
<jenkins.plugins.git.traits.CleanBeforeCheckoutTrait>
|
||||||
|
<extension class="hudson.plugins.git.extensions.impl.CleanBeforeCheckout"/>
|
||||||
|
</jenkins.plugins.git.traits.CleanBeforeCheckoutTrait>
|
||||||
|
<jenkins.plugins.git.traits.CloneOptionTrait>
|
||||||
|
<extension class="hudson.plugins.git.extensions.impl.CloneOption">
|
||||||
|
<shallow>true</shallow>
|
||||||
|
<depth>3</depth>
|
||||||
|
<noTags>true</noTags>
|
||||||
|
<timeout>100</timeout>
|
||||||
|
</extension>
|
||||||
|
</jenkins.plugins.git.traits.CloneOptionTrait>
|
||||||
|
<jenkins.plugins.git.traits.SparseCheckoutPathsTrait>
|
||||||
|
<extension class="hudson.plugins.git.extensions.impl.SparseCheckoutPaths">
|
||||||
|
<sparseCheckoutPaths>
|
||||||
|
<hudson.plugins.git.extensions.impl.SparseCheckoutPath>
|
||||||
|
<path>path1</path>
|
||||||
|
</hudson.plugins.git.extensions.impl.SparseCheckoutPath>
|
||||||
|
<hudson.plugins.git.extensions.impl.SparseCheckoutPath>
|
||||||
|
<path>path2</path>
|
||||||
|
</hudson.plugins.git.extensions.impl.SparseCheckoutPath>
|
||||||
|
<hudson.plugins.git.extensions.impl.SparseCheckoutPath>
|
||||||
|
<path>path3</path>
|
||||||
|
</hudson.plugins.git.extensions.impl.SparseCheckoutPath>
|
||||||
|
</sparseCheckoutPaths>
|
||||||
|
</extension>
|
||||||
|
</jenkins.plugins.git.traits.SparseCheckoutPathsTrait>
|
||||||
|
<jenkins.plugins.git.traits.SubmoduleOptionTrait>
|
||||||
|
<extension class="hudson.plugins.git.extensions.impl.SubmoduleOption">
|
||||||
|
<disableSubmodules>false</disableSubmodules>
|
||||||
|
<recursiveSubmodules>true</recursiveSubmodules>
|
||||||
|
<trackingSubmodules>false</trackingSubmodules>
|
||||||
|
<parentCredentials>true</parentCredentials>
|
||||||
|
<reference/>
|
||||||
|
<timeout>100</timeout>
|
||||||
|
<threads>1</threads>
|
||||||
|
</extension>
|
||||||
|
</jenkins.plugins.git.traits.SubmoduleOptionTrait>
|
||||||
|
<jenkins.plugins.git.traits.CheckoutOptionTrait>
|
||||||
|
<extension class="hudson.plugins.git.extensions.impl.CheckoutOption">
|
||||||
|
<timeout>100</timeout>
|
||||||
|
</extension>
|
||||||
|
</jenkins.plugins.git.traits.CheckoutOptionTrait>
|
||||||
|
<jenkins.plugins.git.traits.PruneStaleBranchTrait>
|
||||||
|
<extension class="hudson.plugins.git.extensions.impl.PruneStaleBranch"/>
|
||||||
|
</jenkins.plugins.git.traits.PruneStaleBranchTrait>
|
||||||
|
<jenkins.plugins.git.traits.WipeWorkspaceTrait>
|
||||||
|
<extension class="hudson.plugins.git.extensions.impl.WipeWorkspace"/>
|
||||||
|
</jenkins.plugins.git.traits.WipeWorkspaceTrait>
|
||||||
|
<jenkins.plugins.git.traits.AuthorInChangelogTrait>
|
||||||
|
<extension class="hudson.plugins.git.extensions.impl.AuthorInChangelog"/>
|
||||||
|
</jenkins.plugins.git.traits.AuthorInChangelogTrait>
|
||||||
|
<jenkins.plugins.git.traits.GitLFSPullTrait>
|
||||||
|
<extension class="hudson.plugins.git.extensions.impl.GitLFSPull"/>
|
||||||
|
</jenkins.plugins.git.traits.GitLFSPullTrait>
|
||||||
</traits>
|
</traits>
|
||||||
</source>
|
</source>
|
||||||
<strategy class="jenkins.branch.DefaultBranchPropertyStrategy">
|
<strategy class="jenkins.branch.DefaultBranchPropertyStrategy">
|
||||||
|
@ -46,3 +46,26 @@ scm:
|
|||||||
- exact-name: {}
|
- exact-name: {}
|
||||||
- regex-name: {}
|
- regex-name: {}
|
||||||
- wildcards-name: {}
|
- wildcards-name: {}
|
||||||
|
clean:
|
||||||
|
after: true
|
||||||
|
before: true
|
||||||
|
prune: true
|
||||||
|
local-branch: true
|
||||||
|
sparse-checkout:
|
||||||
|
paths:
|
||||||
|
- "path1"
|
||||||
|
- "path2"
|
||||||
|
- "path3"
|
||||||
|
shallow-clone: true
|
||||||
|
depth: 3
|
||||||
|
do-not-fetch-tags: true
|
||||||
|
submodule:
|
||||||
|
disable: false
|
||||||
|
recursive: true
|
||||||
|
parent-credentials: true
|
||||||
|
timeout: 100
|
||||||
|
threads: 1
|
||||||
|
timeout: "100"
|
||||||
|
use-author: true
|
||||||
|
wipe-workspace: true
|
||||||
|
lfs-pull: true
|
||||||
|
@ -50,6 +50,9 @@
|
|||||||
</jenkins.plugins.git.traits.RefSpecsSCMSourceTrait_-RefSpecTemplate>
|
</jenkins.plugins.git.traits.RefSpecsSCMSourceTrait_-RefSpecTemplate>
|
||||||
</templates>
|
</templates>
|
||||||
</jenkins.plugins.git.traits.RefSpecsSCMSourceTrait>
|
</jenkins.plugins.git.traits.RefSpecsSCMSourceTrait>
|
||||||
|
<jenkins.plugins.git.traits.WipeWorkspaceTrait>
|
||||||
|
<extension class="hudson.plugins.git.extensions.impl.WipeWorkspace"/>
|
||||||
|
</jenkins.plugins.git.traits.WipeWorkspaceTrait>
|
||||||
</traits>
|
</traits>
|
||||||
</source>
|
</source>
|
||||||
</jenkins.branch.BranchSource>
|
</jenkins.branch.BranchSource>
|
||||||
|
Loading…
Reference in New Issue
Block a user