Skip to content

Commit

Permalink
Errors during docker build should make the DockerBuildTask fail
Browse files Browse the repository at this point in the history
Closes #195
  • Loading branch information
gesellix committed Feb 7, 2022
1 parent 6815b28 commit 60e6301
Showing 1 changed file with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,26 @@ public void onFinished() {
actualBuildContext);
try {
getLogger().debug("Waiting " + buildTimeout + " for the build to finish...");
buildFinished.await(buildTimeout.toMillis(), TimeUnit.MILLISECONDS);
boolean finished = buildFinished.await(buildTimeout.toMillis(), TimeUnit.MILLISECONDS);
if (!finished) {
getLogger().error("Build didn't finish before timeout of " + buildTimeout);
return null;
}

if (BuildInfoExtensionsKt.hasError(infos)) {
BuildInfo error = BuildInfoExtensionsKt.getError(infos);
getLogger().error("Build failed. {}", error != null ? error.getErrorDetail() : null);
return null;
}

ImageID imageId = BuildInfoExtensionsKt.getImageId(infos);
this.imageId = imageId == null ? null : imageId.getID();
return this.imageId;
}
catch (InterruptedException e) {
getLogger().error("Build didn't finish before timeout of " + buildTimeout, e);
getLogger().error("Build interrupted before timeout of " + buildTimeout, e);
return null;
}
ImageID imageId = BuildInfoExtensionsKt.getImageId(infos);
this.imageId = imageId == null ? null : imageId.getID();
return this.imageId;
}

@Internal
Expand Down

0 comments on commit 60e6301

Please sign in to comment.