-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
90 lines (78 loc) · 2.02 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
pipeline {
triggers {
cron(env.BRANCH_NAME == 'main' ? '@weekly' : '')
}
agent {
label 'Linux && Podman'
}
environment{
IMAGE = "serviio"
SERVIIO_VERSION="2.4"
IMAGE_TAG = "${env.IMAGE}:${env.SERVIIO_VERSION}"
IMAGE_LATEST = "${env.IMAGE}:latest"
LOCAL_REGISTRY_IMAGE_TAG_NAME = "${env.REGISTRY_LOCAL}/${env.IMAGE_TAG}"
LOCAL_REGISTRY_IMAGE_LATEST_NAME = "${env.REGISTRY_LOCAL}/${env.IMAGE_LATEST}"
}
stages {
stage('Initialize') {
parallel {
stage('Advertising start of build') {
steps{
slackSend color: "#4675b1", message: "${env.JOB_NAME} build #${env.BUILD_NUMBER} started :fire: (<${env.RUN_DISPLAY_URL}|Open>)"
}
}
stage('Print environments variables') {
steps {
sh 'printenv | sort'
}
}
stage('Print Podman infos') {
steps {
sh '''
podman version
podman system info
'''
}
}
}
}
stage('Building image') {
steps {
sh '''
podman build \
--network slirp4netns \
--pull \
--build-arg Serviio_Version=$SERVIIO_VERSION \
-t $LOCAL_REGISTRY_IMAGE_TAG_NAME \
.
podman tag $LOCAL_REGISTRY_IMAGE_TAG_NAME $LOCAL_REGISTRY_IMAGE_LATEST_NAME
'''
}
}
stage('Pushing images') {
parallel{
stage("Push Tagged image to local registry") {
steps {
sh 'podman push $LOCAL_REGISTRY_IMAGE_TAG_NAME'
}
}
stage("Push latest image to local registry") {
steps {
sh 'podman push $LOCAL_REGISTRY_IMAGE_LATEST_NAME'
}
}
}
}
}
post {
success {
slackSend color: "#4675b1", message: "${env.JOB_NAME} successfully built :blue_heart: !"
}
failure {
slackSend color: "danger", message: "${env.JOB_NAME} build failed :poop: !"
}
cleanup {
cleanWs()
}
}
}