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

Apko.lock contains duplicated repositories when combined from multiple files #1117

Open
sfc-gh-ptabor opened this issue May 9, 2024 · 0 comments

Comments

@sfc-gh-ptabor
Copy link
Contributor

In https://github.com/chainguard-dev/rules_apko/pull/64/files/78c551af671b24f2b5c80a404005761b90147bbe#diff-9912b6950a30993bc94f913745c42a5d3b00be7b99eb96fe6f4b6342886a5420 we observed lock files to be generated with duplicates like:

    {
        "name": "dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64",
        "url": "https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz",
        "architecture": "x86_64"
      },
      {
        "name": "dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64",
        "url": "https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz",
        "architecture": "x86_64"
      },
      {
        "name": "dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64",
        "url": "https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz",
        "architecture": "x86_64"
      },

It would be better if only unique entries were placed (especially if all (name, url, arch) matches:

The code to fix is here:

repos := append([]string{}, baseIc.Contents.Repositories...)

In theory dups can be also created here (but are less likely to happen, but just for sale of consistency we can call unique here as well:

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