Updater is not detecting minor upgrade, when available (example: from version 1.0.0+0.0.5 to 1.0.0+0.0.11) #638

Open
opened 2024-09-09 12:39:00 +00:00 by blu · 3 comments
$ abra --version
abra version 0.9.0-beta-e3a0af5

Old version of the deployed app:

1.0.0+0.0.5
defined in the recipe, here:

compose.yml Line 35 in 56e73c981b
- "coop-cloud.${STACK_NAME}.version=1.0.0+0.0.5"

New version:

1.0.0+0.0.11
defined in the recipe, here

compose.yml Line 35 in 7d42e947b8
- "coop-cloud.${STACK_NAME}.version=1.0.0+0.0.11"

What happens now is:

  • An error message is displayed, and the upgrade is not continuing: INFO[0001] no available upgrades, you're on latest (1.0.0+0.0.5) ✌

Verbose output:

$ abra  app upgrade --debug inventory.example.net
DEBU[0000] collecting metadata from 1 servers: example.net  caller="/drone/src/pkg/config/app.go:229 LoadAppFiles"
DEBU[0000] read mapALL APP ENVS] from /home/user/.abra/servers/example.net/open-inventory.example.net.env  caller="/drone/src/pkg/config/env.go:67 ReadEnv"
DEBU[0000] read env map[ALL APP ENVS] from /home/user/.abra/servers/example.net/open-inventory.example.net.env  caller="/drone/src/pkg/config/app.go:183 ReadAppEnvFile"
DEBU[0000] retrieved {inventory.example.netopen-inventory inventory.example.netmap[ALL APP ENVS] example.net /home/user/.abra/servers/example.net/open-inventory.example.net.env} for inventory.example.net caller="/drone/src/pkg/app/app.go:22 Get"
DEBU[0000] validated inventory.example.netas app argument  caller="/drone/src/cli/internal/validate.go:93 ValidateApp"
DEBU[0000] no /home/user/.gitignore exists, skipping reading gitignore paths  caller="/drone/src/pkg/git/read.go:143 parseExcludesFile"
DEBU[0000] discovered clean git status in /home/user/.abra/recipes/open-inventory  caller="/drone/src/pkg/git/read.go:65 IsClean"
DEBU[0000] successfully checked out refs/heads/main in /home/user/.abra/recipes/open-inventory  caller="/drone/src/pkg/git/branch.go:97 CheckoutDefaultBranch"
DEBU[0000] fetched latest git changes for open-inventory  caller="/drone/src/pkg/recipe/recipe.go:647 EnsureUpToDate"
DEBU[0000] read map[ALL APP ENVS] from /home/user/.abra/recipes/open-inventory/.env.sample  caller="/drone/src/pkg/config/env.go:67 ReadEnv"
DEBU[0000] successfully checked out refs/heads/main in /home/user/.abra/catalogue  caller="/drone/src/pkg/git/branch.go:97 CheckoutDefaultBranch"
DEBU[0000] fetched latest git changes for /home/user/.abra/catalogue  caller="/drone/src/pkg/catalogue/catalogue.go:85 EnsureUpToDate"
DEBU[0000] read recipe catalogue from file system cache in /home/user/.abra/catalogue/recipes.json  caller="/drone/src/pkg/recipe/recipe.go:684 readRecipeCatalogueFS"
DEBU[0000] linting for critical errors in open-inventory configs  caller="/drone/src/pkg/lint/recipe.go:170 LintForErrors"
DEBU[0000] read map[ALL APP ENVS] from /home/user/.abra/recipes/open-inventory/.env.sample  caller="/drone/src/pkg/config/env.go:67 ReadEnv"
DEBU[0000] linting successful, open-inventory is well configured  caller="/drone/src/pkg/lint/recipe.go:192 LintForErrors"
DEBU[0000] checking whether open-inventory_example is already deployed  caller="/drone/src/cli/app/upgrade.go:89 glob..func26"
DEBU[0000] created client for example.net        caller="/drone/src/pkg/client/client.go:68 New"
DEBU[0000] commandconn: starting ssh with [-o ConnectTimeout=60 -l cloud -p 22 -- example.net docker system dial-stdio]  caller="/drone/src/pkg/upstream/commandconn/commandconn.go:49 New"
DEBU[0001] open-inventory_example has been detected as deployed with version 1.0.0+0.0.5  caller="/drone/src/pkg/upstream/stack/stack.go:119 IsDeployed"
DEBU[0001] successfully checked out refs/heads/main in /home/user/.abra/catalogue  caller="/drone/src/pkg/git/branch.go:97 CheckoutDefaultBranch"
DEBU[0001] fetched latest git changes for /home/user/.abra/catalogue  caller="/drone/src/pkg/catalogue/catalogue.go:85 EnsureUpToDate"
DEBU[0001] read recipe catalogue from file system cache in /home/user/.abra/catalogue/recipes.json  caller="/drone/src/pkg/recipe/recipe.go:684 readRecipeCatalogueFS"
WARN[0001] no published versions in catalogue, trying local recipe repository  caller="/drone/src/cli/app/upgrade.go:116 glob..func26"
DEBU[0001] attempting to open git repository in /home/user/.abra/recipes/open-inventory  caller="/drone/src/pkg/recipe/recipe.go:871 GetRecipeVersions"
DEBU[0001] processing v0.0.10 for open-inventory         caller="/drone/src/pkg/recipe/recipe.go:891 GetRecipeVersions.func1"
DEBU[0001] successfully checked out refs/tags/v0.0.10 in /home/user/.abra/recipes/open-inventory  caller="/drone/src/pkg/recipe/recipe.go:903 GetRecipeVersions.func1"
DEBU[0001] read map[ALL APP ENVS from /home/user/.abra/recipes/open-inventory/.env.sample  caller="/drone/src/pkg/config/env.go:67 ReadEnv"
DEBU[0001] successfully checked out refs/heads/main in /home/user/.abra/catalogue  caller="/drone/src/pkg/git/branch.go:97 CheckoutDefaultBranch"
DEBU[0001] fetched latest git changes for /home/user/.abra/catalogue  caller="/drone/src/pkg/catalogue/catalogue.go:85 EnsureUpToDate"
DEBU[0001] read recipe catalogue from file system cache in /home/user/.abra/catalogue/recipes.json  caller="/drone/src/pkg/recipe/recipe.go:684 readRecipeCatalogueFS"
DEBU[0001] stripped library/mariadb to mariadb for parsing  caller="/drone/src/pkg/formatter/formatter.go:69 StripTagMeta"
DEBU[0001] processing v0.0.11 for open-inventory         caller="/drone/src/pkg/recipe/recipe.go:891 GetRecipeVersions.func1"
DEBU[0001] successfully checked out refs/tags/v0.0.11 in /home/user/.abra/recipes/open-inventory  caller="/drone/src/pkg/recipe/recipe.go:903 GetRecipeVersions.func1"
DEBU[0001] read map[ALL APP ENVS] from /home/user/.abra/recipes/open-inventory/.env.sample  caller="/drone/src/pkg/config/env.go:67 ReadEnv"
DEBU[0001] successfully checked out refs/heads/main in /home/user/.abra/catalogue  caller="/drone/src/pkg/git/branch.go:97 CheckoutDefaultBranch"
DEBU[0001] fetched latest git changes for /home/user/.abra/catalogue  caller="/drone/src/pkg/catalogue/catalogue.go:85 EnsureUpToDate"
DEBU[0001] read recipe catalogue from file system cache in /home/user/.abra/catalogue/recipes.json  caller="/drone/src/pkg/recipe/recipe.go:684 readRecipeCatalogueFS"
DEBU[0001] stripped library/mariadb to mariadb for parsing  caller="/drone/src/pkg/formatter/formatter.go:69 StripTagMeta"
DEBU[0001] successfully checked out refs/heads/main in /home/user/.abra/recipes/open-inventory  caller="/drone/src/pkg/git/branch.go:97 CheckoutDefaultBranch"
DEBU[0001] collected [map[v0.0.10:map[app:{eotl/open-inventory 0.0.10} db:{mariadb 10.5}]] map[v0.0.11:map[app:{eotl/open-inventory 0.0.10} db:{mariadb 10.5}]]] for open-inventory  caller="/drone/src/pkg/recipe/recipe.go:950 GetRecipeVersions"
INFO[0001] no available upgrades, you're on latest (1.0.0+0.0.5) ✌  caller="/drone/src/cli/app/upgrade.go:166 glob..func26"

What I wish abra to do, instead of erroring, is:

  • To detect that there is an upgrade, and to offer to upgrade the instance.
Tech details

the function responsible for this seems to be in the updater.go,

this line seems not working properly: versionDelta, err := parsedDeployedVersion.UpgradeDelta(parsedVersion)
from this package: https://git.coopcloud.tech/coop-cloud/tagcmp

--> it is not seeing
1.0.0+0.0.11
as bigger than 1.0.0+0.0.5

and then, based on that output, abra assumes that the app is already running on the last version

extract from updater.go

	var availableUpgrades []string
	for _, version := range versions {
		parsedDeployedVersion, err := tagcmp.Parse(deployedVersion)
		if err != nil {
			return nil, err
		}

		parsedVersion, err := tagcmp.Parse(version)
		if err != nil {
			return nil, err
		}

		versionDelta, err := parsedDeployedVersion.UpgradeDelta(parsedVersion)
		if err != nil {
			return nil, err
		}

		if 0 < versionDelta.UpgradeType() && (versionDelta.UpgradeType() < 4 || majorUpdate) {
			availableUpgrades = append(availableUpgrades, version)
		}
	}
``` $ abra --version abra version 0.9.0-beta-e3a0af5 ``` #### Old version of the deployed app: 1.0.0+0.0.5 defined in the recipe, here: https://git.coopcloud.tech/coop-cloud/open-inventory/src/commit/56e73c981b41455b5b8f52ae8f243ea5c8595ba8/compose.yml#L35 #### New version: 1.0.0+0.0.11 defined in the recipe, here https://git.coopcloud.tech/coop-cloud/open-inventory/src/commit/7d42e947b8086f9ef11679171fbadb6599f5aaaa/compose.yml#L35 **What happens now is:** - An error message is displayed, and the upgrade is not continuing: `INFO[0001] no available upgrades, you're on latest (1.0.0+0.0.5) ✌` Verbose output: ``` $ abra app upgrade --debug inventory.example.net DEBU[0000] collecting metadata from 1 servers: example.net caller="/drone/src/pkg/config/app.go:229 LoadAppFiles" DEBU[0000] read mapALL APP ENVS] from /home/user/.abra/servers/example.net/open-inventory.example.net.env caller="/drone/src/pkg/config/env.go:67 ReadEnv" DEBU[0000] read env map[ALL APP ENVS] from /home/user/.abra/servers/example.net/open-inventory.example.net.env caller="/drone/src/pkg/config/app.go:183 ReadAppEnvFile" DEBU[0000] retrieved {inventory.example.netopen-inventory inventory.example.netmap[ALL APP ENVS] example.net /home/user/.abra/servers/example.net/open-inventory.example.net.env} for inventory.example.net caller="/drone/src/pkg/app/app.go:22 Get" DEBU[0000] validated inventory.example.netas app argument caller="/drone/src/cli/internal/validate.go:93 ValidateApp" DEBU[0000] no /home/user/.gitignore exists, skipping reading gitignore paths caller="/drone/src/pkg/git/read.go:143 parseExcludesFile" DEBU[0000] discovered clean git status in /home/user/.abra/recipes/open-inventory caller="/drone/src/pkg/git/read.go:65 IsClean" DEBU[0000] successfully checked out refs/heads/main in /home/user/.abra/recipes/open-inventory caller="/drone/src/pkg/git/branch.go:97 CheckoutDefaultBranch" DEBU[0000] fetched latest git changes for open-inventory caller="/drone/src/pkg/recipe/recipe.go:647 EnsureUpToDate" DEBU[0000] read map[ALL APP ENVS] from /home/user/.abra/recipes/open-inventory/.env.sample caller="/drone/src/pkg/config/env.go:67 ReadEnv" DEBU[0000] successfully checked out refs/heads/main in /home/user/.abra/catalogue caller="/drone/src/pkg/git/branch.go:97 CheckoutDefaultBranch" DEBU[0000] fetched latest git changes for /home/user/.abra/catalogue caller="/drone/src/pkg/catalogue/catalogue.go:85 EnsureUpToDate" DEBU[0000] read recipe catalogue from file system cache in /home/user/.abra/catalogue/recipes.json caller="/drone/src/pkg/recipe/recipe.go:684 readRecipeCatalogueFS" DEBU[0000] linting for critical errors in open-inventory configs caller="/drone/src/pkg/lint/recipe.go:170 LintForErrors" DEBU[0000] read map[ALL APP ENVS] from /home/user/.abra/recipes/open-inventory/.env.sample caller="/drone/src/pkg/config/env.go:67 ReadEnv" DEBU[0000] linting successful, open-inventory is well configured caller="/drone/src/pkg/lint/recipe.go:192 LintForErrors" DEBU[0000] checking whether open-inventory_example is already deployed caller="/drone/src/cli/app/upgrade.go:89 glob..func26" DEBU[0000] created client for example.net caller="/drone/src/pkg/client/client.go:68 New" DEBU[0000] commandconn: starting ssh with [-o ConnectTimeout=60 -l cloud -p 22 -- example.net docker system dial-stdio] caller="/drone/src/pkg/upstream/commandconn/commandconn.go:49 New" DEBU[0001] open-inventory_example has been detected as deployed with version 1.0.0+0.0.5 caller="/drone/src/pkg/upstream/stack/stack.go:119 IsDeployed" DEBU[0001] successfully checked out refs/heads/main in /home/user/.abra/catalogue caller="/drone/src/pkg/git/branch.go:97 CheckoutDefaultBranch" DEBU[0001] fetched latest git changes for /home/user/.abra/catalogue caller="/drone/src/pkg/catalogue/catalogue.go:85 EnsureUpToDate" DEBU[0001] read recipe catalogue from file system cache in /home/user/.abra/catalogue/recipes.json caller="/drone/src/pkg/recipe/recipe.go:684 readRecipeCatalogueFS" WARN[0001] no published versions in catalogue, trying local recipe repository caller="/drone/src/cli/app/upgrade.go:116 glob..func26" DEBU[0001] attempting to open git repository in /home/user/.abra/recipes/open-inventory caller="/drone/src/pkg/recipe/recipe.go:871 GetRecipeVersions" DEBU[0001] processing v0.0.10 for open-inventory caller="/drone/src/pkg/recipe/recipe.go:891 GetRecipeVersions.func1" DEBU[0001] successfully checked out refs/tags/v0.0.10 in /home/user/.abra/recipes/open-inventory caller="/drone/src/pkg/recipe/recipe.go:903 GetRecipeVersions.func1" DEBU[0001] read map[ALL APP ENVS from /home/user/.abra/recipes/open-inventory/.env.sample caller="/drone/src/pkg/config/env.go:67 ReadEnv" DEBU[0001] successfully checked out refs/heads/main in /home/user/.abra/catalogue caller="/drone/src/pkg/git/branch.go:97 CheckoutDefaultBranch" DEBU[0001] fetched latest git changes for /home/user/.abra/catalogue caller="/drone/src/pkg/catalogue/catalogue.go:85 EnsureUpToDate" DEBU[0001] read recipe catalogue from file system cache in /home/user/.abra/catalogue/recipes.json caller="/drone/src/pkg/recipe/recipe.go:684 readRecipeCatalogueFS" DEBU[0001] stripped library/mariadb to mariadb for parsing caller="/drone/src/pkg/formatter/formatter.go:69 StripTagMeta" DEBU[0001] processing v0.0.11 for open-inventory caller="/drone/src/pkg/recipe/recipe.go:891 GetRecipeVersions.func1" DEBU[0001] successfully checked out refs/tags/v0.0.11 in /home/user/.abra/recipes/open-inventory caller="/drone/src/pkg/recipe/recipe.go:903 GetRecipeVersions.func1" DEBU[0001] read map[ALL APP ENVS] from /home/user/.abra/recipes/open-inventory/.env.sample caller="/drone/src/pkg/config/env.go:67 ReadEnv" DEBU[0001] successfully checked out refs/heads/main in /home/user/.abra/catalogue caller="/drone/src/pkg/git/branch.go:97 CheckoutDefaultBranch" DEBU[0001] fetched latest git changes for /home/user/.abra/catalogue caller="/drone/src/pkg/catalogue/catalogue.go:85 EnsureUpToDate" DEBU[0001] read recipe catalogue from file system cache in /home/user/.abra/catalogue/recipes.json caller="/drone/src/pkg/recipe/recipe.go:684 readRecipeCatalogueFS" DEBU[0001] stripped library/mariadb to mariadb for parsing caller="/drone/src/pkg/formatter/formatter.go:69 StripTagMeta" DEBU[0001] successfully checked out refs/heads/main in /home/user/.abra/recipes/open-inventory caller="/drone/src/pkg/git/branch.go:97 CheckoutDefaultBranch" DEBU[0001] collected [map[v0.0.10:map[app:{eotl/open-inventory 0.0.10} db:{mariadb 10.5}]] map[v0.0.11:map[app:{eotl/open-inventory 0.0.10} db:{mariadb 10.5}]]] for open-inventory caller="/drone/src/pkg/recipe/recipe.go:950 GetRecipeVersions" INFO[0001] no available upgrades, you're on latest (1.0.0+0.0.5) ✌ caller="/drone/src/cli/app/upgrade.go:166 glob..func26" ``` **What I wish abra to do, instead of erroring, is:** - To detect that there is an upgrade, and to offer to upgrade the instance. ##### Tech details the function responsible for this seems to be in the updater.go, this line seems not working properly: `versionDelta, err := parsedDeployedVersion.UpgradeDelta(parsedVersion)` from this package: https://git.coopcloud.tech/coop-cloud/tagcmp --> it is not seeing 1.0.0+0.0.11 as bigger than 1.0.0+0.0.5 and then, based on that output, abra assumes that the app is already running on the last version extract from updater.go ```go var availableUpgrades []string for _, version := range versions { parsedDeployedVersion, err := tagcmp.Parse(deployedVersion) if err != nil { return nil, err } parsedVersion, err := tagcmp.Parse(version) if err != nil { return nil, err } versionDelta, err := parsedDeployedVersion.UpgradeDelta(parsedVersion) if err != nil { return nil, err } if 0 < versionDelta.UpgradeType() && (versionDelta.UpgradeType() < 4 || majorUpdate) { availableUpgrades = append(availableUpgrades, version) } } ```
blu added the
bug
label 2024-09-09 12:39:00 +00:00
Owner

All of the versioning stuff relies on the recipe catalogue, which doesn't seem to include open-inventory:

➜ curl https://recipes.coopcloud.tech/recipes.json | grep inventory
...

My guess is that it's because the open-inventory recipe repo doesn't include the recipe"topic" label. Adding that, and regenerating the recipe catalogue (either by waiting for the daily regen, or by launching a new build of auto-recipes-catalogue-json on Drone), should fix it.

All of the versioning stuff relies on the recipe catalogue, which doesn't seem to include open-inventory: ``` ➜ curl https://recipes.coopcloud.tech/recipes.json | grep inventory ... ``` My guess is that it's because the open-inventory recipe repo doesn't include the `recipe`"topic" label. Adding that, and regenerating the recipe catalogue (either by waiting for the daily regen, or by launching a new build of `auto-recipes-catalogue-json` [on Drone](https://build.coopcloud.tech/coop-cloud/auto-recipes-catalogue-json)), should fix it.

The recipe version should always be bumped as well (with abra recipe sync), so the correct upgrade version should have been e.g. 1.0.1+0.0.11.

To handle this problem, I think it would be more correct if abra release will fail if there is already a published version with the same first part of the version (here 1.0.0)

The recipe version should always be bumped as well (with `abra recipe sync`), so the correct upgrade version should have been e.g. `1.0.1+0.0.11`. To handle this problem, I think it would be more correct if `abra release` will fail if there is already a published version with the same first part of the version (here `1.0.0`)
Owner

We're in a bit of a transition moment with how we're doing recipe releasing, so thanks for patience on this one. Will try to come back on this when the dust settles and the new abra release is out and the migration dust settles #666.

We're in a bit of a transition moment with how we're doing recipe releasing, so thanks for patience on this one. Will try to come back on this when the dust settles and the new `abra` release is out and the migration dust settles https://git.coopcloud.tech/toolshed/organising/issues/666.
Sign in to join this conversation.
No description provided.