-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
152 lines (132 loc) · 5.01 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/usr/bin/env groovy
pipeline {
agent { label 'executor-v2' }
options {
timestamps()
parallelsAlwaysFailFast()
}
triggers {
cron(getDailyCronString())
}
environment {
PDK_DISABLE_ANALYTICS = 'true'
}
stages {
stage('Validate') {
parallel {
stage('Changelog') {
steps { parseChangelog() }
}
stage('Docs') {
steps { sh './ci/gen-docs.sh' }
}
}
}
stage('Build') {
steps {
sh './ci/build.sh'
archiveArtifacts 'pkg/'
}
}
stage('Tests') {
parallel {
// Temporarily skipping Windows integration tests due to issue spinning up Jenkins executors
// stage('Setup & Hold Win2016 Node') {
// steps {
// script {
// dir("ci") {
// stash name: "expose-daemon-script", includes: "expose-daemon.ps1"
// }
// // Node used instead of agent to avoid the automatic git checkout that agent provides.
// // This is because git checkout is unreliable on windows agents
// node('executor-windows-2016-containers'){
// // because the repo is not auto checked out, fetch the configure script
// unstash "expose-daemon-script"
// powershell '.\\expose-daemon.ps1'
// env.WINDOWS_IP = powershell(returnStdout: true, script: '(curl http://169.254.169.254/latest/meta-data/local-ipv4).Content').trim()
// env.WINDOWS_DOCKER_CERT_CA = powershell(returnStdout: true, script: 'cat $env:USERPROFILE\\.docker\\ca.pem')
// env.WINDOWS_DOCKER_CERT_CERT = powershell(returnStdout: true, script: 'cat $env:USERPROFILE\\.docker\\cert.pem')
// env.WINDOWS_DOCKER_CERT_KEY = powershell(returnStdout: true, script: 'cat $env:USERPROFILE\\.docker\\key.pem')
// env.WINDOWS_READY = true
// // The windows node is terminated when the containing node block ends, so we wait until the tests are finished
// // before letting this block complete.
// waitUntil {
// return (env.MAIN_NODE_DONE == "true");
// }
// }
// }
// }
// }
// stage('Test Win2016') {
// stages {
// stage("Wait for Windows node") {
// steps {
// waitUntil {
// script {
// return (env.WINDOWS_READY == "true");
// }
// }
// script {
// env.WINDOWS_DOCKER_CERT_DIR = "${pwd()}/tmp-docker"
// }
// sh "mkdir ${env.WINDOWS_DOCKER_CERT_DIR}"
// writeFile file: "${env.WINDOWS_DOCKER_CERT_DIR}/ca.pem", text: env.WINDOWS_DOCKER_CERT_CA
// writeFile file: "${env.WINDOWS_DOCKER_CERT_DIR}/cert.pem", text: env.WINDOWS_DOCKER_CERT_CERT
// writeFile file: "${env.WINDOWS_DOCKER_CERT_DIR}/key.pem", text: env.WINDOWS_DOCKER_CERT_KEY
// sh "ls -la ${env.WINDOWS_DOCKER_CERT_DIR}"
// }
// }
// stage('Puppet 6 & Conjur 5 Integration Tests') {
// steps {
// dir('examples/puppetmaster') {
// sh '''
// MAIN_HOST_IP="$(curl http://169.254.169.254/latest/meta-data/local-ipv4)" \
// WINDOWS_DOCKER_HOST="tcp://${WINDOWS_IP}:2376" \
// WINDOWS_DOCKER_CERT_PATH="${WINDOWS_DOCKER_CERT_DIR}" \
// WINDOWS_DOCKER_TLS_VERIFY=1 \
// ./test.sh
// '''
// }
// }
// }
// }
// post {
// always {
// script {
// env.MAIN_NODE_DONE = true
// }
// }
// }
// }
stage('Linting & Unit Tests') {
steps {
sh './ci/test.sh'
}
post {
always {
junit 'spec/output/rspec.xml'
archiveArtifacts artifacts: 'spec/output/rspec.xml', fingerprint: true
cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage/coverage.xml', conditionalCoverageTargets: '100, 0, 0', failNoReports: true, failUnhealthy: true, failUnstable: false, lineCoverageTargets: '99, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '100, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
sh 'cp coverage/coverage.xml cobertura.xml'
ccCoverage("cobertura", "github.com/cyberark/conjur-puppet")
}
}
}
}
}
stage('Release Puppet module') {
// Only run this stage when triggered by a tag
when {
tag "v*"
}
steps {
sh './ci/release.sh'
}
}
}
post {
always {
cleanupAndNotify(currentBuild.currentResult)
}
}
}