summaryrefslogtreecommitdiffstats
path: root/.github/scripts
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <austin@netdata.cloud>2022-05-27 07:03:12 -0400
committerGitHub <noreply@github.com>2022-05-27 07:03:12 -0400
commit0542cc3d6bead0535afe5519eea459107c1c0ccd (patch)
tree0fa39d12ca45ed4b45e98cdd61f05a28a6da5e9b /.github/scripts
parent6c3a13d0109895fadc0385c686c9b0455fdf1947 (diff)
Cache invariant components in static builds to reduce build times. (#12877)
* Add basic build caching support to static builds. Cache is store din `artifacts/cache/${BUILDARCH}`. Each third-party component utilizes a separate build cache. Invalidation is only done for version changes (more rigorous invalidation is expected to be handled externally). * Integrate static build caching with CI. * Fix fping cache handling. * Test caching in CI. * Properly skip rebuilds on cache hits. * Remove static build container when done with it. * Reuse existing image automatically if it’s for the correct platform. * Test CI build caching. * Fix static build job names.
Diffstat (limited to '.github/scripts')
-rwxr-xr-x.github/scripts/get-static-cache-key.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/.github/scripts/get-static-cache-key.sh b/.github/scripts/get-static-cache-key.sh
new file mode 100755
index 0000000000..d9fa285970
--- /dev/null
+++ b/.github/scripts/get-static-cache-key.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+arch="${1}"
+platform="$(packaging/makeself/uname2platform.sh "${arch}")"
+
+docker pull --platform "${platform}" netdata/static-builder
+
+# shellcheck disable=SC2046
+cat $(find packaging/makeself/jobs -type f ! -regex '.*\(netdata\|-makeself\).*') > /tmp/static-cache-key-data
+
+docker run -it --rm --platform "${platform}" netdata/static-builder sh -c 'apk list -I 2>/dev/null' >> /tmp/static-cache-key-data
+
+h="$(sha256sum /tmp/static-cache-key-data | cut -f 1 -d ' ')"
+
+echo "::set-output name=key::static-${arch}-${h}"