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
This commit is contained in:
Ivan Fraixedes 2021-10-05 18:33:21 +02:00 committed by Egon Elbre
parent 289ae3325a
commit ab425d4248
2 changed files with 35 additions and 2 deletions

View File

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

View File

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