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

updata reporting wrong max version in remove-update command #366

Open
ytsssun opened this issue Feb 3, 2025 · 0 comments
Open

updata reporting wrong max version in remove-update command #366

ytsssun opened this issue Feb 3, 2025 · 0 comments

Comments

@ytsssun
Copy link
Contributor

ytsssun commented Feb 3, 2025

Platform I'm building on:
x86_64

What I expected to happen:
updata to report correct max version available in the tuf repo. (In my case it is supposed to be 1.32.0)

What actually happened:
updata reported wrong value. (In my case it showed 1.18.0)

How to reproduce the problem:

  1. Download the tuf manifest using tuftool
tuftool download \
    --metadata-url "https://updates.bottlerocket.aws/2020-07-07/aws-k8s-1.29/x86_64/" \
    --targets-url "https://updates.bottlerocket.aws/targets" \
    --root ./default.root.json \
    --target-name manifest.json \
    ./aws-k8s-1.29/x86_64/tuf_in
  1. Call updata -- remove-update
updata -- remove-update ./aws-k8s-1.29/x86_64/tuf_in/manifest.json \
  --arch x86_64 \
  --version 1.30.0 \
  --variant aws-k8s-1.29
20:08:47 [INFO] Update x86_64-aws-k8s-1.29-1.30.0 removed. Current maximum version: 1.18.0     <== Wrong version 

Sample manifest.json

{
  "updates": [
    {
      "variant": "aws-k8s-1.29",
      "arch": "x86_64",
      "version": "1.18.0",
      "max_version": "1.32.0",
      ...
    },
    ....
    {
      "variant": "aws-k8s-1.29",
      "arch": "x86_64",
      "version": "1.30.0",
      "max_version": "1.32.0",
      ...
    },
    {
      "variant": "aws-k8s-1.29",
      "arch": "x86_64",
      "version": "1.31.0",
      "max_version": "1.32.0",
      ...
    },
    {
      "variant": "aws-k8s-1.29",
      "arch": "x86_64",
      "version": "1.32.0",
      "max_version": "1.32.0",
      ...
    }
  ],
  "migrations": {
     ...
  }

The max_version in the updates field is showing correct data. But the code is referencing the version field of the first item of the updates, which is why the max version is not correctly captured. The fix could be sort the manifest and get the latest version from the manifest version, or we can simply use the max_version field.

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

No branches or pull requests

1 participant