-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
64 lines (64 loc) · 1.47 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
pipeline {
agent {
node {
label 'master'
}
}
options {
buildDiscarder(logRotator(numToKeepStr: '100'))
}
stages {
stage('Fetch') {
steps {
deleteDir()
checkout scm: [
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: true,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false
]
],
submoduleCfg: [],
userRemoteConfigs: scm.userRemoteConfigs
]
}
}
stage('Install') {
steps {
sh "apt-get update"
sh "apt install -y libunwind8 gettext python3-pip"
sh "pip3 install awscli"
}
}
stage('Image') {
steps {
sh "docker build -t ${DOCKER_IMAGE}:latest -f Dockerfile ."
}
}
stage('Tag') {
steps {
sh "docker tag ${DOCKER_IMAGE}:latest ${DOCKER_IMAGE}:`git rev-parse HEAD`"
sh "docker tag ${DOCKER_IMAGE}:latest ${DOCKER_IMAGE}:latest"
}
}
stage('Push') {
steps {
sh "\$(aws ecr get-login --no-include-email --region ${REGION})"
sh "docker push ${DOCKER_IMAGE}:`git rev-parse HEAD`"
sh "docker push ${DOCKER_IMAGE}:latest"
}
}
stage('Bounce') {
steps {
sh "aws ecs update-service --force-new-deployment --cluster ${CLUSTER} --service ${SERVICE} --region ${REGION}"
sh "aws ecs wait services-stable --cluster ${CLUSTER} --services ${SERVICE} --region ${REGION}"
}
}
}
}