Generate new Crystalball map if spec files added/deleted

[change-merged]
[build-registry-path=jenkins/canvas-lms/de1103]

flag = none

Test Plan:
-Jenkins passes normally, no new builds ran
-With new/deleted spec file
  -Jenkins will not run the crystalball map build
  -Jenkins will run all rspec tests, no prediction
-With new/deleted spec file and post-merge
  -Jenkins will trigger a new crystalball map build
  -main post-merge build will not wait for map build

Change-Id: I77cddacfb98c8e77798eab276fc5cf08fb524cd3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287658
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
This commit is contained in:
James Butters 2022-03-22 09:13:13 -06:00
parent 540f8839f8
commit e0841f7caa
2 changed files with 10 additions and 0 deletions

5
Jenkinsfile vendored
View File

@ -585,6 +585,11 @@ pipeline {
string(name: 'POSTGRES_IMAGE_TAG', value: "${env.POSTGRES_IMAGE_TAG}"),
])
// Trigger Crystalball map build if spec files were added or removed, will not vote on builds.
if (configuration.isChangeMerged() && filesChangedStage.hasNewDeletedSpecFiles(buildConfig)) {
build(wait: false, job: 'Canvas/proofs-of-concept/crystalball-map')
}
extendedStage('Flakey Spec Catcher')
.hooks(buildSummaryReportHooks.call())
.required(!configuration.isChangeMerged() && filesChangedStage.hasSpecFiles(buildConfig) || configuration.forceFailureFSC() == '1')

View File

@ -44,6 +44,10 @@ def hasYarnFiles(buildConfig) {
return buildConfig[STAGE_NAME].value('yarnFiles')
}
def hasNewDeletedSpecFiles(buildConfig) {
return buildConfig[STAGE_NAME].value('addedOrDeletedSpecFiles')
}
def call(stageConfig) {
def dockerDevFiles = [
'^docker-compose/',
@ -60,6 +64,7 @@ def call(stageConfig) {
stageConfig.value('groovyFiles', git.changedFiles(['.*.groovy', 'Jenkinsfile.*'], 'HEAD^'))
stageConfig.value('yarnFiles', git.changedFiles(['package.json', 'yarn.lock'], 'HEAD^'))
stageConfig.value('migrationFiles', sh(script: 'build/new-jenkins/check-for-migrations.sh', returnStatus: true) == 0)
stageConfig.value('addedOrDeletedSpecFiles', sh(script: 'git diff --name-only --diff-filter=AD HEAD^..HEAD | grep "_spec.rb"', returnStatus: true) == 0)
dir(env.LOCAL_WORKDIR) {
stageConfig.value('specFiles', sh(script: "${WORKSPACE}/build/new-jenkins/spec-changes.sh", returnStatus: true) == 0)