Skip to content

Commit 81882a7

Browse files
committed
Make DockerWrapper check whether pull needed before automatically pulling
1 parent d0ca84a commit 81882a7

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/run/DockerWrapper.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,19 @@ public void executeWithDocker(List<String> containerArgs, File workDir, Pipeline
8989
writer.println("set -e");
9090

9191
writer.println("DOCKER='" + SequencePipelineService.get().getDockerCommand() + "'");
92-
writer.println("$DOCKER pull " + getLocalStorageArgs() + getEffectiveContainerName());
92+
93+
writer.println("IMAGE_EXISTS=`$DOCKER images -q \"" + getEffectiveContainerName() + "\" | wc -l`");
94+
writer.println("LOCAL=not_present");
95+
writer.println("if [ $IMAGE_EXISTS > 0 ];then");
96+
writer.println("\tLOCAL=`docker inspect --format='{{.Digest}}' " + getEffectiveContainerName() + "`");
97+
writer.println("fi");
98+
writer.println("LATEST=`regctl image digest --list " + getEffectiveContainerName() + "`");
99+
writer.println("if [ $LOCAL != $LATEST ];then");
100+
writer.println("\t$DOCKER pull " + getLocalStorageArgs() + getEffectiveContainerName());
101+
writer.println("else");
102+
writer.println("\techo 'Image up to date'");
103+
writer.println("fi");
104+
93105
if (_runPrune)
94106
{
95107
writer.println("$DOCKER image prune " + getLocalStorageArgs() + "-f");

SequenceAnalysis/pipeline_code/extra_tools_install.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,16 @@ else
261261
echo "Already installed"
262262
fi
263263

264+
if [[ ! -e ${LKTOOLS_DIR}/regctl || ! -z $FORCE_REINSTALL ]];
265+
then
266+
echo "Cleaning up previous installs"
267+
rm -Rf regctl*
268+
rm -Rf $LKTOOLS_DIR/regctl*
269+
270+
curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 > regctl
271+
chmod 755 regctl
272+
273+
install regctl $LKTOOLS_DIR/
274+
else
275+
echo "Already installed"
276+
fi

0 commit comments

Comments
 (0)