-
Notifications
You must be signed in to change notification settings - Fork 5
/
Jenkinsfile
32 lines (30 loc) · 1.09 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
// vim: ft=groovy et ts=2 sw=2:
node('java11') {
ansiColor('xterm') {
stage("Building app") {
container('java11') {
// Checkout repo
checkout scm
// Generating build info
commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
build_tag = commit_hash + "_" + env.BUILD_NUMBER
// Building jar
sh """
java --version
pwd
mvn clean install -DskipTests
"""
}
}
stage("Building container") {
container('kaniko') {
// Building and pushing the container
sh """
/kaniko/executor --dockerfile Dockerfile --context `pwd` --destination ${env.DOCKER_HUB_URL}/hcx-mock-service:${build_tag}
echo {\\"image_name\\" : \\"hcx-mock-service\\", \\"image_tag\\" : \\"${build_tag}\\"} > ${env.WORKSPACE}/metadata.json
"""
archiveArtifacts "metadata.json"
}
}
}
}