path: root/scripts/bst-build-or-show
diff options
Diffstat (limited to 'scripts/bst-build-or-show')
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/bst-build-or-show b/scripts/bst-build-or-show
new file mode 100755
index 0000000..7a8a8ec
--- /dev/null
+++ b/scripts/bst-build-or-show
@@ -0,0 +1,16 @@
+# This script runs a BuildStream build for a given element, unless there
+# is a suitable artifact already in the remote cache in which case it just
+# runs `bst show`.
+# It is intended for use by on-demand CI workers. If we just call `bst build`
+# and there is nothing to build then the CI worker will pull all of the remote
+# artifacts into a local cache, which will probably then be discarded anyway.
+set -eu
+if [ "$(bst show $bst_target --deps none --format '%{state}')" == 'cached' ]; then
+ bst --colors show $bst_target
+ bst --colors build $bst_target