fix: keep abra working if recipe catalogue is offline #235
Reference in New Issue
Block a user
No description provided.
Delete Branch "moritz/abra:main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In case the recipe catalogue server is not accessible most abra commands will not work anymore.
Proposal for coop-cloud/organising#292 :
Show an error and continue with the local recipe catalogue.
This way
abra app deploy -Candabra app upgrade -Cshould still work when the server is down.I'm not sure if supressing this error could lead to any unexpected behaviour.
As I could follow the flow, the following commands will use the
ReadRecipeCataloguefunciton:abra app list --statusabra app rollbackabra app upgradeabra app catalogue generateabra app versionabra app backupabra app errorsabra app restoreabra app newabra recipe lintabra recipe versionsabra recipe releaseabra recipe syncabra recipe upgrade@moritz
This is a nice approach! I had a look at the code again, perhaps we could be more specific on the kind of error return value handling from
recipeCatalogueFSIsLatest? E.g. when it does:And fails, instead of
return false, errwe can doreturn false, CatalogueOfflineError()or something. Then we can do anerrors.Is(...)check on theerr != nilcheck and do thelogrus.Error("unable to retrieve catalogue from internet, using local copy")change as you suggested here? Because some of the errors thatrecipeCatalogueFSIsLatestare valid and should result in failing to continue.One thing to check for is the "first use" case, when there is no local catalogue copy. If we do indeed fail to retrieve it from the internet we should check there is a local copy. If not, there isn't much we can do and we should fail to continue? That shouldn't happen too much ofc.
I changed it,so it catches only
CatalogueOfflineErrors.The check if there is a local copy is already present:
4e78b060e0/pkg/recipe/recipe.go (L725)LGTM
@moritz if you're happy with it, please merge away!
1892e068a3to7bba18b47b