mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 00:41:27 -06:00
4c7f20853f
All four of these scripts have #! lines calling for them to run in bash, and they are all marked as executable, so there's no harm in running them directly and it makes it clearer that we're running them in the shell specified on the #! line, rather than with whatever "sh' happens to be on the current system. (Note that this _was_ still correctly using the #! lines before, because it's `sh -c` rather than just `sh`, but nonetheless that old way seemed needlessly confusing.)
70 lines
2.3 KiB
Makefile
70 lines
2.3 KiB
Makefile
WEBSITE_REPO=github.com/hashicorp/terraform-website
|
|
VERSION?="0.3.44"
|
|
PWD=$$(pwd)
|
|
DOCKER_IMAGE="hashicorp/terraform-website:full"
|
|
DOCKER_IMAGE_LOCAL="hashicorp-terraform-website-local"
|
|
DOCKER_RUN_FLAGS=--interactive \
|
|
--rm \
|
|
--tty \
|
|
--workdir "/website" \
|
|
--volume "$(shell pwd):/website/ext/terraform" \
|
|
--volume "$(shell pwd)/website:/website/preview" \
|
|
--publish "3000:3000" \
|
|
-e "IS_CONTENT_PREVIEW=true" \
|
|
-e "PREVIEW_FROM_REPO=terraform" \
|
|
-e "NAV_DATA_DIRNAME=./preview/data" \
|
|
-e "CONTENT_DIRNAME=./preview/docs" \
|
|
-e "CURRENT_GIT_BRANCH=$$(git rev-parse --abbrev-ref HEAD)"
|
|
|
|
# generate runs `go generate` to build the dynamically generated
|
|
# source files, except the protobuf stubs which are built instead with
|
|
# "make protobuf".
|
|
generate:
|
|
go generate ./...
|
|
|
|
# We separate the protobuf generation because most development tasks on
|
|
# Terraform do not involve changing protobuf files and protoc is not a
|
|
# go-gettable dependency and so getting it installed can be inconvenient.
|
|
#
|
|
# If you are working on changes to protobuf interfaces, run this Makefile
|
|
# target to be sure to regenerate all of the protobuf stubs using the expected
|
|
# versions of protoc and the protoc Go plugins.
|
|
protobuf:
|
|
go run ./tools/protobuf-compile .
|
|
|
|
fmtcheck:
|
|
"$(CURDIR)/scripts/gofmtcheck.sh"
|
|
|
|
importscheck:
|
|
"$(CURDIR)/scripts/goimportscheck.sh"
|
|
|
|
staticcheck:
|
|
"$(CURDIR)/scripts/staticcheck.sh"
|
|
|
|
exhaustive:
|
|
"$(CURDIR)/scripts/exhaustive.sh"
|
|
|
|
# Default: run this if working on the website locally to run in watch mode.
|
|
website:
|
|
@echo "==> Downloading latest Docker image..."
|
|
@docker pull ${DOCKER_IMAGE}
|
|
@echo "==> Starting website in Docker..."
|
|
@docker run ${DOCKER_RUN_FLAGS} ${DOCKER_IMAGE} npm start
|
|
|
|
website/local:
|
|
@echo "==> Starting website in Docker..."
|
|
@docker run ${DOCKER_RUN_FLAGS} ${DOCKER_IMAGE_LOCAL} npm start
|
|
|
|
.PHONY: website/build-local
|
|
website/build-local:
|
|
@echo "==> Building local Docker image"
|
|
@docker build https://github.com/hashicorp/terraform-website.git\#master \
|
|
-t $(DOCKER_IMAGE_LOCAL)
|
|
|
|
# disallow any parallelism (-j) for Make. This is necessary since some
|
|
# commands during the build process create temporary files that collide
|
|
# under parallel conditions.
|
|
.NOTPARALLEL:
|
|
|
|
.PHONY: fmtcheck importscheck generate protobuf website website-test staticcheck website/local website/build-local
|