Skip to content

Commit

Permalink
Merge pull request #137 from imjasonh/useragent
Browse files Browse the repository at this point in the history
set useragent
  • Loading branch information
imjasonh committed Apr 5, 2024
2 parents 8f21ab3 + 6c889e7 commit 02922b7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions internal/provider/resource_ko_build.go
Expand Up @@ -27,7 +27,8 @@ import (
)

const (
version = "devel"
version = "devel"
userAgent = "terraform-provider-ko"
)

var validTypes = map[string]struct{}{
Expand Down Expand Up @@ -151,7 +152,10 @@ func (o *buildOptions) makeBuilder(ctx context.Context) (*build.Caching, error)
if o.auth != nil {
kc = authn.NewMultiKeychain(staticKeychain{o.imageRepo, o.auth}, kc)
}
desc, err := remote.Get(ref, remote.WithAuthFromKeychain(kc))
desc, err := remote.Get(ref,
remote.WithAuthFromKeychain(kc),
remote.WithUserAgent(userAgent),
)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -241,7 +245,11 @@ func doPublish(ctx context.Context, r build.Result, opts buildOptions) (string,
if opts.auth != nil {
kc = authn.NewMultiKeychain(staticKeychain{opts.imageRepo, opts.auth}, kc)
}
po := []publish.Option{publish.WithAuthFromKeychain(kc), publish.WithNamer(namer(opts))}
po := []publish.Option{
publish.WithAuthFromKeychain(kc),
publish.WithNamer(namer(opts)),
publish.WithUserAgent(userAgent),
}

p, err := publish.NewDefault(opts.imageRepo, po...)
if err != nil {
Expand Down

0 comments on commit 02922b7

Please sign in to comment.