Skip to content

Commit

Permalink
Option to run docker prune before jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
bbimber committed Dec 2, 2024
1 parent 44aa8ba commit c0af553
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class DockerWrapper extends AbstractCommandWrapper
private final PipelineContext _ctx;
private File _tmpDir = null;
private String _entryPoint = null;
private boolean _runPrune = true;

public DockerWrapper(String containerName, Logger log, PipelineContext ctx)
{
Expand All @@ -41,6 +42,11 @@ public void setEntryPoint(String entryPoint)
_entryPoint = entryPoint;
}

public void setRunPrune(boolean runPrune)
{
_runPrune = runPrune;
}

public void executeWithDocker(List<String> containerArgs, File workDir, PipelineOutputTracker tracker) throws PipelineJobException
{
File localBashScript = new File(workDir, "docker.sh");
Expand All @@ -56,6 +62,11 @@ public void executeWithDocker(List<String> containerArgs, File workDir, Pipeline
writer.println("WD=`pwd`");

writer.println("DOCKER='" + SequencePipelineService.get().getDockerCommand() + "'");
if (_runPrune)
{
writer.println("$DOCKER image prune -f");
}

writer.println("$DOCKER pull " + _containerName);
writer.println("$DOCKER run --rm=true \\");

Expand Down

0 comments on commit c0af553

Please sign in to comment.