Skip to content

Commit 8ecdcb6

Browse files
committed
Merge branch 'master' of github.com:mwiede/docker-java
2 parents 1c27a44 + a5b9b0b commit 8ecdcb6

33 files changed

Lines changed: 536 additions & 465 deletions

.ci/setup_docker.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
set -exu
4+
5+
DOCKER_VERSION="${DOCKER_VERSION:-}"
6+
DOCKER_HOST="${DOCKER_HOST:-}"
7+
8+
if [[ -n $DOCKER_VERSION ]]; then
9+
sudo -E apt-get -q -y --purge remove docker-engine docker-ce
10+
11+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
12+
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
13+
sudo apt-get update
14+
sudo apt-cache madison docker-ce
15+
sudo apt-get install "docker-ce=$DOCKER_VERSION"
16+
fi
17+
18+
if [[ -n $DOCKER_HOST ]]; then
19+
sudo mkdir -p /etc/systemd/system/docker.service.d/
20+
21+
echo "
22+
[Service]
23+
ExecStart=
24+
ExecStart=/usr/bin/dockerd -H $DOCKER_HOST
25+
" | sudo tee -a /etc/systemd/system/docker.service.d/override.conf
26+
27+
sudo systemctl daemon-reload
28+
sudo service docker restart || sudo journalctl -xe
29+
sudo service docker status
30+
fi
31+
32+
while (! docker ps ); do
33+
echo "Waiting for Docker to launch..."
34+
sleep 1
35+
done
36+
docker version
37+
docker info
38+
39+
docker run --rm hello-world

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ ij_java_names_count_to_use_import_on_demand = 9999
1616
[{*.pom,*.xml}]
1717
indent_style = tab
1818
ij_xml_attribute_wrap = off
19+
20+
21+
[*.{yaml,yml}]
22+
indent_size = 2
23+
ij_yaml_keep_indents_on_empty_lines = false

.github/workflows/ci.yml

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,42 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
pull_request: {}
5+
push: { branches: [ master ] }
46

57
jobs:
68
build:
7-
runs-on: ubuntu-latest
9+
runs-on: ubuntu-18.04
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
include:
14+
- { name: "default" }
15+
- { name: "over TCP", dockerHost: "tcp://127.0.0.1:2375" }
16+
- { name: "Docker 18.06.3", dockerVersion: "18.06.3~ce~3-0~ubuntu" }
817

918
steps:
10-
- uses: actions/checkout@v1
11-
- name: Set up JDK 8
12-
uses: actions/setup-java@v1
13-
with:
14-
java-version: 8
15-
- name: Prepare ws
16-
run: rm -f "docker-java/src/test/resources/logback.xml" && mv "docker-java/src/test/resources/travis-logback.xml" "docker-java/src/test/resources/logback-test.xml"
17-
- name: Build with Maven
18-
run: ./mvnw --no-transfer-progress verify
19+
- uses: actions/checkout@v1
20+
- name: Set up JDK 8
21+
uses: actions/setup-java@v1
22+
with:
23+
java-version: 8
24+
- name: Configure Docker
25+
env:
26+
DOCKER_VERSION: ${{matrix.dockerVersion}}
27+
DOCKER_HOST: ${{matrix.dockerHost}}
28+
run: .ci/setup_docker.sh
29+
- name: Build with Maven
30+
env:
31+
DOCKER_HOST: ${{matrix.dockerHost}}
32+
run: ./mvnw --no-transfer-progress verify
33+
- name: Aggregate test reports with ciMate
34+
if: always()
35+
continue-on-error: true
36+
env:
37+
CIMATE_PROJECT_ID: lodr9d83
38+
CIMATE_CI_KEY: "CI / ${{matrix.name}}"
39+
run: |
40+
wget -q https://get.cimate.io/release/linux/cimate
41+
chmod +x cimate
42+
./cimate "**/TEST-*.xml"

.travis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.travis/travis-before-install.sh

Lines changed: 0 additions & 102 deletions
This file was deleted.

docker-java-api/src/main/java/com/github/dockerjava/api/command/PullImageResultCallback.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ private void checkDockerSwarmPullSuccessful() {
9090

9191
private void checkDockerClientPullSuccessful() {
9292
if (latestItem == null) {
93-
throw new DockerClientException("Could not pull image");
94-
} else if (!latestItem.isPullSuccessIndicated()) {
93+
return;
94+
}
95+
96+
if (!latestItem.isPullSuccessIndicated()) {
9597
throw new DockerClientException("Could not pull image: " + messageFromPullResult(latestItem));
9698
}
9799
}

docker-java-api/src/main/java/com/github/dockerjava/api/exception/DockerException.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ public class DockerException extends RuntimeException {
1313
private int httpStatus = 0;
1414

1515
public DockerException(String message, int httpStatus) {
16-
super(message);
16+
super(String.format("Status %d: %s", httpStatus, message));
1717
this.httpStatus = httpStatus;
1818
}
1919

2020
public DockerException(String message, int httpStatus, Throwable cause) {
21-
super(message, cause);
21+
super(String.format("Status %d: %s", httpStatus, message), cause);
22+
this.httpStatus = httpStatus;
2223
}
2324

2425
public int getHttpStatus() {

docker-java-api/src/main/java/com/github/dockerjava/api/model/EventType.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* @since 1.24
1212
*/
1313
public enum EventType {
14+
CONFIG("config"),
1415
/**
1516
* @since 1.24
1617
*/
@@ -26,7 +27,10 @@ public enum EventType {
2627
*/
2728
IMAGE("image"),
2829
NETWORK("network"),
30+
NODE("node"),
2931
PLUGIN("plugin"),
32+
SECRET("secret"),
33+
SERVICE("service"),
3034
VOLUME("volume");
3135

3236
private static final Map<String, EventType> EVENT_TYPES = new HashMap<>();

docker-java-api/src/main/java/com/github/dockerjava/api/model/Image.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package com.github.dockerjava.api.model;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
4+
45
import lombok.EqualsAndHashCode;
56
import lombok.ToString;
67

78
import java.io.Serializable;
9+
import java.util.Map;
810

911
/**
1012
*
@@ -28,12 +30,24 @@ public class Image implements Serializable {
2830
@JsonProperty("RepoTags")
2931
private String[] repoTags;
3032

33+
@JsonProperty("RepoDigests")
34+
private String[] repoDigests;
35+
3136
@JsonProperty("Size")
3237
private Long size;
3338

3439
@JsonProperty("VirtualSize")
3540
private Long virtualSize;
3641

42+
@JsonProperty("SharedSize")
43+
private Long sharedSize;
44+
45+
@JsonProperty("Labels")
46+
public Map<String, String> labels;
47+
48+
@JsonProperty("Containers")
49+
private Integer containers;
50+
3751
public String getId() {
3852
return id;
3953
}
@@ -42,6 +56,10 @@ public String[] getRepoTags() {
4256
return repoTags;
4357
}
4458

59+
public String[] getRepoDigests() {
60+
return repoDigests;
61+
}
62+
4563
public String getParentId() {
4664
return parentId;
4765
}
@@ -57,4 +75,17 @@ public Long getSize() {
5775
public Long getVirtualSize() {
5876
return virtualSize;
5977
}
78+
79+
80+
public Long getSharedSize() {
81+
return sharedSize;
82+
}
83+
84+
public Map<String, String> getLabels() {
85+
return labels;
86+
}
87+
88+
public Integer getContainers() {
89+
return containers;
90+
}
6091
}

0 commit comments

Comments
 (0)