2020-04-08 14:55:40 -04:00
|
|
|
# Determine this makefile's path.
|
|
|
|
|
# Be sure to place this BEFORE `include` directives, if any.
|
|
|
|
|
THIS_FILE := $(lastword $(MAKEFILE_LIST))
|
2020-05-19 08:33:19 -07:00
|
|
|
THIS_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
|
2020-04-08 14:55:40 -04:00
|
|
|
|
2020-04-28 11:20:37 -07:00
|
|
|
TMP_DIR := $(shell mktemp -d)
|
2020-08-10 17:15:02 -04:00
|
|
|
REPO_PATH := github.com/hashicorp/boundary
|
2020-04-08 14:55:40 -04:00
|
|
|
|
2020-05-21 16:03:21 -04:00
|
|
|
CGO_ENABLED?=0
|
|
|
|
|
|
2020-05-11 12:42:10 -04:00
|
|
|
export GEN_BASEPATH := $(shell pwd)
|
2020-05-04 11:23:35 -04:00
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: api
|
2021-01-21 16:27:20 -05:00
|
|
|
api:
|
2020-10-07 14:02:33 -04:00
|
|
|
$(MAKE) --environment-overrides -C internal/api/genapi api
|
2020-05-21 16:03:21 -04:00
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: cli
|
2021-02-23 19:06:39 -05:00
|
|
|
cli:
|
|
|
|
|
$(MAKE) --environment-overrides -C internal/cmd/gencli cli
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: tools
|
2020-06-30 11:26:22 -04:00
|
|
|
tools:
|
2020-05-01 12:38:01 -07:00
|
|
|
go generate -tags tools tools/tools.go
|
2022-04-04 13:55:42 -04:00
|
|
|
go install github.com/bufbuild/buf/cmd/buf@v1.3.1
|
2022-06-09 13:02:55 -04:00
|
|
|
go install github.com/mfridman/tparse@v0.10.3
|
2020-05-01 12:38:01 -07:00
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: cleangen
|
2020-05-21 16:03:21 -04:00
|
|
|
cleangen:
|
2022-03-21 13:26:01 -04:00
|
|
|
@rm -f $(shell find ${THIS_DIR} -name '*.gen.go' && find ${THIS_DIR} -name '*.pb.go' && find ${THIS_DIR} -name '*.pb.gw.go')
|
2020-05-04 14:58:18 -04:00
|
|
|
|
2022-03-16 17:04:07 -04:00
|
|
|
.PHONY: install-no-plugins
|
|
|
|
|
install-no-plugins: export SKIP_PLUGIN_BUILD=1
|
|
|
|
|
install-no-plugins: install
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: dev
|
2022-03-09 16:20:44 -05:00
|
|
|
dev:
|
|
|
|
|
@echo "This command has changed. Please use:"
|
|
|
|
|
@echo "==> make build"
|
|
|
|
|
@echo " to build the binary into the bin/ directory"
|
|
|
|
|
@echo "==> make install"
|
|
|
|
|
@echo " to build the binary and install it into GOPATH/bin"
|
|
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
|
build: BUILD_TAGS+=ui
|
|
|
|
|
build: build-ui-ifne
|
|
|
|
|
@echo "==> Building Boundary with UI features enabled"
|
2020-09-25 17:44:50 -04:00
|
|
|
@CGO_ENABLED=$(CGO_ENABLED) BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/build.sh'"
|
|
|
|
|
|
2022-03-09 16:20:44 -05:00
|
|
|
.PHONY: install
|
|
|
|
|
install: export BOUNDARY_INSTALL_BINARY=1
|
|
|
|
|
install: build
|
|
|
|
|
|
2022-05-09 10:16:10 -04:00
|
|
|
.PHONY: build-memprof
|
|
|
|
|
build-memprof: BUILD_TAGS+=memprofiler
|
|
|
|
|
build-memprof:
|
|
|
|
|
@echo "==> Building Boundary with memory profiling enabled"
|
|
|
|
|
@CGO_ENABLED=$(CGO_ENABLED) BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/build.sh'"
|
|
|
|
|
|
2022-03-29 15:37:25 -04:00
|
|
|
# Format Go files, ignoring files marked as generated through the header defined at
|
|
|
|
|
# https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: fmt
|
2020-08-12 00:40:39 -04:00
|
|
|
fmt:
|
2022-03-29 15:37:25 -04:00
|
|
|
grep -L -R "^\/\/ Code generated .* DO NOT EDIT\.$$" --exclude-dir=.git --include="*.go" . | xargs gofumpt -w
|
2022-05-04 11:10:21 -04:00
|
|
|
buf format -w
|
2020-08-12 00:40:39 -04:00
|
|
|
|
2020-10-08 18:51:53 +01:00
|
|
|
# Set env for all UI targets.
|
2022-09-20 11:14:02 -04:00
|
|
|
UI_TARGETS := update-ui-version build-ui build-ui-ifne clean-ui
|
2020-10-08 18:51:53 +01:00
|
|
|
# Note the extra .tmp path segment in UI_CLONE_DIR is significant and required.
|
|
|
|
|
$(UI_TARGETS): export UI_CLONE_DIR := internal/ui/.tmp/boundary-ui
|
|
|
|
|
$(UI_TARGETS): export UI_VERSION_FILE := internal/ui/VERSION
|
|
|
|
|
$(UI_TARGETS): export UI_DEFAULT_BRANCH := main
|
|
|
|
|
$(UI_TARGETS): export UI_CURRENT_COMMIT := $(shell head -n1 < "$(UI_VERSION_FILE)" | cut -d' ' -f1)
|
|
|
|
|
$(UI_TARGETS): export UI_COMMITISH ?=
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: update-ui-version
|
2020-10-08 18:51:53 +01:00
|
|
|
update-ui-version:
|
|
|
|
|
@if [ -z "$(UI_COMMITISH)" ]; then \
|
|
|
|
|
echo "==> Setting UI version to latest commit on branch '$(UI_DEFAULT_BRANCH)'"; \
|
|
|
|
|
export UI_COMMITISH="$(UI_DEFAULT_BRANCH)"; \
|
|
|
|
|
else \
|
|
|
|
|
echo "==> Setting to latest commit matching '$(UI_COMMITISH)'"; \
|
|
|
|
|
fi; \
|
2022-05-12 09:32:39 -05:00
|
|
|
./scripts/uiupdate.sh
|
2020-10-08 18:51:53 +01:00
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: build-ui
|
2020-06-30 11:26:22 -04:00
|
|
|
build-ui:
|
2020-10-08 18:51:53 +01:00
|
|
|
@if [ -z "$(UI_COMMITISH)" ]; then \
|
|
|
|
|
echo "==> Building default UI version from $(UI_VERSION_FILE): $(UI_CURRENT_COMMIT)"; \
|
|
|
|
|
export UI_COMMITISH="$(UI_CURRENT_COMMIT)"; \
|
|
|
|
|
else \
|
|
|
|
|
echo "==> Building custom UI version $(UI_COMMITISH)"; \
|
|
|
|
|
fi; \
|
2022-09-20 11:14:02 -04:00
|
|
|
./scripts/build-ui.sh
|
|
|
|
|
|
|
|
|
|
.PHONY: clean-ui
|
|
|
|
|
clean-ui:
|
|
|
|
|
rm -rf ${UI_CLONE_DIR}
|
2020-06-30 11:26:22 -04:00
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: build-ui-ifne
|
2020-06-30 11:26:22 -04:00
|
|
|
build-ui-ifne:
|
2021-04-20 09:45:05 -05:00
|
|
|
ifeq (,$(wildcard internal/ui/.tmp/boundary-ui))
|
2020-06-30 11:26:22 -04:00
|
|
|
@echo "==> No UI assets found, building..."
|
2020-10-08 18:51:53 +01:00
|
|
|
@$(MAKE) build-ui
|
2020-06-30 11:26:22 -04:00
|
|
|
else
|
|
|
|
|
@echo "==> UI assets found, use build-ui target to update"
|
|
|
|
|
endif
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: perms-table
|
2020-10-04 21:41:21 -04:00
|
|
|
perms-table:
|
|
|
|
|
@go run internal/website/permstable/permstable.go
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: gen
|
2021-09-10 09:31:27 -04:00
|
|
|
gen: cleangen proto api cli perms-table fmt
|
2020-05-11 12:42:10 -04:00
|
|
|
|
2020-04-28 11:20:37 -07:00
|
|
|
### oplog requires protoc-gen-go v1.20.0 or later
|
|
|
|
|
# GO111MODULE=on go get -u github.com/golang/protobuf/protoc-gen-go@v1.40
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: proto
|
2020-05-19 08:33:19 -07:00
|
|
|
proto: protolint protobuild
|
2020-04-08 14:55:40 -04:00
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: protobuild
|
2020-04-28 11:20:37 -07:00
|
|
|
protobuild:
|
2022-04-04 13:55:42 -04:00
|
|
|
@buf generate -o "${TMP_DIR}"
|
2020-04-28 11:20:37 -07:00
|
|
|
|
|
|
|
|
# Move the generated files from the tmp file subdirectories into the current repo.
|
2020-05-19 08:33:19 -07:00
|
|
|
cp -R ${TMP_DIR}/${REPO_PATH}/* ${THIS_DIR}
|
2020-04-28 11:20:37 -07:00
|
|
|
|
2022-04-04 13:55:42 -04:00
|
|
|
@buf generate --template buf.openapiv2.gen.yaml --path internal/proto/controller/api/services/v1/
|
|
|
|
|
|
2020-04-28 11:20:37 -07:00
|
|
|
@protoc-go-inject-tag -input=./internal/oplog/store/oplog.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/oplog/oplog_test/oplog_test.pb.go
|
2020-07-10 19:01:23 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/iam/store/group_member.pb.go
|
2020-07-08 17:02:01 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/iam/store/role.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/iam/store/principal_role.pb.go
|
2020-07-10 15:46:26 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/iam/store/role_grant.pb.go
|
2020-06-04 20:05:08 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/iam/store/user.pb.go
|
2020-05-08 11:36:28 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/iam/store/scope.pb.go
|
2020-06-11 16:36:47 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/iam/store/group.pb.go
|
2020-05-05 13:29:47 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/db/db_test/db_test.pb.go
|
2020-08-17 11:00:41 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/host/store/host.pb.go
|
2020-05-27 18:16:43 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/host/static/store/static.pb.go
|
2021-09-08 10:06:38 -07:00
|
|
|
@protoc-go-inject-tag -input=./internal/host/plugin/store/host.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/plugin/host/store/plugin.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/plugin/store/plugin.pb.go
|
2020-07-07 07:44:49 -07:00
|
|
|
@protoc-go-inject-tag -input=./internal/authtoken/store/authtoken.pb.go
|
2020-08-10 15:17:15 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/auth/store/account.pb.go
|
2020-07-24 10:23:35 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/auth/password/store/password.pb.go
|
2020-07-29 07:58:19 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/auth/password/store/argon2.pb.go
|
2022-06-09 13:02:55 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/kms/store/root_key.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/kms/store/database_key.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/kms/store/oplog_key.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/kms/store/token_key.pb.go
|
2021-01-26 14:37:10 -05:00
|
|
|
@protoc-go-inject-tag -input=./internal/kms/store/session_key.pb.go
|
2022-05-02 10:32:33 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/kms/store/oidc_key.pb.go
|
2022-11-16 17:17:28 -06:00
|
|
|
@protoc-go-inject-tag -input=./internal/kms/store/data_key_version_destruction_job.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/kms/store/data_key_version_destruction_job_run.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/kms/store/data_key_version_destruction_job_progress.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/kms/store/data_key_version_destruction_job_run_allowed_table_name.pb.go
|
2022-06-20 18:20:17 -07:00
|
|
|
@protoc-go-inject-tag -input=./internal/server/store/controller.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/server/store/worker.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/server/store/root_certificate.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/server/store/worker_auth.pb.go
|
2020-08-26 13:58:46 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/target/store/target.pb.go
|
2021-10-26 09:57:22 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/target/targettest/store/target.pb.go
|
2021-09-29 13:13:49 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/target/tcp/store/target.pb.go
|
2021-04-08 20:54:32 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/auth/oidc/store/oidc.pb.go
|
2021-05-06 14:54:10 -07:00
|
|
|
@protoc-go-inject-tag -input=./internal/scheduler/job/store/job.pb.go
|
2021-06-22 22:26:26 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/credential/store/credential.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/credential/vault/store/vault.pb.go
|
2022-05-18 20:20:45 -07:00
|
|
|
@protoc-go-inject-tag -input=./internal/credential/static/store/static.pb.go
|
2021-11-04 09:34:01 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/kms/store/audit_key.pb.go
|
2020-08-26 13:58:46 -04:00
|
|
|
|
2021-10-04 13:37:07 -04:00
|
|
|
# inject classification tags (see: https://github.com/hashicorp/go-eventlogger/tree/main/filters/encrypt)
|
2021-09-30 12:55:47 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/auth_method_service.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/scopes/scope.pb.go
|
2022-11-16 17:17:28 -06:00
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/scope_service.pb.go
|
2021-11-09 11:43:41 -05:00
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/servers/services/session_service.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/targets/target.pb.go
|
2022-04-14 14:34:58 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/target_service.pb.go
|
2022-03-29 17:42:23 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/accounts/account.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/account_service.pb.go
|
2022-04-13 12:56:31 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/hosts/host.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/host_service.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/plugins/plugin.pb.go
|
2022-04-13 12:58:19 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/host_catalog_service.pb.go
|
2022-04-13 12:58:33 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/hostsets/host_set.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/host_set_service.pb.go
|
2022-04-13 15:46:10 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/authtokens_service.pb.go
|
2022-04-12 16:09:40 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/managed_group_service.pb.go
|
2022-04-08 13:39:06 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/groups/group.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/group_service.pb.go
|
2022-04-07 15:24:31 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/credential_store_service.pb.go
|
2022-04-06 15:36:08 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/credential_library_service.pb.go
|
2022-05-18 20:20:45 -07:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/credentials/credential.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/credential_service.pb.go
|
2022-04-12 22:37:04 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/roles/role.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/role_service.pb.go
|
2022-04-12 22:38:45 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/sessions/session.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/session_service.pb.go
|
2022-04-13 09:42:31 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/users/user.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/user_service.pb.go
|
2022-06-09 06:43:58 -04:00
|
|
|
@protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/workers/worker.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/api/services/worker_service.pb.go
|
2022-06-14 12:09:02 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/servers/services/server_coordination_service.pb.go
|
2022-06-23 12:16:16 -07:00
|
|
|
@protoc-go-inject-tag -input=./internal/gen/controller/servers/servers.pb.go
|
2022-06-14 12:09:02 -04:00
|
|
|
|
2020-08-26 13:58:46 -04:00
|
|
|
|
2021-08-30 19:02:48 -04:00
|
|
|
# these protos, services and openapi artifacts are purely for testing purposes
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/gen/testing/event/event.pb.go
|
2022-04-04 13:55:42 -04:00
|
|
|
@buf generate --template buf.testing.gen.yaml --path internal/proto/testing/event/v1/
|
2021-08-30 19:02:48 -04:00
|
|
|
|
2020-04-28 11:20:37 -07:00
|
|
|
@rm -R ${TMP_DIR}
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: protolint
|
2020-05-21 16:03:21 -04:00
|
|
|
protolint:
|
2022-04-04 13:55:42 -04:00
|
|
|
@buf lint
|
2022-07-11 17:23:09 -04:00
|
|
|
# First check all protos except controller/servers and controller/storage for WIRE_JSON compatibility
|
2022-06-17 11:58:37 -04:00
|
|
|
cd internal/proto && buf breaking --against 'https://github.com/hashicorp/boundary.git#branch=stable-website,subdir=internal/proto' \
|
|
|
|
|
--exclude-path=controller/servers \
|
2022-07-11 17:23:09 -04:00
|
|
|
--exclude-path=controller/storage \
|
2022-06-17 11:58:37 -04:00
|
|
|
--config buf.breaking.json.yaml
|
|
|
|
|
# Next check all protos for WIRE compatibility. WIRE is a subset of WIRE_JSON so we don't need to exclude any files.
|
|
|
|
|
cd internal/proto && buf breaking --against 'https://github.com/hashicorp/boundary.git#branch=stable-website,subdir=internal/proto' \
|
|
|
|
|
--config buf.breaking.wire.yaml
|
2020-04-28 11:20:37 -07:00
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: website
|
2020-07-24 15:10:34 -07:00
|
|
|
# must have nodejs and npm installed
|
|
|
|
|
website: website-install website-start
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: website-install
|
2020-07-24 15:10:34 -07:00
|
|
|
website-install:
|
|
|
|
|
@npm install --prefix website/
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: website-start
|
2020-07-24 15:10:34 -07:00
|
|
|
website-start:
|
|
|
|
|
@npm start --prefix website/
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: test-database-up
|
2021-08-24 14:48:11 -04:00
|
|
|
test-database-up:
|
|
|
|
|
make -C testing/dbtest/docker database-up
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: test-database-down
|
2021-08-24 14:48:11 -04:00
|
|
|
test-database-down:
|
|
|
|
|
make -C testing/dbtest/docker clean
|
|
|
|
|
|
2022-04-25 16:11:27 -04:00
|
|
|
.PHONY: generate-database-dumps
|
|
|
|
|
generate-database-dumps:
|
|
|
|
|
@$(MAKE) -C testing/dbtest/docker generate-database-dumps
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: test-ci
|
2021-10-14 11:56:08 -04:00
|
|
|
test-ci: export CI_BUILD=1
|
|
|
|
|
test-ci:
|
|
|
|
|
CGO_ENABLED=$(CGO_ENABLED) BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/build.sh'"
|
2022-07-25 12:52:21 -07:00
|
|
|
~/.go/bin/go test ./... -v $(TESTARGS) -json -cover -timeout 120m | tparse -follow
|
2020-07-24 20:37:44 -07:00
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: test-sql
|
2021-08-11 13:25:32 -04:00
|
|
|
test-sql:
|
|
|
|
|
$(MAKE) -C internal/db/sqltest/ test
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: test
|
2021-08-24 14:48:11 -04:00
|
|
|
test:
|
2022-06-09 13:02:55 -04:00
|
|
|
go test ./... -timeout 30m -json -cover | tparse -follow
|
2021-02-12 10:43:05 -06:00
|
|
|
|
2021-12-01 18:57:03 -05:00
|
|
|
.PHONY: test-sdk
|
|
|
|
|
test-sdk:
|
|
|
|
|
$(MAKE) -C sdk/ test
|
|
|
|
|
|
|
|
|
|
.PHONY: test-api
|
|
|
|
|
test-api:
|
|
|
|
|
$(MAKE) -C api/ test
|
|
|
|
|
|
2022-09-16 15:54:55 +00:00
|
|
|
.PHONY: test-cli
|
|
|
|
|
test-cli:
|
|
|
|
|
$(MAKE) -C internal/tests/cli test
|
|
|
|
|
|
2021-12-01 18:57:03 -05:00
|
|
|
.PHONY: test-all
|
|
|
|
|
test-all: test-sdk test-api test
|
|
|
|
|
|
2022-04-25 16:07:46 -04:00
|
|
|
BENCH_TIME?=1s
|
|
|
|
|
BENCH_COUNT?=1s
|
|
|
|
|
.PHONY: benchmark
|
|
|
|
|
benchmark:
|
|
|
|
|
@go test \
|
|
|
|
|
-timeout 60m \
|
|
|
|
|
./internal/servers/controller/handlers/sessions/ \
|
|
|
|
|
-v \
|
|
|
|
|
-bench '^BenchmarkSessionList$$' \
|
|
|
|
|
-benchtime $(BENCH_TIME) \
|
|
|
|
|
-count $(BENCH_COUNT) \
|
|
|
|
|
-run '^$$'
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: install-go
|
2020-07-24 20:37:44 -07:00
|
|
|
install-go:
|
|
|
|
|
./ci/goinstall.sh
|
2020-07-24 15:10:34 -07:00
|
|
|
|
2020-10-29 08:44:57 -07:00
|
|
|
# Docker build and publish variables and targets
|
|
|
|
|
REGISTRY_NAME?=docker.io/hashicorp
|
|
|
|
|
IMAGE_NAME=boundary
|
2022-01-13 14:22:13 -08:00
|
|
|
VERSION?=0.7.4
|
2020-10-29 08:44:57 -07:00
|
|
|
IMAGE_TAG=$(REGISTRY_NAME)/$(IMAGE_NAME):$(VERSION)
|
|
|
|
|
IMAGE_TAG_DEV=$(REGISTRY_NAME)/$(IMAGE_NAME):latest-$(shell git rev-parse --short HEAD)
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: docker
|
2022-02-01 07:41:27 -08:00
|
|
|
docker: docker-build
|
2020-10-29 08:44:57 -07:00
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: docker-build
|
2022-02-01 07:41:27 -08:00
|
|
|
# Builds from the releases.hashicorp.com official binary
|
2020-10-29 08:44:57 -07:00
|
|
|
docker-build:
|
2022-02-01 07:41:27 -08:00
|
|
|
docker build \
|
|
|
|
|
--tag $(IMAGE_TAG) \
|
|
|
|
|
--tag hashicorp/boundary:latest \
|
|
|
|
|
--target=official \
|
|
|
|
|
--build-arg VERSION=$(VERSION) \
|
|
|
|
|
.
|
2020-10-29 08:44:57 -07:00
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: docker-multiarch-build
|
2022-02-01 07:41:27 -08:00
|
|
|
# Builds multiarch from the releases.hashicorp.com official binary
|
2021-07-28 14:52:15 -04:00
|
|
|
docker-multiarch-build:
|
2021-07-29 08:00:03 -07:00
|
|
|
docker buildx build \
|
2022-02-01 07:41:27 -08:00
|
|
|
--tag $(IMAGE_TAG) \
|
|
|
|
|
--tag hashicorp/boundary:latest \
|
|
|
|
|
--target=official \
|
|
|
|
|
--build-arg VERSION=$(VERSION) \
|
|
|
|
|
--platform linux/amd64,linux/arm64 \
|
|
|
|
|
.
|
2021-09-21 09:46:17 -04:00
|
|
|
|
2022-07-11 08:48:07 -07:00
|
|
|
DEV_DOCKER_GOOS ?= linux
|
|
|
|
|
DEV_DOCKER_GOARCH ?= amd64
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: docker-build-dev
|
2022-02-01 07:41:27 -08:00
|
|
|
# Builds from the locally generated binary in ./bin/
|
2022-07-11 08:48:07 -07:00
|
|
|
docker-build-dev: export GOOS=$(DEV_DOCKER_GOOS)
|
|
|
|
|
docker-build-dev: export GOARCH=$(DEV_DOCKER_GOARCH)
|
2022-03-11 11:49:25 -05:00
|
|
|
docker-build-dev: build
|
2022-09-26 08:39:13 -07:00
|
|
|
docker buildx build \
|
|
|
|
|
--load \
|
|
|
|
|
--platform $(DEV_DOCKER_GOOS)/$(DEV_DOCKER_GOARCH) \
|
2022-02-01 07:41:27 -08:00
|
|
|
--tag $(IMAGE_TAG_DEV) \
|
|
|
|
|
--target=dev \
|
|
|
|
|
--build-arg=boundary \
|
|
|
|
|
.
|
2022-09-26 08:39:13 -07:00
|
|
|
@echo "Successfully built $(IMAGE_TAG_DEV)"
|
2020-10-29 08:44:57 -07:00
|
|
|
|
2020-04-28 11:20:37 -07:00
|
|
|
.NOTPARALLEL:
|
2020-09-28 17:15:28 +01:00
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: ci-config
|
2020-09-28 17:15:28 +01:00
|
|
|
ci-config:
|
|
|
|
|
@$(MAKE) -C .circleci ci-config
|
|
|
|
|
|
2021-12-01 08:49:15 -05:00
|
|
|
.PHONY: ci-verify
|
2020-09-28 17:15:28 +01:00
|
|
|
ci-verify:
|
|
|
|
|
@$(MAKE) -C .circleci ci-verify
|
|
|
|
|
|
2022-02-01 07:41:27 -08:00
|
|
|
.PHONY: version
|
|
|
|
|
# This is used for release builds by .github/workflows/build.yml
|
|
|
|
|
version:
|
|
|
|
|
@go run ./cmd/boundary version | awk '/Version Number:/ { print $$3 }'
|
2022-05-26 13:32:21 -04:00
|
|
|
|
|
|
|
|
EDITION?=
|
|
|
|
|
.PHONY: edition
|
|
|
|
|
# This is used for release builds by .github/workflows/build.yml
|
|
|
|
|
edition:
|
|
|
|
|
@if [ -z "$(EDITION)" ]; then \
|
|
|
|
|
go run ./cmd/boundary version -format=json | jq -r '.version_metadata // "oss"'; \
|
|
|
|
|
else \
|
|
|
|
|
echo $(EDITION); \
|
|
|
|
|
fi; \
|