[libvirt] [dockerfiles PATCH] Add 'trigger' and 'monitor' scripts

Andrea Bolognani abologna at redhat.com
Wed Sep 11 13:11:35 UTC 2019


These are extremely crude scripts that are nonetheless useful when
it's time to rebuild all images. Usage is along these lines:

  $ ls libvirt-debian-10* >in
  $ ./trigger in out
  $ ./monitor out 3

Error handling is almost non-existent, but realistically speaking
at most three people will ever run these scripts anyway :)

Quay has limits on both the number of jobs that can be running at
the same time and the rate of job submission: rebuilding containers
in batches, eg. all Debian 10 containers, followed by all Debian 9
containers, and so on, allows us to remain within those limits.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 monitor | 40 ++++++++++++++++++++++++++++++++++++++++
 trigger | 23 +++++++++++++++++++++++
 2 files changed, 63 insertions(+)
 create mode 100755 monitor
 create mode 100755 trigger

diff --git a/monitor b/monitor
new file mode 100755
index 0000000..fd27140
--- /dev/null
+++ b/monitor
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+QUAYADMIN="../libvirt-jenkins-ci/guests/quayadmin"
+
+usage() {
+    echo "Usage: monitor INFILE INTERVAL" >&2
+    exit 1
+}
+
+infile="$1"
+interval="$2"
+
+test "$infile" || usage
+test "$interval" || usage
+
+while true; do
+    reset
+    output=no
+
+    while read _ build _ _ _ repository; do
+        repository="${repository#*/}"
+
+        out=$("$QUAYADMIN" show-build libvirt "$repository" "$build")
+        phase=$(echo "$out" | grep phase: | sed -E 's/.*: //g')
+
+        if test "$phase" = "complete"; then
+            continue
+        fi
+
+        echo "libvirt/$repository: $phase"
+        output=yes
+
+    done <"$infile"
+
+    if test "$output" == "no"; then
+        break
+    fi
+
+    sleep "$interval"
+done
diff --git a/trigger b/trigger
new file mode 100755
index 0000000..d2e853d
--- /dev/null
+++ b/trigger
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+QUAYADMIN="../libvirt-jenkins-ci/guests/quayadmin"
+
+usage() {
+    echo "Usage: trigger INFILE OUTFILE" >&2
+    exit 1
+}
+
+infile="$1"
+outfile="$2"
+
+test "$infile" || usage
+test "$outfile" || usage
+
+while read zip
+do
+    repository="${zip%.zip}"
+    url="https://github.com/libvirt/libvirt-dockerfiles/raw/master/$zip"
+
+    "$QUAYADMIN" create-build libvirt "$repository" "$url"
+
+done <"$infile" | tee "$outfile"
-- 
2.21.0




More information about the libvir-list mailing list