Skip to content

Commit

Permalink
fix (gradle-plugin) : OpenShiftExtension should pick up `jkube.build.…
Browse files Browse the repository at this point in the history
…pushSecret` property (#2414)

Add getOpenshiftPushSecretOrDefault method in OpenShiftExtension to pick
up configuration value from property if it's not provided in groovy dsl

Signed-off-by: Rohan Kumar <[email protected]>
  • Loading branch information
rohanKanojia committed Oct 6, 2023
1 parent d9e23dc commit 767bde0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static Stream<Arguments> defaultValues() {
return Stream.of(
arguments("getBuildStrategyOrDefault", JKubeBuildStrategy.s2i),
arguments("getOpenshiftPullSecretOrDefault", "pullsecret-jkube"),
arguments("getOpenshiftPushSecretOrDefault", null),
arguments("getS2iBuildNameSuffixOrDefault", "-s2i"),
arguments("getS2iImageStreamLookupPolicyLocalOrDefault", true),
arguments("getBuildOutputKindOrDefault", "ImageStreamTag"),
Expand All @@ -82,8 +83,8 @@ static Stream<Arguments> 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"),
Expand Down

0 comments on commit 767bde0

Please sign in to comment.