Skip to content

Commit

Permalink
Revert latch removal, as this somehow broke the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hialus committed Apr 27, 2024
1 parent 459e878 commit 8c3acb2
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.nio.file.Paths;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.concurrent.CountDownLatch;

import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
Expand Down Expand Up @@ -322,6 +323,7 @@ private void executeDockerCommand(String containerId, String buildJobId, boolean
execCreateCmd = execCreateCmd.withUser("root");
}
ExecCreateCmdResponse execCreateCmdResponse = execCreateCmd.exec();
final CountDownLatch latch = new CountDownLatch(1);
try {
dockerClient.execStartCmd(execCreateCmdResponse.getId()).withDetach(detach).exec(new ResultCallback.Adapter<>() {

Expand All @@ -333,11 +335,20 @@ public void onNext(Frame item) {
buildLogsMap.appendBuildLogEntry(buildJobId, buildLogEntry);
}
}
}).awaitCompletion();

@Override
public void onComplete() {
latch.countDown();
}
});
}
catch (ConflictException e) {
throw new LocalCIException("Could not execute Docker command: " + String.join(" ", command), e);
}

try {
latch.await();
}
catch (InterruptedException e) {
throw new LocalCIException("Interrupted while executing Docker command: " + String.join(" ", command), e);
}
Expand Down

0 comments on commit 8c3acb2

Please sign in to comment.