File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
docker-java-api/src/main/java/com/github/dockerjava/api/model
docker-java/src/test/java/com/github/dockerjava/cmd Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ public class BuildResponseItem extends ResponseItem {
99 private static final long serialVersionUID = -1252904184236343612L ;
1010
1111 private static final String BUILD_SUCCESS = "Successfully built" ;
12+ private static final String SHA256 = "sha256:" ;
1213
1314 /**
1415 * Returns whether the stream field indicates a successful build operation
@@ -19,7 +20,7 @@ public boolean isBuildSuccessIndicated() {
1920 return false ;
2021 }
2122
22- return getStream ().contains (BUILD_SUCCESS );
23+ return getStream ().contains (BUILD_SUCCESS ) || getStream (). startsWith ( SHA256 ) ;
2324 }
2425
2526 @ JsonIgnore
@@ -28,6 +29,10 @@ public String getImageId() {
2829 return null ;
2930 }
3031
32+ if (getStream ().startsWith (SHA256 )) {
33+ return getStream ().replaceFirst (SHA256 , "" ).trim ();
34+ }
35+
3136 return getStream ().replaceFirst (BUILD_SUCCESS , "" ).trim ();
3237 }
3338}
Original file line number Diff line number Diff line change 3939import static org .hamcrest .MatcherAssert .assertThat ;
4040import static org .hamcrest .Matchers .containsInAnyOrder ;
4141import static org .hamcrest .Matchers .containsString ;
42+ import static org .hamcrest .Matchers .endsWith ;
4243import static org .hamcrest .Matchers .equalTo ;
4344import static org .hamcrest .Matchers .isEmptyString ;
4445import static org .hamcrest .Matchers .not ;
@@ -317,6 +318,22 @@ public void cacheFrom() throws Exception {
317318
318319 }
319320
321+ @ Test
322+ public void quiet () {
323+ File baseDir = fileFromBuildTestResource ("labels" );
324+
325+ String imageId = dockerRule .getClient ()
326+ .buildImageCmd (baseDir )
327+ .withQuiet (true )
328+ .exec (new BuildImageResultCallback ())
329+ .awaitImageId ();
330+
331+ InspectImageResponse inspectImageResponse = dockerRule .getClient ().inspectImageCmd (imageId ).exec ();
332+ assertThat (inspectImageResponse , not (nullValue ()));
333+ assertThat (inspectImageResponse .getId (), endsWith (imageId ));
334+ LOG .info ("Image Inspect: {}" , inspectImageResponse .toString ());
335+ }
336+
320337 public void dockerfileNotInBaseDirectory () throws Exception {
321338 File baseDirectory = fileFromBuildTestResource ("dockerfileNotInBaseDirectory" );
322339 File dockerfile = fileFromBuildTestResource ("dockerfileNotInBaseDirectory/dockerfileFolder/Dockerfile" );
You can’t perform that action at this time.
0 commit comments