Allow requesting serial signing 76/14676/2
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>
Fri, 22 Feb 2019 18:32:20 +0000 (13:32 -0500)
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>
Fri, 22 Feb 2019 19:10:57 +0000 (14:10 -0500)
Sigul-signing directories containing a lot of large artifacts may not be
optimal, because whether serial or parallel, the same amount of
network IO is required and the job takes about the same amount of time
in the end. This allows passing "serial" as a third argument to sign_dir
to specifically request serial operation.

Change-Id: I6a6267090cee6cbed1f134b27eb6cec485fa1793
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
releasenotes/notes/add-option-for-serial-e5342f8365a92120.yaml [new file with mode: 0644]
shell/sign

diff --git a/releasenotes/notes/add-option-for-serial-e5342f8365a92120.yaml b/releasenotes/notes/add-option-for-serial-e5342f8365a92120.yaml
new file mode 100644 (file)
index 0000000..a3b7655
--- /dev/null
@@ -0,0 +1,8 @@
+---
+features:
+  - |
+    Allow passing ``serial`` as third argument to **sign_dir**
+
+    Parallel-signing using sigul is resulting in NSPR reset errors,
+    so allow passing "serial" to the sign_dir function as a third argument
+    to request serial signing of directory contents.
index d572560..4ef50a0 100755 (executable)
@@ -91,7 +91,15 @@ sign_dir() {
         exit 1
     fi
 
+    local mode="serial"
     if hash parallel 2>/dev/null; then
+        # Unless you specifically asked for serial mode
+        if [ "$3" != "serial" ]; then
+            local mode="parallel"
+        fi
+    fi
+
+    if [ "$mode" == "parallel" ]; then
         echo "Signing in parallel..."
         case "$signer" in
             gpg )
@@ -116,7 +124,7 @@ sign_dir() {
         echo "Signed the following files:"
         printf '%s\n' "${files_to_sign[@]}"
     else
-        echo "GNU parallel not found. Signing in serial mode..."
+        echo "Signing in serial mode..."
         case "$signer" in
             gpg )
                 for f in "${files_to_sign[@]}"; do