Add ability to share results with selected people.

sil2100/private-runs
Łukasz 'sil2100' Zemczak 4 years ago
parent 3b1699db2a
commit 1de71dbbfd

@ -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

@ -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

@ -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

@ -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

@ -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': {

@ -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',

Loading…
Cancel
Save