-
Notifications
You must be signed in to change notification settings - Fork 102
/
Jenkinsfile
51 lines (51 loc) · 1.33 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
pipeline {
agent any
tools {
nodejs "nodejs"
terraform "terraform"
}
stages {
stage("Build") {
steps {
script {
sh """
npm install
npm run build
"""
}
}
}
stage("Test") {
steps {
script {
sh script: "npm test", returnStatus: true
}
}
}
stage("Deploy") {
steps {
script {
sh """
zip -r $UNIQUE_ANIMAL_IDENTIFIER-build-artifacts.zip build/
aws s3 cp $UNIQUE_ANIMAL_IDENTIFIER-build-artifacts.zip s3://dpg-november-artifact-bucket
cd terraform
terraform init -backend-config="key=${UNIQUE_ANIMAL_IDENTIFIER}.tfstate"
terraform apply --auto-approve
"""
}
}
}
stage("Show Domain") {
steps {
script {
sh script: "bash ${WORKSPACE}/scripts/display-dns.sh ${UNIQUE_ANIMAL_IDENTIFIER}", returnStatus: true
}
}
}
}
post {
cleanup {
deleteDir()
}
}
}