Mercurial > mozilla > hg > ReleaseTalos
annotate releasetalos.py @ 0:642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 22 Jan 2013 12:10:40 -0800 |
parents | |
children | af3e9bef7722 |
rev | line source |
---|---|
0
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
2 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
3 """ |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
4 releasetalos |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
5 create a bug to deploy a new talos.zip |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
6 """ |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
7 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
8 import bzconsole |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
9 import datetime |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
10 import sys |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
11 import talostry |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
12 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
13 from bzconsole.command import read_dotfile |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
14 from mozillatry import ConfigurationError |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
15 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
16 comment = """ |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
17 A new talos.zip should be deployed for m-c. |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
18 The zip should be uploaded to people.mozilla.org and the link posted here. |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
19 The zip should then be copied to http://build.mozilla.org/talos/zips/ . |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
20 talos.json should be updated with this location: |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
21 https://hg.mozilla.org/mozilla-central/file/tip/testing/talos/talos.json |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
22 """ |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
23 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
24 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
25 class ReleaseTalos(talostry.TalosTryConfiguration): |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
26 __doc__ = __doc__ |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
27 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
28 options = talostry.TalosTryConfiguration |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
29 options.update({'cc': {'default': [':jmaher', ':armenzg', ':edmorley'], |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
30 'help': 'cc to the bug'}, |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
31 'title': {'default': "Deploy new talos.zip for %s" % (datetime.datetime.now().strftime("%Y-%m-%d")), |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
32 'help' 'title of bug'}, |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
33 }) |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
34 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
35 def validate(self): |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
36 """validate configuration""" |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
37 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
38 talostry.TalosTryConfiguration.validate(self) |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
39 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
40 # bugzilla credentials keys |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
41 credentials = set(['username', 'password']) |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
42 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
43 # parse bzconsole auth from ~/.bz |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
44 # TODO: should be inputtable alternatively directly from configuration |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
45 data = read_dotfile() |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
46 for key in credentials: |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
47 if key in data and key not in self.config: |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
48 self.config[key] = data[key] |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
49 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
50 # ensure bugzilla credentials are given |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
51 if not credentials.issubset(self.config.keys()) |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
52 raise ConfigurationError("Missing bugzilla credentials: %s" % |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
53 ', '.join([i for i in credentials |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
54 if i not in self.config.keys()])) |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
55 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
56 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
57 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
58 def generate_bug(self): |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
59 """ |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
60 generate a bug to release a new talos; |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
61 returns the bug number |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
62 """ |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
63 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
64 bzapi = bzconsole.BZapi(username=self.config['username'], |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
65 password=self.config['password']) |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
66 url = bzapi.new(component='Release Engineering: Automation (General)', |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
67 title=self.config['title'], |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
68 description=comment.strip(), |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
69 cc=self.config['cc']) |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
70 print url |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
71 bug = int(url.rsplit('/', 1)[-1]) |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
72 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
73 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
74 def main(args=sys.argv[1:]): |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
75 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
76 # parse command line arguments |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
77 releasetalos = ReleaseTalos() |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
78 options, args = parser.parse_args(args) |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
79 if args: |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
80 parser.print_help() |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
81 parser.exit(1) |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
82 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
83 # generate bug |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
84 releasetalos.generate_bug() |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
85 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
86 ### TODO: |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
87 # - deduce and mark bugs from this talos.zip from last talos.zip |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
88 # - upload talos.zip to people.mozilla.org |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
89 # - push to try if talos tests are given |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
90 |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
91 if __name__ == '__main__': |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
92 main() |
642e1f903bd0
initial commit of talos, mozutils port of http://k0s.org/mozilla/talos/new-talos-zip-bug.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
93 |