1
- import groovy.json.JsonOutput
2
-
3
- def version = " UNKNOWN"
4
- def commit = " UNKNOWN"
5
- def dockerHubRepo = " overture/rollcall"
6
- def gitHubRegistry = " ghcr.io"
7
- def gitHubRepo = " overture-stack/rollcall"
8
-
9
- pipeline {
10
- agent {
11
- kubernetes {
12
- label ' rollcall-executor'
13
- yaml """
14
- apiVersion: v1
15
- kind: Pod
16
- spec:
17
- containers:
18
- - name: jdk
19
- tty: true
20
- image: openjdk:11
21
- env:
22
- - name: DOCKER_HOST
23
- value: tcp://localhost:2375
24
- - name: helm
25
- image: alpine/helm:2.12.3
26
- command:
27
- - cat
28
- tty: true
29
- - name: docker
30
- image: docker:18-git
31
- tty: true
32
- env:
33
- - name: DOCKER_HOST
34
- value: tcp://localhost:2375
35
- - name: HOME
36
- value: /home/jenkins/agent
37
- - name: dind-daemon
38
- image: docker:18.06-dind
39
- securityContext:
40
- privileged: true
41
- runAsUser: 0
42
- volumeMounts:
43
- - name: docker-graph-storage
44
- mountPath: /var/lib/docker
45
- securityContext:
46
- runAsUser: 1000
47
- volumes:
48
- - name: docker-graph-storage
49
- emptyDir: {}
50
- """
51
- }
52
- }
53
- stages {
54
- stage(' Prepare' ) {
55
- steps {
56
- script {
57
- commit = sh(returnStdout : true , script : ' git describe --always' ). trim()
58
- }
59
- script {
60
- version = readMavenPom(). getVersion()
61
- }
62
- }
63
- }
64
- stage(' Test' ) {
65
- steps {
66
- container(' jdk' ) {
67
- sh " ./mvnw test package"
68
- }
69
- }
70
- }
71
- stage(' Build & Publish Develop' ) {
72
- when {
73
- branch " develop"
74
- }
75
- steps {
76
- container(' docker' ) {
77
- withCredentials([usernamePassword(credentialsId :' OvertureDockerHub' , usernameVariable : ' USERNAME' , passwordVariable : ' PASSWORD' )]) {
78
- sh ' docker login -u $USERNAME -p $PASSWORD'
79
- }
80
- sh " docker build --network=host -f Dockerfile . -t ${ dockerHubRepo} :edge -t ${ dockerHubRepo} :${ commit} "
81
- sh " docker push ${ dockerHubRepo} :edge"
82
- sh " docker push ${ dockerHubRepo} :${ commit} "
83
- }
84
- container(' docker' ) {
85
- withCredentials([usernamePassword(credentialsId :' OvertureBioGithub' , usernameVariable : ' USERNAME' , passwordVariable : ' PASSWORD' )]) {
86
- sh " docker login ${ gitHubRegistry} -u $USERNAME -p $PASSWORD "
87
- }
88
- sh " docker build --network=host -f Dockerfile . -t ${ gitHubRegistry} /${ gitHubRepo} :edge -t ${ gitHubRegistry} /${ gitHubRepo} :${ commit} "
89
- sh " docker push ${ gitHubRegistry} /${ gitHubRepo} :edge"
90
- sh " docker push ${ gitHubRegistry} /${ gitHubRepo} :${ commit} "
91
- }
92
-
93
- }
94
- }
95
- stage(' Release & tag' ) {
96
- when {
97
- branch " master"
98
- }
99
- steps {
100
- container(' docker' ) {
101
- withCredentials([usernamePassword(credentialsId : ' OvertureBioGithub' , passwordVariable : ' GIT_PASSWORD' , usernameVariable : ' GIT_USERNAME' )]) {
102
- sh " git tag ${ version} "
103
- sh " git push https://${ GIT_USERNAME} :${ GIT_PASSWORD} @github.com/${ gitHubRepo} --tags"
104
- }
105
- withCredentials([usernamePassword(credentialsId :' OvertureDockerHub' , usernameVariable : ' USERNAME' , passwordVariable : ' PASSWORD' )]) {
106
- sh ' docker login -u $USERNAME -p $PASSWORD'
107
- }
108
- sh " docker build --network=host -f Dockerfile . -t ${ dockerHubRepo} :latest -t ${ dockerHubRepo} :${ version} "
109
- sh " docker push ${ dockerHubRepo} :${ version} "
110
- sh " docker push ${ dockerHubRepo} :latest"
111
- }
112
- container(' docker' ) {
113
- withCredentials([usernamePassword(credentialsId :' OvertureBioGithub' , usernameVariable : ' USERNAME' , passwordVariable : ' PASSWORD' )]) {
114
- sh " docker login ${ gitHubRegistry} -u $USERNAME -p $PASSWORD "
115
- }
116
- sh " docker build --network=host -f Dockerfile . -t ${ gitHubRegistry} /${ gitHubRepo} :latest -t ${ gitHubRegistry} /${ gitHubRepo} :${ version} "
117
- sh " docker push ${ gitHubRegistry} /${ gitHubRepo} :${ version} "
118
- sh " docker push ${ gitHubRegistry} /${ gitHubRepo} :latest"
119
- }
120
-
121
- }
122
- }
123
- }
124
- }
1
+ @Library (value = ' jenkins-pipeline-library@master' , changelog = false ) _
2
+ pipelineOVERTURERollcall()
0 commit comments