@@ -58,143 +58,156 @@ pipeline {
58
58
VECTOR_TARGET = " ${ BRANCH_BUILD} -target"
59
59
VECTOR_CARGO_CACHE = " ${ BRANCH_BUILD} -cargo"
60
60
VECTOR_RUSTUP_CACHE = " ${ BRANCH_BUILD} -rustup"
61
+ TOP_COMMIT = sh(
62
+ script : ' git log --pretty="format:%s by %cn" HEAD | head -1' ,
63
+ returnStdout : true
64
+ ). trim()
61
65
}
62
66
stages {
63
- stage(' Release Tool' ) {
64
- steps {
65
- sh ' make release-tool'
66
- }
67
- }
68
- stage(' Lint and test release' ){
69
- tools {
70
- nodejs ' NodeJS 20'
71
- }
72
- environment {
73
- GIT_BRANCH = " ${ CURRENT_BRANCH} "
74
- // This is not populated on PR builds and is needed for the release dry runs
75
- BRANCH_NAME = " ${ CURRENT_BRANCH} "
76
- CHANGE_ID = " "
67
+ stage(' Continue?' ) {
68
+ // Do not run the stages on a release commit, unless it's for a sanity build.
69
+ when {
70
+ anyOf {
71
+ expression { ! (env. TOP_COMMIT ==~ / ^chore\( release\) : \d +\.\d +\.\d + \[ skip ci\] by LogDNA Bot$/ ) }
72
+ environment name : ' SANITY_BUILD' , value : ' true'
73
+ }
77
74
}
78
- steps {
79
- script {
80
- configFileProvider(NPMRC ) {
81
- sh ' npm ci'
82
- sh ' npm run release:dry'
75
+ stages {
76
+ stage(' Release Tool' ) {
77
+ steps {
78
+ sh ' make release-tool'
83
79
}
84
80
}
85
- sh ' ./release-tool lint'
86
- sh ' ./release-tool test'
87
- }
88
- }
89
- stage(' Unit test' ){
90
- // Important: do one step serially since it'll be the one to prepare the testing container
91
- // and install the rust toolchain in it. Volume mounts are created here, too.
92
- steps {
93
- sh """
94
- make test ENVIRONMENT=true
95
- """
96
- }
97
- }
98
- stage(' Checks' ) {
99
- // All `make ENVIRONMENT=true` steps should now use the existing container
100
- parallel {
101
- stage(' check-clippy' ){
81
+ stage(' Lint and test release' ){
82
+ tools {
83
+ nodejs ' NodeJS 20'
84
+ }
85
+ environment {
86
+ GIT_BRANCH = " ${ CURRENT_BRANCH} "
87
+ // This is not populated on PR builds and is needed for the release dry runs
88
+ BRANCH_NAME = " ${ CURRENT_BRANCH} "
89
+ CHANGE_ID = " "
90
+ }
102
91
steps {
103
- sh """
104
- make check-clippy ENVIRONMENT=true
105
- make check-scripts ENVIRONMENT=true
106
- """
92
+ script {
93
+ configFileProvider(NPMRC ) {
94
+ sh ' npm ci'
95
+ sh ' npm run release:dry'
96
+ }
97
+ }
98
+ sh ' ./release-tool lint'
99
+ sh ' ./release-tool test'
107
100
}
108
101
}
109
- stage(' check-fmt ' ){
110
- // Important: do this step serially since it'll be the one to prepare the testing container
102
+ stage(' Unit test ' ){
103
+ // Important: do one step serially since it'll be the one to prepare the testing container
111
104
// and install the rust toolchain in it. Volume mounts are created here, too.
112
105
steps {
113
106
sh """
114
- make check ENVIRONMENT=true
115
- make check-fmt ENVIRONMENT=true
107
+ make test ENVIRONMENT=true
116
108
"""
117
109
}
118
110
}
119
- stage(' check-deny' ){
120
- steps {
121
- catchError(buildResult : ' SUCCESS' , stageResult : ' FAILURE' ) {
122
- sh """
123
- make check-deny ENVIRONMENT=true
124
- """
111
+ stage(' Checks' ) {
112
+ // All `make ENVIRONMENT=true` steps should now use the existing container
113
+ parallel {
114
+ stage(' check-clippy' ){
115
+ steps {
116
+ sh """
117
+ make check-clippy ENVIRONMENT=true
118
+ make check-scripts ENVIRONMENT=true
119
+ """
120
+ }
121
+ }
122
+ stage(' check-fmt' ){
123
+ steps {
124
+ sh """
125
+ make check ENVIRONMENT=true
126
+ make check-fmt ENVIRONMENT=true
127
+ """
128
+ }
129
+ }
130
+ stage(' check-deny' ){
131
+ steps {
132
+ catchError(buildResult : ' SUCCESS' , stageResult : ' FAILURE' ) {
133
+ sh """
134
+ make check-deny ENVIRONMENT=true
135
+ """
136
+ }
137
+ }
138
+ }
139
+ stage(' image test' ) {
140
+ when {
141
+ changeRequest() // Only do this during PRs because it can take 30 minutes
142
+ }
143
+ steps {
144
+ script {
145
+ buildx. build(
146
+ project : PROJECT_NAME
147
+ , push : false
148
+ , tags : [BRANCH_BUILD ]
149
+ , dockerfile : " distribution/docker/mezmo/Dockerfile"
150
+ )
151
+ }
152
+ }
125
153
}
126
154
}
127
155
}
128
- stage(' image test ' ) {
156
+ stage(' Feature build and publish ' ) {
129
157
when {
130
- changeRequest() // Only do this during PRs because it can take 30 minutes
158
+ expression {
159
+ CURRENT_BRANCH ==~ / feature\/ LOG-\d +/
160
+ }
131
161
}
132
162
steps {
133
163
script {
164
+ def tag = slugify(" ${ CURRENT_BRANCH} -${ BUILD_NUMBER} " )
134
165
buildx. build(
135
166
project : PROJECT_NAME
136
- , push : false
137
- , tags : [BRANCH_BUILD ]
167
+ , push : true
168
+ , tags : [tag ]
138
169
, dockerfile : " distribution/docker/mezmo/Dockerfile"
139
170
)
140
171
}
172
+ sh ' ./release-tool clean'
173
+ sh ' ./release-tool build'
174
+ sh ' ./release-tool publish'
141
175
}
142
176
}
143
- }
144
- }
145
- stage(' Feature build and publish' ) {
146
- when {
147
- expression {
148
- CURRENT_BRANCH ==~ / feature\/ LOG-\d +/
149
- }
150
- }
151
- steps {
152
- script {
153
- def tag = slugify(" ${ CURRENT_BRANCH} -${ BUILD_NUMBER} " )
154
- buildx. build(
155
- project : PROJECT_NAME
156
- , push : true
157
- , tags : [tag]
158
- , dockerfile : " distribution/docker/mezmo/Dockerfile"
159
- )
160
- }
161
- sh ' ./release-tool clean'
162
- sh ' ./release-tool build'
163
- sh ' ./release-tool publish'
164
- }
165
- }
166
- stage(' Release and publish' ) {
167
- when {
168
- branch DEFAULT_BRANCH
169
- not {
170
- environment name : ' SANITY_BUILD' , value : ' true'
171
- }
172
- }
173
- tools {
174
- nodejs ' NodeJS 20'
175
- }
176
- steps {
177
- script {
178
- configFileProvider(NPMRC ) {
179
- sh ' npm ci'
180
- sh ' npm run release'
177
+ stage(' Release and publish' ) {
178
+ when {
179
+ branch DEFAULT_BRANCH
180
+ not {
181
+ environment name : ' SANITY_BUILD' , value : ' true'
182
+ }
183
+ }
184
+ tools {
185
+ nodejs ' NodeJS 20'
181
186
}
187
+ steps {
188
+ script {
189
+ configFileProvider(NPMRC ) {
190
+ sh ' npm ci'
191
+ sh ' npm run release'
192
+ }
182
193
183
- def tag = sh (
184
- script : " ./release-tool debug-RELEASE_VERSION" ,
185
- returnStdout : true
186
- ). split(' = ' )[1 ]. trim()
194
+ def tag = sh (
195
+ script : " ./release-tool debug-RELEASE_VERSION" ,
196
+ returnStdout : true
197
+ ). split(' = ' )[1 ]. trim()
187
198
188
- buildx. build(
189
- project : PROJECT_NAME
190
- , push : true
191
- , tags : [tag]
192
- , dockerfile : " distribution/docker/mezmo/Dockerfile"
193
- )
199
+ buildx. build(
200
+ project : PROJECT_NAME
201
+ , push : true
202
+ , tags : [tag]
203
+ , dockerfile : " distribution/docker/mezmo/Dockerfile"
204
+ )
205
+ }
206
+ sh ' ./release-tool clean'
207
+ sh ' ./release-tool build'
208
+ sh ' ./release-tool publish'
209
+ }
194
210
}
195
- sh ' ./release-tool clean'
196
- sh ' ./release-tool build'
197
- sh ' ./release-tool publish'
198
211
}
199
212
}
200
213
}
0 commit comments