[ARVADOS] created: df1447d6b6993eeafa2e3145045ee0f4e196a825
Git user
git at public.curoverse.com
Tue Apr 5 16:22:42 EDT 2016
at df1447d6b6993eeafa2e3145045ee0f4e196a825 (commit)
commit df1447d6b6993eeafa2e3145045ee0f4e196a825
Author: Brett Smith <brett at curoverse.com>
Date: Tue Apr 5 16:21:20 2016 -0400
8810: crunch-job reports errors when checking if Docker image is loaded.
Since the check was previously in an `if !` condition, errors in it
would cause us to enter the branch.
diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job
index cc0b60c..bef7c00 100755
--- a/sdk/cli/bin/crunch-job
+++ b/sdk/cli/bin/crunch-job
@@ -416,8 +416,17 @@ if ($docker_locator = $Job->{docker_image_locator}) {
Log (undef, "docker image hash is $docker_hash");
$docker_stream =~ s/^\.//;
my $docker_install_script = qq{
-if ! $docker_bin images -q --no-trunc --all | grep -qxF \Q$docker_hash\E; then
- arv-get \Q$docker_locator$docker_stream/$docker_hash.tar\E | $docker_bin load
+if $docker_bin images -q --no-trunc --all | grep -qxF \Q$docker_hash\E; then
+ exit 0
+fi
+declare -a exit_codes=("\${PIPESTATUS[@]}")
+if [ 0 != "\${exit_codes[0]}" ]; then
+ exit "\${exit_codes[0]}" # `docker images` failed
+elif [ 1 != "\${exit_codes[1]}" ]; then
+ exit "\${exit_codes[1]}" # `grep` encountered an error
+else
+ # Everything worked fine, but grep didn't find the image on this host.
+ arv-get \Q$docker_locator$docker_stream/$docker_hash.tar\E | $docker_bin load
fi
};
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list