mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-18 20:51:45 +00:00
cmd/sync-containers: add github.Keychain
Running sync-containers in a GitHub workflow will be simpler if we check github.Keychain, which uses the GITHUB_TOKEN if present. Updates https://github.com/tailscale/corp/issues/8461 Signed-off-by: Denton Gentry <dgentry@tailscale.com>
This commit is contained in:
parent
9bd6a2fb8d
commit
7439bc7ba6
@ -24,6 +24,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/go-containerregistry/pkg/authn"
|
"github.com/google/go-containerregistry/pkg/authn"
|
||||||
|
"github.com/google/go-containerregistry/pkg/authn/github"
|
||||||
"github.com/google/go-containerregistry/pkg/name"
|
"github.com/google/go-containerregistry/pkg/name"
|
||||||
v1 "github.com/google/go-containerregistry/pkg/v1"
|
v1 "github.com/google/go-containerregistry/pkg/v1"
|
||||||
"github.com/google/go-containerregistry/pkg/v1/remote"
|
"github.com/google/go-containerregistry/pkg/v1/remote"
|
||||||
@ -47,8 +48,9 @@ func main() {
|
|||||||
log.Fatalf("--dst is required")
|
log.Fatalf("--dst is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keychain := authn.NewMultiKeychain(authn.DefaultKeychain, github.Keychain)
|
||||||
opts := []remote.Option{
|
opts := []remote.Option{
|
||||||
remote.WithAuthFromKeychain(authn.DefaultKeychain),
|
remote.WithAuthFromKeychain(keychain),
|
||||||
remote.WithContext(context.Background()),
|
remote.WithContext(context.Background()),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user