Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
Fix ImageChange triggers not being set in DeploymentConfig when resou…
Browse files Browse the repository at this point in the history
…rce fragments are used.

Related StackOverlow post: https://stackoverflow.com/questions/60375063

This seems to be a regression since we introduced sidecar containers support. For applying
ImageChange triggers we have to check which containers are main application containers and
which are sidecars. Well, we do that but when we don't set any `defaultApplicationContainerName`
when sidecar option is disabled. It seemed like a bug introduced my me during implementation.
  • Loading branch information
rohanKanojia committed Mar 2, 2020
1 parent 2c58aa0 commit 6525f61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Usage:
* Fix #1789: script to extract changelog information for notifications
* Fix #1770: Fixed my mistake, remove constructors from OpenshiftBuildConfig which were causing PluginConfigurationException
* Fix #1791: Fix NullPointerException in FileDataSecretEnricher (due to recent change in Kubernetes Client Builder null to LinkedHashMap conversion)
* Fix: ImageChangeTags not being applied in DeploymentConfig generated by plugin in case of resource fragments. (Issue found in [this](https://stackoverflow.com/questions/60375063) StackOverflow post.)

### 4.4.0 (2020-02-13)
* Fix #1572: Support maven --batch-mode option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,8 @@ public static String mergePodSpec(PodSpecBuilder builder, PodSpec defaultPodSpec
}

public static String mergePodSpec(PodSpecBuilder builder, PodSpec defaultPodSpec, String defaultName, boolean sidecarEnabled) {
// The default application container name is needed by plugin in order
// to add ImageChange triggers in case of DeploymentConfig
String defaultApplicationContainerName = null;
List<Container> containers = builder.buildContainers();
List<Container> defaultContainers = defaultPodSpec.getContainers();
Expand Down Expand Up @@ -753,6 +755,11 @@ public static String mergePodSpec(PodSpecBuilder builder, PodSpec defaultPodSpec
container = new Container();
containers.add(container);
}
// If default container name is not set, add first found
// container as default application container.
if (defaultApplicationContainerName == null) {
defaultApplicationContainerName = container.getName();
}
}

mergeSimpleFields(container, defaultContainer);
Expand Down

0 comments on commit 6525f61

Please sign in to comment.