2021-09-21 08:38:48 -04:00
|
|
|
default: testacc
|
2020-09-17 16:27:48 -04:00
|
|
|
GOOS=$(shell go env GOOS)
|
|
|
|
|
GOARCH=$(shell go env GOARCH)
|
|
|
|
|
INSTALL_PATH=~/.local/share/terraform/plugins/localhost/providers/boundary/0.0.1/linux_$(GOARCH)
|
2020-10-02 18:16:11 -07:00
|
|
|
BUILD_ALL_PATH=${PWD}/bin
|
|
|
|
|
|
2020-09-17 16:27:48 -04:00
|
|
|
ifeq ($(GOOS), darwin)
|
|
|
|
|
INSTALL_PATH=~/Library/Application\ Support/io.terraform/plugins/localhost/providers/boundary/0.0.1/darwin_$(GOARCH)
|
|
|
|
|
endif
|
|
|
|
|
ifeq ($(GOOS), "windows")
|
|
|
|
|
INSTALL_PATH=%APPDATA%/HashiCorp/Terraform/plugins/localhost/providers/boundary/0.0.1/windows_$(GOARCH)
|
|
|
|
|
endif
|
2020-05-14 17:06:23 -07:00
|
|
|
|
2021-09-21 08:38:48 -04:00
|
|
|
REGISTRY_NAME?=docker.io/hashicorpboundary
|
|
|
|
|
IMAGE_NAME=postgres
|
|
|
|
|
IMAGE_TAG ?= $(REGISTRY_NAME)/$(IMAGE_NAME):11-alpine
|
|
|
|
|
DOCKER_ARGS ?= -d
|
|
|
|
|
PG_OPTS ?=
|
|
|
|
|
TEST_DB_PORT ?= 5432
|
|
|
|
|
BOUNDARY_VERSION = $(shell go mod edit -json | jq -r '.["Require"][] | select(.Path=="github.com/hashicorp/boundary") | .["Version"]')
|
|
|
|
|
GOPATH ?= ~/go
|
|
|
|
|
GOMODCACHE ?= $(GOPATH)/pkg/mod
|
|
|
|
|
|
2020-10-13 23:12:03 -04:00
|
|
|
tools:
|
|
|
|
|
go generate -tags tools tools/tools.go
|
|
|
|
|
|
2020-10-14 11:28:28 -04:00
|
|
|
fmtcheck:
|
|
|
|
|
echo "Placeholder"
|
|
|
|
|
|
2020-10-14 11:17:57 -04:00
|
|
|
test:
|
|
|
|
|
echo "Placeholder"
|
|
|
|
|
|
2020-05-14 17:06:23 -07:00
|
|
|
# Run acceptance tests
|
|
|
|
|
testacc:
|
|
|
|
|
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m
|
2020-06-09 18:24:17 -07:00
|
|
|
|
2020-07-24 20:29:19 -07:00
|
|
|
testacc-ci: install-go
|
2020-09-03 10:14:55 -07:00
|
|
|
git config --global --add url."git@github.com:".insteadOf "https://github.com/"
|
2020-07-24 20:29:19 -07:00
|
|
|
TF_ACC=1 ~/.go/bin/go test ./... -v $(TESTARGS) -timeout 120m
|
|
|
|
|
|
2021-09-21 08:38:48 -04:00
|
|
|
install-go: ~/.go/bin/go
|
|
|
|
|
|
|
|
|
|
~/.go/bin/go:
|
2020-07-24 20:29:19 -07:00
|
|
|
./ci/goinstall.sh
|
2020-06-09 18:24:17 -07:00
|
|
|
|
|
|
|
|
dev:
|
2021-09-21 08:38:48 -04:00
|
|
|
mkdir -p $(INSTALL_PATH)
|
2020-09-17 16:27:48 -04:00
|
|
|
go build -o $(INSTALL_PATH)/terraform-provider-boundary main.go
|
2020-10-02 18:16:11 -07:00
|
|
|
|
|
|
|
|
all:
|
|
|
|
|
mkdir -p $(BUILD_ALL_PATH)
|
|
|
|
|
GOOS=darwin go build -o $(BUILD_ALL_PATH)/terraform-provider-boundary_darwin-amd64 main.go
|
|
|
|
|
GOOS=windows go build -o $(BUILD_ALL_PATH)/terraform-provider-boundary_windows-amd64 main.go
|
|
|
|
|
GOOS=linux go build -o $(BUILD_ALL_PATH)/terraform-provider-boundary_linux-amd64 main.go
|
2020-10-13 11:04:24 -07:00
|
|
|
|
2021-09-21 08:38:48 -04:00
|
|
|
docs:
|
2021-06-21 09:27:41 -07:00
|
|
|
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
|
|
|
|
|
|
2020-10-13 11:04:24 -07:00
|
|
|
rm-id-flag-from-docs:
|
|
|
|
|
find docs/ -name "*.md" -type f | xargs sed -i -e '/- \*\*id\*\*/d'
|
2020-10-13 23:12:03 -04:00
|
|
|
|
2021-09-21 08:38:48 -04:00
|
|
|
test-database-up:
|
|
|
|
|
@echo "Using image: $(IMAGE_TAG)"
|
|
|
|
|
@echo "Additional postgres configuration: $(PG_OPTS)"
|
|
|
|
|
@echo "Using volume: $(GOMODCACHE)/github.com/hashicorp/boundary@$(BOUNDARY_VERSION)/internal/db/schema/migrations/postgres:/migrations"
|
|
|
|
|
@docker run \
|
|
|
|
|
$(DOCKER_ARGS) \
|
|
|
|
|
--name boundary-sql-tests \
|
|
|
|
|
-p $(TEST_DB_PORT):5432 \
|
|
|
|
|
-e POSTGRES_PASSWORD=boundary \
|
|
|
|
|
-e POSTGRES_USER=boundary \
|
|
|
|
|
-e POSTGRES_DB=boundary \
|
|
|
|
|
-e PGDATA=/pgdata \
|
|
|
|
|
--mount type=tmpfs,destination=/pgdata \
|
|
|
|
|
-v "$(GOMODCACHE)/github.com/hashicorp/boundary@$(BOUNDARY_VERSION)/internal/db/schema/migrations/postgres":/migrations \
|
|
|
|
|
$(IMAGE_TAG) \
|
|
|
|
|
-c 'config_file=/etc/postgresql/postgresql.conf' \
|
|
|
|
|
$(PG_OPTS) 1> /dev/null
|
|
|
|
|
@echo "Test database available at: 127.0.0.1:$(TEST_DB_PORT)"
|
|
|
|
|
@echo "For database logs run:"
|
|
|
|
|
@echo " docker logs boundary-sql-tests"
|
|
|
|
|
|
|
|
|
|
test-database-down:
|
|
|
|
|
docker stop boundary-sql-tests || true
|
|
|
|
|
docker rm -v boundary-sql-tests || true
|
|
|
|
|
|
|
|
|
|
.PHONY: testacc tools docs test-database-up test-database-down
|