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