From b8f0e75d344eba6b4af90a4c1074f34fb7b6c77f Mon Sep 17 00:00:00 2001 From: Pawel Piatek Date: Mon, 15 Mar 2021 12:12:52 +0100 Subject: [PATCH] Add git submodule threads Signed-off-by: Pawel Piatek Change-Id: I3dbc0e710460a5f55d4146cb1dd70e1ac3560e68 --- jenkins_jobs/modules/scm.py | 3 +++ tests/macros/fixtures/scm/obj-in-scm-macro001.xml | 1 + tests/multibranch/fixtures/scm_bitbucket_full.xml | 1 + tests/multibranch/fixtures/scm_bitbucket_full.yaml | 1 + tests/multibranch/fixtures/scm_git_full.xml | 1 + tests/multibranch/fixtures/scm_git_full.yaml | 1 + tests/multibranch/fixtures/scm_github_full.xml | 1 + tests/multibranch/fixtures/scm_github_full.yaml | 1 + tests/scm/fixtures/git-submodule01.xml | 1 + tests/scm/fixtures/git-submodule01.yaml | 1 + 10 files changed, 12 insertions(+) diff --git a/jenkins_jobs/modules/scm.py b/jenkins_jobs/modules/scm.py index 3a2571fc0..350da35a0 100644 --- a/jenkins_jobs/modules/scm.py +++ b/jenkins_jobs/modules/scm.py @@ -322,6 +322,8 @@ def git(registry, xml_parent, data): during clone (optional) * **timeout** (`int`) - Specify a timeout (in minutes) for submodules operations (default 10). + * **threads** (`int`) - Number of parallel processes to be used when + updating submodules. Default is to use a single thread for submodule updates. * **timeout** (`str`) - Timeout for git commands in minutes (optional) * **use-author** (`bool`): Use author rather than committer in Jenkin's build changeset (default false) @@ -673,6 +675,7 @@ def git_extensions(xml_parent, data): data["submodule"].get("reference-repo", "") ) XML.SubElement(ext, "timeout").text = str(data["submodule"].get("timeout", 10)) + XML.SubElement(ext, "threads").text = str(data["submodule"].get("threads", 1)) if "timeout" in data: ext_name = impl_prefix + "CheckoutOption" if trait: diff --git a/tests/macros/fixtures/scm/obj-in-scm-macro001.xml b/tests/macros/fixtures/scm/obj-in-scm-macro001.xml index 9918f252c..8cbe8834d 100644 --- a/tests/macros/fixtures/scm/obj-in-scm-macro001.xml +++ b/tests/macros/fixtures/scm/obj-in-scm-macro001.xml @@ -46,6 +46,7 @@ false 10 + 1 diff --git a/tests/multibranch/fixtures/scm_bitbucket_full.xml b/tests/multibranch/fixtures/scm_bitbucket_full.xml index 72c426b61..9de63398c 100644 --- a/tests/multibranch/fixtures/scm_bitbucket_full.xml +++ b/tests/multibranch/fixtures/scm_bitbucket_full.xml @@ -140,6 +140,7 @@ true 100 + 1 diff --git a/tests/multibranch/fixtures/scm_bitbucket_full.yaml b/tests/multibranch/fixtures/scm_bitbucket_full.yaml index 253d84d41..121e9df17 100644 --- a/tests/multibranch/fixtures/scm_bitbucket_full.yaml +++ b/tests/multibranch/fixtures/scm_bitbucket_full.yaml @@ -96,6 +96,7 @@ scm: recursive: true parent-credentials: true timeout: 100 + threads: 1 timeout: "100" skip-notifications: true use-author: true diff --git a/tests/multibranch/fixtures/scm_git_full.xml b/tests/multibranch/fixtures/scm_git_full.xml index 98242da05..02c6d4623 100644 --- a/tests/multibranch/fixtures/scm_git_full.xml +++ b/tests/multibranch/fixtures/scm_git_full.xml @@ -98,6 +98,7 @@ true 100 + 1 diff --git a/tests/multibranch/fixtures/scm_git_full.yaml b/tests/multibranch/fixtures/scm_git_full.yaml index 4b3b164c3..7fa333dbe 100644 --- a/tests/multibranch/fixtures/scm_git_full.yaml +++ b/tests/multibranch/fixtures/scm_git_full.yaml @@ -85,6 +85,7 @@ scm: recursive: true parent-credentials: true timeout: 100 + threads: 1 timeout: "100" use-author: true wipe-workspace: true diff --git a/tests/multibranch/fixtures/scm_github_full.xml b/tests/multibranch/fixtures/scm_github_full.xml index 49451804b..11bd8c6ef 100644 --- a/tests/multibranch/fixtures/scm_github_full.xml +++ b/tests/multibranch/fixtures/scm_github_full.xml @@ -122,6 +122,7 @@ true 100 + 1 diff --git a/tests/multibranch/fixtures/scm_github_full.yaml b/tests/multibranch/fixtures/scm_github_full.yaml index cfd0feab6..607813e8e 100644 --- a/tests/multibranch/fixtures/scm_github_full.yaml +++ b/tests/multibranch/fixtures/scm_github_full.yaml @@ -96,6 +96,7 @@ scm: recursive: true parent-credentials: true timeout: 100 + threads: 1 timeout: "100" skip-notifications: true use-author: true diff --git a/tests/scm/fixtures/git-submodule01.xml b/tests/scm/fixtures/git-submodule01.xml index 3d36a7145..c935e6741 100644 --- a/tests/scm/fixtures/git-submodule01.xml +++ b/tests/scm/fixtures/git-submodule01.xml @@ -29,6 +29,7 @@ true /jenkins_home/.gitcache/submodules 15 + 1 diff --git a/tests/scm/fixtures/git-submodule01.yaml b/tests/scm/fixtures/git-submodule01.yaml index dc2ab720b..a83851c64 100644 --- a/tests/scm/fixtures/git-submodule01.yaml +++ b/tests/scm/fixtures/git-submodule01.yaml @@ -8,3 +8,4 @@ scm: parent-credentials: true reference-repo: /jenkins_home/.gitcache/submodules timeout: 15 + threads: 1