-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
87 lines (78 loc) · 2.31 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
pipeline {
agent { label 'conjur-enterprise-common-agent' }
options {
timestamps()
buildDiscarder(logRotator(numToKeepStr: '30'))
}
triggers {
cron(getDailyCronString())
}
environment {
// Sets the MODE to the specified or autocalculated value as appropriate
MODE = release.canonicalizeMode()
}
stages {
// Aborts any builds triggered by another project that wouldn't include any changes
stage ("Skip build if triggering job didn't create a release") {
when {
expression {
MODE == "SKIP"
}
}
steps {
script {
currentBuild.result = 'ABORTED'
error("Aborting build because this build was triggered from upstream, but no release was built")
}
}
}
stage('Get InfraPool ExecutorV2 Agent(s)') {
steps{
script {
// Request ExecutorV2 agents for 1 hour(s)
INFRAPOOL_EXECUTORV2_AGENTS = getInfraPoolAgent.connected(type: "ExecutorV2", quantity: 1, duration: 1)
INFRAPOOL_EXECUTORV2_AGENT_0 = INFRAPOOL_EXECUTORV2_AGENTS[0]
INFRAPOOL_EXECUTORV2ARM_AGENTS = getInfraPoolAgent.connected(type: "ExecutorV2ARM", quantity: 1, duration: 1)
INFRAPOOL_EXECUTORV2ARM_AGENT_0 = INFRAPOOL_EXECUTORV2ARM_AGENTS[0]
}
}
}
// Generates a VERSION file based on the current build number and latest version in CHANGELOG.md
stage('Validate Changelog and set version') {
steps {
script {
updateVersion(INFRAPOOL_EXECUTORV2_AGENT_0, "CHANGELOG.md", "${BUILD_NUMBER}")
updateVersion(INFRAPOOL_EXECUTORV2ARM_AGENT_0, "CHANGELOG.md", "${BUILD_NUMBER}")
}
}
}
stage('Lint Changelog') {
steps {
script {
INFRAPOOL_EXECUTORV2_AGENT_0.agentSh 'ci/bin/validate_changelog'
}
}
}
stage('Test') {
steps {
script {
INFRAPOOL_EXECUTORV2_AGENT_0.agentSh 'ci/test'
}
}
post {
always {
script {
INFRAPOOL_EXECUTORV2_AGENT_0.agentStash name: 'rspec-results', includes: 'spec/reports/*.xml'
unstash 'rspec-results'
junit 'spec/reports/results.xml'
}
}
}
}
}
post {
always {
releaseInfraPoolAgent(".infrapool/release_agents")
}
}
}