-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
56 lines (49 loc) · 1.72 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
54
55
56
node {
def nodeBuilder = docker.image("scomm/node-build:latest")
nodeBuilder.pull()
// Test
try {
stage('Checkout') {
checkout scm
}
nodeBuilder.inside("-v ${env.WORKSPACE}:/var/www/html -u 0:0 --entrypoint=''") {
stage('Yarn') {
sh 'yarn install'
}
stage ('Build') {
sh 'yarn build'
}
}
} catch (e) {
slackSend color: 'bad', message: "Failed building ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|View>)"
throw e
}
if (env.BRANCH_NAME == 'master') {
// Build
try {
stage('Build Container') {
nodeBuilder = docker.build("identify-me-library:v${env.BUILD_NUMBER}", ".")
}
} catch (e) {
slackSend color: 'bad', message: "Failed building ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|View>)"
throw e
}
// Deploy
try {
stage('Deploy Image') {
docker.withRegistry('https://664537616798.dkr.ecr.us-east-1.amazonaws.com', 'ecr:us-east-1:aws-jenkins-login') {
nodeBuilder.push("v${env.BUILD_NUMBER}");
}
}
stage('Deploy Upgrade') {
rancher confirm: true, credentialId: 'rancher', endpoint: 'https://rancher.as3.io/v2-beta', environmentId: '1a18', image: "664537616798.dkr.ecr.us-east-1.amazonaws.com/identify-me-library:v${env.BUILD_NUMBER}", service: 'id-me/library', environments: '', ports: '', timeout: 300
}
stage('Deploy Notify') {
slackSend color: 'good', message: "Finished deploying ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|View>)"
}
} catch (e) {
slackSend color: 'bad', message: "Failed deploying ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|View>)"
throw e
}
}
}