Skip to content

Commit

Permalink
chore: use contants to ref imageInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
ericzzzzzzz committed Dec 11, 2023
1 parent 2b227b1 commit 1c67fff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pkg/skaffold/build/ko/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/google/ko/pkg/commands/options"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/config"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/constants"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/docker"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/platform"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/latest"
Expand All @@ -40,9 +41,9 @@ func (b *Builder) newKoBuilder(ctx context.Context, a *latest.Artifact, platform
return nil, fmt.Errorf("parsing image %v: %w", tag, err)
}
imageInfoEnv := map[string]string{
"IMAGE_REPO": ref.Repo,
"IMAGE_NAME": ref.Name,
"IMAGE_TAG": ref.Tag,
constants.ImageRef.Repo: ref.Repo,
constants.ImageRef.Name: ref.Name,
constants.ImageRef.Tag: ref.Tag,
}
if err != nil {
return nil, fmt.Errorf("could not resolve skaffold runtime env for ko builder: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/build/ko/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func TestBuildOptions(t *testing.T) {
},
},
{
description: "",
description: "test build option, inject envs for expanding templates",
artifact: latest.Artifact{
ArtifactType: latest.ArtifactType{
KoArtifact: &latest.KoArtifact{
Expand Down
2 changes: 2 additions & 0 deletions pkg/skaffold/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ var ImageRef = struct {
Repo string
Tag string
Digest string
Name string
}{
Repo: "IMAGE_REPO",
Tag: "IMAGE_TAG",
Digest: "IMAGE_DIGEST",
Name: "IMAGE_NAME",
}
var DefaultKubectlManifests = []string{"k8s/*.yaml"}

Expand Down

0 comments on commit 1c67fff

Please sign in to comment.