Repository navigation
fix(backups-create): returns an error when the backup fails - #1266
Merged
Merged
Conversation
josephpage
force-pushed
the
fix/backups-create-error
branch
from
October 12, 2026 12:49
bc71677 to
e11c476
Compare
EtienneM
self-requested a review
October 13, 2026 08:19
EtienneM
approved these changes
Oct 13, 2026
EtienneM
left a comment
Member
There was a problem hiding this comment.
Thanks for your contribution
`backups-create` waits for the backup to finish and reports "Backup failed" on stderr when it ends in error, but it returns no error: the command exits with the status 0, and a CI/CD pipeline runs the next step even though the backup failed. Commands waiting for an asynchronous operation do return an error: `deployments.Stream` returns `ErrDeploymentFailed` when a deployment fails, and `apps.OperationWaiter.WaitOperation` returns an error when the operation fails, both leading to `errorQuit` and an exit code of 1. The failure is now reported by the standard error handling (`An error occurred: backup <id> failed`) instead of a custom message.
EtienneM
force-pushed
the
fix/backups-create-error
branch
from
October 13, 2026 15:16
74b8ce8 to
40d1b7a
Compare
EtienneM
enabled auto-merge
October 13, 2026 15:16
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.
Context
backups-createwaits for the backup to finish (it polls the backup status until it isdoneorerror) and prints "Backup failed" on stderr when the backup ends in error, but it returns no error:So the command exits with the status 0 even when the backup failed. In a CI/CD pipeline (the typical use case of a manual backup: back up before deploying a new version), the next step is run anyway.
Other commands do fail
Returning an error when the asynchronous operation they wait for fails is what other commands do:
deployments.Stream(used bydeployanddeployment-follow) returnsErrDeploymentFailed:apps.OperationWaiter.WaitOperation(used byrestart,scaleandrun) returns an error:In both cases the
cmdlayer callserrorQuit(ctx, err), which exits with the code 1.Changes
db.CreateBackupreturns an error when the backup does not end in thedonestatus, sobackups-createnow exits with the code 1. The failure is displayed by the standard error reporting (An error occurred: backup <id> failed) instead of the custom message.Notes
gofmtreports nothing on the modified file. I did not add a test: the repository tests pure helpers, and this path would need a mocked client (config.ScalingoClientis a package-level function). Happy to add one if you have a pattern in mind.