From a236166c71b6eaae622d585f35f3f27459971c1c Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Wed, 6 Apr 2022 20:23:55 +0200 Subject: [PATCH] Store compiled web ui in CI (#10546) Some downstream distros fail to compile Prometheus UI (Debian, NixOS). This is an attempt to store compiled UI in circleci for them to consume it. Currently we do not expose this outside of circleci. Signed-off-by: Julien Pivotto Co-authored-by: Julien Pivotto --- .circleci/config.yml | 3 +++ Makefile | 7 ++++++- scripts/package_assets.sh | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 scripts/package_assets.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 9419f8b988..44cf04abd4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -62,6 +62,9 @@ jobs: - run: make ui-lint - run: make ui-build-module - run: make ui-test + - run: make assets-tarball -o assets + - store_artifacts: + path: web/ui/static.tar.gz - save_cache: key: v3-npm-deps-{{ checksum "web/ui/package-lock.json" }} paths: diff --git a/Makefile b/Makefile index f28a535969..c5b58bf5ab 100644 --- a/Makefile +++ b/Makefile @@ -63,10 +63,15 @@ ui-lint: assets: ui-install ui-build .PHONY: assets-compress -assets-compress: +assets-compress: assets @echo '>> compressing assets' scripts/compress_assets.sh +.PHONY: assets-tarball +assets-tarball: assets-compress + @echo '>> packaging assets' + scripts/package_assets.sh + .PHONY: test # If we only want to only test go code we have to change the test target # which is called by all. diff --git a/scripts/package_assets.sh b/scripts/package_assets.sh new file mode 100755 index 0000000000..f747d8d51f --- /dev/null +++ b/scripts/package_assets.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# +# compress static assets + +set -euo pipefail + +cd web/ui +find static -type f -name '*.gz' -print0 | xargs -0 tar cf static.tar.gz