-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
87 lines (82 loc) · 3.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
#!groovy
def workerNode = "devel11"
pipeline {
agent { label workerNode }
tools {
// refers to the name set in manage jenkins -> global tool configuration
maven "Maven 3"
}
triggers {
pollSCM("H/03 * * * *")
upstream(upstreamProjects: "Docker-payara5-bump-trigger",
threshold: hudson.model.Result.SUCCESS)
}
options {
timestamps()
}
environment {
GITLAB_PRIVATE_TOKEN = credentials("metascrum-gitlab-api-token")
}
stages {
stage("clear workspace") {
steps {
deleteDir()
checkout scm
}
}
stage("verify") {
steps {
sh "mvn verify pmd:pmd"
junit "**/target/surefire-reports/TEST-*.xml,**/target/failsafe-reports/TEST-*.xml"
}
}
stage("publish pmd results") {
steps {
step([$class : 'hudson.plugins.pmd.PmdPublisher',
pattern : '**/target/pmd.xml',
unstableTotalAll: "0",
failedTotalAll : "0"])
}
}
stage("docker build") {
steps {
script {
def repo = "docker-metascrum.artifacts.dbccloud.dk"
def name = "hydra-service"
def version = env.BRANCH_NAME + '-' + env.BUILD_NUMBER
def image = docker.build("${repo}/${name}:${version}")
image.push()
if (env.BRANCH_NAME ==~ /master|trunk/) {
image.push("DIT-${env.BUILD_NUMBER}")
}
}
}
}
stage("Update DIT") {
agent {
docker {
label workerNode
image "docker-dbc.artifacts.dbccloud.dk/build-env:latest"
alwaysPull true
}
}
when {
expression {
(currentBuild.result == null || currentBuild.result == 'SUCCESS') && env.BRANCH_NAME == 'master'
}
}
steps {
script {
dir("deploy") {
sh """
set-new-version services/rawrepo/rawrepo-hydra-tmpl.yml ${env.GITLAB_PRIVATE_TOKEN} metascrum/dit-gitops-secrets DIT-${env.BUILD_NUMBER} -b master
set-new-version rawrepo-hydra-basismig.yml ${env.GITLAB_PRIVATE_TOKEN} metascrum/rawrepo-hydra-deploy DIT-${env.BUILD_NUMBER} -b basismig
set-new-version rawrepo-hydra-fbstest.yml ${env.GITLAB_PRIVATE_TOKEN} metascrum/rawrepo-hydra-deploy DIT-${env.BUILD_NUMBER} -b fbstest
set-new-version rawrepo-hydra-metascrum-staging.yml ${env.GITLAB_PRIVATE_TOKEN} metascrum/rawrepo-hydra-deploy DIT-${env.BUILD_NUMBER} -b metascrum-staging
"""
}
}
}
}
}
}