diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2017-08-29 12:35:52 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2017-08-29 14:12:54 +0000 |
commit | 3458d7369246f83f26f802bf9d9827c67cf40f69 (patch) | |
tree | 14b081a50dd56831300df88ad22f0d3e2496e631 /scripts/bst-build-or-show | |
parent | ef35783a49fe1971f63e022b3a8bede4e686bc2c (diff) | |
download | definitions-3458d7369246f83f26f802bf9d9827c67cf40f69.tar.gz |
.gitlab-ci.yml: Avoid pulling artifacts for every BuildStream build
We shouldn't download artifacts to the CI workers every time somebody
pushes just to throw them away again. This should speed up no-op builds.
The functionality is implemented in two shell scripts. Context is here:
https://gitlab.com/BuildStream/buildstream/issues/77
It would be possible to do this with a single script, but I wanted to
avoid doing any argument parsing code in shell.
Diffstat (limited to 'scripts/bst-build-or-show')
-rwxr-xr-x | scripts/bst-build-or-show | 16 |
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 00000000..7a8a8ecc --- /dev/null +++ b/scripts/bst-build-or-show @@ -0,0 +1,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}')" == 'cached' ]; then + bst --colors show $bst_target +else + bst --colors build $bst_target +fi |