diff --git a/britney.conf b/britney.conf index 4432f79..569e646 100644 --- a/britney.conf +++ b/britney.conf @@ -108,6 +108,9 @@ ADT_SWIFT_USER = ADT_SWIFT_PASS = ADT_SWIFT_AUTH_URL = ADT_SWIFT_TENANT = +# List of launchpad users/teams that should have read access to any private +# result logs +ADT_PRIVATE_SHARED = # Base URL for autopkgtest site, used for links in the excuses ADT_CI_URL = https://autopkgtest.ubuntu.com/ ADT_HUGE = 20 diff --git a/britney.conf.template b/britney.conf.template index bea5f7d..3855425 100644 --- a/britney.conf.template +++ b/britney.conf.template @@ -130,6 +130,9 @@ ADT_SWIFT_USER = ADT_SWIFT_PASS = ADT_SWIFT_AUTH_URL = ADT_SWIFT_TENANT = +# List of launchpad users/teams that should have read access to any private +# result logs +ADT_PRIVATE_SHARED = # Base URL for autopkgtest site, used for links in the excuses ADT_CI_URL = https://example.com/ # Enable the huge queue for packages that trigger vast amounts of tests to not diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py index ec195fa..1a49669 100644 --- a/britney2/policies/autopkgtest.py +++ b/britney2/policies/autopkgtest.py @@ -145,6 +145,11 @@ class AutopkgtestPolicy(BasePolicy): except AttributeError: self.options.adt_ppas = [] + try: + self.options.adt_private_shared = self.options.adt_private_shared.strip().split() + except AttributeError: + self.options.adt_private_shared = [] + self.swift_container = 'autopkgtest-' + options.series if self.options.adt_ppas: # private PPAs require the auth credentials given + we allow the @@ -1112,7 +1117,9 @@ class AutopkgtestPolicy(BasePolicy): params['submit-time'] = datetime.strftime(datetime.utcnow(), '%Y-%m-%d %H:%M:%S%z') if self.swift_conn: - params['readable-by'] = self.options.adt_swift_user + params['swiftuser'] = self.options.adt_swift_user + if self.options.adt_private_shared: + params['readable-by'] = self.options.adt_private_shared if self.amqp_channel: import amqplib.client_0_8 as amqp diff --git a/tests/__init__.py b/tests/__init__.py index a036b94..3625953 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -399,6 +399,7 @@ ADT_SWIFT_USER = ADT_SWIFT_PASS = ADT_SWIFT_AUTH_URL = ADT_SWIFT_TENANT = +ADT_PRIVATE_SHARED = ADT_CI_URL = https://autopkgtest.ubuntu.com/ ADT_HUGE = 20 diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 7e2d7b8..76ec47c 100644 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -2562,6 +2562,8 @@ class AT(TestAutopkgtestBase): print('ADT_SWIFT_TENANT = tenant') elif line.startswith('ADT_SWIFT_AUTH_URL'): print('ADT_SWIFT_AUTH_URL = http://127.0.0.1:5000/v2.0/') + elif line.startswith('ADT_PRIVATE_SHARED'): + print('ADT_PRIVATE_SHARED = user1 team2') else: sys.stdout.write(line) @@ -2576,7 +2578,8 @@ class AT(TestAutopkgtestBase): for request in self.amqp_requests: self.assertIn('"triggers": ["lightgreen/2"]', request) self.assertIn('"ppas": ["first/ppa", "user:password@joe/foo:DEADBEEF"]', request) - self.assertIn('"readable-by": "user"', request) + self.assertIn('"swiftuser": "user"', request) + self.assertIn('"readable-by": ["user1", "team2"]', request) # add results to PPA specific swift container self.swift.set_results({'private-autopkgtest-testing-joe-foo': { @@ -2642,7 +2645,10 @@ class AT(TestAutopkgtestBase): self.assertEqual(len(self.amqp_requests), 2) for request in self.amqp_requests: self.assertIn('"triggers": ["lightgreen/2"]', request) - self.assertIn('"readable-by": "user"', request) + self.assertIn('"swiftuser": "user"', request) + # we did not give a list of users to give read-access, so make sure + # there are none + self.assertNotIn('"readable-by"', request) # add results to PPA specific swift container self.swift.set_results({'private-autopkgtest-testing': { diff --git a/tests/test_policy.py b/tests/test_policy.py index 553e1b0..bea9f97 100644 --- a/tests/test_policy.py +++ b/tests/test_policy.py @@ -47,6 +47,7 @@ def initialize_policy(test_name, policy_class, *args, **kwargs): adt_swift_pass='', adt_swift_tenant='', adt_swift_auth_url='', + adt_private_shared=[], adt_success_bounty=3, adt_regression_penalty=False, adt_retry_url_mech='run_id',