-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
36 lines (32 loc) · 975 Bytes
/
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
pipeline {
agent none
stages {
stage('Test and Publish') {
agent { label 'sbt-template' }
environment {
DOCKER_REPO = "${env.DOCKER_REPO}"
ECR_RW = credentials('ecr-rw')
VERSION = getVersion()
}
steps {
container('sbt-container') {
script {
sh 'docker build --network host -t $DOCKER_REPO/interop-frontend:$VERSION .'
withCredentials([usernamePassword(credentialsId: 'ecr-rw', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY')]) {
sh '''
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin $DOCKER_REPO
'''
}
sh 'docker image push $DOCKER_REPO/interop-frontend:$VERSION'
}
}
}
}
}
}
String getVersion() {
if(env.TAG_NAME)
return env.TAG_NAME
else
return env.GIT_LOCAL_BRANCH + '-latest'
}