Skip to content

Commit

Permalink
Refresh creds after 30 minutes (#435)
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 authored Dec 20, 2024
1 parent ec27fec commit dd5586f
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 dd5586f

Please sign in to comment.