This repository has been archived by the owner on Apr 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJenkinsfile
67 lines (60 loc) · 1.71 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
#!groovy
@Library('github.com/teecke/jenkins-pipeline-library@v3.4.1') _
// Initialize global config
cfg = jplConfig('gp-nginx', 'docker', '', [email: env.CITEECKE_NOTIFY_EMAIL_TARGETS])
/**
* Build and publish docker images
*
* @param nextReleaseNumber String Release number to be used as tag
*/
def buildAndPublishDockerImage(nextReleaseNumber = "") {
if (nextReleaseNumber == "") {
nextReleaseNumber = sh (script: "kd get-next-release-number .", returnStdout: true).trim().substring(1)
}
docker.withRegistry("", 'teeckebot-docker-credentials') {
def customImage = docker.build("teecke/${cfg.projectName}:${nextReleaseNumber}", "--pull --no-cache statics")
customImage.push()
if (nextReleaseNumber != "beta") {
customImage.push('latest')
}
}
}
pipeline {
agent { label 'docker' }
stages {
stage ('Initialize') {
steps {
jplStart(cfg)
}
}
stage ('Bash linter') {
steps {
sh 'devcontrol run-bash-linter'
}
}
stage ('Build') {
steps {
buildAndPublishDockerImage("beta")
}
}
stage ('Make release') {
when { branch 'release/new' }
steps {
buildAndPublishDockerImage()
jplMakeRelease(cfg, true)
}
}
}
post {
always {
jplPostBuild(cfg)
}
}
options {
timestamps()
ansiColor('xterm')
buildDiscarder(logRotator(artifactNumToKeepStr: '20',artifactDaysToKeepStr: '30'))
disableConcurrentBuilds()
timeout(time: 10, unit: 'MINUTES')
}
}