diff --git a/jenkins_jobs/modules/scm.py b/jenkins_jobs/modules/scm.py index 6e5529eeb..4568efb51 100644 --- a/jenkins_jobs/modules/scm.py +++ b/jenkins_jobs/modules/scm.py @@ -573,6 +573,8 @@ def repo(parser, xml_parent, data): (optional) :arg str manifest-group: Only retrieve those projects in the manifest tagged with the provided group name (optional) + :arg list(str) ignore-projects: a list of projects in which changes would + not be considered to trigger a build when pooling (optional) :arg str destination-dir: Location relative to the workspace root to clone under (optional) :arg str repo-url: custom url to retrieve the repo application (optional) @@ -645,6 +647,13 @@ def repo(parser, xml_parent, data): else: xe.text = str(val) + # ignore-projects does not follow the same pattern of the other parameters, + # so process it here: + ip = XML.SubElement(scm, 'ignoreProjects', {'class': 'linked-hash-set'}) + ignored_projects = data.get('ignore-projects', ['']) + for ignored_project in ignored_projects: + XML.SubElement(ip, 'string').text = str(ignored_project) + def store(parser, xml_parent, data): """yaml: store diff --git a/tests/macros/fixtures/scm/multi-scms002.xml b/tests/macros/fixtures/scm/multi-scms002.xml index 1623aaee2..a9f8c1bdd 100644 --- a/tests/macros/fixtures/scm/multi-scms002.xml +++ b/tests/macros/fixtures/scm/multi-scms002.xml @@ -27,6 +27,9 @@ false false false + + + 2 diff --git a/tests/scm/fixtures/repo001.xml b/tests/scm/fixtures/repo001.xml index 3afe3692e..f63e81962 100644 --- a/tests/scm/fixtures/repo001.xml +++ b/tests/scm/fixtures/repo001.xml @@ -23,5 +23,9 @@ remote="gerrit" revision="master" /> </manifest> + + static-project + unimportant-project + diff --git a/tests/scm/fixtures/repo001.yaml b/tests/scm/fixtures/repo001.yaml index 630fe9e39..cc503c7b3 100644 --- a/tests/scm/fixtures/repo001.yaml +++ b/tests/scm/fixtures/repo001.yaml @@ -4,6 +4,9 @@ scm: manifest-branch: stable manifest-file: repo.xml manifest-group: drivers + ignore-projects: + - static-project + - unimportant-project destination-dir: build repo-url: https://internal.net/projects/repo mirror-dir: ~/git/project/