Skip to content

Commit

Permalink
Merge branch 'main' into bump-to-go-1-20
Browse files Browse the repository at this point in the history
  • Loading branch information
dlion authored Sep 13, 2023
2 parents b794393 + 6a790d1 commit 93054d6
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
5 changes: 3 additions & 2 deletions acceptance/reproducibility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package acceptance
import (
"context"
"fmt"
"os"
"testing"

dockerclient "github.com/docker/docker/client"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
ggcrremote "github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
"os"
"testing"

"github.com/buildpacks/imgutil"
"github.com/buildpacks/imgutil/local"
Expand Down
6 changes: 3 additions & 3 deletions remote/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func prepareNewWindowsImage(ri *Image) error {
func processPreviousImageOption(ri *Image, prevImageRepoName string, platform imgutil.Platform) error {
reg := getRegistry(prevImageRepoName, ri.registrySettings)

prevImage, err := NewV1Image(prevImageRepoName, ri.keychain, WithV1DefaultPlatform(platform), WithV1RegistrySetting(reg.insecure, reg.insecureSkipVerify))
prevImage, err := NewV1Image(prevImageRepoName, ri.keychain, WithV1DefaultPlatform(platform), WithV1RegistrySetting(reg.insecure))
if err != nil {
return err
}
Expand Down Expand Up @@ -220,7 +220,7 @@ func newV1Image(keychain authn.Keychain, repoName string, platform imgutil.Platf

opts := []remote.Option{remote.WithAuth(auth), remote.WithPlatform(v1Platform)}
// #nosec G402
if reg.insecureSkipVerify {
if reg.insecure {
opts = append(opts, remote.WithTransport(&http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
Expand Down Expand Up @@ -276,7 +276,7 @@ func referenceForRepoName(keychain authn.Keychain, ref string, insecure bool) (n
func processBaseImageOption(ri *Image, baseImageRepoName string, platform imgutil.Platform) error {
reg := getRegistry(baseImageRepoName, ri.registrySettings)
var err error
ri.image, err = NewV1Image(baseImageRepoName, ri.keychain, WithV1DefaultPlatform(platform), WithV1RegistrySetting(reg.insecure, reg.insecureSkipVerify))
ri.image, err = NewV1Image(baseImageRepoName, ri.keychain, WithV1DefaultPlatform(platform), WithV1RegistrySetting(reg.insecure))
if err != nil {
return err
}
Expand Down
11 changes: 5 additions & 6 deletions remote/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ func WithPreviousImage(imageName string) ImageOption {

// WithRegistrySetting (remote only) registers options to use when accessing images in a registry in order to construct
// the image. The referenced images could include the base image, a previous image, or the image itself.
func WithRegistrySetting(repository string, insecure, insecureSkipVerify bool) ImageOption {
// insecure parameter allows image references to be fetched without TLS.
func WithRegistrySetting(repository string, insecure bool) ImageOption {
return func(opts *options) error {
opts.registrySettings = make(map[string]registrySetting)
opts.registrySettings[repository] = registrySetting{
insecure: insecure,
insecureSkipVerify: insecureSkipVerify,
insecure: insecure,
}
return nil
}
Expand All @@ -125,11 +125,10 @@ func WithV1DefaultPlatform(platform imgutil.Platform) V1ImageOption {
}

// WithV1RegistrySetting registers options to use when accessing images in a registry in order to construct a v1.Image.
func WithV1RegistrySetting(insecure, insecureSkipVerify bool) V1ImageOption {
func WithV1RegistrySetting(insecure bool) V1ImageOption {
return func(opts *v1Options) error {
opts.registrySetting = registrySetting{
insecure: insecure,
insecureSkipVerify: insecureSkipVerify,
insecure: insecure,
}
return nil
}
Expand Down
3 changes: 1 addition & 2 deletions remote/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ type Image struct {
}

type registrySetting struct {
insecure bool
insecureSkipVerify bool
insecure bool
}

// getters
Expand Down
2 changes: 1 addition & 1 deletion remote/remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func testImage(t *testing.T, when spec.G, it spec.S) {
repoName,
authn.DefaultKeychain,
remote.FromBaseImage("host.docker.internal/bar"),
remote.WithRegistrySetting("host.docker.internal", true, true))
remote.WithRegistrySetting("host.docker.internal", true))

h.AssertError(t, err, "http://")
})
Expand Down
3 changes: 2 additions & 1 deletion tools/bcdhive_generator/bcdhive_hivex.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package main

import (
"github.com/gabriel-samfira/go-hivex"
"io/ioutil"
"os"
"path/filepath"
"strings"

"github.com/gabriel-samfira/go-hivex"

"github.com/pkg/errors"
"golang.org/x/text/encoding/unicode"
"golang.org/x/tools/go/packages"
Expand Down

0 comments on commit 93054d6

Please sign in to comment.