Skip to content

Commit

Permalink
Refresh creds after 30 minutes
Browse files Browse the repository at this point in the history
For fairly large uploads, we might have expired creds during an upload
retry. This forces a cred refresh after 30 minutes to ensure we aren't
using expired credentials on retry.

Signed-off-by: Jon Johnson <jon.johnson@chainguard.dev>
  • Loading branch information
jonjohnsonjr committed Dec 20, 2024
1 parent ec27fec commit ee832dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package provider

import (
"context"
"time"

"chainguard.dev/apko/pkg/apk/apk"
"github.com/google/go-containerregistry/pkg/authn"
Expand Down Expand Up @@ -100,7 +101,7 @@ func (p *Provider) Configure(ctx context.Context, req provider.ConfigureRequest,
return
}

kc := authn.NewMultiKeychain(google.Keychain, authn.DefaultKeychain)
kc := authn.NewMultiKeychain(google.Keychain, authn.RefreshingKeychain(authn.DefaultKeychain, 30*time.Minute))
ropts := []remote.Option{
remote.WithAuthFromKeychain(kc),
remote.WithUserAgent("terraform-provider-apko/" + p.version),
Expand Down

0 comments on commit ee832dd

Please sign in to comment.