2023-04-12 17:06:26 +01:00
GO_VERSION ?= 1.20.3
2018-08-31 16:21:44 +01:00
GOOS ?= linux
GOARCH ?= amd64
2019-10-22 10:44:13 +01:00
GOPATH ?= $( shell go env GOPATH)
2022-01-12 15:57:32 +00:00
NODE_VERSION ?= 16.11.1
2018-07-25 22:47:02 +01:00
COMPOSE_PROJECT_NAME := ${ TAG } -$( shell git rev-parse --abbrev-ref HEAD)
2019-05-21 15:36:09 +01:00
BRANCH_NAME ?= $( shell git rev-parse --abbrev-ref HEAD | sed "s!/!-!g" )
2022-02-24 11:58:15 +00:00
GIT_TAG := $( shell git rev-parse --short HEAD)
2020-12-28 21:59:06 +00:00
i f e q ( $ { B R A N C H _ N A M E } , m a i n )
2022-02-24 11:58:15 +00:00
TAG := ${ GIT_TAG } -go${ GO_VERSION }
2019-03-07 18:58:55 +00:00
TRACKED_BRANCH := true
LATEST_TAG := latest
2018-08-22 03:54:56 +01:00
e l s e
2022-02-24 11:58:15 +00:00
TAG := ${ GIT_TAG } -${ BRANCH_NAME } -go${ GO_VERSION }
2019-05-21 15:36:09 +01:00
i f n e q ( , $( findstring release -,$ ( BRANCH_NAME ) ) )
2019-03-07 18:58:55 +00:00
TRACKED_BRANCH := true
2019-05-21 15:36:09 +01:00
LATEST_TAG := ${ BRANCH_NAME } -latest
2019-03-07 18:58:55 +00:00
e n d i f
2018-08-22 03:54:56 +01:00
e n d i f
2018-08-31 16:21:44 +01:00
CUSTOMTAG ?=
2018-07-25 22:47:02 +01:00
2018-08-31 16:21:44 +01:00
FILEEXT :=
i f e q ( $ { G O O S } , w i n d o w s )
FILEEXT := .exe
e n d i f
DOCKER_BUILD := docker build \
2019-04-08 21:01:20 +01:00
--build-arg TAG = ${ TAG }
2018-06-21 20:36:39 +01:00
2022-02-24 11:58:15 +00:00
DOCKER_BUILDX := docker buildx build
2018-10-16 19:47:43 +01:00
.DEFAULT_GOAL := help
.PHONY : help
help :
@awk ' BEGIN { \
FS = ":.*##" ; \
printf "\nUsage:\n make \033[36m<target>\033[0m\n" \
} \
/^[ a-zA-Z_-] +:.*?##/ { \
printf " \033[36m%-17s\033[0m %s\n" , $$ 1, $$ 2 \
} \
/^##@/ { \
printf "\n\033[1m%s\033[0m\n" , substr( $$ 0, 5) \
} ' $( MAKEFILE_LIST)
##@ Dependencies
.PHONY : build -dev -deps
build-dev-deps : ## Install dependencies for builds
go get golang.org/x/tools/cover
2019-11-05 20:14:10 +00:00
go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo
2021-11-30 19:50:56 +00:00
go get github.com/github-release/github-release
2018-10-16 19:47:43 +01:00
.PHONY : goimports -fix
goimports-fix : ## Applies goimports to every go file (excluding vendored files)
2018-12-07 13:44:25 +00:00
goimports -w -local storj.io $$ ( find . -type f -name '*.go' -not -path "*/vendor/*" )
2018-06-13 19:22:32 +01:00
2018-12-13 20:01:43 +00:00
.PHONY : goimports -st
goimports-st : ## Applies goimports to every go file in `git status` (ignores untracked files)
2019-01-22 12:35:48 +00:00
@git status --porcelain -uno| grep .go| grep -v "^D" | sed -E 's,\w+\s+(.+->\s+)?,,g' | xargs -I { } goimports -w -local storj.io { }
2018-12-13 20:01:43 +00:00
2021-09-08 17:56:29 +01:00
.PHONY : build -packages
2021-10-05 17:33:21 +01:00
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
2021-09-08 17:56:29 +01:00
build-packages-race :
go build -v ./...
build-packages-normal :
go build -v -race ./...
build-satellite-npm :
cd web/satellite && npm ci
build-storagenode-npm :
cd web/storagenode && npm ci
build-multinode-npm :
cd web/multinode && npm ci
2021-10-05 17:33:21 +01:00
build-satellite-admin-npm :
cd satellite/admin/ui && npm ci
2021-09-08 17:56:29 +01:00
2019-01-16 23:09:57 +00:00
##@ Simulator
2019-01-16 18:50:16 +00:00
2021-01-07 15:57:42 +00:00
# Allow the caller to set GATEWAYPATH if desired. This controls where the new
# go module is created to install the specific gateway version.
i f n d e f G A T E W A Y P A T H
GATEWAYPATH = .build/gateway-tmp
e n d i f
2019-01-16 23:09:57 +00:00
.PHONY : install -sim
install-sim : ## install storj-sim
2019-01-16 18:50:16 +00:00
@echo " Running ${ @ } "
2019-12-20 17:01:46 +00:00
go install -race -v \
storj.io/storj/cmd/satellite \
storj.io/storj/cmd/storagenode \
storj.io/storj/cmd/storj-sim \
storj.io/storj/cmd/versioncontrol \
storj.io/storj/cmd/uplink \
storj.io/storj/cmd/identity \
2021-05-13 18:05:49 +01:00
storj.io/storj/cmd/certificates \
storj.io/storj/cmd/multinode
2020-03-25 09:56:53 +00:00
2021-11-01 10:20:53 +00:00
## install the latest stable version of Gateway-ST
go install -race -v storj.io/gateway@latest
2019-01-16 18:50:16 +00:00
2022-05-19 23:46:37 +01:00
##@ Lint
LINT_TARGET = "./..."
.PHONY : .lint
.lint :
go run ./scripts/lint.go \
-parallel 4 \
-race \
-modules \
-copyright \
-imports \
-peer-constraints \
-atomic-align \
-monkit \
-errs \
-staticcheck \
-golangci \
-monitoring \
-wasm-size \
-protolock \
$( LINT_TARGET)
.PHONY : lint
lint :
docker run --rm -it \
-v ${ GOPATH } /pkg:/go/pkg \
-v ${ PWD } :/storj \
-w /storj \
2022-06-02 11:33:20 +01:00
storjlabs/ci-slim \
2022-05-19 23:46:37 +01:00
make .lint LINT_TARGET = " $( LINT_TARGET) "
2022-06-21 12:07:21 +01:00
.PHONY : .lint /testsuite /ui
.lint/testsuite/ui :
2022-05-19 23:46:37 +01:00
go run ./scripts/lint.go \
2022-06-21 12:07:21 +01:00
-work-dir testsuite/ui \
2022-05-19 23:46:37 +01:00
-parallel 4 \
-imports \
-atomic-align \
-errs \
-staticcheck \
-golangci \
$( LINT_TARGET)
2022-06-21 12:07:21 +01:00
.PHONY : lint /testsuite /ui
lint/testsuite/ui :
2022-05-19 23:46:37 +01:00
docker run --rm -it \
-v ${ GOPATH } /pkg:/go/pkg \
-v ${ PWD } :/storj \
-w /storj \
storjlabs/ci \
2022-06-21 12:07:21 +01:00
make .lint/testsuite/ui LINT_TARGET = " $( LINT_TARGET) "
2022-05-19 23:46:37 +01:00
2018-10-16 19:47:43 +01:00
##@ Test
2018-04-25 15:55:26 +01:00
2022-05-19 18:57:04 +01:00
TEST_TARGET ?= "./..."
.PHONY : test /setup
test/setup :
2022-05-26 10:27:52 +01:00
@docker compose -f docker-compose.tests.yaml down -v --remove-orphans ## cleanup previous data
2022-05-19 18:57:04 +01:00
@docker compose -f docker-compose.tests.yaml up -d
@sleep 3
2022-06-09 09:59:29 +01:00
@docker compose -f docker-compose.tests.yaml exec crdb1 bash -c 'cockroach sql --insecure -e "create database testcockroach;"'
@docker compose -f docker-compose.tests.yaml exec crdb2 bash -c 'cockroach sql --insecure -e "create database testcockroach;"'
@docker compose -f docker-compose.tests.yaml exec crdb3 bash -c 'cockroach sql --insecure -e "create database testcockroach;"'
@docker compose -f docker-compose.tests.yaml exec crdb4 bash -c 'cockroach sql --insecure -e "create database testcockroach;"'
@docker compose -f docker-compose.tests.yaml exec crdb5 bash -c 'cockroach sql --insecure -e "create database testcockroach;"'
@docker compose -f docker-compose.tests.yaml exec crdb4 bash -c 'cockroach sql --insecure -e "create database testmetabase;"'
@docker compose -f docker-compose.tests.yaml exec postgres bash -c 'echo "postgres" | psql -U postgres -c "create database teststorj;"'
@docker compose -f docker-compose.tests.yaml exec postgres bash -c 'echo "postgres" | psql -U postgres -c "create database testmetabase;"'
@docker compose -f docker-compose.tests.yaml exec postgres bash -c 'echo "postgres" | psql -U postgres -c "ALTER ROLE postgres CONNECTION LIMIT -1;"'
2022-05-19 18:57:04 +01:00
.PHONY : test /postgres
test/postgres : test /setup ## Run tests against Postgres (developer)
@env \
2022-05-26 10:27:52 +01:00
STORJ_TEST_POSTGRES = 'postgres://postgres:postgres@localhost:5532/teststorj?sslmode=disable' \
STORJ_TEST_COCKROACH = 'omit' \
2022-05-19 18:57:04 +01:00
STORJ_TEST_LOG_LEVEL = 'info' \
go test -tags noembed -parallel 4 -p 6 -vet= off -race -v -cover -coverprofile= .coverprofile $( TEST_TARGET) || { \
2022-05-26 10:27:52 +01:00
docker compose -f docker-compose.tests.yaml down -v; \
2022-05-19 18:57:04 +01:00
}
2022-05-26 10:27:52 +01:00
@docker compose -f docker-compose.tests.yaml down -v
2022-05-19 18:57:04 +01:00
@echo done
.PHONY : test /cockroach
test/cockroach : test /setup ## Run tests against CockroachDB (developer)
@env \
2022-05-26 10:27:52 +01:00
STORJ_TEST_COCKROACH_NODROP = 'true' \
STORJ_TEST_POSTGRES = 'omit' \
STORJ_TEST_COCKROACH = "cockroach://root@localhost:26356/testcockroach?sslmode=disable" \
STORJ_TEST_COCKROACH = " $$ S TORJ_TEST_COCKROACH;cockroach://root@localhost:26357/testcockroach?sslmode=disable " \
STORJ_TEST_COCKROACH = " $$ STORJ_TEST_COCKROACH;cockroach://root@localhost:26358/testcockroach?sslmode=disable " \
STORJ_TEST_COCKROACH = " $$ STORJ_TEST_COCKROACH;cockroach://root@localhost:26359/testcockroach?sslmode=disable " \
STORJ_TEST_COCKROACH_ALT = 'cockroach://root@localhost:26360/testcockroach?sslmode=disable' \
2022-05-19 18:57:04 +01:00
STORJ_TEST_LOG_LEVEL = 'info' \
go test -tags noembed -parallel 4 -p 6 -vet= off -race -v -cover -coverprofile= .coverprofile $( TEST_TARGET) || { \
2022-05-26 10:27:52 +01:00
docker compose -f docker-compose.tests.yaml down -v; \
2022-05-19 18:57:04 +01:00
}
2022-05-26 10:27:52 +01:00
@docker compose -f docker-compose.tests.yaml down -v
2022-05-19 18:57:04 +01:00
@echo done
2018-10-16 19:47:43 +01:00
.PHONY : test
2022-05-19 18:57:04 +01:00
test : test /setup ## Run tests against CockroachDB and Postgres (developer)
@env \
2022-05-26 10:27:52 +01:00
STORJ_TEST_COCKROACH_NODROP = 'true' \
STORJ_TEST_POSTGRES = 'postgres://postgres:postgres@localhost:5532/teststorj?sslmode=disable' \
STORJ_TEST_COCKROACH = "cockroach://root@localhost:26356/testcockroach?sslmode=disable" \
STORJ_TEST_COCKROACH = " $$ STORJ_TEST_COCKROACH;cockroach://root@localhost:26357/testcockroach?sslmode=disable " \
STORJ_TEST_COCKROACH = " $$ STORJ_TEST_COCKROACH;cockroach://root@localhost:26358/testcockroach?sslmode=disable " \
STORJ_TEST_COCKROACH = " $$ STORJ_TEST_COCKROACH;cockroach://root@localhost:26359/testcockroach?sslmode=disable " \
STORJ_TEST_COCKROACH_ALT = 'cockroach://root@localhost:26360/testcockroach?sslmode=disable' \
2022-05-19 18:57:04 +01:00
STORJ_TEST_LOG_LEVEL = 'info' \
go test -tags noembed -parallel 4 -p 6 -vet= off -race -v -cover -coverprofile= .coverprofile $( TEST_TARGET) || { \
docker compose -f docker-compose.tests.yaml rm -fs; \
}
@docker compose -f docker-compose.tests.yaml rm -fs
2018-05-09 00:01:46 +01:00
@echo done
2018-06-05 22:06:37 +01:00
2019-01-16 23:09:57 +00:00
.PHONY : test -sim
2019-04-30 19:18:32 +01:00
test-sim : ## Test source with storj-sim (jenkins)
2019-01-08 15:24:15 +00:00
@echo " Running ${ @ } "
2022-09-16 10:12:06 +01:00
@./scripts/tests/integration/test-sim.sh
2019-01-08 15:24:15 +00:00
2021-03-08 11:21:43 +00:00
.PHONY : test -sim -redis -unavailability
test-sim-redis-unavailability : ## Test source with Redis availability with storj-sim (jenkins)
@echo " Running ${ @ } "
2022-09-16 10:12:06 +01:00
@./scripts/tests/redis/test-sim-redis-up-and-down.sh
2021-03-08 11:21:43 +00:00
2019-09-04 18:58:38 +01:00
.PHONY : test -certificates
test-certificates : ## Test certificate signing service and storagenode setup (jenkins)
2019-01-04 17:23:23 +00:00
@echo " Running ${ @ } "
2019-09-04 18:58:38 +01:00
@./scripts/test-certificates.sh
2019-01-04 17:23:23 +00:00
2019-08-07 00:03:14 +01:00
.PHONY : test -sim -backwards -compatible
test-sim-backwards-compatible : ## Test uploading a file with lastest release (jenkins)
@echo " Running ${ @ } "
2022-09-16 10:12:06 +01:00
@./scripts/tests/backwardcompatibility/test-sim-backwards.sh
2019-08-07 00:03:14 +01:00
2019-10-15 18:00:14 +01:00
.PHONY : check -monitoring
check-monitoring : ## Check for locked monkit calls that have changed
@echo " Running ${ @ } "
2019-12-16 15:25:12 +00:00
@check-monitoring ./... | diff -U0 ./monkit.lock - \
2021-07-30 15:56:29 +01:00
|| ( echo "Locked monkit metrics have been changed. **Notify #team-data** and run \`go run github.com/storj/ci/check-monitoring -out monkit.lock ./...\` to update monkit.lock file." \
2019-10-15 18:00:14 +01:00
&& exit 1)
2021-01-20 18:57:47 +00:00
.PHONY : test -wasm -size
test-wasm-size : ## Test that the built .wasm code has not increased in size
@echo " Running ${ @ } "
@./scripts/test-wasm-size.sh
2018-10-16 19:47:43 +01:00
##@ Build
2018-07-13 16:02:33 +01:00
2019-10-08 09:52:19 +01:00
.PHONY : storagenode -console
storagenode-console :
# build web assets
rm -rf web/storagenode/dist
# install npm dependencies and build the binaries
docker run --rm -i \
--mount type = bind,src= " ${ PWD } " ,dst= /go/src/storj.io/storj \
-w /go/src/storj.io/storj/web/storagenode \
2019-10-08 13:59:22 +01:00
-e HOME = /tmp \
-u $( shell id -u) :$( shell id -g) \
2022-01-12 15:57:32 +00:00
node:${ NODE_VERSION } \
2019-10-08 09:52:19 +01:00
/bin/bash -c "npm ci && npm run build"
2021-07-12 16:11:37 +01:00
.PHONY : multinode -console
multinode-console :
# build web assets
rm -rf web/multinode/dist
# install npm dependencies and build the binaries
docker run --rm -i \
--mount type = bind,src= " ${ PWD } " ,dst= /go/src/storj.io/storj \
-w /go/src/storj.io/storj/web/multinode \
-e HOME = /tmp \
-u $( shell id -u) :$( shell id -g) \
2022-01-12 15:57:32 +00:00
node:${ NODE_VERSION } \
2021-07-12 16:11:37 +01:00
/bin/bash -c "npm ci && npm run build"
2021-10-05 17:33:21 +01:00
.PHONY : satellite -admin -ui
satellite-admin-ui :
# 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) \
2022-01-12 15:57:32 +00:00
node:${ NODE_VERSION } \
2022-03-23 13:29:47 +00:00
/bin/bash -c "npm ci && npm run build"
2021-10-05 17:33:21 +01:00
2020-12-11 01:23:39 +00:00
.PHONY : satellite -wasm
satellite-wasm :
docker run --rm -i -v " ${ PWD } " :/go/src/storj.io/storj -e GO111MODULE = on \
2021-09-08 17:56:29 +01:00
-e GOOS = js -e GOARCH = wasm -e GOARM = 6 -e CGO_ENABLED = 1 \
2020-12-11 01:23:39 +00:00
-v /tmp/go-cache:/tmp/.cache/go-build -v /tmp/go-pkg:/go/pkg \
-w /go/src/storj.io/storj -e GOPROXY -e TAG = ${ TAG } -u $( shell id -u) :$( shell id -g) storjlabs/golang:${ GO_VERSION } \
scripts/build-wasm.sh ; \
2018-10-16 19:47:43 +01:00
.PHONY : images
2023-01-26 13:49:12 +00:00
images : multinode -image satellite -image uplink -image versioncontrol -image ## Build multinode, satellite and versioncontrol Docker images
2018-10-16 19:47:43 +01:00
echo Built version: ${ TAG }
2018-08-23 22:04:51 +01:00
2022-02-20 21:56:33 +00:00
.PHONY : multinode -image
2022-02-20 22:42:43 +00:00
multinode-image : multinode_linux_arm multinode_linux_arm 64 multinode_linux_amd 64 ## Build multinode Docker image
2022-02-20 21:56:33 +00:00
${ DOCKER_BUILD } --pull= true -t storjlabs/multinode:${ TAG } ${ CUSTOMTAG } -amd64 \
-f cmd/multinode/Dockerfile .
2022-03-25 08:18:58 +00:00
${ DOCKER_BUILD } --pull= true -t storjlabs/multinode:${ TAG } ${ CUSTOMTAG } -arm32v5 \
--build-arg= GOARCH = arm --build-arg= DOCKER_ARCH = arm32v5 \
2022-02-20 21:56:33 +00:00
-f cmd/multinode/Dockerfile .
${ DOCKER_BUILD } --pull= true -t storjlabs/multinode:${ TAG } ${ CUSTOMTAG } -arm64v8 \
--build-arg= GOARCH = arm64 --build-arg= DOCKER_ARCH = arm64v8 \
-f cmd/multinode/Dockerfile .
2023-01-16 18:55:28 +00:00
.PHONY : uplink -image
uplink-image : uplink_linux_arm uplink_linux_arm 64 uplink_linux_amd 64 ## Build uplink-cli Docker image
${ DOCKER_BUILD } --pull= true -t storjlabs/uplink:${ TAG } ${ CUSTOMTAG } -amd64 \
-f cmd/uplink/Dockerfile .
${ DOCKER_BUILD } --pull= true -t storjlabs/uplink:${ TAG } ${ CUSTOMTAG } -arm32v5 \
--build-arg= GOARCH = arm --build-arg= DOCKER_ARCH = arm32v5 \
-f cmd/uplink/Dockerfile .
${ DOCKER_BUILD } --pull= true -t storjlabs/uplink:${ TAG } ${ CUSTOMTAG } -arm64v8 \
--build-arg= GOARCH = arm64 --build-arg= DOCKER_ARCH = arm64v8 \
-f cmd/uplink/Dockerfile .
2018-10-16 19:47:43 +01:00
.PHONY : satellite -image
2019-08-19 10:40:16 +01:00
satellite-image : satellite_linux_arm satellite_linux_arm 64 satellite_linux_amd 64 ## Build satellite Docker image
2019-04-08 21:01:20 +01:00
${ DOCKER_BUILD } --pull= true -t storjlabs/satellite:${ TAG } ${ CUSTOMTAG } -amd64 \
-f cmd/satellite/Dockerfile .
2022-03-25 08:18:58 +00:00
${ DOCKER_BUILD } --pull= true -t storjlabs/satellite:${ TAG } ${ CUSTOMTAG } -arm32v5 \
--build-arg= GOARCH = arm --build-arg= DOCKER_ARCH = arm32v5 \
2019-04-08 21:01:20 +01:00
-f cmd/satellite/Dockerfile .
2020-12-21 13:50:57 +00:00
${ DOCKER_BUILD } --pull= true -t storjlabs/satellite:${ TAG } ${ CUSTOMTAG } -arm64v8 \
2021-07-30 13:01:48 +01:00
--build-arg= GOARCH = arm64 --build-arg= DOCKER_ARCH = arm64v8 \
2019-08-19 10:40:16 +01:00
-f cmd/satellite/Dockerfile .
2020-04-21 15:48:40 +01:00
2019-05-02 22:25:04 +01:00
.PHONY : versioncontrol -image
2019-08-19 10:40:16 +01:00
versioncontrol-image : versioncontrol_linux_arm versioncontrol_linux_arm 64 versioncontrol_linux_amd 64 ## Build versioncontrol Docker image
2019-05-02 22:25:04 +01:00
${ DOCKER_BUILD } --pull= true -t storjlabs/versioncontrol:${ TAG } ${ CUSTOMTAG } -amd64 \
-f cmd/versioncontrol/Dockerfile .
2022-03-25 08:18:58 +00:00
${ DOCKER_BUILD } --pull= true -t storjlabs/versioncontrol:${ TAG } ${ CUSTOMTAG } -arm32v5 \
--build-arg= GOARCH = arm --build-arg= DOCKER_ARCH = arm32v5 \
2019-05-02 22:25:04 +01:00
-f cmd/versioncontrol/Dockerfile .
2020-12-21 13:50:57 +00:00
${ DOCKER_BUILD } --pull= true -t storjlabs/versioncontrol:${ TAG } ${ CUSTOMTAG } -arm64v8 \
2021-07-30 13:01:48 +01:00
--build-arg= GOARCH = arm64 --build-arg= DOCKER_ARCH = arm64v8 \
2019-08-19 10:40:16 +01:00
-f cmd/versioncontrol/Dockerfile .
2018-08-27 22:06:55 +01:00
2018-08-31 16:21:44 +01:00
.PHONY : binary
binary : CUSTOMTAG = -${GOOS }-${GOARCH }
binary :
2018-09-05 21:40:47 +01:00
@if [ -z " ${ COMPONENT } " ] ; then echo "Try one of the following targets instead:" \
&& for b in binaries ${ BINARIES } ; do echo " - $$ b " ; done && exit 1; fi
2018-08-31 16:21:44 +01:00
mkdir -p release/${ TAG }
2019-06-18 18:18:10 +01:00
mkdir -p /tmp/go-cache /tmp/go-pkg
2018-10-16 19:48:17 +01:00
rm -f cmd/${ COMPONENT } /resource.syso
2021-09-08 17:56:29 +01:00
if [ " ${ GOARCH } " = "amd64" ] ; then sixtyfour = "-64" ; fi ; \
[ " ${ GOOS } " = "windows" ] && [ " ${ GOARCH } " = "amd64" ] && goversioninfo $$ sixtyfour -o cmd/${ COMPONENT } /resource.syso \
-original-name ${ COMPONENT } _${ GOOS } _${ GOARCH } ${ FILEEXT } \
-description " ${ COMPONENT } program for Storj " \
-product-ver-major " $( shell git describe --tags --exact-match --match "v[0-9]*\.[0-9]*\.[0-9]*" | awk -F'.' 'BEGIN {v=0} {gsub("v", "", $$0); v=$$1} END {print v}' ) " \
-ver-major " $( shell git describe --tags --exact-match --match "v[0-9]*\.[0-9]*\.[0-9]*" | awk -F'.' 'BEGIN {v=0} {gsub("v", "", $$0); v=$$1} END {print v}' ) " \
-product-ver-minor " $( shell git describe --tags --exact-match --match "v[0-9]*\.[0-9]*\.[0-9]*" | awk -F'.' 'BEGIN {v=0} {v=$$2} END {print v}' ) " \
-ver-minor " $( shell git describe --tags --exact-match --match "v[0-9]*\.[0-9]*\.[0-9]*" | awk -F'.' 'BEGIN {v=0} {v=$$2} END {print v}' ) " \
-product-ver-patch " $( shell git describe --tags --exact-match --match "v[0-9]*\.[0-9]*\.[0-9]*" | awk -F'.' 'BEGIN {v=0} {v=$$3} END {print v}' | awk -F'-' 'BEGIN {v=0} {v=$$1} END {print v}' ) " \
-ver-patch " $( shell git describe --tags --exact-match --match "v[0-9]*\.[0-9]*\.[0-9]*" | awk -F'.' 'BEGIN {v=0} {v=$$3} END {print v}' | awk -F'-' 'BEGIN {v=0} {v=$$1} END {print v}' ) " \
-product-version " $( shell git describe --tags --exact-match --match "v[0-9]*\.[0-9]*\.[0-9]*" | awk -F'-' 'BEGIN {v=0} {v=$$1} END {print v}' || echo "dev" ) " \
-special-build " $( shell git describe --tags --exact-match --match "v[0-9]*\.[0-9]*\.[0-9]*" | awk -F'-' 'BEGIN {v=0} {v=$$2} END {print v}' ) " \
resources/versioninfo.json || echo "goversioninfo is not installed, metadata will not be created"
2021-09-07 14:17:12 +01:00
docker run --rm -i -v " ${ PWD } " :/go/src/storj.io/storj -e GO111MODULE = on \
2021-09-08 17:56:29 +01:00
-e GOOS = ${ GOOS } -e GOARCH = ${ GOARCH } -e GOARM = 6 -e CGO_ENABLED = 1 \
-v /tmp/go-cache:/tmp/.cache/go-build -v /tmp/go-pkg:/go/pkg \
-w /go/src/storj.io/storj -e GOPROXY -u $( shell id -u) :$( shell id -g) storjlabs/golang:${ GO_VERSION } \
scripts/release.sh build $( EXTRA_ARGS) -o release/${ TAG } /$( COMPONENT) _${ GOOS } _${ GOARCH } ${ FILEEXT } \
storj.io/storj/cmd/${ COMPONENT }
if [ " ${ COMPONENT } " = "satellite" ] && [ " ${ GOOS } " = "linux" ] && [ " ${ GOARCH } " = "amd64" ] ; \
then \
echo "Building wasm code" ; \
$( MAKE) satellite-wasm; \
fi
2020-12-11 01:23:39 +00:00
2018-09-05 21:40:47 +01:00
chmod 755 release/${ TAG } /$( COMPONENT) _${ GOOS } _${ GOARCH } ${ FILEEXT }
2018-10-17 19:21:18 +01:00
[ " ${ FILEEXT } " = ".exe" ] && storj-sign release/${ TAG } /$( COMPONENT) _${ GOOS } _${ GOARCH } ${ FILEEXT } || echo "Skipping signing"
2018-08-31 16:21:44 +01:00
rm -f release/${ TAG } /${ COMPONENT } _${ GOOS } _${ GOARCH } .zip
2019-11-05 18:47:50 +00:00
.PHONY : binary -check
binary-check :
2019-11-05 20:41:02 +00:00
@if [ -f release/${ TAG } /${ COMPONENT } _${ GOOS } _${ GOARCH } ] || [ -f release/${ TAG } /${ COMPONENT } _${ GOOS } _${ GOARCH } .exe ] ; \
then \
echo " release/ ${ TAG } / ${ COMPONENT } _ ${ GOOS } _ ${ GOARCH } exists " ; \
else \
echo " Making ${ COMPONENT } " ; \
$( MAKE) binary; \
fi
2019-11-05 18:47:50 +00:00
.PHONY : certificates_ %
certificates_% :
2019-11-11 18:58:08 +00:00
$( MAKE) binary-check COMPONENT = certificates GOARCH = $( word 3, $( subst _, ,$@ ) ) GOOS = $( word 2, $( subst _, ,$@ ) )
2019-11-05 18:47:50 +00:00
.PHONY : identity_ %
identity_% :
2019-11-11 18:58:08 +00:00
$( MAKE) binary-check COMPONENT = identity GOARCH = $( word 3, $( subst _, ,$@ ) ) GOOS = $( word 2, $( subst _, ,$@ ) )
2022-02-20 21:56:33 +00:00
.PHONE : multinode_ %
multinode_% : multinode -console
$( MAKE) binary-check COMPONENT = multinode GOARCH = $( word 3, $( subst _, ,$@ ) ) GOOS = $( word 2, $( subst _, ,$@ ) )
2018-09-05 21:40:47 +01:00
.PHONY : satellite_ %
2021-10-05 17:33:21 +01:00
satellite_% : satellite -admin -ui
2019-11-11 18:58:08 +00:00
$( MAKE) binary-check COMPONENT = satellite GOARCH = $( word 3, $( subst _, ,$@ ) ) GOOS = $( word 2, $( subst _, ,$@ ) )
2018-09-05 21:40:47 +01:00
.PHONY : storagenode_ %
2019-10-08 09:52:19 +01:00
storagenode_% : storagenode -console
2019-11-11 18:58:08 +00:00
$( MAKE) binary-check COMPONENT = storagenode GOARCH = $( word 3, $( subst _, ,$@ ) ) GOOS = $( word 2, $( subst _, ,$@ ) )
2019-11-05 18:47:50 +00:00
.PHONY : storagenode -updater_ %
storagenode-updater_% :
2020-09-28 13:46:32 +01:00
EXTRA_ARGS = "-tags=service" $( MAKE) binary-check COMPONENT = storagenode-updater GOARCH = $( word 3, $( subst _, ,$@ ) ) GOOS = $( word 2, $( subst _, ,$@ ) )
2018-09-05 21:40:47 +01:00
.PHONY : uplink_ %
uplink_% :
2019-04-08 21:01:20 +01:00
$( MAKE) binary-check COMPONENT = uplink GOARCH = $( word 3, $( subst _, ,$@ ) ) GOOS = $( word 2, $( subst _, ,$@ ) )
2019-05-02 22:25:04 +01:00
.PHONY : versioncontrol_ %
versioncontrol_% :
2019-11-11 18:58:08 +00:00
$( MAKE) binary-check COMPONENT = versioncontrol GOARCH = $( word 3, $( subst _, ,$@ ) ) GOOS = $( word 2, $( subst _, ,$@ ) )
2021-07-12 16:11:37 +01:00
.PHONY : multinode_ %
multinode_% : multinode -console
$( MAKE) binary-check COMPONENT = multinode GOARCH = $( word 3, $( subst _, ,$@ ) ) GOOS = $( word 2, $( subst _, ,$@ ) )
2018-09-05 21:40:47 +01:00
2019-10-04 21:48:41 +01:00
2023-05-25 09:56:02 +01:00
COMPONENTLIST := certificates identity multinode satellite storagenode storagenode-updater uplink versioncontrol
2021-09-15 14:12:53 +01:00
OSARCHLIST := linux_amd64 linux_arm linux_arm64 windows_amd64 freebsd_amd64
2018-09-05 21:40:47 +01:00
BINARIES := $( foreach C,$( COMPONENTLIST) ,$( foreach O,$( OSARCHLIST) ,$C_ $O ) )
2018-08-31 16:21:44 +01:00
.PHONY : binaries
2023-05-25 09:56:02 +01:00
binaries : ${BINARIES } ## Build certificates, identity, multinode, satellite, storagenode, uplink, versioncontrol and multinode binaries (jenkins)
2018-10-16 19:47:43 +01:00
2019-10-08 12:51:22 +01:00
.PHONY : sign -windows -installer
2019-11-04 18:24:36 +00:00
sign-windows-installer :
2019-10-08 12:51:22 +01:00
storj-sign release/${ TAG } /storagenode_windows_amd64.msi
2018-10-16 19:47:43 +01:00
##@ Deploy
.PHONY : push -images
2022-03-25 08:18:58 +00:00
push-images : ## Push Docker images to Docker Hub (jenkins)
2019-04-08 21:01:20 +01:00
# images have to be pushed before a manifest can be created
2023-01-26 13:49:12 +00:00
for c in multinode satellite uplink versioncontrol ; do \
2019-04-15 20:04:02 +01:00
docker push storjlabs/$$ c:${ TAG } ${ CUSTOMTAG } -amd64 \
2022-03-25 08:18:58 +00:00
&& docker push storjlabs/$$ c:${ TAG } ${ CUSTOMTAG } -arm32v5 \
2020-12-21 13:50:57 +00:00
&& docker push storjlabs/$$ c:${ TAG } ${ CUSTOMTAG } -arm64v8 \
2019-04-15 18:49:08 +01:00
&& for t in ${ TAG } ${ CUSTOMTAG } ${ LATEST_TAG } ; do \
2019-08-28 13:18:56 +01:00
docker manifest create storjlabs/$$ c:$$ t \
storjlabs/$$ c:${ TAG } ${ CUSTOMTAG } -amd64 \
2022-03-25 08:18:58 +00:00
storjlabs/$$ c:${ TAG } ${ CUSTOMTAG } -arm32v5 \
2020-12-21 13:50:57 +00:00
storjlabs/$$ c:${ TAG } ${ CUSTOMTAG } -arm64v8 \
2019-04-15 19:30:36 +01:00
&& docker manifest annotate storjlabs/$$ c:$$ t storjlabs/$$ c:${ TAG } ${ CUSTOMTAG } -amd64 --os linux --arch amd64 \
2022-03-25 08:18:58 +00:00
&& docker manifest annotate storjlabs/$$ c:$$ t storjlabs/$$ c:${ TAG } ${ CUSTOMTAG } -arm32v5 --os linux --arch arm --variant v5 \
2020-12-21 13:50:57 +00:00
&& docker manifest annotate storjlabs/$$ c:$$ t storjlabs/$$ c:${ TAG } ${ CUSTOMTAG } -arm64v8 --os linux --arch arm64 --variant v8 \
2019-04-15 18:49:08 +01:00
&& docker manifest push --purge storjlabs/$$ c:$$ t \
; done \
; done
2018-08-31 16:21:44 +01:00
.PHONY : binaries -upload
2018-10-16 19:47:43 +01:00
binaries-upload : ## Upload binaries to Google Storage (jenkins)
2020-01-27 19:26:57 +00:00
cd " release/ ${ TAG } " ; for f in *; do \
2021-03-11 11:35:32 +00:00
zipname = $$ ( echo $$ { f} | sed 's/.exe//g' ) \
2021-03-15 19:37:22 +00:00
&& filename = $$ ( echo $$ { f} | sed 's/_.*\.exe/.exe/g' | sed 's/_.*\.msi/.msi/g' | sed 's/_.*//g' ) \
2021-03-11 11:35:32 +00:00
&& if [ " $$ {f} " != " $$ {filename} " ] ; then \
ln $$ { f} $$ { filename} \
&& zip -r " $$ {zipname}.zip " " $$ {filename} " \
&& rm $$ { filename} \
; else \
zip -r " $$ {zipname}.zip " " $$ {filename} " \
; fi \
2020-01-27 19:26:57 +00:00
; done
2019-04-08 21:01:20 +01:00
cd " release/ ${ TAG } " ; gsutil -m cp -r *.zip " gs://storj-v3-alpha-builds/ ${ TAG } / "
2018-08-31 16:21:44 +01:00
2021-11-30 19:50:56 +00:00
.PHONY : draft -release
draft-release :
2021-12-22 12:33:07 +00:00
scripts/draft-release.sh ${ BRANCH_NAME } " release/ ${ TAG } "
2021-11-30 19:50:56 +00:00
2018-10-16 19:47:43 +01:00
##@ Clean
.PHONY : clean
2021-04-08 16:56:46 +01:00
clean : binaries -clean clean -images ## Clean docker test environment, local release binaries, and local Docker images
2018-10-16 19:47:43 +01:00
2018-08-31 16:21:44 +01:00
.PHONY : binaries -clean
2018-10-16 19:47:43 +01:00
binaries-clean : ## Remove all local release binaries (jenkins)
2018-08-31 16:21:44 +01:00
rm -rf release
2018-10-16 19:47:43 +01:00
.PHONY : clean -images
clean-images :
2022-02-20 21:56:33 +00:00
-docker rmi storjlabs/multinode:${ TAG } ${ CUSTOMTAG }
2019-03-07 15:22:18 +00:00
-docker rmi storjlabs/satellite:${ TAG } ${ CUSTOMTAG }
2019-05-21 12:57:20 +01:00
-docker rmi storjlabs/versioncontrol:${ TAG } ${ CUSTOMTAG }
2018-10-16 19:47:43 +01:00
2019-05-09 14:25:44 +01:00
##@ Tooling
2019-09-10 14:24:16 +01:00
.PHONY : diagrams
diagrams :
2020-02-01 19:12:27 +00:00
archview -root "storj.io/storj/satellite.Core" -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/satellite/ ./satellite/... | dot -T svg -o satellite-core.svg
archview -root "storj.io/storj/satellite.API" -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/satellite/ ./satellite/... | dot -T svg -o satellite-api.svg
archview -root "storj.io/storj/satellite.Repairer" -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/satellite/ ./satellite/... | dot -T svg -o satellite-repair.svg
2019-09-10 14:24:16 +01:00
archview -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/satellite/ ./satellite/... | dot -T svg -o satellite.svg
archview -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/storagenode/ ./storagenode/... | dot -T svg -o storage-node.svg
.PHONY : diagrams -graphml
diagrams-graphml :
2020-02-01 19:12:27 +00:00
archview -root "storj.io/storj/satellite.Core" -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/satellite/ -out satellite-core.graphml ./satellite/...
archview -root "storj.io/storj/satellite.API" -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/satellite/ -out satellite-api.graphml ./satellite/...
archview -root "storj.io/storj/satellite.Repairer" -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/satellite/ -out satellite-repair.graphml ./satellite/...
2019-09-10 14:24:16 +01:00
archview -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/satellite/ -out satellite.graphml ./satellite/...
archview -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/storagenode/ -out storage-node.graphml ./storagenode/...
2020-06-05 09:19:28 +01:00
.PHONY : bump -dependencies
bump-dependencies :
2021-03-29 12:16:31 +01:00
go get storj.io/common@main storj.io/private@main storj.io/uplink@main
2020-09-07 14:01:29 +01:00
go mod tidy
2022-06-21 12:07:21 +01:00
cd testsuite/ui; \
2023-03-27 11:45:10 +01:00
go get storj.io/common@main storj.io/private@main storj.io/uplink@main; \
go mod tidy;
cd testsuite/storjscan; \
go get storj.io/common@main storj.io/private@main storj.io/uplink@main; \
2021-09-16 16:09:07 +01:00
go mod tidy;
2021-03-29 12:45:27 +01:00
update-proto-lock :
2021-04-08 16:56:46 +01:00
protolock commit --ignore "satellite/internalpb,storagenode/internalpb"