satellite/admin/ui,web/{multinode,storagenode}: build without embedding

Embedded files significantly increase the binary size for linking.
Add a tag that allows disabling embedding the build npm code.

Change-Id: I9d1fd7376d1fa035965c33d259faaa6c4770dfe1
This commit is contained in:
Egon Elbre 2022-03-29 12:42:53 +03:00
parent 19a2555126
commit 1f1f777d06
8 changed files with 68 additions and 4 deletions

View File

@ -89,13 +89,13 @@ pipeline {
stage('go') {
steps {
// use go test to build all the packages, including tests
sh 'go test -v -p 16 -bench XYZXYZXYZXYZ -run XYZXYZXYZXYZ ./...'
sh 'go test -v -p 16 -tags noembed -bench XYZXYZXYZXYZ -run XYZXYZXYZXYZ ./...'
}
}
stage('go -race') {
steps {
// use go test to build all the packages, including tests
sh 'go test -v -p 16 -bench XYZXYZXYZXYZ -run XYZXYZXYZXYZ -race ./...'
sh 'go test -v -p 16 -tags noembed -bench XYZXYZXYZXYZ -run XYZXYZXYZXYZ -race ./...'
// install storj-sim
sh 'go install -race -v storj.io/storj/cmd/satellite '+
@ -206,7 +206,7 @@ pipeline {
sh 'psql -U postgres -c \'create database testmetabase;\''
sh 'use-ports -from 1024 -to 10000 &'
sh 'go test -parallel 4 -p 6 -vet=off $COVERFLAGS -timeout 32m -json -race ./... 2>&1 | tee .build/tests.json | xunit -out .build/tests.xml'
sh 'go test -tags noembed -parallel 4 -p 6 -vet=off $COVERFLAGS -timeout 32m -json -race ./... 2>&1 | tee .build/tests.json | xunit -out .build/tests.xml'
}
post {
@ -238,7 +238,7 @@ pipeline {
}
steps {
sh 'psql -U postgres -c \'create database benchstorj;\''
sh 'go test -parallel 1 -p 1 -vet=off -timeout 20m -short -run XYZXYZXYZXYZ -bench . -benchtime 1x ./...'
sh 'go test -tags noembed -parallel 1 -p 1 -vet=off -timeout 20m -short -run XYZXYZXYZXYZ -bench . -benchtime 1x ./...'
}
}

View File

@ -24,6 +24,7 @@ func TestBasic(t *testing.T) {
Reconfigure: testplanet.Reconfigure{
Satellite: func(log *zap.Logger, index int, config *satellite.Config) {
config.Admin.Address = "127.0.0.1:0"
config.Admin.StaticDir = "ui/build"
},
},
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {

View File

@ -1,6 +1,9 @@
// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
//go:build !noembed
// +build !noembed
package adminui
import (

View File

@ -0,0 +1,18 @@
// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
//go:build noembed
// +build noembed
package adminui
import "io/fs"
// Assets contains either the built admin/ui or it is empty.
var Assets fs.FS = emptyFS{}
// emptyFS implements an empty filesystem
type emptyFS struct{}
// Open implements fs.FS method.
func (emptyFS) Open(name string) (fs.File, error) { return nil, fs.ErrNotExist }

View File

@ -1,6 +1,9 @@
// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
//go:build !noembed
// +build !noembed
package multinodeweb
import (

View File

@ -0,0 +1,18 @@
// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
//go:build noembed
// +build noembed
package multinodeweb
import "io/fs"
// Assets contains either the built admin/ui or it is empty.
var Assets fs.FS = emptyFS{}
// emptyFS implements an empty filesystem
type emptyFS struct{}
// Open implements fs.FS method.
func (emptyFS) Open(name string) (fs.File, error) { return nil, fs.ErrNotExist }

View File

@ -1,6 +1,9 @@
// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
//go:build !noembed
// +build !noembed
package storagenodeweb
import (

View File

@ -0,0 +1,18 @@
// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
//go:build noembed
// +build noembed
package storagenodeweb
import "io/fs"
// Assets contains either the built admin/ui or it is empty.
var Assets fs.FS = emptyFS{}
// emptyFS implements an empty filesystem
type emptyFS struct{}
// Open implements fs.FS method.
func (emptyFS) Open(name string) (fs.File, error) { return nil, fs.ErrNotExist }