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

support basic_auth at the provider level #40

Merged
merged 1 commit into from
Jan 4, 2023

Conversation

imjasonh
Copy link
Member

This is intended to be used with something like https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecr_authorization_token to provide ko-provider-wide auth for all requests.

As an example I haven't yet tried myself, to authorize pushes to an ECR repo:

data "aws_ecr_authorization_token" "token" {}

resource "aws_ecr_repository" "foo" {
  name = "foo"
}

provider "ko" {
  docker_repo = aws_ecr_repository.foo.name
  basic_auth = aws_ecr_authorization_token.token.authorization_token
}

Help with #37

@imjasonh
Copy link
Member Author

The ko_resolve resource doesn't work with this yet, because it uses commands.NewPublisher, which always uses the credhelper-infused multikeychain, and doesn't provide a way to override that. We might need to crack open stuff in ko to enable that, or use something besides pkg/commands.

@@ -187,8 +191,12 @@ func doBuild(ctx context.Context, opts buildOptions) (string, error) {
return "", fmt.Errorf("build: %v", err)
}

p, err := publish.NewDefault(opts.dockerRepo,
publish.WithAuthFromKeychain(authn.DefaultKeychain))
kc := authn.DefaultKeychain
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll need to reconcile this with your other change.

Copy link
Contributor

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

LGTM other than coordinating the keychain PRs

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.

None yet

2 participants