summaryrefslogtreecommitdiff
path: root/scripts/bst-build-or-show
blob: eac56a9fd5f5597131a1ee3b6f30f07e0a3d47d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
# 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
bst_target="$1"
if [ "$(bst show $bst_target --deps none --format '%{state}')" == 'downloadable' ]; then
    bst --colors show $bst_target
else
    bst --colors build $bst_target
fi