-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
105 lines (105 loc) · 2.57 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
pipeline{
agent none
stages{
stage('build images'){
agent any
steps{
script{
docker.withRegistry('https://nexus.intranda.com:4443','jenkins-docker'){
dockerimage = docker.build("goobi-viewer-docker-solr:${env.BUILD_ID}_${env.GIT_COMMIT}")
dockerimage_public = docker.build("intranda/goobi-viewer-docker-solr:${env.BUILD_ID}_${env.GIT_COMMIT}")
}
}
}
}
stage('publish image to internal repository'){
agent any
steps{
script {
docker.withRegistry('https://nexus.intranda.com:4443','jenkins-docker'){
dockerimage.push("${env.BRANCH_NAME}-${env.BUILD_ID}_${env.GIT_COMMIT}")
dockerimage.push("${env.BRANCH_NAME}")
}
}
}
}
stage('publish production image to internal repository'){
agent any
when {
branch 'master'
}
steps{
script{
docker.withRegistry('https://nexus.intranda.com:4443','jenkins-docker'){
dockerimage.push("latest")
}
}
}
}
stage('publish develop image to Docker Hub'){
when {
branch 'develop'
}
steps{
script{
docker.withRegistry('','0b13af35-a2fb-41f7-8ec7-01eaddcbe99d'){
dockerimage_public.push("${env.BRANCH_NAME}")
}
}
}
}
stage('publish production image to Docker Hub'){
when {
branch 'master'
}
steps{
script{
docker.withRegistry('','0b13af35-a2fb-41f7-8ec7-01eaddcbe99d'){
dockerimage_public.push("latest")
}
}
}
}
stage('publish develop image to GitHub container registry'){
agent any
when {
branch 'develop'
}
steps{
script{
docker.withRegistry('https://ghcr.io','jenkins-github-container-registry'){
dockerimage_public.push("${env.BRANCH_NAME}")
}
}
}
}
stage('publish production image to GitHub container registry'){
agent any
when {
branch 'master'
}
steps{
script{
docker.withRegistry('https://ghcr.io','jenkins-github-container-registry'){
dockerimage_public.push("latest")
}
}
}
}
}
post {
always{
node(null) {
deleteDir()
}
}
changed {
emailext(
subject: '${DEFAULT_SUBJECT}',
body: '${DEFAULT_CONTENT}',
recipientProviders: [requestor(),culprits()],
attachLog: true
)
}
}
}