don't run prediction in post-merge

do not run crystalball prediction in post-merge
and wrap in try/catch to not fail build while
still testing crystalball

flag = none

Test Plan:
-Jenkins passes

Change-Id: I33bb4ee2bf6107456e1d85614b0a3c9c994f1e2e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282773
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
Reviewed-by: Brian Watson <bwatson@instructure.com>
This commit is contained in:
James Butters 2022-01-13 09:39:52 -07:00
parent 46aa4764f1
commit dcb9c45d3b
2 changed files with 17 additions and 12 deletions

27
Jenkinsfile vendored
View File

@ -427,19 +427,24 @@ pipeline {
extendedStage('Generate Crystalball Prediction')
.hooks(buildSummaryReportHooks.call())
.obeysAllowStages(false)
.required(!configuration.isChangeMerged())
.timeout(2)
.execute {
/* groovylint-disable-next-line GStringExpressionWithinString */
sh '''
diffFrom=\$(git rev-parse ${GERRIT_PATCHSET_REVISION}^1)
docker run --name=crystal --volume \$(pwd)/.git:/usr/src/app/.git \
-e CRYSTALBALL_DIFF_FROM=${diffFrom} \
-e CRYSTALBALL_DIFF_TO=${GERRIT_PATCHSET_REVISION} \
$PATCHSET_TAG bundle exec crystalball --dry-run
docker cp \$(docker ps -qa -f name=crystal):/usr/src/app/crystalball_spec_list.txt ./tmp/crystalball_spec_list.txt
ls -a tmp/
'''
archiveArtifacts allowEmptyArchive: true, artifacts: 'tmp/crystalball_spec_list.txt'
try {
/* groovylint-disable-next-line GStringExpressionWithinString */
sh '''
diffFrom=\$(git rev-parse ${GERRIT_PATCHSET_REVISION}^1)
docker run --name=crystal --volume \$(pwd)/.git:/usr/src/app/.git \
-e CRYSTALBALL_DIFF_FROM=${diffFrom} \
-e CRYSTALBALL_DIFF_TO=${GERRIT_PATCHSET_REVISION} \
$PATCHSET_TAG bundle exec crystalball --dry-run
docker cp \$(docker ps -qa -f name=crystal):/usr/src/app/crystalball_spec_list.txt ./tmp/crystalball_spec_list.txt
'''
archiveArtifacts allowEmptyArchive: true, artifacts: 'tmp/crystalball_spec_list.txt'
/* groovylint-disable-next-line CatchException */
} catch (Exception e) {
// don't fail build for this
}
}
extendedStage('Parallel Run Tests').obeysAllowStages(false).execute { stageConfig, buildConfig ->

View File

@ -195,7 +195,7 @@ pipeline {
rspecNodeTotal.times { index ->
extendedStage("RSpecQ Rspec Set ${(index + 1).toString().padLeft(2, '0')}")
.envVars(["CI_NODE_INDEX=$index", "CRYSTAL_BALL_SPECS=.", "BUILD_NAME=${env.JOB_NAME}_build${env.BUILD_NUMBER}_rspec"])
.envVars(["CI_NODE_INDEX=$index", 'CRYSTAL_BALL_SPECS=.', "BUILD_NAME=${env.JOB_NAME}_build${env.BUILD_NUMBER}_rspec"])
.hooks(postStageHandler + [onNodeAcquired: { rspecStage.setupNode() }, onNodeReleasing: { rspecStage.tearDownNode('rspec') }])
.required(env.ENABLE_CRYSTALBALL != '1') /* don't run again, already running in regular build */
.nodeRequirements(rspecNodeRequirements)