diff --git a/jenkins_jobs/modules/project_multibranch.py b/jenkins_jobs/modules/project_multibranch.py index 2b803712c..0616c97ea 100644 --- a/jenkins_jobs/modules/project_multibranch.py +++ b/jenkins_jobs/modules/project_multibranch.py @@ -637,7 +637,7 @@ def bitbucket_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 `. @@ -670,6 +670,41 @@ def gerrit_scm(xml_parent, data): 'SCHEME' or 'ID'. 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: .. literalinclude:: @@ -749,6 +784,18 @@ def gerrit_scm(xml_parent, data): 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): r"""Configure Git SCM diff --git a/tests/multibranch/fixtures/scm_gerrit_full.xml b/tests/multibranch/fixtures/scm_gerrit_full.xml index 9ccebb31b..d7f30ba1f 100644 --- a/tests/multibranch/fixtures/scm_gerrit_full.xml +++ b/tests/multibranch/fixtures/scm_gerrit_full.xml @@ -51,6 +51,63 @@ SCHEME jenkins + + + + + + + + + true + 3 + true + 100 + + + + + + + path1 + + + path2 + + + path3 + + + + + + + false + true + false + true + + 100 + 1 + + + + + 100 + + + + + + + + + + + + + + diff --git a/tests/multibranch/fixtures/scm_gerrit_full.yaml b/tests/multibranch/fixtures/scm_gerrit_full.yaml index 5d702f367..34e8d5fae 100644 --- a/tests/multibranch/fixtures/scm_gerrit_full.yaml +++ b/tests/multibranch/fixtures/scm_gerrit_full.yaml @@ -46,3 +46,26 @@ scm: - exact-name: {} - regex-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 diff --git a/tests/multibranch/fixtures/scm_gerrit_minimal.xml b/tests/multibranch/fixtures/scm_gerrit_minimal.xml index b29acd09c..61c9183c6 100644 --- a/tests/multibranch/fixtures/scm_gerrit_minimal.xml +++ b/tests/multibranch/fixtures/scm_gerrit_minimal.xml @@ -50,6 +50,9 @@ + + +