Merge lp:~abentley/ci-director/convert-to-gitbranch into lp:ci-director

Proposed by Aaron Bentley
Status: Merged
Merged at revision: 189
Proposed branch: lp:~abentley/ci-director/convert-to-gitbranch
Merge into: lp:ci-director
Diff against target: 53 lines (+14/-3)
2 files modified
cidirector/tests/test_update_outcome.py (+10/-2)
cidirector/update_outcome.py (+4/-1)
To merge this branch: bzr merge lp:~abentley/ci-director/convert-to-gitbranch
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+315072@code.launchpad.net

Commit message

Convert origin/ format to gitbranch format on output.

Description of the change

This branch tweaks the update-outcome script to emit gitbranch: branches.

update-output ignores buildvars.* in favour of Jenkins parameters, so switching from ci-director to github-juju-landed changed the branch names it records.

This branch changes the branch names it emits to juju-reports json. It converts origin/master to gitbranch:master:github.com/juju/juju.

This seems appropriate since writing this data is already an explicit conversion process. It also means that builds such 4729 will be automatically fixed if the reports json is rewritten.

To post a comment you must log in.
190. By Aaron Bentley

Fix test name.

Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cidirector/tests/test_update_outcome.py'
2--- cidirector/tests/test_update_outcome.py 2016-08-29 18:42:59 +0000
3+++ cidirector/tests/test_update_outcome.py 2017-01-18 20:29:53 +0000
4@@ -725,7 +725,9 @@
5 state.write_json(filename, data)
6
7 @staticmethod
8- def get_revision_build_data():
9+ def get_revision_build_data(branch=None):
10+ if branch is None:
11+ branch = 'gitbranch:master:github.com/juju/juju'
12 return {
13 'build-revision': {'builds': {'32': {
14 'number': 32,
15@@ -736,7 +738,7 @@
16 'parameters': [
17 {
18 'name': 'branch',
19- 'value': 'gitbranch:master:github.com/juju/juju',
20+ 'value': branch,
21 },
22 {
23 'name': 'revision',
24@@ -810,6 +812,12 @@
25 mongo_data = OutcomeState.make_mongo_data(32, rb_data, lbs_data, {})
26 self.assertEqual(False, mongo_data['tests']['foo']['vote'])
27
28+ def test_make_mongo_data_git_branch_name(self):
29+ mongo_data = OutcomeState.make_mongo_data(
30+ 32, self.get_revision_build_data(branch='origin/master'),
31+ set(), {'aws': 'foo'})
32+ self.assertEqual(self.get_expected_mongo_data(), mongo_data)
33+
34 @classmethod
35 def get_job_json(cls, timestamp=100, duration=200, build_number=1,
36 branch=None):
37
38=== modified file 'cidirector/update_outcome.py'
39--- cidirector/update_outcome.py 2016-08-29 19:05:30 +0000
40+++ cidirector/update_outcome.py 2017-01-18 20:29:53 +0000
41@@ -616,8 +616,11 @@
42 judge = BaseResultJudge(job_source)
43 result = judge.determine_result()
44 started = from_jenkins_timestamp(build_revision['timestamp'])
45+ branch = build_revision_params['branch']
46+ branch = re.sub('^origin/(.*)$', r'gitbranch:\1:github.com/juju/juju',
47+ branch)
48 mongo_data = {
49- 'branch': build_revision_params['branch'],
50+ 'branch': branch,
51 'build': {'last_build': revision_build},
52 'complete_failure_info': dict(result.voting_failures),
53 'cloud-health': {'substrates': substrates_health},

Subscribers

People subscribed via source and target branches