Skip to content

Commit

Permalink
Make DockerWrapper check whether pull needed before automatically pul…
Browse files Browse the repository at this point in the history
…ling
  • Loading branch information
bbimber committed Jan 8, 2025
1 parent d0ca84a commit 81882a7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,19 @@ public void executeWithDocker(List<String> containerArgs, File workDir, Pipeline
writer.println("set -e");

writer.println("DOCKER='" + SequencePipelineService.get().getDockerCommand() + "'");
writer.println("$DOCKER pull " + getLocalStorageArgs() + getEffectiveContainerName());

writer.println("IMAGE_EXISTS=`$DOCKER images -q \"" + getEffectiveContainerName() + "\" | wc -l`");
writer.println("LOCAL=not_present");
writer.println("if [ $IMAGE_EXISTS > 0 ];then");
writer.println("\tLOCAL=`docker inspect --format='{{.Digest}}' " + getEffectiveContainerName() + "`");
writer.println("fi");
writer.println("LATEST=`regctl image digest --list " + getEffectiveContainerName() + "`");
writer.println("if [ $LOCAL != $LATEST ];then");
writer.println("\t$DOCKER pull " + getLocalStorageArgs() + getEffectiveContainerName());
writer.println("else");
writer.println("\techo 'Image up to date'");
writer.println("fi");

if (_runPrune)
{
writer.println("$DOCKER image prune " + getLocalStorageArgs() + "-f");
Expand Down
13 changes: 13 additions & 0 deletions SequenceAnalysis/pipeline_code/extra_tools_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,16 @@ else
echo "Already installed"
fi

if [[ ! -e ${LKTOOLS_DIR}/regctl || ! -z $FORCE_REINSTALL ]];
then
echo "Cleaning up previous installs"
rm -Rf regctl*
rm -Rf $LKTOOLS_DIR/regctl*

curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 > regctl
chmod 755 regctl

install regctl $LKTOOLS_DIR/
else
echo "Already installed"
fi

0 comments on commit 81882a7

Please sign in to comment.