-
Notifications
You must be signed in to change notification settings - Fork 7
/
Jenkinsfile
46 lines (39 loc) · 1.08 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
#!/usr/bin/env groovy
node {
stage('Checkout') {
checkout(scm)
}
stage('Docker build') {
sh('make build')
}
stage('Docker check') {
sh('make check')
}
stage('Parsing version') {
// Get the module version
TRUE_VERSION = sh(script: 'make module_version', returnStdout: true).trim()
VERSION = sh(script: "echo ${TRUE_VERSION} | sed 's/-.*\$//'", returnStdout: true).trim()
BRANCH_VERSION = sh(
script: "echo ${TRUE_VERSION} | grep -Eo '^[0-9]+(\\.[0-9]+)?'", returnStdout: true
).trim()
// Log parsed version
echo("TRUE_VERSION = ${TRUE_VERSION}")
echo("VERSION = ${VERSION}")
echo("BRANCH_VERSION = ${BRANCH_VERSION}")
}
stage('Docker push') {
// Get the module name
module_name = sh(script: 'make module_name', returnStdout: true).trim()
docker.withRegistry(
"https://${env.AWS_ACCOUNT_ID}.dkr.ecr.eu-central-1.amazonaws.com",
"ecr:eu-central-1:${env.ENVIRONMENT}"
) {
// Push the version tags
image = docker.image(module_name)
image.push(TRUE_VERSION)
image.push(VERSION)
image.push(BRANCH_VERSION)
image.push('latest')
}
}
}