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

Plumb through the notion of build-time repositories. #1169

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

mattmoor
Copy link
Member

There are three interesting use cases enabled by this change:

  1. Silence ./packages warnings with our private images.

Currently for our private images, we pull private packages via GCS fuse mounted to ./packages/. This results in warnings from apk when the indices are updated today because this path does not exist.

By making ./packages a build-time only thing, this goes away.

  1. Stop leaking auth in build repository URLs into the final image

Currently it is impossible to use https://user:pass@repo style repositories without the credential leaking into the image's /etc/apk/repositories.

With this change, credentialed URLs may be passed to --build-repository-append and the credentials will only be used for the initial image construction and not be present in the final image.

  1. Enable using private APK registries with HTTP_AUTH without breaking apk update

We uncovered an unfortunate side-effect of switching from ./packages to apk.cgr.dev/chainguard-private for our packages: apk update breaks.

With the former, we get a WARNING that ./packages is not found (see 1. above).

With the latter, we get a WARNING that the caller isn't authorized, but unlike ./packages it returns a non-zero exit code breaking Dockerfile builds.

Armed with this change, we can move apk.cgr.dev/chainguard-private into our build_repositories, specify auth at build-time via HTTP_AUTH and avoid the private repository URL leaking into the final image causing apk update to break.

@mattmoor mattmoor marked this pull request as draft June 14, 2024 23:51
There are three interesting use cases enabled by this change:

1. Silence `./packages` warnings with our private images.

Currently for our private images, we pull private packages via GCS fuse mounted to `./packages/`.  This results in warnings from `apk` when the indices are updated today because this path does not exist.

By making `./packages` a build-time only thing, this goes away.

2. Stop leaking auth in build repository URLs into the final image

Currently it is impossible to use `https://user:pass@repo` style repositories without the credential leaking into the image's `/etc/apk/repositories`.

With this change, credentialed URLs may be passed to `--build-repository-append` and the credentials will only be used for the initial image construction and not be present in the final image.

3. Enable using private APK registries with `HTTP_AUTH` without breaking `apk update`

We uncovered an unfortunate side-effect of switching from `./packages` to `apk.cgr.dev/chainguard-private` for our packages: `apk update` breaks.

With the former, we get a `WARNING` that `./packages` is not found (see `1.` above).

With the latter, we get a `WARNING` that the caller isn't authorized, but unlike `./packages` it returns a non-zero exit code breaking `Dockerfile` builds.

Armed with this change, we can move `apk.cgr.dev/chainguard-private` into our `build_repositories`, specify auth at build-time via `HTTP_AUTH` and avoid the private repository URL leaking into the final image causing `apk update` to break.

Signed-off-by: Matt Moore <mattmoor@chainguard.dev>
@imjasonh imjasonh marked this pull request as ready for review June 17, 2024 14:39
@imjasonh imjasonh merged commit ac840f8 into chainguard-dev:main Jun 17, 2024
20 checks passed
imjasonh added a commit to chainguard-dev/terraform-provider-apko that referenced this pull request Jun 17, 2024
Picks up chainguard-dev/apko#1169

This lets us define repos to pull packages from at apko-build-time,
which won't be available or visible via `apk update` or `apk add`.

---------

Signed-off-by: Jason Hall <jason@chainguard.dev>
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

Successfully merging this pull request may close these issues.

3 participants