Skip to content

managers/apk: Support packages.repositories[].key#905

Merged
stgraber merged 1 commit intolxc:mainfrom
nbuwe:feature-apk-keys
Mar 10, 2025
Merged

managers/apk: Support packages.repositories[].key#905
stgraber merged 1 commit intolxc:mainfrom
nbuwe:feature-apk-keys

Conversation

@nbuwe
Copy link
Copy Markdown
Contributor

@nbuwe nbuwe commented Feb 28, 2025

Not sure it it would have been better off as a feature request issue. Since I have a proposed patch, a draft PR seemed more expedient. Easy to file an issue retroactively if the procedure requires one.

This patch makes apk manager write packages.repositories[].key to /etc/apk/keys/$name if name is set.

Silently ignore entries that don't set both the name and the key so that existing configs that (ab)use (previously ignored) name as a comment don't break suddenly.

url and name+key are handled independently of each other, so you can combine them or keep them separate (one key for several repos) as necessary.

This allows for stuff like:

packages:
  manager: apk
  repositories:
    # custom repo and its key
    - url: https://localhost:8088/packages/user
      name: user-badc0ffe.rsa.pub
      key: |-
        -----BEGIN PUBLIC KEY-----
        ...

    # ci keys (common, fixed)
    - name: mergerequests@test-1057ca75.rsa.pub
      variants: [musl]
      key: |-
        -----BEGIN PUBLIC KEY-----
        ...

    - name: mergerequests@test-deadbeef.rsa.pub
      variants: [glibc]
      key: |-
        -----BEGIN PUBLIC KEY-----
        ...

    # ci ephemeral repo(s) for some MR(s)
    - url: https://ci/{{image.variant}}/mergerequests/MR-37/testing
    - url: https://ci/{{image.variant}}/mergerequests/MR-42/testing

Write key to /etc/apk/keys/$name if name is set.

Silently ignore entries that don't set both the name and the key so
that existing configs that (ab)use (previously ignored) name as a
comment don't break suddenly.

Signed-off-by: Valery Ushakov <valery.ushakov@bell-sw.com>
@stgraber stgraber marked this pull request as ready for review March 10, 2025 04:02
@stgraber stgraber merged commit 6f83902 into lxc:main Mar 10, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants