|
a/Allura/push_re.py |
|
b/Allura/push_re.py |
|
... |
|
... |
19 |
print '---BEGIN---'
|
19 |
print '---BEGIN---'
|
20 |
print text
|
20 |
print text
|
21 |
print '---END---'
|
21 |
print '---END---'
|
22 |
raw_input("Verify that there are no new dependencies, or RPM's are build for all deps...")
|
22 |
raw_input("Verify that there are no new dependencies, or RPM's are build for all deps...")
|
23 |
raw_input("Verify that a new sandbox builds starts without engr help...")
|
23 |
raw_input("Verify that a new sandbox builds starts without engr help...")
|
24 |
raw_input('When this is done, create a JIRA ticket (https://engr.geek.net/jira/secure/CreateIssue!default.jspa) with the same contents...')
|
24 |
raw_input('When this is done, create a SOG Trac ticket'
|
|
|
25 |
' (https://control.sog.geek.net/sog/trac/newticket?keywords=LIAISON) with the'
|
|
|
26 |
' same contents...')
|
25 |
raw_input('Now link the two tickets...')
|
27 |
raw_input('Now link the two tickets...')
|
26 |
newforge_num = raw_input('What is the newforge ticket number? ')
|
28 |
newforge_num = raw_input('What is the newforge ticket number? ')
|
27 |
command('git', 'tag', '-a', '-m', '[#%s] - Push to RE' % newforge_num, tag, 'master')
|
29 |
command('git', 'tag', '-a', '-m', '[#%s] - Push to RE' % newforge_num, tag, 'master')
|
28 |
command('git', 'push', 'origin', 'master')
|
30 |
command('git', 'push', 'origin', 'master')
|
29 |
command('git', 'push', 'live', 'master')
|
31 |
command('git', 'push', 'live', 'master')
|
|
... |
|
... |
46 |
last_release = command('git tag -l release_*')
|
48 |
last_release = command('git tag -l release_*')
|
47 |
if last_release: last_release = last_release[-1]
|
49 |
if last_release: last_release = last_release[-1]
|
48 |
else: last_release = ''
|
50 |
else: last_release = ''
|
49 |
changes = command(
|
51 |
changes = command(
|
50 |
'git', 'log', "--format=* %h %s", last_release.strip() + '..')
|
52 |
'git', 'log', "--format=* %h %s", last_release.strip() + '..')
|
|
|
53 |
assert changes, 'There were no commits found; maybe you forgot to merge dev->master?'
|
51 |
changes = ''.join(changes)
|
54 |
changes = ''.join(changes)
|
52 |
prelaunch = []
|
55 |
prelaunch = []
|
53 |
postlaunch = ['* allurapaste ensure_index /var/local/config/production.ini']
|
56 |
postlaunch = []
|
54 |
needs_reactor_setup = raw_input('Does this release require a reactor_setup? [n]')
|
57 |
needs_reactor_setup = raw_input('Does this release require a reactor_setup? [n]')
|
55 |
needs_flyway = raw_input('Does this release require a migration? [y]')
|
58 |
needs_flyway = raw_input('Does this release require a migration? [y]')
|
56 |
if needs_reactor_setup[:1].lower() in ('y', '1'):
|
59 |
if needs_reactor_setup[:1].lower() in ('y', '1'):
|
57 |
postlaunch.append('* service reactor stop')
|
60 |
postlaunch.append('* service reactor stop')
|
58 |
postlaunch.append('* allurapaste reactor_setup /var/local/config/production.ini')
|
61 |
postlaunch.append('* allurapaste reactor_setup /var/local/config/production.ini')
|
59 |
postlaunch.append('* service reactor start')
|
62 |
postlaunch.append('* service reactor start')
|
60 |
if needs_flyway[:1].lower() in ('', 'y', '1'):
|
63 |
if needs_flyway[:1].lower() in ('', 'y', '1'):
|
61 |
prelaunch.append('* dump the database in case we need to roll back')
|
64 |
prelaunch.append('* dump the database in case we need to roll back')
|
62 |
postlaunch.append('* allurapaste flyway --url mongo://sfn-mongo-1:27017/')
|
65 |
postlaunch.append('* allurapaste flyway --url mongo://sfn-mongo:27017/')
|
63 |
if postlaunch:
|
66 |
if postlaunch:
|
64 |
postlaunch = [ 'From sfu-scmprocess-1 do the following:\n' ] + postlaunch
|
67 |
postlaunch = [ 'From sfu-scmprocess-1 do the following:\n' ] + postlaunch
|
65 |
postlaunch = '\n'.join(postlaunch)
|
68 |
postlaunch = '\n'.join(postlaunch)
|
66 |
else:
|
69 |
else:
|
67 |
postlaunch = '-none-'
|
70 |
postlaunch = '-none-'
|
68 |
if prelaunch:
|
71 |
if prelaunch:
|
69 |
prelaunch = [ 'From sfn-mongo-1 do the following:\n' ] + prelaunch
|
72 |
prelaunch = [ 'From sfn-mongo do the following:\n' ] + prelaunch
|
70 |
prelaunch = '\n'.join(prelaunch)
|
73 |
prelaunch = '\n'.join(prelaunch)
|
71 |
else:
|
74 |
else:
|
72 |
prelaunch = '-none-'
|
75 |
prelaunch = '-none-'
|
|
|
76 |
postlaunch.append('* allurapaste ensure_index /var/local/config/production.ini')
|
73 |
return TICKET_TEMPLATE.substitute(locals()), tag
|
77 |
return TICKET_TEMPLATE.substitute(locals()), tag
|
74 |
|
78 |
|
75 |
|
79 |
|
76 |
def command(*args):
|
80 |
def command(*args):
|
77 |
if len(args) == 1 and isinstance(args[0], basestring):
|
81 |
if len(args) == 1 and isinstance(args[0], basestring):
|
|
... |
|
... |
96 |
else:
|
100 |
else:
|
97 |
value = raw_input(prompt or ('%s: ' % key))
|
101 |
value = raw_input(prompt or ('%s: ' % key))
|
98 |
CP.set(section, key, value)
|
102 |
CP.set(section, key, value)
|
99 |
return value
|
103 |
return value
|
100 |
|
104 |
|
101 |
TICKET_TEMPLATE=string.Template('''
|
105 |
TICKET_TEMPLATE=string.Template('''{{{
|
|
|
106 |
#!push
|
|
|
107 |
|
102 |
(engr) Name of Engineer pushing: $engineer
|
108 |
(engr) Name of Engineer pushing: $engineer
|
103 |
(engr) Which code tree(s): allura
|
109 |
(engr) Which code tree(s): allura
|
104 |
(engr) Is configtree to be pushed?: no
|
110 |
(engr) Is configtree to be pushed?: no
|
105 |
(engr) Which release/revision is going to be synced?: $tag
|
111 |
(engr) Which release/revision is going to be synced?: $tag
|
106 |
(engr) Itemized list of changes to be launched with sync:
|
112 |
(engr) Itemized list of changes to be launched with sync:
|
|
... |
|
... |
114 |
Post-launch dependencies:
|
120 |
Post-launch dependencies:
|
115 |
|
121 |
|
116 |
$postlaunch
|
122 |
$postlaunch
|
117 |
|
123 |
|
118 |
(engr) Approved for release (Dean/Dave/John): None
|
124 |
(engr) Approved for release (Dean/Dave/John): None
|
119 |
(sog) Approval for sync provided by (Jacob/Jay/David/Wayne): None
|
|
|
120 |
(sog) Outcome of sync:
|
125 |
(sog) Outcome of sync:
|
|
|
126 |
}}}''')
|
121 |
|
127 |
|
122 |
''')
|
|
|
123 |
|
|
|
124 |
if __name__ == '__main__':
|
128 |
if __name__ == '__main__':
|
125 |
main()
|
129 |
main()
|