ci-dockerfiles-sanity-check: Add verbatim from upstream repo

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: Ic4e32d081e2f9ac30bad50ba0e2edf84ecca2aa7
diff --git a/ci-dockerfiles-deployment/update-images.sh b/ci-dockerfiles-deployment/update-images.sh
new file mode 100755
index 0000000..d4b9058
--- /dev/null
+++ b/ci-dockerfiles-deployment/update-images.sh
@@ -0,0 +1,42 @@
+#!/bin/bash -e
+
+cd dockerfiles/
+
+images_to_update=""
+
+# find out which images haven't had any commits in the last 30 days
+
+for dir in ./*/; do
+    shortdir=$(basename $dir)
+    # Skip toolchain images
+    echo $shortdir|grep -q tcwg && continue
+    # not an image dir
+    [ -x $shortdir/build.sh ]||continue
+    changed=$(git log -1 --oneline --since "1 month" ${shortdir}|wc -l)
+    if [ $changed -eq 1 ]; then
+        echo "new: $shortdir"
+    else
+        echo "nothing new: $shortdir"
+        images_to_update="$images_to_update $shortdir"
+    fi
+done
+
+echo $images_to_update
+
+# trigger builds for every non-updated image over the http api
+for image in $images_to_update
+do
+    arch=$(echo ${image} | cut -f2 -d '-')
+    if [ "$arch" = "aarch64" ]; then
+        arch=arm64
+    fi
+    if [ "$arch" = "amd64" -o "$arch" = "arm64" -o "$arch" = "armhf" ]; then
+        cat > ../docker_${image}_build.txt << EOF
+nodelabel=build-${arch}
+image=${image}
+EOF
+    else
+        echo "unknown arch: $arch in $image"
+    fi
+done
+