Merge lp:~ursinha/ubuntu-ci-services-itself/add-launchpad-ppa-owner into lp:ubuntu-ci-services-itself

Proposed by Ursula Junque
Status: Merged
Approved by: Francis Ginther
Approved revision: 368
Merged at revision: 369
Proposed branch: lp:~ursinha/ubuntu-ci-services-itself/add-launchpad-ppa-owner
Merge into: lp:ubuntu-ci-services-itself
Diff against target: 176 lines (+22/-12)
12 files modified
branch-source-builder/cupstream2distro/settings.py (+2/-1)
create_lp_creds.py (+2/-0)
juju-deployer/configs/unit_config.yaml.tmpl (+1/-0)
juju-deployer/deploy.py (+1/-0)
juju-deployer/test_deploy.py (+1/-0)
ppa-assigner/ppa_assigner/api.py (+2/-1)
ppa-assigner/ppa_assigner/launchpad.py (+2/-2)
ppa-assigner/ppa_assigner/management/__init__.py (+3/-2)
ppa-assigner/ppa_assigner/models.py (+2/-2)
ppa-assigner/ppa_assigner/settings.py (+2/-1)
ppa-assigner/ppa_assigner/tests.py (+2/-2)
tests/ppa_assigner/test.py (+2/-1)
To merge this branch: bzr merge lp:~ursinha/ubuntu-ci-services-itself/add-launchpad-ppa-owner
Reviewer Review Type Date Requested Status
Andy Doan (community) Approve
Francis Ginther Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+210523@code.launchpad.net

Commit message

Adding CI_LAUNCHPAD_PPA_OWNER, the team that actually owns the ppa pool

Description of the change

As part of enabling private PPAs, I'm introducing ppa_owner, the team that has the ppas.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:368
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/387/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/387/rebuild

