Skip to content

Commit

Permalink
more refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
dskiff committed Apr 25, 2024
1 parent 1f41e42 commit a3f61bc
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/build/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/google/go-containerregistry/pkg/v1/remote"
)

func GetBaseImage(ctx BuildContext, baseRef string, platform Platform, keychain authn.Keychain) (v1.Image, error) {
func getBaseImage(ctx BuildContext, baseRef string, platform Platform, keychain authn.Keychain) (v1.Image, error) {
if baseRef == "scratch" {
return empty.Image, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/build/layers.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func createLayerFromFolder(ctx BuildContext, layer BuildSpecInjectLayer, opts ..
}

func createTarFromFolder(ctx BuildContext, srcPath, dstPath string) (string, error) {
tarFile, err := CreateTempFile(ctx)
tarFile, err := createTempFile(ctx)
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/build/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/google/go-containerregistry/pkg/v1/remote"
)

func Publish(ctx BuildContext, image v1.Image, target BuildSpecTarget) error {
func publish(ctx BuildContext, image v1.Image, target BuildSpecTarget) error {
tag, err := name.NewTag(target.Repo)
if err != nil {
return fmt.Errorf("failed to parse target repo: %w", err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/build/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type BuildContext struct {
}

func Build(ctx BuildContext, spec BuildSpec) error {
baseImage, err := GetBaseImage(ctx, spec.BaseRef, spec.InjectLayer.Platform, ctx.Keychain)
baseImage, err := getBaseImage(ctx, spec.BaseRef, spec.InjectLayer.Platform, ctx.Keychain)
if err != nil {
return fmt.Errorf("failed to retrieve base image: %w", err)
}
Expand All @@ -73,7 +73,7 @@ func Build(ctx BuildContext, spec BuildSpec) error {
return fmt.Errorf("failed to mutate config: %w", err)
}

return Publish(ctx, newImage, spec.Target)
return publish(ctx, newImage, spec.Target)
}

func mutateConfig(img v1.Image, layer BuildSpecInjectLayer) (v1.Image, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/build/temp.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
)

func CreateTempFile(ctx BuildContext) (*os.File, error) {
func createTempFile(ctx BuildContext) (*os.File, error) {
fp, err := os.CreateTemp(ctx.TempPath, "tko-temp-*.tar")
if err != nil {
return nil, err
Expand Down

0 comments on commit a3f61bc

Please sign in to comment.