Merge lp:~gesha/linaro-license-protection/check-build-info-on-publishing into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Georgy Redkozubov
Status: Merged
Approved by: Paul Sokolovsky
Approved revision: 155
Merged at revision: 155
Proposed branch: lp:~gesha/linaro-license-protection/check-build-info-on-publishing
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 82 lines (+43/-0)
2 files modified
scripts/publish_to_snapshots.py (+12/-0)
tests/test_publish_to_snapshots.py (+31/-0)
To merge this branch: bzr merge lp:~gesha/linaro-license-protection/check-build-info-on-publishing
Reviewer Review Type Date Requested Status
Paul Sokolovsky Approve
Review via email: mp+145427@code.launchpad.net

Description of the change

This branch adds checks for BUILD-INFO.txt before publishing artifacts.
Build artifacts without proper protection with BUILD-INFO.txt shouldn't be published to prevent possible leaks.

To post a comment you must log in.
Revision history for this message
Paul Sokolovsky (pfalcon) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/publish_to_snapshots.py'
2--- scripts/publish_to_snapshots.py 2013-01-01 23:57:40 +0000
3+++ scripts/publish_to_snapshots.py 2013-01-29 16:12:28 +0000
4@@ -15,6 +15,7 @@
5 product_dir_path = 'target/product'
6 PASS = 0
7 FAIL = 1
8+buildinfo = 'BUILD-INFO.txt'
9 acceptable_job_types = [
10 'android',
11 'prebuilt',
12@@ -367,6 +368,13 @@
13 print "Failed to move files destination path", target_dir_path
14 return FAIL
15
16+ def check_buildinfo(self, build_dir_path):
17+ buildinfo_path = os.path.join(build_dir_path, buildinfo)
18+ if not os.path.exists(buildinfo_path):
19+ return FAIL
20+
21+ return PASS
22+
23
24 def main():
25 global uploads_path
26@@ -387,6 +395,10 @@
27 if build_dir_path is None or target_dir_path is None:
28 print "Problem with build/target path, move failed"
29 return FAIL
30+ ret = publisher.check_buildinfo(build_dir_path)
31+ if ret != PASS:
32+ print "BUILD-INFO.txt is not present in artifacts being published"
33+ return FAIL
34 ret = publisher.move_artifacts(args, build_dir_path, target_dir_path)
35 if ret != PASS:
36 print "Move Failed"
37
38=== modified file 'tests/test_publish_to_snapshots.py'
39--- tests/test_publish_to_snapshots.py 2012-12-05 13:47:59 +0000
40+++ tests/test_publish_to_snapshots.py 2013-01-29 16:12:28 +0000
41@@ -11,6 +11,9 @@
42 SnapshotsPublisher,
43 setup_parser,
44 product_dir_path,
45+ FAIL,
46+ PASS,
47+ buildinfo
48 )
49
50
51@@ -726,3 +729,31 @@
52 self.assertEqual(content, open(resulting_file).read())
53 self.assertEqual(howto_content, open(resulting_howto_file).read())
54 shutil.rmtree(source_dir)
55+
56+ def test_check_buildinfo(self):
57+ self.publisher = SnapshotsPublisher()
58+ param = self.parser.parse_args(
59+ ['-t', 'prebuilt', '-j', 'precise-armhf-ubuntu-desktop',
60+ '-n', '1'])
61+ self.publisher.validate_args(param)
62+ build_dir = '/'.join([param.job_name, str(param.build_num)])
63+ build_path = os.path.join(self.uploads_path, build_dir)
64+ os.makedirs(build_path)
65+
66+ file_name = os.path.join(build_path, buildinfo)
67+ file = open(file_name, "w")
68+ file.close()
69+
70+ self.assertEqual(PASS, self.publisher.check_buildinfo(build_dir))
71+
72+ def test_check_buildinfo_no_file(self):
73+ self.publisher = SnapshotsPublisher()
74+ param = self.parser.parse_args(
75+ ['-t', 'prebuilt', '-j', 'precise-armhf-ubuntu-desktop',
76+ '-n', '1'])
77+ self.publisher.validate_args(param)
78+ build_dir = '/'.join([param.job_name, str(param.build_num)])
79+ build_path = os.path.join(self.uploads_path, build_dir)
80+ os.makedirs(build_path)
81+
82+ self.assertEqual(FAIL, self.publisher.check_buildinfo(build_dir))

Subscribers

People subscribed via source and target branches