Trigger CDC schema tests if a migration is present

If a migration is present in the commit, this triggers
a build that checks if the migration will break things
for CDC/Canvas Data 2.

test plan:
- Verify that, if a migration adds a new column, the
  CDC Schema Check step fails in the build (like in
  build 4636, a previous version of this commit which
  had a migration added)
- If a migration renames a column that CDC doesn't
  care about, the CDC Schema Check step runs but
  does not fail.
- If a commit has no migration in it, the CDC Schema
  Check step doesn't run.

Change-Id: Ibe33955d11ef62bf68b8dd4cdb838cf2dad126e8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240916
Reviewed-by: James Butters <jbutters@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
This commit is contained in:
Tucker McKnight 2020-06-23 00:16:12 -06:00 committed by Tucker Mcknight
parent b6dc6ebb68
commit eee0b0d4bc
2 changed files with 17 additions and 0 deletions

12
Jenkinsfile vendored
View File

@ -347,6 +347,18 @@ pipeline {
}
}
if (sh(script: 'build/new-jenkins/check-for-migrations.sh', returnStatus: true) == 0) {
echo 'adding CDC Schema check'
stages['CDC Schema Check'] = {
build job: '../Canvas/cdc-event-transformer-master', parameters: [
string(name: 'CANVAS_LMS_IMAGE_TAG', value: "${env.NAME}-${env.TAG_SUFFIX}")
]
}
}
else {
echo 'no migrations added, skipping CDC Schema check'
}
if (env.GERRIT_EVENT_TYPE != 'change-merged' && (sh(script: 'build/new-jenkins/spec-changes.sh', returnStatus: true) == 0)) {
echo 'adding Flakey Spec Catcher'
stages['Flakey Spec Catcher'] = {

View File

@ -0,0 +1,5 @@
#!/bin/bash
# grep will exit with code 0 if any commits between origin/master and
# HEAD contain db/migrate.
git show --pretty="" --name-only origin/master..HEAD | grep "db/migrate"