diff --git a/CHANGELOG.md b/CHANGELOG.md index f36bba17fa..3977196f8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ Usage: * Fix #2393: Remove timestamp from `org.label-schema.build-date` LABEL to utilize docker cache * Fix #2399: Helm no longer generates default function; broadens support for different value types * Fix #2400: Helm supports complex values in `values.yaml` fragments (such as annotations or arrays) +* Fix #2414: OpenShift Gradle Plugin picks up `jkube.build.pushSecret` property _**Note**_: - Container Images generated using jkube opinionated defaults no longer contain full timestamp in `org.label-schema.build-date` label. The label contains the build date in the format `yyyy-MM-dd`. diff --git a/gradle-plugin/openshift/src/main/java/org/eclipse/jkube/gradle/plugin/OpenShiftExtension.java b/gradle-plugin/openshift/src/main/java/org/eclipse/jkube/gradle/plugin/OpenShiftExtension.java index f37bc48649..cd51b56cc5 100644 --- a/gradle-plugin/openshift/src/main/java/org/eclipse/jkube/gradle/plugin/OpenShiftExtension.java +++ b/gradle-plugin/openshift/src/main/java/org/eclipse/jkube/gradle/plugin/OpenShiftExtension.java @@ -88,6 +88,10 @@ public String getOpenshiftPullSecretOrDefault() { return getOrDefaultString("jkube.build.pullSecret", this::getOpenshiftPullSecret, DEFAULT_OPENSHIFT_PULLSECRET); } + public String getOpenshiftPushSecretOrDefault() { + return getOrDefaultString("jkube.build.pushSecret", this::getOpenshiftPushSecret, null); + } + public String getS2iBuildNameSuffixOrDefault() { return getOrDefaultString("jkube.s2i.buildNameSuffix", this::getS2iBuildNameSuffix, DEFAULT_S2I_BUILDNAME_SUFFIX); } diff --git a/gradle-plugin/openshift/src/main/java/org/eclipse/jkube/gradle/plugin/task/OpenShiftBuildTask.java b/gradle-plugin/openshift/src/main/java/org/eclipse/jkube/gradle/plugin/task/OpenShiftBuildTask.java index b5647151fb..8dd0d967c3 100644 --- a/gradle-plugin/openshift/src/main/java/org/eclipse/jkube/gradle/plugin/task/OpenShiftBuildTask.java +++ b/gradle-plugin/openshift/src/main/java/org/eclipse/jkube/gradle/plugin/task/OpenShiftBuildTask.java @@ -34,7 +34,7 @@ protected BuildServiceConfig.BuildServiceConfigBuilder buildServiceConfigBuilder .openshiftPullSecret(getOpenShiftExtension().getOpenshiftPullSecretOrDefault()) .s2iBuildNameSuffix(getOpenShiftExtension().getS2iBuildNameSuffixOrDefault()) .s2iImageStreamLookupPolicyLocal(getOpenShiftExtension().getS2iImageStreamLookupPolicyLocalOrDefault()) - .openshiftPushSecret(getOpenShiftExtension().getOpenshiftPushSecret().getOrNull()) + .openshiftPushSecret(getOpenShiftExtension().getOpenshiftPushSecretOrDefault()) .resourceConfig(getOpenShiftExtension().resources) .buildOutputKind(getOpenShiftExtension().getBuildOutputKindOrDefault()) .enricherTask(e -> { diff --git a/gradle-plugin/openshift/src/test/java/org/eclipse/jkube/gradle/plugin/OpenShiftExtensionPropertyTest.java b/gradle-plugin/openshift/src/test/java/org/eclipse/jkube/gradle/plugin/OpenShiftExtensionPropertyTest.java index 2e08b472bf..78b6c70ec0 100644 --- a/gradle-plugin/openshift/src/test/java/org/eclipse/jkube/gradle/plugin/OpenShiftExtensionPropertyTest.java +++ b/gradle-plugin/openshift/src/test/java/org/eclipse/jkube/gradle/plugin/OpenShiftExtensionPropertyTest.java @@ -56,6 +56,7 @@ static Stream defaultValues() { return Stream.of( arguments("getBuildStrategyOrDefault", JKubeBuildStrategy.s2i), arguments("getOpenshiftPullSecretOrDefault", "pullsecret-jkube"), + arguments("getOpenshiftPushSecretOrDefault", null), arguments("getS2iBuildNameSuffixOrDefault", "-s2i"), arguments("getS2iImageStreamLookupPolicyLocalOrDefault", true), arguments("getBuildOutputKindOrDefault", "ImageStreamTag"), @@ -82,8 +83,8 @@ static Stream propertiesAndValues() { return Stream.of( arguments("getBuildStrategyOrDefault", "jkube.build.strategy", "jib", JKubeBuildStrategy.jib), arguments("getBuildStrategyOrDefault", "jkube.build.strategy", "docker", JKubeBuildStrategy.docker), - arguments("getOpenshiftPullSecretOrDefault", "jkube.build.pullSecret", "pullsecret-other", "pullsecret-other", - "pullsecret-jkube"), + arguments("getOpenshiftPullSecretOrDefault", "jkube.build.pullSecret", "pullsecret-other", "pullsecret-other"), + arguments("getOpenshiftPushSecretOrDefault", "jkube.build.pushSecret", "pushsecret-other", "pushsecret-other"), arguments("getS2iBuildNameSuffixOrDefault", "jkube.s2i.buildNameSuffix", "-other", "-other"), arguments("getS2iImageStreamLookupPolicyLocalOrDefault", "jkube.s2i.imageStreamLookupPolicyLocal", "false", false), arguments("getBuildOutputKindOrDefault", "jkube.build.buildOutput.kind", "DockerImage", "DockerImage"),