Skip to content

Commit

Permalink
Fix bugs discovered in v0.1.6 (#113)
Browse files Browse the repository at this point in the history
Signed-off-by: Santosh <[email protected]>
  • Loading branch information
santoshkal authored Jun 21, 2024
1 parent dd7f5e3 commit 5704fc8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ changelog:
sort: asc
groups: # Regex use RE2 syntax as defined here: https://github.com/google/re2/wiki/Syntax.
- title: 'Updates'
regexp: ^(?i).*?update\w*(\([[:word:]]+\))??!?:.+$
regexp: '^.*?update(\([[:word:]]+\))??!?:.+$'
order: 100
- title: 'Bug fixes'
regexp: ^(?i).*?fix\w*(\([[:word:]]+\))??!?:.+$
Expand Down
2 changes: 1 addition & 1 deletion cmd/artifact_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func runPushCmd(cmd *cobra.Command, args []string) error {
if err != nil {
return fmt.Errorf("error getting credentials: %v", err)
}
opts, err := oci.GenerateCraneOptions(cmd.Context(), ref, auth, []string{ref.Context().Scope(transport.PushScope)})
opts, err := oci.GenerateCraneOptions(ref, auth, []string{ref.Context().Scope(transport.PushScope)})
if err != nil {
log.Errorf("Error creating options required for push: %v", err)
}
Expand Down
17 changes: 9 additions & 8 deletions pkg/oci/ociClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func CheckTagAndPullArchive(url, tool, creds string, archivePath *os.File) error
if err != nil {
return fmt.Errorf("error getting credentials: %v", err)
}
opts, err := GenerateCraneOptions(context.Background(), ref, auth, []string{ref.Context().Scope(transport.PullScope)})
opts, err := GenerateCraneOptions(ref, auth, []string{ref.Context().Scope(transport.PullScope)})
if err != nil {
log.Errorf("Error reading credentials: %v", err)
}
Expand Down Expand Up @@ -208,7 +208,7 @@ func PullArtifact(ctx context.Context, creds, dest, path string) error {
if err != nil {
return fmt.Errorf("error getting credentials: %v", err)
}
opts, err := GenerateCraneOptions(ctx, ref, auth, []string{ref.Context().Scope(transport.PullScope)})
opts, err := GenerateCraneOptions(ref, auth, []string{ref.Context().Scope(transport.PullScope)})
if err != nil {
return fmt.Errorf("error getting credentials: %v", err)
}
Expand Down Expand Up @@ -297,7 +297,7 @@ func GetCreds(creds string) (authn.Authenticator, error) {
}

// Most parts of GenerateCraneOptions and its related funcs are copied from https://github.com/google/go-containerregistry/blob/1b4e4078a545f2b6f96766a064b45ee77cdbefdd/pkg/v1/remote/options.go#L128
func GenerateCraneOptions(ctx context.Context, ref name.Reference, auth authn.Authenticator, scopes []string) ([]crane.Option, error) {
func GenerateCraneOptions(ref name.Reference, auth authn.Authenticator, scopes []string) ([]crane.Option, error) {
opts := []crane.Option{}
var retryTransport http.RoundTripper

Expand All @@ -319,11 +319,12 @@ func GenerateCraneOptions(ctx context.Context, ref name.Reference, auth authn.Au
}))
retryTransport = transport.NewUserAgent(retryTransport, userAgent)

t, err := transport.NewWithContext(ctx, ref.Context().Registry, auth, retryTransport, scopes)
if err != nil {
return nil, err
}
opts = append(opts, crane.WithTransport(t))
// t, err := transport.NewWithContext(ref.Context().Registry, auth, retryTransport, scopes)
// if err != nil {
// return nil, err
// }
opts = append(opts, crane.WithTransport(retryTransport))

return opts, nil
}

Expand Down

0 comments on commit 5704fc8

Please sign in to comment.