-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-alert-context.groovy
More file actions
67 lines (54 loc) · 1.9 KB
/
deploy-alert-context.groovy
File metadata and controls
67 lines (54 loc) · 1.9 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
62
63
64
65
66
67
// Groovy script to deploy to the AWS lambda service
// from master on https://github.com/Khan/alert-context.
//
// alert-context is a lambda function that intercepts slack messages
// from gcloud and augments them to have more useful information
// before passing them on to the ka slack channels.
@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.withTimeout
// The easiest setup ever! -- we just use the defaults.
new Setup(steps).apply();
def installDeps() {
withTimeout('15m') {
kaGit.safeSyncToOrigin("git@github.com:Khan/alert-context", "master");
// These secrets are installed above the workspace when we run the
// jenkins setup script (in Khan/aws-config).
sh("ln -snf ../../../secrets.py alert-context/src/secrets.py");
sh("chmod 644 alert-context/src/secrets.py");
dir("alert-context") {
sh("make -B deps"); // force a remake of all deps all the time
}
}
}
def deploy() {
withTimeout('1h') {
// This is also installed via setup.sh.
def AWS_ACCESS_KEY_ID = readFile("../aws_access_key").trim();
def AWS_SECRET_ACCESS_KEY = readFile("../aws_secret").trim();
dir("alert-context") {
withEnv(["AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}",
"AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}"]) {
sh("make deploy");
}
}
}
}
onMaster('2h') {
notify([slack: [channel: '#eng-deploys-backend',
sender: 'Mr Monkey',
emoji: ':monkey_face:',
when: ['BUILD START',
'SUCCESS', 'FAILURE', 'UNSTABLE', 'ABORTED']]]) {
stage("Installing deps") {
installDeps();
}
stage("Deploying") {
deploy();
}
}
}