-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
32 lines (27 loc) · 1.01 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
@Library('podTemplateLib')
import net.santiment.utils.podTemplates
slaveTemplates = new podTemplates()
slaveTemplates.dockerTemplate { label ->
node(label) {
container('docker') {
def scmVars = checkout scm
def imageName = "san-chain-exporter"
stage('Run tests') {
sh "./bin/test.sh"
}
stage('Build image') {
withCredentials([string(credentialsId: 'aws_account_id', variable: 'aws_account_id')]) {
def awsRegistry = "${env.aws_account_id}.dkr.ecr.eu-central-1.amazonaws.com"
docker.withRegistry("https://${awsRegistry}", "ecr:eu-central-1:ecr-credentials") {
sh "docker build \
-t ${awsRegistry}/${imageName}:${env.BRANCH_NAME} \
-t ${awsRegistry}/${imageName}:${scmVars.GIT_COMMIT} \
-f docker/Dockerfile ."
sh "docker push ${awsRegistry}/${imageName}:${env.BRANCH_NAME}"
sh "docker push ${awsRegistry}/${imageName}:${scmVars.GIT_COMMIT}"
}
}
}
}
}
}