From ab425d424879d144c3745d7c1117ee77429a484c Mon Sep 17 00:00:00 2001 From: Ivan Fraixedes Date: Tue, 5 Oct 2021 18:33:21 +0200 Subject: [PATCH] build: Consider the Admin UI assets Add into the Makefile and Jenkins the operations to build the Admin UI assets and lint them. Change-Id: I687c1adec796fd591664e34eb73a465e53096b58 --- Jenkinsfile.public | 18 ++++++++++++++++++ Makefile | 19 +++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile.public b/Jenkinsfile.public index f0f3219b9..b1ee676b5 100644 --- a/Jenkinsfile.public +++ b/Jenkinsfile.public @@ -115,6 +115,15 @@ pipeline { } } } + stage('satellite/admin/ui') { + steps { + dir('satellite/admin/ui') { + sh 'npm ci --prefer-offline --no-audit' + sh 'npm run build' + sh 'rm -rf public/build' // Remove the build directory for avoiding linting those files. + } + } + } } } @@ -339,6 +348,15 @@ pipeline { } } } + + stage('satellite/admin/ui') { + steps { + dir("satellite/admin/ui") { + sh 'npm run validate' + sh script: 'npm audit', returnStatus: true + } + } + } } } diff --git a/Makefile b/Makefile index 219d2160d..dda22d6a7 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,7 @@ goimports-st: ## Applies goimports to every go file in `git status` (ignores unt @git status --porcelain -uno|grep .go|grep -v "^D"|sed -E 's,\w+\s+(.+->\s+)?,,g'|xargs -I {} goimports -w -local storj.io {} .PHONY: build-packages -build-packages: build-packages-race build-packages-normal build-satellite-npm build-storagenode-npm build-multinode-npm ## Test docker images locally +build-packages: build-packages-race build-packages-normal build-satellite-npm build-storagenode-npm build-multinode-npm build-satellite-admin-npm ## Test docker images locally build-packages-race: go build -v ./... build-packages-normal: @@ -72,6 +72,8 @@ build-storagenode-npm: cd web/storagenode && npm ci build-multinode-npm: cd web/multinode && npm ci +build-satellite-admin-npm: + cd satellite/admin/ui && npm ci ##@ Simulator @@ -174,6 +176,19 @@ multinode-console: /usr/bin/env echo -e '\nfunc init() { FileSystem = AssetFile() }' >> multinode/console/consoleassets/bindata.resource.go gofmt -w -s multinode/console/consoleassets/bindata.resource.go +.PHONY: satellite-admin-ui +satellite-admin-ui: + # build web assets + rm -rf satellite/admin/ui/public/build + # install npm dependencies for being embedded by Go embed. + docker run --rm -i \ + --mount type=bind,src="${PWD}",dst=/go/src/storj.io/storj \ + -w /go/src/storj.io/storj/satellite/admin/ui \ + -e HOME=/tmp \ + -u $(shell id -u):$(shell id -g) \ + node:16.11.1 \ + /bin/bash -c "npm run build" + .PHONY: satellite-wasm satellite-wasm: docker run --rm -i -v "${PWD}":/go/src/storj.io/storj -e GO111MODULE=on \ @@ -286,7 +301,7 @@ identity_%: inspector_%: $(MAKE) binary-check COMPONENT=inspector GOARCH=$(word 3, $(subst _, ,$@)) GOOS=$(word 2, $(subst _, ,$@)) .PHONY: satellite_% -satellite_%: +satellite_%: satellite-admin-ui $(MAKE) binary-check COMPONENT=satellite GOARCH=$(word 3, $(subst _, ,$@)) GOOS=$(word 2, $(subst _, ,$@)) .PHONY: storagenode_% storagenode_%: storagenode-console