Skip to content

Commit

Permalink
Merge pull request #3478 from GoogleContainerTools/rename-jib-args-fu…
Browse files Browse the repository at this point in the history
…nctions

Rename jib args functions
  • Loading branch information
loosebazooka authored Jan 7, 2020
2 parents a84596b + c34ee53 commit 19a4dec
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pkg/skaffold/build/gcb/jib.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ func (b *Builder) jibBuildSpec(artifact *latest.Artifact, tag string) (cloudbuil
Steps: []*cloudbuild.BuildStep{{
Name: b.MavenImage,
Entrypoint: "sh",
Args: fixHome("mvn", jib.GenerateMavenArgs("build", tag, artifact.JibArtifact, b.skipTests, b.insecureRegistries)),
Args: fixHome("mvn", jib.GenerateMavenBuildArgs("build", tag, artifact.JibArtifact, b.skipTests, b.insecureRegistries)),
}},
}, nil
case jib.JibGradle:
return cloudbuild.Build{
Steps: []*cloudbuild.BuildStep{{
Name: b.GradleImage,
Entrypoint: "sh",
Args: fixHome("gradle", jib.GenerateGradleArgs("jib", tag, artifact.JibArtifact, b.skipTests, b.insecureRegistries)),
Args: fixHome("gradle", jib.GenerateGradleBuildArgs("jib", tag, artifact.JibArtifact, b.skipTests, b.insecureRegistries)),
}},
}, nil
default:
Expand Down
8 changes: 4 additions & 4 deletions pkg/skaffold/build/jib/gradle.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const MinimumJibGradleVersion = "1.4.0"
var GradleCommand = util.CommandWrapper{Executable: "gradle", Wrapper: "gradlew"}

func (b *Builder) buildJibGradleToDocker(ctx context.Context, out io.Writer, workspace string, artifact *latest.JibArtifact, tag string) (string, error) {
args := GenerateGradleArgs("jibDockerBuild", tag, artifact, b.skipTests, b.insecureRegistries)
args := GenerateGradleBuildArgs("jibDockerBuild", tag, artifact, b.skipTests, b.insecureRegistries)
if err := b.runGradleCommand(ctx, out, workspace, args); err != nil {
return "", err
}
Expand All @@ -52,7 +52,7 @@ func (b *Builder) buildJibGradleToDocker(ctx context.Context, out io.Writer, wor
}

func (b *Builder) buildJibGradleToRegistry(ctx context.Context, out io.Writer, workspace string, artifact *latest.JibArtifact, tag string) (string, error) {
args := GenerateGradleArgs("jib", tag, artifact, b.skipTests, b.insecureRegistries)
args := GenerateGradleBuildArgs("jib", tag, artifact, b.skipTests, b.insecureRegistries)
if err := b.runGradleCommand(ctx, out, workspace, args); err != nil {
return "", err
}
Expand Down Expand Up @@ -96,8 +96,8 @@ func getSyncMapCommandGradle(ctx context.Context, workspace string, a *latest.Ji
return &cmd
}

// GenerateGradleArgs generates the arguments to Gradle for building the project as an image.
func GenerateGradleArgs(task string, imageName string, a *latest.JibArtifact, skipTests bool, insecureRegistries map[string]bool) []string {
// GenerateGradleBuildArgs generates the arguments to Gradle for building the project as an image.
func GenerateGradleBuildArgs(task string, imageName string, a *latest.JibArtifact, skipTests bool, insecureRegistries map[string]bool) []string {
args := gradleBuildArgsFunc(task, a, skipTests)
if insecure, err := isOnInsecureRegistry(imageName, insecureRegistries); err == nil && insecure {
// jib doesn't support marking specific registries as insecure
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/build/jib/gradle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func TestGetSyncMapCommandGradle(t *testing.T) {
}
}

func TestGenerateGradleArgs(t *testing.T) {
func TestGenerateGradleBuildArgs(t *testing.T) {
tests := []struct {
description string
in latest.JibArtifact
Expand All @@ -341,7 +341,7 @@ func TestGenerateGradleArgs(t *testing.T) {
for _, test := range tests {
testutil.Run(t, test.description, func(t *testutil.T) {
t.Override(&gradleBuildArgsFunc, gradleBuildArgsFuncFake)
command := GenerateGradleArgs("testTask", test.image, &test.in, test.skipTests, test.insecureRegistries)
command := GenerateGradleBuildArgs("testTask", test.image, &test.in, test.skipTests, test.insecureRegistries)
t.CheckDeepEqual(test.out, command)
})
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/skaffold/build/jib/maven.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const MinimumJibMavenVersion = "1.4.0"
var MavenCommand = util.CommandWrapper{Executable: "mvn", Wrapper: "mvnw"}

func (b *Builder) buildJibMavenToDocker(ctx context.Context, out io.Writer, workspace string, artifact *latest.JibArtifact, tag string) (string, error) {
args := GenerateMavenArgs("dockerBuild", tag, artifact, b.skipTests, b.insecureRegistries)
args := GenerateMavenBuildArgs("dockerBuild", tag, artifact, b.skipTests, b.insecureRegistries)
if err := b.runMavenCommand(ctx, out, workspace, args); err != nil {
return "", err
}
Expand All @@ -51,7 +51,7 @@ func (b *Builder) buildJibMavenToDocker(ctx context.Context, out io.Writer, work
}

func (b *Builder) buildJibMavenToRegistry(ctx context.Context, out io.Writer, workspace string, artifact *latest.JibArtifact, tag string) (string, error) {
args := GenerateMavenArgs("build", tag, artifact, b.skipTests, b.insecureRegistries)
args := GenerateMavenBuildArgs("build", tag, artifact, b.skipTests, b.insecureRegistries)
if err := b.runMavenCommand(ctx, out, workspace, args); err != nil {
return "", err
}
Expand Down Expand Up @@ -96,8 +96,8 @@ func getSyncMapCommandMaven(ctx context.Context, workspace string, a *latest.Jib
return &cmd
}

// GenerateMavenArgs generates the arguments to Maven for building the project as an image.
func GenerateMavenArgs(goal string, imageName string, a *latest.JibArtifact, skipTests bool, insecureRegistries map[string]bool) []string {
// GenerateMavenBuildArgs generates the arguments to Maven for building the project as an image.
func GenerateMavenBuildArgs(goal string, imageName string, a *latest.JibArtifact, skipTests bool, insecureRegistries map[string]bool) []string {
args := mavenBuildArgsFunc(goal, a, skipTests)
if insecure, err := isOnInsecureRegistry(imageName, insecureRegistries); err == nil && insecure {
// jib doesn't support marking specific registries as insecure
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/build/jib/maven_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func TestGetSyncMapCommandMaven(t *testing.T) {
}
}

func TestGenerateMavenArgs(t *testing.T) {
func TestGenerateMavenBuildArgs(t *testing.T) {
tests := []struct {
description string
a latest.JibArtifact
Expand All @@ -333,7 +333,7 @@ func TestGenerateMavenArgs(t *testing.T) {
for _, test := range tests {
testutil.Run(t, test.description, func(t *testutil.T) {
t.Override(&mavenBuildArgsFunc, mavenBuildArgsFuncFake)
args := GenerateMavenArgs("test-goal", test.image, &test.a, test.skipTests, test.insecureRegistries)
args := GenerateMavenBuildArgs("test-goal", test.image, &test.a, test.skipTests, test.insecureRegistries)
t.CheckDeepEqual(test.out, args)
})
}
Expand Down

0 comments on commit 19a4dec

Please sign in to comment.