[ARVADOS] updated: b0440160e64caecbff160a26f62301dd15d84c7f

git at public.curoverse.com git at public.curoverse.com
Tue Sep 9 15:14:37 EDT 2014


Summary of changes:
 sdk/cli/bin/crunch-job | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

       via  b0440160e64caecbff160a26f62301dd15d84c7f (commit)
      from  f467b469109e27bc18635c8952892e4c23fabd60 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit b0440160e64caecbff160a26f62301dd15d84c7f
Author: Brett Smith <brett at curoverse.com>
Date:   Tue Sep 9 15:16:22 2014 -0400

    #3830: Make crunch-job's git calls more robust.
    
    * Check git's exit status and only continue on 0.
    * Log git's exit status after optional calls.
    * Always log the resolved commit hash when it's found.
    
    Hopefully this will prevent a recurrence of refs #3830, or help rule
    out some possibilities if it does happen.  Tested by hand on 4xphq.

diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job
index a2c5512..0ffd8a9 100755
--- a/sdk/cli/bin/crunch-job
+++ b/sdk/cli/bin/crunch-job
@@ -447,9 +447,10 @@ else
   if ($treeish =~ m{^\d{1,4}$}) {
     my $gitlog = `git --git-dir=\Q$repo\E log --pretty="format:%H" --grep="git-svn-id:.*\@"\Q$treeish\E" " master`;
     chomp $gitlog;
-    if ($gitlog =~ /^[a-f0-9]{40}$/) {
+    Log(undef, "git Subversion search exited $?");
+    if (($? == 0) && ($gitlog =~ /^[a-f0-9]{40}$/)) {
       $commit = $gitlog;
-      Log (undef, "Using commit $commit for script_version $treeish");
+      Log(undef, "Using commit $commit for Subversion revision $treeish");
     }
   }
 
@@ -458,21 +459,19 @@ else
   if (!defined $commit) {
     my $found = `git --git-dir=\Q$repo\E rev-list -1 ''\Q$treeish\E`;
     chomp $found;
-    if ($found =~ /^[0-9a-f]{40}$/s) {
+    Log(undef, "git rev-list exited $? with result '$found'");
+    if (($? == 0) && ($found =~ /^[0-9a-f]{40}$/s)) {
       $commit = $found;
+      Log(undef, "Using commit $commit for tree-ish $treeish");
       if ($commit ne $treeish) {
 	# Make sure we record the real commit id in the database,
 	# frozentokey, logs, etc. -- instead of an abbreviation or a
 	# branch name which can become ambiguous or point to a
 	# different commit in the future.
-	$ENV{"CRUNCH_SRC_COMMIT"} = $commit;
-	Log (undef, "Using commit $commit for tree-ish $treeish");
-        if ($commit ne $treeish) {
-          $Job->{'script_version'} = $commit;
-          !$job_has_uuid or
-              $Job->update_attributes('script_version' => $commit) or
-              croak("Error while updating job");
-        }
+        $Job->{'script_version'} = $commit;
+        !$job_has_uuid or
+            $Job->update_attributes('script_version' => $commit) or
+            croak("Error while updating job");
       }
     }
   }
@@ -482,6 +481,7 @@ else
     @execargs = ("sh", "-c",
 		 "mkdir -p $ENV{CRUNCH_INSTALL} && cd $ENV{CRUNCH_TMP} && perl -");
     $git_archive = `git --git-dir=\Q$repo\E archive ''\Q$commit\E`;
+    croak("git archive failed: exit " . ($? >> 8)) if ($? != 0);
   }
   else {
     croak ("could not figure out commit id for $treeish");

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list