diff --git a/cmd/artifact/config/config.go b/cmd/artifact/config/config.go index dc34f4a5..cfb216ad 100644 --- a/cmd/artifact/config/config.go +++ b/cmd/artifact/config/config.go @@ -83,7 +83,7 @@ func (o *artifactConfigOptions) RunArtifactConfig(ctx context.Context, args []st return fmt.Errorf("invalid platform format: %s", o.platform) } - if config, err = puller.PullConfigLayer(ctx, ref, tokens[0], tokens[1]); err != nil { + if config, err = puller.RawConfigLayer(ctx, ref, tokens[0], tokens[1]); err != nil { return err } diff --git a/cmd/artifact/install/install.go b/cmd/artifact/install/install.go index 799b317d..e69afd81 100644 --- a/cmd/artifact/install/install.go +++ b/cmd/artifact/install/install.go @@ -219,7 +219,7 @@ func (o *artifactInstallOptions) RunArtifactInstall(ctx context.Context, args [] return nil, err } - artifactConfig, err := puller.GetArtifactConfig(ctx, ref, runtime.GOOS, runtime.GOARCH) + artifactConfig, err := puller.ArtifactConfig(ctx, ref, runtime.GOOS, runtime.GOARCH) if err != nil { return nil, err } diff --git a/internal/follower/follower.go b/internal/follower/follower.go index 78ffeebb..806fcb5c 100644 --- a/internal/follower/follower.go +++ b/internal/follower/follower.go @@ -171,7 +171,7 @@ func (f *Follower) follow(ctx context.Context) { f.logger.Info("Found new artifact version", f.logger.Args("followerName", f.ref, "tag", f.tag)) // Pull config layer to check falco versions - artifactConfig, err := f.GetArtifactConfig(ctx, f.ref, runtime.GOOS, runtime.GOARCH) + artifactConfig, err := f.ArtifactConfig(ctx, f.ref, runtime.GOOS, runtime.GOARCH) if err != nil { f.logger.Error("Unable to pull config layer", f.logger.Args("followerName", f.ref, "reason", err.Error())) return diff --git a/pkg/oci/puller/puller.go b/pkg/oci/puller/puller.go index 0d2c3d00..d716f744 100644 --- a/pkg/oci/puller/puller.go +++ b/pkg/oci/puller/puller.go @@ -235,11 +235,11 @@ func (p *Puller) RawManifest(ctx context.Context, ref, os, arch string) ([]byte, return manifestBytes, nil } -// GetArtifactConfig fetches only the config layer from a given ref. +// ArtifactConfig fetches only the config layer from a given ref. // If the artifact has a v1.MediaTypeImageIndex descriptor then it fetches the config layer for the // specified platform. -func (p *Puller) GetArtifactConfig(ctx context.Context, ref, os, arch string) (*oci.ArtifactConfig, error) { - configBytes, err := p.PullConfigLayer(ctx, ref, os, arch) +func (p *Puller) ArtifactConfig(ctx context.Context, ref, os, arch string) (*oci.ArtifactConfig, error) { + configBytes, err := p.RawConfigLayer(ctx, ref, os, arch) if err != nil { return nil, err } @@ -252,10 +252,10 @@ func (p *Puller) GetArtifactConfig(ctx context.Context, ref, os, arch string) (* return &artifactConfig, nil } -// PullConfigLayer fetches only the config layer from a given ref. +// RawConfigLayer fetches only the config layer from a given ref. // If the artifact has a v1.MediaTypeImageIndex descriptor then it fetches the config layer for the // specified platform. -func (p *Puller) PullConfigLayer(ctx context.Context, ref, os, arch string) ([]byte, error) { +func (p *Puller) RawConfigLayer(ctx context.Context, ref, os, arch string) ([]byte, error) { repo, err := repository.NewRepository(ref, repository.WithClient(p.Client), repository.WithPlainHTTP(p.plainHTTP)) if err != nil { return nil, err diff --git a/pkg/oci/puller/puller_test.go b/pkg/oci/puller/puller_test.go index 34e5d3a7..ba1e1de7 100644 --- a/pkg/oci/puller/puller_test.go +++ b/pkg/oci/puller/puller_test.go @@ -144,7 +144,7 @@ var _ = Describe("Puller", func() { }) }) - Context("PullConfigLayer func", func() { + Context("RawConfigLayer func", func() { var ( ref string os string @@ -154,7 +154,7 @@ var _ = Describe("Puller", func() { ) JustBeforeEach(func() { puller = ocipuller.NewPuller(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), plainHTTP, tracker) - cfgLayer, err = puller.PullConfigLayer(ctx, ref, os, arch) + cfgLayer, err = puller.RawConfigLayer(ctx, ref, os, arch) }) JustAfterEach(func() {