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 <roidelapluie@inuits.eu>

Co-authored-by: Julien Pivotto <roidelapluie@o11y.eu>
This commit is contained in:
Julien Pivotto 2022-04-06 20:23:55 +02:00 committed by GitHub
parent 1c1b174a8e
commit a236166c71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View File

@ -62,6 +62,9 @@ jobs:
- run: make ui-lint - run: make ui-lint
- run: make ui-build-module - run: make ui-build-module
- run: make ui-test - run: make ui-test
- run: make assets-tarball -o assets
- store_artifacts:
path: web/ui/static.tar.gz
- save_cache: - save_cache:
key: v3-npm-deps-{{ checksum "web/ui/package-lock.json" }} key: v3-npm-deps-{{ checksum "web/ui/package-lock.json" }}
paths: paths:

View File

@ -63,10 +63,15 @@ ui-lint:
assets: ui-install ui-build assets: ui-install ui-build
.PHONY: assets-compress .PHONY: assets-compress
assets-compress: assets-compress: assets
@echo '>> compressing assets' @echo '>> compressing assets'
scripts/compress_assets.sh scripts/compress_assets.sh
.PHONY: assets-tarball
assets-tarball: assets-compress
@echo '>> packaging assets'
scripts/package_assets.sh
.PHONY: test .PHONY: test
# If we only want to only test go code we have to change the test target # If we only want to only test go code we have to change the test target
# which is called by all. # which is called by all.

8
scripts/package_assets.sh Executable file
View File

@ -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