Merge lp:~sinzui/juju-ci-tools/match-job-name into lp:juju-ci-tools

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 1984
Proposed branch: lp:~sinzui/juju-ci-tools/match-job-name
Merge into: lp:juju-ci-tools
Diff against target: 30 lines (+6/-1)
2 files modified
s3ci.py (+4/-0)
tests/test_s3ci.py (+2/-1)
To merge this branch: bzr merge lp:~sinzui/juju-ci-tools/match-job-name
Reviewer Review Type Date Requested Status
Christopher Lee (community) Approve
Review via email: mp+322171@code.launchpad.net

Description of the change

Match the exact job name.

the assemble-stream job fails because s3ci.py assumes it got an exact match of the job name. Yesterday I added 1-8 counterpart jobs for all the build agent jobs. s3ci.py is confused by build-centos and build-centos-1-8. It looks for "/build-" to follow the exact jobs name. It errors when it does not find a build number in "-1-8/build" because
the fragment does not start with "/build-"

My fix just checks for a match, No match means the job name is not an exact match. We had a good test; adding the case reproduced the problem. I added logging to see that s3ci/py found.

To post a comment you must log in.
Revision history for this message
Christopher Lee (veebers) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 's3ci.py'
2--- s3ci.py 2017-02-22 16:08:27 +0000
3+++ s3ci.py 2017-04-07 00:02:58 +0000
4@@ -120,7 +120,11 @@
5 keys = bucket.list(prefix)
6 by_build = {}
7 for key in keys:
8+ logging.debug('looking at {}'.format(key.name))
9 match = re.search('^/build-(\d+)', key.name[len(prefix):])
10+ if match is None:
11+ logging.debug('job name is not /{}/'.format(job))
12+ continue
13 build = int(match.group(1))
14 by_build.setdefault(build, []).append(key)
15 # We can't use last successful build, because we don't know what builds
16
17=== modified file 'tests/test_s3ci.py'
18--- tests/test_s3ci.py 2017-02-22 16:08:27 +0000
19+++ tests/test_s3ci.py 2017-04-07 00:02:58 +0000
20@@ -283,8 +283,9 @@
21 match_key = FakeKey(275, 'job-foo', 27, 'file-pattern')
22 wrong_name = FakeKey(275, 'job-foo', 27, 'file-pat+ern')
23 wrong_job = FakeKey(275, 'job.foo', 27, 'file-pattern')
24+ wrong_job2 = FakeKey(275, 'job-foo-1-8', 27, 'file-pattern')
25 wrong_rb = FakeKey(276, 'job-foo', 27, 'file-pattern')
26- keys = [match_key, wrong_name, wrong_job, wrong_rb]
27+ keys = [match_key, wrong_name, wrong_job, wrong_rb, wrong_job2]
28 bucket = FakeBucket(keys)
29 filtered = find_file_keys(
30 bucket, 275, 'job-foo', 'file-pat+ern')

Subscribers

People subscribed via source and target branches