@@ -188,22 +188,21 @@ pipeline {
188
188
def isMajor = env. RELEASE_VERSION . endsWith(" .0.0" )
189
189
if (isMajor) {
190
190
// major release, create '.x' branch
191
- sh(script : """
192
- git fetch origin ${ RELEASE_TAG} # ensure remote tag is fetched for local checkout
193
- git checkout ${ RELEASE_TAG}
194
- git checkout -b ${ BRANCH_DOT_X}
195
- """ )
191
+ sh(label : " remote tag is fetched for local checkout" , script : " git fetch origin ${ RELEASE_TAG} " )
192
+ sh(label : " create .x branch from ${ RELEASE_TAG} " , script : """
193
+ git checkout ${ RELEASE_TAG} --force
194
+ git checkout -b ${ BRANCH_DOT_X} --force""" )
196
195
gitPush()
197
196
input message : " This was a major version release. Please update the conf.yml in the docs repo before continuing" , ok " Continue"
198
197
} else {
199
198
// minor release, force-update existing '.x' branch. any change applied to '.x' branch, for example to
200
199
// fix doc or release notes should also have been applied to master/stable branch we are releasing from
201
- sh(script : """
202
- git fetch origin ${ BRANCH_DOT_X} # ensure remote branch is fetched for local checkout
203
- git fetch origin ${ RELEASE_TAG} # ensure remote tag is fetched for local checkout
204
- git checkout --track origin/ ${ BRANCH_DOT_X }
205
- git reset --hard ${ RELEASE_TAG }
206
- """ )
200
+ sh(label : " remote tag and branch are fetched for local checkout " , script : """
201
+ git fetch origin ${ BRANCH_DOT_X}
202
+ git fetch origin ${ RELEASE_TAG} """ )
203
+ sh( label : " force-update .x branch from ${ RELEASE_TAG } " , script : """
204
+ git checkout --track origin/ ${ BRANCH_DOT_X } --force
205
+ git reset --hard ${ RELEASE_TAG } """ )
207
206
gitPush(args : " -f ${ BRANCH_DOT_X} " )
208
207
}
209
208
}
@@ -214,10 +213,8 @@ pipeline {
214
213
dir(" ${ BASE_DIR} " ) {
215
214
// restore git state before updating .x branch, otherwise later external scripts will use
216
215
// the version when the tag was created, which might not match the release branch state
217
- sh(script : """
218
- git fetch origin ${ BRANCH_SPECIFIER} # ensure remote branch is fetched for local checkout
219
- git checkout --track origin/${ BRANCH_SPECIFIER}
220
- """ )
216
+ sh(label : " remote branch is fetched for local checkout" , script : " git fetch origin ${ BRANCH_SPECIFIER} " )
217
+ sh(label : " restore to previous updating version" , script : " git checkout --track origin/${ BRANCH_SPECIFIER} " )
221
218
}
222
219
}
223
220
}
0 commit comments