From 1ecedbbe682f7d1d61248f2e478df7ad0e2351c1 Mon Sep 17 00:00:00 2001 From: Vsevolod Fedorov Date: Sat, 1 Jun 2024 17:12:30 +0300 Subject: [PATCH] Add labels to lauch build property for gitlab trigger Change-Id: Id5f965d5fd5f81531401d4727fd5c3d33a5d3b5b --- jenkins_jobs/modules/triggers.py | 3 ++ tests/triggers/fixtures/gitlab001.xml | 1 + tests/triggers/fixtures/gitlab002.xml | 1 + tests/triggers/fixtures/gitlab003.xml | 1 + tests/triggers/fixtures/gitlab004.xml | 1 + tests/triggers/fixtures/gitlab005.xml | 1 + tests/triggers/fixtures/gitlab006.xml | 1 + tests/triggers/fixtures/gitlab007.xml | 1 + tests/triggers/fixtures/gitlab008.xml | 1 + tests/triggers/fixtures/gitlab009.xml | 1 + .../fixtures/gitlab010.plugins_info.yaml | 3 ++ tests/triggers/fixtures/gitlab010.xml | 32 +++++++++++++++++++ tests/triggers/fixtures/gitlab010.yaml | 3 ++ 13 files changed, 50 insertions(+) create mode 100644 tests/triggers/fixtures/gitlab010.plugins_info.yaml create mode 100644 tests/triggers/fixtures/gitlab010.xml create mode 100644 tests/triggers/fixtures/gitlab010.yaml diff --git a/jenkins_jobs/modules/triggers.py b/jenkins_jobs/modules/triggers.py index 1b421ad76..0f1066926 100644 --- a/jenkins_jobs/modules/triggers.py +++ b/jenkins_jobs/modules/triggers.py @@ -1662,6 +1662,8 @@ def gitlab(registry, xml_parent, data): :arg str source-branch-regex: Regular expression to select branches :arg str target-branch-regex: Regular expression to select branches :arg str secret-token: Secret token for build trigger + :arg str force-build-labels: Labels that launch a build if they are added + (comma-separated) :arg dict merge-request-label-filter-config: If used allow merge requests filtering by labels @@ -1765,6 +1767,7 @@ def gitlab(registry, xml_parent, data): ("source-branch-regex", "sourceBranchRegex", ""), ("target-branch-regex", "targetBranchRegex", ""), ("secret-token", "secretToken", ""), + ("force-build-labels", "labelsThatForcesBuildIfAdded", ""), ] helpers.convert_mapping_to_xml(gitlab, data, mapping, fail_required=True) diff --git a/tests/triggers/fixtures/gitlab001.xml b/tests/triggers/fixtures/gitlab001.xml index d72c78b74..023df31e3 100644 --- a/tests/triggers/fixtures/gitlab001.xml +++ b/tests/triggers/fixtures/gitlab001.xml @@ -24,6 +24,7 @@ + master, master2, local-test broken-test, master-foo diff --git a/tests/triggers/fixtures/gitlab002.xml b/tests/triggers/fixtures/gitlab002.xml index 4fc6577b0..b680e8c31 100644 --- a/tests/triggers/fixtures/gitlab002.xml +++ b/tests/triggers/fixtures/gitlab002.xml @@ -24,6 +24,7 @@ + master feature diff --git a/tests/triggers/fixtures/gitlab003.xml b/tests/triggers/fixtures/gitlab003.xml index 9b3a90d00..2acf9836f 100644 --- a/tests/triggers/fixtures/gitlab003.xml +++ b/tests/triggers/fixtures/gitlab003.xml @@ -24,6 +24,7 @@ + master baz, foo, fnord diff --git a/tests/triggers/fixtures/gitlab004.xml b/tests/triggers/fixtures/gitlab004.xml index bde1b4271..70e7cf55a 100644 --- a/tests/triggers/fixtures/gitlab004.xml +++ b/tests/triggers/fixtures/gitlab004.xml @@ -24,6 +24,7 @@ + master, master2, local-test broken-test, master-foo test diff --git a/tests/triggers/fixtures/gitlab005.xml b/tests/triggers/fixtures/gitlab005.xml index 1028f6e7b..4dbf48e33 100644 --- a/tests/triggers/fixtures/gitlab005.xml +++ b/tests/triggers/fixtures/gitlab005.xml @@ -24,6 +24,7 @@ + diff --git a/tests/triggers/fixtures/gitlab006.xml b/tests/triggers/fixtures/gitlab006.xml index b341ce919..c0fe5a627 100644 --- a/tests/triggers/fixtures/gitlab006.xml +++ b/tests/triggers/fixtures/gitlab006.xml @@ -24,6 +24,7 @@ (.*debug.*|.*release.*) secret-build-token + include1, include2 exclude1, exclude2 diff --git a/tests/triggers/fixtures/gitlab007.xml b/tests/triggers/fixtures/gitlab007.xml index fc7072d6a..b44807344 100644 --- a/tests/triggers/fixtures/gitlab007.xml +++ b/tests/triggers/fixtures/gitlab007.xml @@ -24,6 +24,7 @@ + master, master2, local-test broken-test, master-foo diff --git a/tests/triggers/fixtures/gitlab008.xml b/tests/triggers/fixtures/gitlab008.xml index 6edb2d32d..d3f175c6b 100644 --- a/tests/triggers/fixtures/gitlab008.xml +++ b/tests/triggers/fixtures/gitlab008.xml @@ -24,6 +24,7 @@ + diff --git a/tests/triggers/fixtures/gitlab009.xml b/tests/triggers/fixtures/gitlab009.xml index 3260bdf55..4bf154b6f 100644 --- a/tests/triggers/fixtures/gitlab009.xml +++ b/tests/triggers/fixtures/gitlab009.xml @@ -24,6 +24,7 @@ + diff --git a/tests/triggers/fixtures/gitlab010.plugins_info.yaml b/tests/triggers/fixtures/gitlab010.plugins_info.yaml new file mode 100644 index 000000000..235eb2914 --- /dev/null +++ b/tests/triggers/fixtures/gitlab010.plugins_info.yaml @@ -0,0 +1,3 @@ +- longName: 'GitLab Plugin' + shortName: 'gitlab-plugin' + version: "0" diff --git a/tests/triggers/fixtures/gitlab010.xml b/tests/triggers/fixtures/gitlab010.xml new file mode 100644 index 000000000..776506149 --- /dev/null +++ b/tests/triggers/fixtures/gitlab010.xml @@ -0,0 +1,32 @@ + + + + + true + + + true + true + false + false + false + true + Jenkins please retry a build + true + true + true + false + true + true + false + false + false + + + + ForceBuildLabel + + + + + diff --git a/tests/triggers/fixtures/gitlab010.yaml b/tests/triggers/fixtures/gitlab010.yaml new file mode 100644 index 000000000..c14656645 --- /dev/null +++ b/tests/triggers/fixtures/gitlab010.yaml @@ -0,0 +1,3 @@ +triggers: + - gitlab: + force-build-labels: ForceBuildLabel