review: Approve (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

Looks good, I would just make sure it's clear that the CI_LAUNCHPAD_PPA_OWNER could be a team or user.

review: Approve
Revision history for this message
Andy Doan (doanac) wrote :

we should probably either default this new value to CI_LAUNCHPAD_USER or be sure to email everyone on the team before this gets merged so people don't get surprised tomorrow

Revision history for this message
Andy Doan (doanac) wrote :

but I'm +1 either way

review: Approve
Revision history for this message
Ursula Junque (ursinha) wrote :

> we should probably either default this new value to CI_LAUNCHPAD_USER or be
> sure to email everyone on the team before this gets merged so people don't get
> surprised tomorrow

I'll send the email, these are in fact two different things and I'd have to change this for the demo anyway, to be able to support private ppas.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'branch-source-builder/cupstream2distro/settings.py'
2--- branch-source-builder/cupstream2distro/settings.py 2014-02-19 16:34:46 +0000
3+++ branch-source-builder/cupstream2distro/settings.py 2014-03-12 01:37:14 +0000
4@@ -50,7 +50,8 @@
5 print('Unable to use unit_config(%s), defaulting values' % path)
6 return config
7 _cfg = _unit_config()
8-LAUNCHPAD_PPA_USER = _cfg.get('launchpad_user', None)
9+LAUNCHPAD_PPA_OWNER = _cfg.get('launchpad_ppa_owner', None)
10+LAUNCHPAD_USER = _cfg.get('launchpad_user', None)
11 LAUNCHPAD_API_BASE = _cfg.get(
12 'launchpad_api_base', 'https://api.launchpad.net/1.0')
13 OAUTH_CONSUMER_KEY = _cfg.get('oauth_consumer_key', None)
14
15=== modified file 'create_lp_creds.py'
16--- create_lp_creds.py 2014-02-22 16:39:00 +0000
17+++ create_lp_creds.py 2014-03-12 01:37:14 +0000
18@@ -39,6 +39,8 @@
19 print('export CI_OAUTH_TOKEN_SECRET={}'.format(creds.access_token.secret))
20 # Can't find lp user in the creds, it's bzr lp-login anyway
21 print('export CI_LAUNCHPAD_USER=`bzr lp-login`')
22+ # This should be a team that owns the ppa build pool
23+ print('export CI_LAUNCHPAD_PPA_OWNER=`bzr lp-login`')
24 return 0
25
26
27
28=== modified file 'juju-deployer/configs/unit_config.yaml.tmpl'
29--- juju-deployer/configs/unit_config.yaml.tmpl 2014-03-10 22:25:00 +0000
30+++ juju-deployer/configs/unit_config.yaml.tmpl 2014-03-12 01:37:14 +0000
31@@ -10,6 +10,7 @@
32 # and see ../../create_lp_creds.py
33 launchpad_api_base: https://api.launchpad.net/1.0
34 launchpad_user: $CI_LAUNCHPAD_USER
35+launchpad_ppa_owner: $CI_LAUNCHPAD_PPA_OWNER
36 oauth_consumer_key: $CI_OAUTH_CONSUMER_KEY
37 oauth_token: $CI_OAUTH_TOKEN
38 oauth_token_secret: $CI_OAUTH_TOKEN_SECRET
39
40=== modified file 'juju-deployer/deploy.py'
41--- juju-deployer/deploy.py 2014-03-10 22:25:00 +0000
42+++ juju-deployer/deploy.py 2014-03-12 01:37:14 +0000
43@@ -43,6 +43,7 @@
44 'CI_BRANCH': 'lp:ubuntu-ci-services-itself',
45 'CI_PAYLOAD_URL': 'n/a',
46 'CI_LAUNCHPAD_USER': None,
47+ 'CI_LAUNCHPAD_PPA_OWNER': None,
48 'CI_OAUTH_CONSUMER_KEY': None,
49 'CI_OAUTH_TOKEN': None,
50 'CI_OAUTH_TOKEN_SECRET': None,
51
52=== modified file 'juju-deployer/test_deploy.py'
53--- juju-deployer/test_deploy.py 2014-03-10 22:25:00 +0000
54+++ juju-deployer/test_deploy.py 2014-03-12 01:37:14 +0000
55@@ -31,6 +31,7 @@
56 'CI_OAUTH_TOKEN': 'token',
57 'CI_OAUTH_TOKEN_SECRET': 'secret',
58 'CI_LAUNCHPAD_USER': 'lp-user',
59+ 'CI_LAUNCHPAD_PPA_OWNER': 'lp-ppa-owner',
60 }
61 with mock.patch.dict('os.environ', env_required):
62 deploy.check_environment()
63
64=== modified file 'ppa-assigner/ppa_assigner/api.py'
65--- ppa-assigner/ppa_assigner/api.py 2014-03-10 22:25:00 +0000
66+++ ppa-assigner/ppa_assigner/api.py 2014-03-12 01:37:14 +0000
67@@ -106,7 +106,8 @@
68 queryset = PPA.objects.none()
69
70 def get_list(self, request, **kwargs):
71- lp = settings.LAUNCHPAD_PPA_USER is not None
72+ lp = settings.LAUNCHPAD_USER is not None
73+ lp = lp and settings.LAUNCHPAD_PPA_OWNER is not None
74 lp = lp and settings.OAUTH_TOKEN is not None
75 lp = lp and settings.OAUTH_TOKEN_SECRET is not None
76 lp = lp and settings.OAUTH_CONSUMER_KEY is not None
77
78=== modified file 'ppa-assigner/ppa_assigner/launchpad.py'
79--- ppa-assigner/ppa_assigner/launchpad.py 2014-03-10 22:25:00 +0000
80+++ ppa-assigner/ppa_assigner/launchpad.py 2014-03-12 01:37:14 +0000
81@@ -66,7 +66,7 @@
82 def get_publishing_history(ppa):
83 '''A generator for the source and binary publish history of a ppa.'''
84 url = settings.LAUNCHPAD_API_BASE + '/~%s/+archive/%s/?ws.op='
85- url = url % (settings.LAUNCHPAD_PPA_USER, ppa.split('/')[-1])
86+ url = url % (settings.LAUNCHPAD_PPA_OWNER, ppa.split('/')[-1])
87
88 for x in lp_collection(url + 'getPublishedSources'):
89 yield x
90@@ -110,7 +110,7 @@
91 def _sync_source(ppa, source_name, version, pocket, archive):
92 '''Used for populating a PPA so we can run integration tests.'''
93 url = 'https://api.launchpad.net/1.0/~%s/+archive/%s'
94- url = url % (settings.LAUNCHPAD_PPA_USER, ppa.split('/')[-1])
95+ url = url % (settings.LAUNCHPAD_PPA_OWNER, ppa.split('/')[-1])
96 data = {
97 'ws.op': 'syncSource',
98 'from_archive': archive,
99
100=== modified file 'ppa-assigner/ppa_assigner/management/__init__.py'
101--- ppa-assigner/ppa_assigner/management/__init__.py 2014-02-07 16:20:15 +0000
102+++ ppa-assigner/ppa_assigner/management/__init__.py 2014-03-12 01:37:14 +0000
103@@ -25,8 +25,9 @@
104 try:
105 ppa_assigner.models.PPA.populate_from_launchpad()
106 except:
107- msg = 'Unable to populate PPAs from launchpad. Check that '\
108- 'LAUNCHPAD_USER is configured correctly in local_settings.py.'
109+ msg = ('Unable to populate PPAs from launchpad. Check that '
110+ 'LAUNCHPAD_PPA_OWNER is configured correctly in '
111+ 'local_settings.py.')
112 logging.error(msg)
113
114 # Testing is run with: manage.py test ....
115
116=== modified file 'ppa-assigner/ppa_assigner/models.py'
117--- ppa-assigner/ppa_assigner/models.py 2014-02-24 19:16:04 +0000
118+++ ppa-assigner/ppa_assigner/models.py 2014-03-12 01:37:14 +0000
119@@ -80,11 +80,11 @@
120 def populate_from_launchpad():
121 '''Get list of PPAs from launchpad and ensure they exist here.'''
122 url = settings.LAUNCHPAD_API_BASE + '/~%s/ppas'
123- url = url % settings.LAUNCHPAD_PPA_USER
124+ url = url % settings.LAUNCHPAD_PPA_OWNER
125 logging.info('populating ppa model from: %s', url)
126 try:
127 pat = re.compile(settings.PPA_PATTERN)
128- ppas = ['ppa:%s/%s' % (settings.LAUNCHPAD_PPA_USER, x['name'])
129+ ppas = ['ppa:%s/%s' % (settings.LAUNCHPAD_PPA_OWNER, x['name'])
130 for x in launchpad.lp_collection(url)
131 if pat.match(x['name'])]
132 PPA._merge_ppas(set(ppas))
133
134=== modified file 'ppa-assigner/ppa_assigner/settings.py'
135--- ppa-assigner/ppa_assigner/settings.py 2014-03-10 22:25:00 +0000
136+++ ppa-assigner/ppa_assigner/settings.py 2014-03-12 01:37:14 +0000
137@@ -42,7 +42,8 @@
138 return config
139 _cfg = _unit_config()
140
141-LAUNCHPAD_PPA_USER = _cfg.get('launchpad_user', None)
142+LAUNCHPAD_USER = _cfg.get('launchpad_user', None)
143+LAUNCHPAD_PPA_OWNER = _cfg.get('launchpad_ppa_owner', None)
144 LAUNCHPAD_API_BASE = _cfg.get(
145 'launchpad_api_base', 'https://api.launchpad.net/1.0')
146 OAUTH_CONSUMER_KEY = _cfg.get('oauth_consumer_key', None)
147
148=== modified file 'ppa-assigner/ppa_assigner/tests.py'
149--- ppa-assigner/ppa_assigner/tests.py 2014-03-10 22:25:00 +0000
150+++ ppa-assigner/ppa_assigner/tests.py 2014-03-12 01:37:14 +0000
151@@ -199,9 +199,9 @@
152 resp = mock.Mock()
153 resp.read.return_value = json.dumps(data)
154 urlopen.return_value = resp
155- user = settings.LAUNCHPAD_PPA_USER
156+ ppa_owner = settings.LAUNCHPAD_PPA_OWNER
157 self.patch('ppa/', {'populate': True})
158- expected = ['ppa:%s/%s' % (user, x['name']) for x in expected]
159+ expected = ['ppa:%s/%s' % (ppa_owner, x['name']) for x in expected]
160 found = [x.name for x in PPA.objects.all().order_by('name')]
161 self.assertListEqual(expected, found)
162
163
164=== modified file 'tests/ppa_assigner/test.py'
165--- tests/ppa_assigner/test.py 2014-02-22 16:30:18 +0000
166+++ tests/ppa_assigner/test.py 2014-03-12 01:37:14 +0000
167@@ -108,7 +108,8 @@
168 def test_ppa_name(self):
169 url = 'http://{}:{}/api/v1/ppa'
170 resp, content = self.get_server_status_and_content(url)
171- expected = 'ppa:{}/ci-pool-'.format(os.environ['CI_LAUNCHPAD_USER'])
172+ expected = 'ppa:{}/ci-pool-'.format(
173+ os.environ['CI_LAUNCHPAD_PPA_OWNER'])
174 self.assertIn(expected, content['objects'][0]['name'])
175
176 def test_next_page_ppa(self):

Subscribers

People subscribed via source and target branches