build / build (push) Successful in 10m48s
The build job regenerates schema.json and diffs it against the checked-in copy, to catch a resources.go edit that never got a `make tfgen`. The comment above it claimed the schema carries no version. It does: tfgen writes the upstream version into `packageDescription`. So the job, which builds at the Makefile's default VERSION, regenerated a schema stamped v0.1.0 and diffed it against the committed v0.2.0 one. The v0.2.0 push failed on a mismatch that had nothing to do with the mapping. Bump the default to match the committed schema and say plainly in both places that the two move together. Verified by running the job's exact command -- `make provider` with no override, then the diff -- which now exits 0. The release job was unaffected: it derives VERSION from the tag.
93 lines
3.2 KiB
Makefile
93 lines
3.2 KiB
Makefile
PACK := dokploy
|
|
ORG := maxvojtkov
|
|
PROJECT := github.com/$(ORG)/pulumi-$(PACK)
|
|
PROVIDER_PATH := provider
|
|
VERSION_PATH := $(PROVIDER_PATH)/pkg/version.Version
|
|
|
|
TFGEN := pulumi-tfgen-$(PACK)
|
|
PROVIDER := pulumi-resource-$(PACK)
|
|
|
|
WORKING_DIR := $(shell pwd)
|
|
SCHEMA_DIR := $(WORKING_DIR)/provider/cmd/$(PROVIDER)
|
|
|
|
# The checked-in schema.json embeds this version in `packageDescription`, and
|
|
# CI diffs the regenerated schema against it on every push to main. So this
|
|
# default is not cosmetic: it has to match the version the committed schema was
|
|
# generated at, which means bumping it in the same commit as a release.
|
|
# Release builds override it from the tag.
|
|
VERSION ?= 0.2.0
|
|
LDFLAGS := -X $(PROJECT)/$(VERSION_PATH)=$(VERSION)
|
|
|
|
JAVASCRIPT_PKG := @$(ORG)/pulumi-$(PACK)
|
|
PYTHON_PKG := pulumi_$(PACK)
|
|
|
|
.PHONY: default
|
|
default: provider build_sdks ## Build the provider plugin and all SDKs
|
|
|
|
# ---------------------------------------------------------------- code gen ---
|
|
|
|
.PHONY: tfgen
|
|
tfgen: ## Regenerate schema.json and bridge-metadata.json
|
|
(cd provider && go build -o $(WORKING_DIR)/bin/$(TFGEN) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(TFGEN))
|
|
$(WORKING_DIR)/bin/$(TFGEN) schema --out $(SCHEMA_DIR)
|
|
|
|
.PHONY: provider
|
|
provider: tfgen ## Build the provider plugin binary into bin/
|
|
(cd provider && go build -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER))
|
|
|
|
.PHONY: build_sdks
|
|
build_sdks: build_nodejs build_python build_go build_dotnet ## Generate every language SDK
|
|
|
|
# sdk/nodejs/bin is what gets published to npm, so package.json and the docs
|
|
# have to be copied in next to the compiled JavaScript.
|
|
.PHONY: build_nodejs
|
|
build_nodejs: tfgen
|
|
rm -rf sdk/nodejs
|
|
$(WORKING_DIR)/bin/$(TFGEN) nodejs --out sdk/nodejs/
|
|
cd sdk/nodejs && npm install && npm run build
|
|
cp README.md LICENSE sdk/nodejs/package.json sdk/nodejs/bin/
|
|
|
|
.PHONY: build_python
|
|
build_python: tfgen
|
|
rm -rf sdk/python
|
|
$(WORKING_DIR)/bin/$(TFGEN) python --out sdk/python/
|
|
cp README.md LICENSE sdk/python/
|
|
|
|
.PHONY: build_go
|
|
build_go: tfgen
|
|
rm -rf sdk/go
|
|
$(WORKING_DIR)/bin/$(TFGEN) go --out sdk/go/
|
|
|
|
.PHONY: build_dotnet
|
|
build_dotnet: tfgen
|
|
rm -rf sdk/dotnet
|
|
$(WORKING_DIR)/bin/$(TFGEN) dotnet --out sdk/dotnet/
|
|
cp README.md LICENSE sdk/dotnet/
|
|
printf "$(VERSION)" > sdk/dotnet/version.txt
|
|
|
|
# ------------------------------------------------------------------ local ----
|
|
|
|
.PHONY: install
|
|
install: provider ## Install the plugin locally so `pulumi up` can find it
|
|
pulumi plugin install resource $(PACK) $(VERSION) --file $(WORKING_DIR)/bin/$(PROVIDER) --reinstall
|
|
@echo
|
|
@echo "To use the unpublished Node SDK from a local program:"
|
|
@echo " make build_nodejs && npm install $(WORKING_DIR)/sdk/nodejs"
|
|
|
|
.PHONY: lint
|
|
lint: ## Vet and format-check the provider sources
|
|
cd provider && go vet ./... && test -z "$$(gofmt -l .)"
|
|
|
|
.PHONY: test
|
|
test: ## Run provider unit tests
|
|
cd provider && go test ./... -count=1
|
|
|
|
.PHONY: clean
|
|
clean: ## Remove build artifacts and generated SDKs
|
|
rm -rf bin sdk/nodejs sdk/python sdk/go sdk/dotnet
|
|
|
|
.PHONY: help
|
|
help:
|
|
@grep -hE '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) \
|
|
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}'
|