Support for publishing SQL schema from scratch, and publishing from a branch #1751
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.
Fixes #1735.
Appropriately handle the case where we're starting a new release and need to have the migrations directory created. The force flag is not required for this operation (nor should it IMO).
I also fix the job to allow us deploying from a branch, in which case the directory will just be the branch name. This is mainly for testing this PR but I can see it being useful in niche circumstances.
To cleanly accomplish this I replace
gcloud
withrclone
, for a few reasons:rclone
is a stable interface,gcloud alpha
is not.rclone
has more predictable and favorable semantics, i.e. we don't need any special handling for the case where the remote migrations directory doesn't exist.gcloud alpha
doesn't have a directory existence test function, nor does it provide any sensible way of parsing the kind of error that occurs. So to ignore a missing remote directory we have to do|| true
or doif grep "not found" <<<$OUTPUT
, neither of which are very good solutions.Expand for details on the testing I did for this:
force
flag. https://github.com/divviup/janus/actions/runs/5906628503/job/16023031038