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
=== modified file 'cidirector/tests/test_update_outcome.py'
--- cidirector/tests/test_update_outcome.py 2016-08-29 18:42:59 +0000
+++ cidirector/tests/test_update_outcome.py 2017-01-18 20:29:53 +0000
@@ -725,7 +725,9 @@
725 state.write_json(filename, data)725 state.write_json(filename, data)
726726
727 @staticmethod727 @staticmethod
728 def get_revision_build_data():728 def get_revision_build_data(branch=None):
729 if branch is None:
730 branch = 'gitbranch:master:github.com/juju/juju'
729 return {731 return {
730 'build-revision': {'builds': {'32': {732 'build-revision': {'builds': {'32': {
731 'number': 32,733 'number': 32,
@@ -736,7 +738,7 @@
736 'parameters': [738 'parameters': [
737 {739 {
738 'name': 'branch',740 'name': 'branch',
739 'value': 'gitbranch:master:github.com/juju/juju',741 'value': branch,
740 },742 },
741 {743 {
742 'name': 'revision',744 'name': 'revision',
@@ -810,6 +812,12 @@
810 mongo_data = OutcomeState.make_mongo_data(32, rb_data, lbs_data, {})812 mongo_data = OutcomeState.make_mongo_data(32, rb_data, lbs_data, {})
811 self.assertEqual(False, mongo_data['tests']['foo']['vote'])813 self.assertEqual(False, mongo_data['tests']['foo']['vote'])
812814
815 def test_make_mongo_data_git_branch_name(self):
816 mongo_data = OutcomeState.make_mongo_data(
817 32, self.get_revision_build_data(branch='origin/master'),
818 set(), {'aws': 'foo'})
819 self.assertEqual(self.get_expected_mongo_data(), mongo_data)
820
813 @classmethod821 @classmethod
814 def get_job_json(cls, timestamp=100, duration=200, build_number=1,822 def get_job_json(cls, timestamp=100, duration=200, build_number=1,
815 branch=None):823 branch=None):
816824
=== modified file 'cidirector/update_outcome.py'
--- cidirector/update_outcome.py 2016-08-29 19:05:30 +0000
+++ cidirector/update_outcome.py 2017-01-18 20:29:53 +0000
@@ -616,8 +616,11 @@
616 judge = BaseResultJudge(job_source)616 judge = BaseResultJudge(job_source)
617 result = judge.determine_result()617 result = judge.determine_result()
618 started = from_jenkins_timestamp(build_revision['timestamp'])618 started = from_jenkins_timestamp(build_revision['timestamp'])
619 branch = build_revision_params['branch']
620 branch = re.sub('^origin/(.*)$', r'gitbranch:\1:github.com/juju/juju',
621 branch)
619 mongo_data = {622 mongo_data = {
620 'branch': build_revision_params['branch'],623 'branch': branch,
621 'build': {'last_build': revision_build},624 'build': {'last_build': revision_build},
622 'complete_failure_info': dict(result.voting_failures),625 'complete_failure_info': dict(result.voting_failures),
623 'cloud-health': {'substrates': substrates_health},626 'cloud-health': {'substrates': substrates_health},

Subscribers

People subscribed via source and target branches