Skip to content

Commit 8a62fe8

Browse files
committed
ci: fixed formatting
Signed-off-by: Allen Conlon <[email protected]>
1 parent c414ff7 commit 8a62fe8

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

src/internal/agent/hooks/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func getManifestConfigMediaType(ctx context.Context, zarfState *state.State, ima
5757
_, b, err := oras.FetchBytes(ctx, registry, imageAddress, oras.DefaultFetchBytesOptions)
5858

5959
if err != nil {
60-
return "", fmt.Errorf("got an error when trying to access the manifest for %s, error %v", imageAddress, err)
60+
return "", fmt.Errorf("got an error when trying to access the manifest for %s, error %w", imageAddress, err)
6161
}
6262

6363
var manifest ocispec.Manifest

src/internal/agent/hooks/common_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818
"oras.land/oras-go/v2/registry/remote"
1919
)
2020

21-
func populateLocalRegistry(t *testing.T, ctx context.Context, localUrl string, artifact transform.Image, copyOpts oras.CopyOptions) {
22-
localReg, err := remote.NewRegistry(localUrl)
21+
func populateLocalRegistry(ctx context.Context, t *testing.T, localURL string, artifact transform.Image, copyOpts oras.CopyOptions) {
22+
localReg, err := remote.NewRegistry(localURL)
2323
require.NoError(t, err)
2424

2525
localReg.PlainHTTP = true
@@ -36,21 +36,21 @@ func populateLocalRegistry(t *testing.T, ctx context.Context, localUrl string, a
3636
_, err = oras.Copy(ctx, src, artifact.Tag, dst, artifact.Tag, copyOpts)
3737
require.NoError(t, err)
3838

39-
hashedTag, err := transform.ImageTransformHost(localUrl, fmt.Sprintf("%s/%s:%s", artifact.Host, artifact.Path, artifact.Tag))
39+
hashedTag, err := transform.ImageTransformHost(localURL, fmt.Sprintf("%s/%s:%s", artifact.Host, artifact.Path, artifact.Tag))
4040
require.NoError(t, err)
4141

4242
_, err = oras.Copy(ctx, src, artifact.Tag, dst, hashedTag, copyOpts)
4343
require.NoError(t, err)
4444
}
4545

46-
func setupRegistry(t *testing.T, ctx context.Context, port int, artifacts []transform.Image, copyOpts oras.CopyOptions) (string, error) {
47-
localUrl := testutil.SetupInMemoryRegistry(ctx, t, port)
46+
func setupRegistry(ctx context.Context, t *testing.T, port int, artifacts []transform.Image, copyOpts oras.CopyOptions) (string, error) {
47+
localURL := testutil.SetupInMemoryRegistry(ctx, t, port)
4848

4949
for _, art := range artifacts {
50-
populateLocalRegistry(t, ctx, localUrl, art, copyOpts)
50+
populateLocalRegistry(ctx, t, localURL, art, copyOpts)
5151
}
5252

53-
return localUrl, nil
53+
return localURL, nil
5454
}
5555

5656
type mediaTypeTest struct {
@@ -122,7 +122,7 @@ func TestConfigMediaTypes(t *testing.T) {
122122
t.Run(tt.name, func(t *testing.T) {
123123
t.Parallel()
124124
ctx := testutil.TestContext(t)
125-
url, err := setupRegistry(t, ctx, port, tt.artifact, tt.Opts)
125+
url, err := setupRegistry(ctx, t, port, tt.artifact, tt.Opts)
126126
require.NoError(t, err)
127127

128128
s := &state.State{RegistryInfo: state.RegistryInfo{Address: url}}

src/internal/agent/hooks/flux-ocirepo_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ func TestFluxOCIMutationWebhook(t *testing.T) {
347347
}
348348

349349
ctx := context.Background()
350-
url, err := setupRegistry(t, ctx, port, artifacts, oras.DefaultCopyOptions)
350+
url, err := setupRegistry(ctx, t, port, artifacts, oras.DefaultCopyOptions)
351351
require.NoError(t, err)
352352

353353
for _, tt := range tests {

src/internal/packager/images/common.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ func Ping(ctx context.Context, plainHTTP bool, registryURL string, client *auth.
121121
return fmt.Errorf("could not connect to registry %s over %s. status code: %d", registryURL, buildScheme(plainHTTP), resp.StatusCode)
122122
}
123123

124+
// ShouldUsePlainHTTP returns true if the registryURL is an http endpoint
124125
// This is inspired by the Crane functionality to determine the schema to be used - https://github.com/google/go-containerregistry/blob/main/pkg/v1/remote/transport/ping.go
125126
// Zarf relies heavily on this logic, as the internal registry communicates over HTTP, however we want Zarf to be flexible should the registry be over https in the future
126127
func ShouldUsePlainHTTP(ctx context.Context, registryURL string, client *auth.Client) (bool, error) {

0 commit comments

Comments
 (0)