Vdb 1318 CI/CD protection from out of order migrations#204
Merged
paytonrules merged 16 commits intostagingfrom Jun 10, 2020
Merged
Vdb 1318 CI/CD protection from out of order migrations#204paytonrules merged 16 commits intostagingfrom
paytonrules merged 16 commits intostagingfrom
Conversation
6e14432 to
7e1136d
Compare
elizabethengelman
approved these changes
Jun 8, 2020
Contributor
elizabethengelman
left a comment
There was a problem hiding this comment.
Looking good! 👍
These flags don't make sense in the checkMigrations command I'm currently writing. We may wish to, in the future, but anything that requires all these params in one sub-package to specify the params once.
Preliminary. This requires more testing, command line params and integration with CI.
To make it possible to test that little filter I had to add an interface (fine) but a bunch of code to copy slice of objects into a slice of interfaces (less fine). To make the GitHubfile structure match the NamedFile interface I had to make its Name field lowercase (private). Also fine, but then that meant it didn't marshal from JSON, so I had to add an internal struct with exported fields. Whew.
And test it.
Testing revealed I was mutating in place, which I did not want to do, so hooray!
You still have to point at Github though
And the new migrations
Anything that isn't shared is moved to backfill.go. This is kind of misleading since all the code is in the same package anyway, but as part of this I did need to move the PreRunPersistent in checkMigrationsCmd to be PreRun so that both the logging and initGithubParams functions are called.
Add validatemigrationorder to Makefile. The name checkmigrations has other, similar names in the Makefile related to generating migrations, so don't use that. Add an executable target to the Makefile, and depend on that for validatemigrationorder. This is more make appropriate. Make the build task always rebuild the executable, to match existing behavior.
Use wrapped errors for clarification, and use differently errors instead of reusing err.
334a33a to
3499864
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This validates that every new migration comes after those in staging, so a staging deployment shouldn't fail. It also validates that the migrations are of a valid format.