Skip to content

Commit b3029ca

Browse files
committed
update version to 3.5.0
2 parents e40bd6c + fe0ecf3 commit b3029ca

38 files changed

+1547
-2515
lines changed

CHANGELOG.md

+31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Changelog
22

3+
## 3.5.0
4+
[Released](https://bitbucket.org/xnatdev/container-service/src/3.5.0/).
5+
6+
* **Improvement** [CS-946][] Prevent setting mutually distinct k8s PVC mounting options
7+
* **Bugfix** [CS-966][] Ensure tracking of container IDs in workflow tables in a Kubernetes environment
8+
* **Bugfix** [CS-968][] Switch the docker API library we use from [docker-client][] to [docker-java][].
9+
This should restore CS functionality on docker engine v25 and higher.
10+
11+
### A Note About Our Docker Library
12+
Originally we used the [spotify/docker-client][] library to wrap the docker remote API in java method calls. They stopped updating that and put out their final release [v6.1.1][] in 2016.
13+
14+
We switched the Container Service to use a fork of that client, [dmandalidis/docker-client][] in CS version 3.0.0. Given that this was a fork of the client we already used, it was a simple drop-in replacement with no changes needed.
15+
16+
But that library maintainer did continue to make changes. In 2023 they released a major version upgrade, [v7.0.0][], which dropped support for Java 8. That is the version of Java we use in XNAT (at time of writing) so this change meant we weren't able to update our version of this library. That was fine for a while...
17+
...Until version 25 of the docker engine, in which they made an API change which caused an error in the version we used of `docker-client`. The library (presumably) fixed their issue but we weren't able to use that fix because our version of the library was frozen by their decision to drop Java 8 support.
18+
19+
This forced us to switch our library from `docker-client` to [docker-java][]. This was not a drop-in replacement, and did require a migration. All the same docker API endpoints were supported in a 1:1 replacement—which took a little effort but was straightforward—except for one. The `docker-java` library did not support requesting `GenericResources` on a swarm service, which is the mechanism by which we allow commands to specify that they need a GPU. We opened a ticket reporting that lack of support (https://github.com/docker-java/docker-java/issues/2320), but at time of writing there has been no response. I created a fork (https://github.com/johnflavin/docker-java) and fixed the issue myself (https://github.com/docker-java/docker-java/pull/2327), but at time of writing that also has no response. I built a custom version of `docker-java` `3.4.0.1` and pushed that to the XNAT artifactory ([ext-release-local/com/github/docker-java][]).
20+
21+
Long story short, as of CS version `3.5.0` we depend on `docker-java` version `3.4.0.1` for our docker (and swarm) API support.
22+
23+
[CS-946]: https://radiologics.atlassian.net/browse/CS-946
24+
[CS-966]: https://radiologics.atlassian.net/browse/CS-966
25+
[CS-968]: https://radiologics.atlassian.net/browse/CS-968
26+
[docker-client]: https://github.com/spotify/docker-client
27+
[spotify/docker-client]: https://github.com/spotify/docker-client
28+
[v6.1.1]: https://github.com/spotify/docker-client/releases/tag/v6.1.1
29+
[dmandalidis/docker-client]: https://github.com/dmandalidis/docker-client
30+
[v7.0.0]: https://github.com/dmandalidis/docker-client/tree/v7.0.0
31+
[docker-java]: https://github.com/docker-java/docker-java
32+
[ext-release-local/com/github/docker-java]: https://nrgxnat.jfrog.io/ui/repos/tree/General/ext-release-local/com/github/docker-java
33+
334
## 3.4.3
435
[Released](https://bitbucket.org/xnatdev/container-service/src/3.4.3/).
536

build.gradle

+22-22
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ plugins {
1616
}
1717

1818
group "org.nrg.xnatx.plugins"
19-
version "3.4.3"
19+
version "3.5.0"
2020

2121
sourceCompatibility = 1.8
2222
targetCompatibility = 1.8
@@ -42,22 +42,22 @@ dependencyManagement {
4242
}
4343
}
4444
}
45-
def vDockerClient = "6.0.4"
45+
46+
def vDockerJava = "3.4.0.1"
4647
def vAutoValue = "1.3"
4748
def vKubernetesClient = "15.0.+"
4849
def vPowerMock = "1.7.0"
4950
def vGson = dependencyManagement.importedProperties["gson.version"]
5051
def vJackson = dependencyManagement.importedProperties["jackson.version"]
5152
def vSpringSecurity = dependencyManagement.importedProperties["spring-security.version"]
5253
def vActiveMQ = dependencyManagement.importedProperties["activemq.version"]
53-
def vJersey = "3.0.6"
54+
def vBouncyCastle = "1.64" // Included in xnat-web via spring-security-jwt 1.1.1, see XNAT-7907
5455

5556
// Use this configuration to put dependencies into the fat jar
5657
configurations {
5758
implementation.extendsFrom(implementAndInclude)
5859
all {
5960
resolutionStrategy.force "org.mockito:mockito-core:${vMockito}"
60-
exclude group: "org.bouncycastle"
6161
}
6262
}
6363

@@ -67,22 +67,8 @@ dependencies {
6767

6868
compileOnly "com.google.auto.value:auto-value:${vAutoValue}"
6969

70-
implementAndInclude ("org.mandas:docker-client:${vDockerClient}") {
71-
exclude group: "ch.qos.logback"
72-
exclude group: "org.slf4j"
73-
exclude group: "com.fasterxml.jackson.core"
74-
exclude group: "org.apache.commons", module: "commons-compress" // included in xnat-web via parent
75-
}
76-
77-
implementAndInclude "org.glassfish.jersey.core:jersey-client:${vJersey}"
78-
implementAndInclude "org.glassfish.jersey.inject:jersey-hk2:${vJersey}"
79-
implementAndInclude ("org.glassfish.jersey.connectors:jersey-apache-connector:${vJersey}") {
80-
exclude group: "org.apache.httpcomponents", module: "httpclient" // included in xnat-web directly
81-
}
82-
implementAndInclude ("org.glassfish.jersey.media:jersey-media-json-jackson:${vJersey}") {
83-
exclude group: "com.fasterxml.jackson.core" // Included in xnat-web directly
84-
exclude group: "com.fasterxml.jackson.module", module: "jackson-module-jaxb-annotations" // Included in xnat-web via spawner -> jackson-dataformat-xml
85-
}
70+
implementAndInclude "com.github.docker-java:docker-java-core:${vDockerJava}"
71+
implementAndInclude "com.github.docker-java:docker-java-transport-okhttp:${vDockerJava}"
8672

8773
implementAndInclude ("io.kubernetes:client-java:${vKubernetesClient}") {
8874
exclude group: "com.google.code.gson"
@@ -92,7 +78,9 @@ dependencies {
9278
exclude group: "org.apache.commons", module: "commons-compress"
9379
exclude group: "org.apache.commons", module: "commons-lang3"
9480
exclude group: "org.slf4j"
81+
exclude group: "org.bouncycastle"
9582
exclude group: "org.yaml", module: "snakeyaml"
83+
exclude group: "com.squareup.okhttp3", module: "okhttp" // Included via docker-java-transport-okhttp
9684
}
9785
implementAndInclude ("io.kubernetes:client-java-api:${vKubernetesClient}") { // Explicitly including to exclude transitive deps
9886
exclude group: "com.google.code.gson"
@@ -177,6 +165,8 @@ dependencies {
177165

178166
implementation group: 'javax.interceptor', name: 'javax.interceptor-api', version: '1.2.2'
179167

168+
runtimeOnly "org.bouncycastle:bcpkix-jdk15on:$vBouncyCastle"
169+
runtimeOnly "org.bouncycastle:bcprov-jdk15on:$vBouncyCastle"
180170
runtimeOnly "commons-codec:commons-codec"
181171
runtimeOnly "commons-io:commons-io"
182172
runtimeOnly "org.apache.commons:commons-compress"
@@ -203,8 +193,18 @@ dependencies {
203193
testImplementation "com.vladmihalcea:hibernate-types-43:${dependencyManagement.importedProperties["vladmihalcea-hibernate-types.version"]}"
204194
}
205195

206-
task unitTest( type: Test ) {
207-
exclude "**/*IntegrationTest.class"
196+
test {
197+
systemProperty "integration", System.getProperty('integration') == "true"
198+
}
199+
200+
tasks.register ( 'unitTest', Test ) {
201+
systemProperties['integration'] = "false"
202+
test
203+
}
204+
205+
tasks.register ( 'integrationTest', Test ) {
206+
systemProperties['integration'] = "true"
207+
test
208208
}
209209

210210
// Pulls in the Jenkins BUILD_NUMBER environment variable if available.

src/main/java/org/nrg/containers/api/ContainerControlApi.java

+3-34
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
package org.nrg.containers.api;
22

3-
import org.mandas.docker.client.DockerClient;
4-
import org.mandas.docker.client.exceptions.ServiceNotFoundException;
5-
import org.mandas.docker.client.exceptions.TaskNotFoundException;
63
import org.nrg.containers.events.model.DockerContainerEvent;
74
import org.nrg.containers.exceptions.ContainerBackendException;
85
import org.nrg.containers.exceptions.ContainerException;
96
import org.nrg.containers.exceptions.DockerServerException;
107
import org.nrg.containers.exceptions.NoContainerServerException;
118
import org.nrg.containers.exceptions.NoDockerServerException;
12-
import org.nrg.containers.model.command.auto.Command;
9+
import org.nrg.containers.exceptions.ServiceNotFoundException;
10+
import org.nrg.containers.exceptions.TaskNotFoundException;
1311
import org.nrg.containers.model.command.auto.ResolvedCommand;
1412
import org.nrg.containers.model.container.auto.Container;
15-
import org.nrg.containers.model.container.auto.ContainerMessage;
1613
import org.nrg.containers.model.container.auto.ServiceTask;
1714
import org.nrg.containers.model.dockerhub.DockerHubBase;
1815
import org.nrg.containers.model.dockerhub.DockerHubBase.DockerHub;
@@ -24,7 +21,6 @@
2421
import java.time.OffsetDateTime;
2522
import java.util.Date;
2623
import java.util.List;
27-
import java.util.Map;
2824

2925
public interface ContainerControlApi {
3026

@@ -45,44 +41,17 @@ public interface ContainerControlApi {
4541
Container create(ResolvedCommand resolvedCommand, UserI user) throws NoContainerServerException, ContainerBackendException, ContainerException;
4642
Container create(Container toCreate, UserI user) throws NoContainerServerException, ContainerBackendException, ContainerException;
4743
void start(final Container toStart) throws NoContainerServerException, ContainerBackendException;
48-
@Deprecated Container createContainerOrSwarmService(final ResolvedCommand dockerCommand, final UserI userI) throws NoDockerServerException, DockerServerException, ContainerException;
49-
@Deprecated Container createContainerOrSwarmService(final Container container, final UserI userI) throws NoDockerServerException, DockerServerException, ContainerException;
50-
@Deprecated void startContainer(final Container containerOrService) throws NoDockerServerException, DockerServerException;
51-
52-
List<Command> parseLabels(final String imageName)
53-
throws DockerServerException, NoDockerServerException, NotFoundException;
54-
55-
List<ContainerMessage> getAllContainers() throws NoDockerServerException, DockerServerException;
56-
List<ContainerMessage> getContainers(final Map<String, String> params) throws NoDockerServerException, DockerServerException;
57-
ContainerMessage getContainer(final String id) throws NotFoundException, NoDockerServerException, DockerServerException;
58-
String getContainerStatus(final String id) throws NotFoundException, NoDockerServerException, DockerServerException;
5944

6045
String getLog(Container container, LogType logType) throws ContainerBackendException, NoContainerServerException;
6146
String getLog(Container container, LogType logType, Boolean withTimestamps, OffsetDateTime since) throws ContainerBackendException, NoContainerServerException;
62-
@Deprecated String getStdoutLog(Container container) throws NoDockerServerException, DockerServerException;
63-
@Deprecated String getStderrLog(Container container) throws NoDockerServerException, DockerServerException;
64-
@Deprecated String getContainerStdoutLog(String containerId, DockerClient.LogsParam... logParams) throws NoDockerServerException, DockerServerException;
65-
@Deprecated String getContainerStderrLog(String containerId, DockerClient.LogsParam... logParams) throws NoDockerServerException, DockerServerException;
66-
@Deprecated String getServiceStdoutLog(String serviceId, DockerClient.LogsParam... logParams) throws NoDockerServerException, DockerServerException;
67-
@Deprecated String getServiceStderrLog(String serviceId, DockerClient.LogsParam... logParams) throws NoDockerServerException, DockerServerException;
68-
47+
6948
void kill(Container container) throws NoContainerServerException, ContainerBackendException, NotFoundException;
7049
void autoCleanup(Container container) throws NoContainerServerException, ContainerBackendException, NotFoundException;
7150
void remove(Container container) throws NoContainerServerException, ContainerBackendException, NotFoundException;
72-
@Deprecated void killContainer(final String id) throws NoDockerServerException, DockerServerException, NotFoundException;
73-
@Deprecated void killService(String id) throws NoDockerServerException, DockerServerException, NotFoundException;
74-
@Deprecated void removeContainerOrService(final Container container) throws NoDockerServerException, DockerServerException;
7551

76-
ServiceTask getTaskForService(Container service) throws NoDockerServerException, DockerServerException, ServiceNotFoundException, TaskNotFoundException;
7752
ServiceTask getTaskForService(DockerServer dockerServer, Container service) throws DockerServerException, ServiceNotFoundException, TaskNotFoundException;
7853

7954
List<DockerContainerEvent> getContainerEvents(final Date since, final Date until) throws NoDockerServerException, DockerServerException;
80-
@Deprecated void throwContainerEvents(final Date since, final Date until) throws NoDockerServerException, DockerServerException;
81-
@Deprecated void throwLostTaskEventForService(Container service);
82-
@Deprecated void throwTaskEventForService(Container service) throws NoDockerServerException, DockerServerException, ServiceNotFoundException, TaskNotFoundException;
83-
@Deprecated void throwTaskEventForService(DockerServer dockerServer, Container service) throws DockerServerException, ServiceNotFoundException, TaskNotFoundException;
84-
@Deprecated void throwRestartEventForService(Container service) throws ContainerException;
85-
@Deprecated void throwWaitingEventForService(Container service) throws ContainerException;
8655

8756
Integer getFinalizingThrottle();
8857
boolean isStatusEmailEnabled();

0 commit comments

Comments
 (0)