Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add river validate command to check for unapplied migrations #170

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

brandur
Copy link
Contributor

@brandur brandur commented Jan 22, 2024

This one's a feature request from a few months from [1] in which we add
a river validate command which fails with a non-zero exit code in case
there are unapplied migrations in the target database. As described in
the original discussion, this could be used in a project's CI to detect
and fail in the presence of a new migration that was part of a River
version update (giving people an easy way to check programmatically so
that upgrades aren't as dependent on a user successfully seeing a new
migration in the changelog).

[1] #68

@brandur brandur force-pushed the brandur-river-validate branch 10 times, most recently from 31c3470 to 353e525 Compare January 22, 2024 01:43
This one's a feature request from a few months from [1] in which we add
a `river validate` command which fails with a non-zero exit code in case
there are unapplied migrations in the target database. As described in
the original discussion, this could be used in a project's CI to detect
and fail in the presence of a new migration that was part of a River
version update (giving people an easy way to check programmatically so
that upgrades aren't as dependent on a user successfully seeing a new
migration in the changelog).

[1] #68
@@ -2,7 +2,7 @@ module github.com/riverqueue/river/cmd/river

go 1.21.4

// replace github.com/riverqueue/river => ../..
replace github.com/riverqueue/river => ../..
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncommented to demonstrate that the whole package works, but I'll have to unwind this as I'm cutting a release. We have steps in development.md that'll theoretically work for this situation ...

@brandur brandur requested a review from bgentry January 22, 2024 01:47
Copy link
Contributor

@bgentry bgentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks :shipit:

@brandur
Copy link
Contributor Author

brandur commented Jan 22, 2024

Great, thanks!

@brandur brandur merged commit ab170e7 into master Jan 22, 2024
7 checks passed
@brandur brandur deleted the brandur-river-validate branch January 22, 2024 15:52
brandur added a commit that referenced this pull request Jan 22, 2024
Here, as proposed by the new release instructions in #169, tee up some
changes for 0.0.17, updating `CHANGELOG.md` with the new section and
modifying `go.mod` files to point to the new release.

Unfortunate note no. 1: the `go.mod` files change from 0.0.15 to 0.0.17
instead of starting at 0.0.16 because I accidentally botched the last
release by not pushing the `go.mod` changes. Hopefully this new process
will correct that so it doesn't happen again.

Unfortunate note no. 2: As noted in #169, we expect the build to fail
here because `go.mod` files point to a version that doesn't have a tag
yet.

The new `river validate` is included here (#170) so I'm also going to
try a two-phase release by tagging all submodules except for
`./cmd/river` with 0.0.17 first, then modifying that submodule to point
to the new 0.0.17 in other modules, then do a cut and release for it
separately. Kind of a pain, but as discussed at length before, this
seems to be the least bad of a bunch of suboptimal options.
brandur added a commit that referenced this pull request Jan 23, 2024
Here, as proposed by the new release instructions in #169, tee up some
changes for 0.0.17, updating `CHANGELOG.md` with the new section and
modifying `go.mod` files to point to the new release.

Unfortunate note no. 1: the `go.mod` files change from 0.0.15 to 0.0.17
instead of starting at 0.0.16 because I accidentally botched the last
release by not pushing the `go.mod` changes. Hopefully this new process
will correct that so it doesn't happen again.

Unfortunate note no. 2: As noted in #169, we expect the build to fail
here because `go.mod` files point to a version that doesn't have a tag
yet.

The new `river validate` is included here (#170) so I'm also going to
try a two-phase release by tagging all submodules except for
`./cmd/river` with 0.0.17 first, then modifying that submodule to point
to the new 0.0.17 in other modules, then do a cut and release for it
separately. Kind of a pain, but as discussed at length before, this
seems to be the least bad of a bunch of suboptimal options.
brandur added a commit that referenced this pull request Jan 23, 2024
Follow up #172 by also updating the River CLI to version 0.0.17. This
must be done as a separate step because the River CLI module depends on
the main module, and therefore the 0.0.17 tag for the main module must
exist before we can lock to it from the River CLI.

The rough process here was to:

* Remove the `replace` statement added in #170 to demonstrate that the
  new `river validate` command worked.

* Modify `./cmd/river/go.mod`'s River dependency to use v0.0.17.

* Run `go mod tidy` to update `go.sum` and bump the version of the other
  River subdependencies too.
brandur added a commit that referenced this pull request Jan 23, 2024
Follow up #172 by also updating the River CLI to version 0.0.17. This
must be done as a separate step because the River CLI module depends on
the main module, and therefore the 0.0.17 tag for the main module must
exist before we can lock to it from the River CLI.

The rough process here was to:

* Remove the `replace` statement added in #170 to demonstrate that the
  new `river validate` command worked.

* Modify `./cmd/river/go.mod`'s River dependency to use v0.0.17.

* Run `go mod tidy` to update `go.sum` and bump the version of the other
  River subdependencies too.

After merging this, I'll add and push one last tag:

    export VERSION=v0.0.17
    git tag cmd/river/$VERSION -m "release cmd/river/$VERSION"
    git push --tags
brandur added a commit that referenced this pull request Jan 23, 2024
Follow up #172 by also updating the River CLI to version 0.0.17. This
must be done as a separate step because the River CLI module depends on
the main module, and therefore the 0.0.17 tag for the main module must
exist before we can lock to it from the River CLI.

The rough process here was to:

* Remove the `replace` statement added in #170 to demonstrate that the
  new `river validate` command worked.

* Modify `./cmd/river/go.mod`'s River dependency to use v0.0.17.

* Run `go mod tidy` to update `go.sum` and bump the version of the other
  River subdependencies too.

After merging this, I'll add and push one last tag:

    export VERSION=v0.0.17
    git tag cmd/river/$VERSION -m "release cmd/river/$VERSION"
    git push --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants