Skip to content

Conversation

@carolynvs
Copy link
Member

@carolynvs carolynvs commented Feb 14, 2023

What does this change

At build time, Porter needs the repository digest of each referenced image from porter.yaml. We update the referenced images in the final porter.yaml generated to .cnab/app/porter.yaml with the digest, so that the bundle is "pinned" to a specific image that can't be messed up by a force push over an existing tag for example.

I have updated how we do this so that instead of pulling the entire referenced image, we just call HEAD on the image to get its repository digest.

Previously when we pulled images during build, we always allowed insecure registries (because the underlying implementation didn't support making that configurable). Now that we are executing a HEAD request instead to get the digest, instead of pulling the image with PullImage, we can be more explicit like we are with the publish command.

I have added --insecure-registry to porter build, so that the bundle author can decide when building if they want to allow connections to an insecure registry (http or self-signed certificates).

What issue does it fix

Closes #2576

Notes for the reviewer

N/A

Checklist

  • Did you write tests?
  • Did you write documentation? (updated cli docs for porter build)
  • Did you change porter.yaml or a storage document record? Update the corresponding schema file.
  • If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

Reviewer Checklist

  • Comment with /azp run test-porter-release if a magefile or build script was modified
  • Comment with /azp run porter-integration if it's a non-trivial PR

@carolynvs carolynvs force-pushed the build-ref-digest-perf branch from 1f0ca1b to 13a45d2 Compare April 7, 2023 19:06
@carolynvs carolynvs changed the title Only retrieve referenced image digest during build Do not pull referenced images during build Apr 7, 2023
At build time, Porter needs the repository digest of each referenced bundle from porter.yaml. We update the referenced images in the final porter.yaml generated to .cnab/app/porter.yaml with the digest, so that the bundle is "pinned" to a specific image that can't be messed up by a force push over an existing tag for example.

I have updated how we do this so that instead of pulling the entire referenced image, we just call HEAD on the image to get its repository digest.

Signed-off-by: Carolyn Van Slyck <[email protected]>
When porter builds a bundle, we lookup the repository digest of any referenced images. Previously we did that with Pull, which always allowed connections to insecure registries. Now that we are executing a HEAD request instead to get the digest, instead of pulling the image with PullImage, we can be more explicit like we are with the publish commnad.

I have added --insecure-registry to porter build, so that the bundle author can decide when building if they want to allow connections to an insecure registry (http or self-signed certificates).

Signed-off-by: Carolyn Van Slyck <[email protected]>
@carolynvs carolynvs force-pushed the build-ref-digest-perf branch from 0d556e4 to 74e196e Compare April 10, 2023 14:06
@carolynvs carolynvs marked this pull request as ready for review April 10, 2023 14:09
@carolynvs carolynvs merged commit 842e29a into getporter:main Apr 10, 2023
@carolynvs carolynvs deleted the build-ref-digest-perf branch April 10, 2023 19:28
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.

Build pulls referenced images when all we need is a digest

2 participants