summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2017-08-29 12:35:52 (GMT)
committerSam Thursfield <sam.thursfield@codethink.co.uk>2017-08-29 14:12:54 (GMT)
commit3458d7369246f83f26f802bf9d9827c67cf40f69 (patch)
tree14b081a50dd56831300df88ad22f0d3e2496e631
parentef35783a49fe1971f63e022b3a8bede4e686bc2c (diff)
downloaddefinitions-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.
-rw-r--r--.gitlab-ci.yml30
-rwxr-xr-xscripts/bst-build-or-show16
-rwxr-xr-xscripts/bst-cross-build-or-show17
3 files changed, 48 insertions, 15 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cefaa95..06c6286 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -184,77 +184,77 @@ bst-convert:
bst-build-build-system:
stage: build-1
script:
- - bst --colors build systems/build-system-content.bst
+ - scripts/bst-build-or-show systems/build-system-content.bst
# Test building all converted Baserock systems
bst-build-base-system:
stage: build-2
script:
- - bst --colors build systems/base-system-content.bst
+ - scripts/bst-build-or-show systems/base-system-content.bst
bst-build-devel-system:
stage: build-2
script:
- - bst --colors build systems/devel-system-content.bst
+ - scripts/bst-build-or-show systems/devel-system-content.bst
bst-build-genivi-demo-platform-system:
stage: build-2
script:
- - bst --colors build systems/genivi-demo-platform-content.bst
+ - scripts/bst-build-or-show systems/genivi-demo-platform-content.bst
bst-build-gnome-system:
stage: build-2
script:
- - bst --colors build systems/gnome-system-content.bst
+ - scripts/bst-build-or-show systems/gnome-system-content.bst
bst-build-ivi-demo-platform-system:
stage: build-2
script:
- - bst --colors build systems/ivi-system-content.bst
+ - scripts/bst-build-or-show systems/ivi-system-content.bst
bst-build-minimal-system:
stage: build-2
script:
- - bst --colors build systems/minimal-system-content.bst
+ - scripts/bst-build-or-show systems/minimal-system-content.bst
bst-build-openstack-system:
stage: build-2
script:
- - bst --colors build systems/openstack-system-content.bst
+ - scripts/bst-build-or-show systems/openstack-system-content.bst
bst-build-trove-system:
stage: build-2
script:
- - bst --colors build systems/trove-system-content.bst
+ - scripts/bst-build-or-show systems/trove-system-content.bst
bst-build-weston-system:
stage: build-2
script:
- - bst --colors build systems/weston-system-content.bst
+ - scripts/bst-build-or-show systems/weston-system-content.bst
bst-build-weston-qt5-system:
stage: build-2
script:
- - bst --colors build systems/weston-qt5-system-content.bst
+ - scripts/bst-build-or-show systems/weston-qt5-system-content.bst
# Test cross building a toolchain and sysroot for each supported non-x86_64
# architecture.
bst-build-sysroot-armv8b64:
stage: build-3
script:
- - bst --colors --target-arch=armv8b64 build gnu-toolchain/stage2.bst
+ - scripts/bst-cross-build-or-show armv8b64 gnu-toolchain/stage2.bst
bst-build-sysroot-armv8l64:
stage: build-3
script:
- - bst --colors --target-arch=armv8l64 build gnu-toolchain/stage2.bst
+ - scripts/bst-cross-build-or-show armv8l64 gnu-toolchain/stage2.bst
bst-build-sysroot-ppc64b:
stage: build-3
script:
- - bst --colors --target-arch=ppc64b build gnu-toolchain/stage2.bst
+ - scripts/bst-cross-build-or-show ppc64b gnu-toolchain/stage2.bst
bst-build-sysroot-ppc64l:
stage: build-3
script:
- - bst --colors --target-arch=ppc64l build gnu-toolchain/stage2.bst
+ - scripts/bst-cross-build-or-show ppc64l gnu-toolchain/stage2.bst
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 @@
+#!/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
diff --git a/scripts/bst-cross-build-or-show b/scripts/bst-cross-build-or-show
new file mode 100755
index 0000000..3be2b48
--- /dev/null
+++ b/scripts/bst-cross-build-or-show
@@ -0,0 +1,17 @@
+#!/bin/bash
+# This script runs a BuildStream cross-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_arch="$1"
+bst_target="$2"
+if [ "$(bst --target-arch=$bst_target_arch show $bst_target --deps none --format '%{state}')" == 'cached' ]; then
+ bst --colors --target-arch="$bst_target_arch" show $bst_target
+else
+ bst --colors --target-arch="$bst_target_arch" build $bst_target
+fi