-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
74 lines (74 loc) · 1.61 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
pipeline {
agent none
environment {
IMAGE = "membership-portal-ui"
ECR_URL = "https://527059199351.dkr.ecr.us-west-1.amazonaws.com/"
}
stages {
stage('Build') {
parallel {
// stage('Lint') {
// agent {
// docker {
// image 'node:8-alpine'
// }
// }
// steps {
// sh 'yarn'
// sh 'yarn lint'
// }
// }
stage('Test') {
agent {
docker {
image 'node:8-alpine'
}
}
steps {
sh 'yarn'
sh 'yarn test'
}
}
stage('Build') {
agent {
dockerfile {
filename 'Dockerfile'
additionalBuildArgs '-t $IMAGE'
}
}
steps {
sh 'echo "Done"'
}
}
}
}
stage('Push') {
agent any
when {
branch "deploy"
}
steps {
script {
def url = env.ECR_URL + env.IMAGE
def tags = [env.GIT_COMMIT[0..6], env.GIT_BRANCH]
docker.withRegistry(url, "ecr:us-west-1:AWS_CREDENTIALS") {
tags.each { tag ->
docker.image(env.IMAGE).push(tag)
}
}
}
}
}
stage('Deploy') {
agent any
when {
branch "deploy"
}
steps {
sshagent(credentials: ['members.uclaacm.com']) {
sh 'ssh -o StrictHostKeyChecking=no -l ec2-user members.uclaacm.com "cd membership-portal-deployment/prod && make deploy"'
}
}
}
}
}