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

Pass all additional auth to builder #18615

Closed
wants to merge 1 commit into from

Conversation

ChevronTango
Copy link

@ChevronTango ChevronTango commented Aug 29, 2023

Description

Adds the ability for Gitpod to pass all additional authenticated through to the builder. Right now the additional auth is only passing through some user defined auth which neglects some of the additional auth found in the docker pull secrets. In order for the builder to eventually proxy and mirror upstream registries it needs to know about both the user defined credentials, and the system defined credentials.

This also makes sure that only the auth needed to actually pull the base image is passed through.

Summary generated by Copilot

🤖 Generated by Copilot at a39718e

This pull request adds support for all auth to be passed through to the builder

Related Issue(s)

How to test

Documentation

Preview status

gitpod:summary

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

Copy link
Contributor

@csweichel csweichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for that PR.

The move of the authentication into common-go is a bit too far, especially because registry-facade does not necessarily need that functionality (more details in the comment).

In addition to a few changes that's outlined in the comments below, this work goes definitely in the right direction.

components/common-go/auth/ecr.go Outdated Show resolved Hide resolved
var additionalAuth []byte
if err == nil {
res := make(auth.ImageBuildAuth)
res[reference.Domain(wsref)] = registry.AuthConfig(*wsrefAuth)
workspaceAuth, err = json.Marshal(map[string]auth.ImageBuildAuth{"auths": res})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By passing workspace auth explicitly here, the additional auth no longer becomes necessary, i.e. we can just merge the two. The only reason they were separate before was because the workspace author originally came through with the secret.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did wonder about simplifying the whole thing into a single combined auth file, however I felt that was a lot for what I was trying to achieve and I didn't know if that was an appropriate tactic given the importance of the image-builder. Are you suggesting that we pass through a single Auth variable that is used by the Bob for everything, and which includes a combination of all the docker config the builder knows about? That would definitely simplify a lot of the confusion here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So as per my other PR #18604 It looks like the strategy I've settled on is to still pass through an amalgamated auth in the additionalAuth field where it can be used by the proxy and builder, whilst the workspaceAuth contains just the auth needed for pulling the wsref directly. I'm happy to still combine them into a single var, but it actually works out more elegant keeping them separate.

@ChevronTango
Copy link
Author

Simplified this MR to aid with pushing the auth through to the Bob. This will be in support of the changes in #18604

@ChevronTango ChevronTango changed the title Add ECR auth to everything in the registry chain Pass all additional auth to builder Sep 13, 2023
@stale
Copy link

stale bot commented Oct 15, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Oct 15, 2023
@stale stale bot closed this Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold meta: stale This issue/PR is stale and will be closed soon size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants