run_upload_packages.py: ignore errors writing timestamp files, but print
authorWard Vandewege <ward@curii.com>
Fri, 29 Jan 2021 15:41:55 +0000 (10:41 -0500)
committerWard Vandewege <ward@curii.com>
Fri, 29 Jan 2021 15:41:55 +0000 (10:41 -0500)
out a warning. We run this script from emphemeral machines now, so the
timestamp mechanism is not used.

No issue #

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

jenkins/run_upload_packages.py

index a161c2cefd8dbb86b732e69c5a565134dbba8481..bc4f4ffc6ae11096fcb742333ab6aa9c077941a4 100755 (executable)
@@ -69,9 +69,18 @@ class TimestampFile:
             return -1
 
     def update(self):
-        os.close(os.open(self.path, os.O_CREAT | os.O_APPEND))
-        os.utime(self.path, (time.time(), self.start_time))
-
+        try:
+            os.close(os.open(self.path, os.O_CREAT | os.O_APPEND))
+            os.utime(self.path, (time.time(), self.start_time))
+        except:
+            # when the packages directory is created/populated by a build in a
+            # docker container, as root, the script that runs the upload
+            # doesn't always have permission to touch a timestamp file there.
+            # In production, we build/upload from ephemeral machines, which
+            # means that the timestamp mechanism is not used. We print a
+            # warning and move on without erroring out.
+            print("Warning: unable to update timestamp file",self.path,"permission problem?")
+            pass
 
 class PackageSuite:
     NEED_SSH = False