-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
36 lines (35 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
@Library('github.com/releaseworks/jenkinslib') _
pipeline {
environment {
AWS_DEFAULT_REGION = 'us-east-2'
}
agent {
docker {
image 'maven:latest'
args '-v $HOME/.m2:/root/.m2'
}
}
stages {
stage('build') {
steps {
sh 'mvn clean install -DskipTests'
}
}
stage('publish') {
when {
branch 'master'
}
steps {
script {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'production', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY']]) {
withElasticContainerRegistry {
def app = docker.build("102252363609.dkr.ecr.us-east-2.amazonaws.com/mtgbutler-api")
app.push('latest');
sh 'aws ecs update-service --cluster mtgbutler-production --service api --force-new-deployment'
}
}
}
}
}
}
}