From 65eed3effbe1301702bbe4e6ffd00cdce8285e9f Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Fri, 3 May 2024 09:38:05 -0400 Subject: [PATCH 1/2] fix: TestGenerateMavenBuildArgs-host-platform --- pkg/skaffold/build/jib/maven_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/skaffold/build/jib/maven_test.go b/pkg/skaffold/build/jib/maven_test.go index ca91d8377bd..df73962cc9f 100644 --- a/pkg/skaffold/build/jib/maven_test.go +++ b/pkg/skaffold/build/jib/maven_test.go @@ -23,7 +23,6 @@ import ( "io" "os" "os/exec" - "runtime" "strings" "testing" "time" @@ -350,7 +349,7 @@ func TestGenerateMavenBuildArgs(t *testing.T) { {description: "multi module without tests with insecure-registry", a: latest.JibArtifact{Project: "module"}, image: "registry.tld/image", skipTests: true, insecureRegistries: map[string]bool{"registry.tld": true}, out: []string{"fake-mavenBuildArgs-for-module-for-test-goal-skipTests", "-Djib.allowInsecureRegistries=true", "-Dimage=registry.tld/image"}}, {description: "single module with custom base image", a: latest.JibArtifact{BaseImage: "docker://busybox"}, image: "image", out: []string{"fake-mavenBuildArgs-for-test-goal", "-Djib.from.image=docker://busybox", "-Dimage=image"}}, {description: "multi module with custom base image", a: latest.JibArtifact{Project: "module", BaseImage: "docker://busybox"}, image: "image", out: []string{"fake-mavenBuildArgs-for-module-for-test-goal", "-Djib.from.image=docker://busybox", "-Dimage=image"}}, - {description: "host platform", image: "image", platforms: platform.Matcher{Platforms: []v1.Platform{platforms.DefaultSpec()}}, out: []string{"fake-mavenBuildArgs-for-test-goal", fmt.Sprintf("-Djib.from.platforms=%s/%s", runtime.GOOS, runtime.GOARCH), "-Dimage=image"}}, + {description: "host platform", image: "image", platforms: platform.Matcher{Platforms: []v1.Platform{platforms.DefaultSpec()}}, out: []string{"fake-mavenBuildArgs-for-test-goal", fmt.Sprintf("-Djib.from.platforms=%s", platform.Format(platforms.DefaultSpec())), "-Dimage=image"}}, {description: "cross-platform", image: "image", platforms: platform.Matcher{Platforms: []v1.Platform{{OS: "freebsd", Architecture: "arm"}}}, out: []string{"fake-mavenBuildArgs-for-test-goal", "-Djib.from.platforms=freebsd/arm", "-Dimage=image"}, expectedMinVersion: MinimumJibMavenVersionForCrossPlatform}, {description: "multi-platform", image: "image", platforms: platform.Matcher{Platforms: []v1.Platform{{OS: "linux", Architecture: "amd64"}, {OS: "darwin", Architecture: "arm64"}}}, out: []string{"fake-mavenBuildArgs-for-test-goal", "-Djib.from.platforms=linux/amd64,darwin/arm64", "-Dimage=image"}, expectedMinVersion: MinimumJibMavenVersionForCrossPlatform}, { From 10c735f09b23f0edbcbae4eb8e9c86d14ab39422 Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Fri, 3 May 2024 10:04:44 -0400 Subject: [PATCH 2/2] fix: gradle --- pkg/skaffold/build/jib/gradle_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/skaffold/build/jib/gradle_test.go b/pkg/skaffold/build/jib/gradle_test.go index 5a4a476bb02..d47c2a3c02d 100644 --- a/pkg/skaffold/build/jib/gradle_test.go +++ b/pkg/skaffold/build/jib/gradle_test.go @@ -23,7 +23,6 @@ import ( "io" "os" "os/exec" - "runtime" "strings" "testing" "time" @@ -365,7 +364,7 @@ func TestGenerateGradleBuildArgs(t *testing.T) { {description: "multi module without tests with insecure registries", in: latest.JibArtifact{Project: "project"}, image: "registry.tld/image", skipTests: true, insecureRegistries: map[string]bool{"registry.tld": true}, out: []string{"fake-gradleBuildArgs-for-project-for-testTask-skipTests", "-Djib.allowInsecureRegistries=true", "--image=registry.tld/image"}}, {description: "single module with custom base image", in: latest.JibArtifact{BaseImage: "docker://busybox"}, image: "image", out: []string{"fake-gradleBuildArgs-for-testTask", "-Djib.from.image=docker://busybox", "--image=image"}}, {description: "multi module with custom base image", in: latest.JibArtifact{Project: "project", BaseImage: "docker://busybox"}, image: "image", out: []string{"fake-gradleBuildArgs-for-project-for-testTask", "-Djib.from.image=docker://busybox", "--image=image"}}, - {description: "host platform", image: "image", platforms: platform.Matcher{Platforms: []v1.Platform{platforms.DefaultSpec()}}, out: []string{"fake-gradleBuildArgs-for-testTask", fmt.Sprintf("-Djib.from.platforms=%s/%s", runtime.GOOS, runtime.GOARCH), "--image=image"}}, + {description: "host platform", image: "image", platforms: platform.Matcher{Platforms: []v1.Platform{platforms.DefaultSpec()}}, out: []string{"fake-gradleBuildArgs-for-testTask", fmt.Sprintf("-Djib.from.platforms=%s", platform.Format(platforms.DefaultSpec())), "--image=image"}}, {description: "cross-platform", image: "image", platforms: platform.Matcher{Platforms: []v1.Platform{{OS: "freebsd", Architecture: "arm"}}}, out: []string{"fake-gradleBuildArgs-for-testTask", "-Djib.from.platforms=freebsd/arm", "--image=image"}, expectedMinVersion: MinimumJibGradleVersionForCrossPlatform}, {description: "multi-platform", image: "image", platforms: platform.Matcher{Platforms: []v1.Platform{{OS: "linux", Architecture: "amd64"}, {OS: "darwin", Architecture: "arm64"}}}, out: []string{"fake-gradleBuildArgs-for-testTask", "-Djib.from.platforms=linux/amd64,darwin/arm64", "--image=image"}, expectedMinVersion: MinimumJibGradleVersionForCrossPlatform}, {