diff --git a/jenkins_jobs/modules/triggers.py b/jenkins_jobs/modules/triggers.py index 0271ea6b5..2b65f6e3f 100644 --- a/jenkins_jobs/modules/triggers.py +++ b/jenkins_jobs/modules/triggers.py @@ -676,6 +676,8 @@ def github_pull_request(parser, xml_parent, data): :arg list admin-list: the users with admin rights (optional) :arg list white-list: users whose pull requests build (optional) :arg list org-list: orgs whose users should be white listed (optional) + :arg bool allow-whitelist-orgs-as-admins: members of white listed orgs + will have admin rights. (default false) :arg string cron: cron syntax of when to run (optional) :arg string trigger-phrase: when filled, commenting this phrase in the pull request will trigger a build (optional) @@ -701,6 +703,8 @@ def github_pull_request(parser, xml_parent, data): XML.SubElement(ghprb, 'spec').text = data.get('cron', '') admin_string = "\n".join(data.get('admin-list', [])) XML.SubElement(ghprb, 'adminlist').text = admin_string + XML.SubElement(ghprb, 'allowMembersOfWhitelistedOrgsAsAdmin').text = str( + data.get('allow-whitelist-orgs-as-admins', False)).lower() white_string = "\n".join(data.get('white-list', [])) XML.SubElement(ghprb, 'whitelist').text = white_string org_string = "\n".join(data.get('org-list', [])) diff --git a/tests/triggers/fixtures/github-pull-request.xml b/tests/triggers/fixtures/github-pull-request.xml index 7d00e165d..188f75412 100644 --- a/tests/triggers/fixtures/github-pull-request.xml +++ b/tests/triggers/fixtures/github-pull-request.xml @@ -5,6 +5,7 @@ * * * * * user1 user2 + true user3 user4 org1 diff --git a/tests/triggers/fixtures/github-pull-request.yaml b/tests/triggers/fixtures/github-pull-request.yaml index 36a228e8a..5e8100ead 100644 --- a/tests/triggers/fixtures/github-pull-request.yaml +++ b/tests/triggers/fixtures/github-pull-request.yaml @@ -15,6 +15,7 @@ triggers: github-hooks: true permit-all: false auto-close-on-fail: false + allow-whitelist-orgs-as-admins: true white-list-target-branches: - master - testing