-
Notifications
You must be signed in to change notification settings - Fork 5
/
Jenkinsfile
53 lines (43 loc) · 1.12 KB
/
Jenkinsfile
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
pipeline {
agent any
stages {
stage('Unit test') {
steps {
sh 'serverless --help' // to ensure it is installed
}
}
stage('Integration test') {
steps {
sh 'serverless deploy --stage dev'
sh 'serverless invoke --stage dev --function hello'
}
}
stage('Production') {
when {
env.BRANCH_NAME == 'master'
}
steps {
parallel (
'us-east-1' : {
sh 'serverless deploy --stage production --region us-east-1'
sh 'serverless invoke --stage production --region us-east-1 --function hello'
},
'ap-southeast-2' : {
sh 'serverless deploy --stage production --region ap-southeast-2'
sh 'serverless invoke --stage production --region ap-southeast-2 --function hello'
}
)
}
}
stage('Teardown') {
steps {
echo 'No need for DEV environment now, tear it down'
sh 'serverless remove --stage dev'
}
}
}
environment {
AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY')
}
}