-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotify-znd-owners.groovy
More file actions
61 lines (52 loc) · 1.68 KB
/
notify-znd-owners.groovy
File metadata and controls
61 lines (52 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Check in with all znd owners (via Slack) to ask if they can delete
// their znd.
//
// 'znd's are non-default deploys of our application to appengine.
// Appengine limits how many deploys we can have (default or no),
// and when we run into that limit one way of making space is to
// ask people who have deployed old znd's to delete them. This
// jenkins job does this asking.
//
// (We're able to identify who deployed what znd since we ask people
// to make their username part of the znd's name.)
@Library("kautils")
// Classes we use, under jenkins-jobs/src/.
import org.khanacademy.Setup;
// Vars we use, under jenkins-jobs/vars/. This is just for documentation.
//import vars.kaGit
//import vars.notify
//import vars.withSecrets
//import vars.withTimeout
//import vars.withVirtualenv
// The simplest setup ever! -- we only want the defaults.
new Setup(steps).apply();
def _setupWebapp() {
withTimeout('1h') {
kaGit.safeSyncToOrigin("git@github.com:Khan/webapp", "master");
}
}
def runScript() {
withTimeout('1h') {
withSecrets.slackAlertlibOnly() { // because we pass --notify_slack
dir("webapp") {
sh("make clean_pyc"); // in case some .py files went away
sh("deploy/notify_znd_owners.py --notify_slack");
}
}
}
}
onMaster('1h') {
notify([slack: [channel: '#eng-deploys-backend',
sender: 'Mr Monkey',
emoji: ':monkey_face:',
when: ['SUCCESS', 'FAILURE', 'UNSTABLE', 'ABORTED']]]) {
stage("Initializing webapp") {
_setupWebapp();
}
stage("Notifying") {
withVirtualenv.python3() {
runScript();
}
}
}
}