Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename tfgen to codegen #1279

Merged
merged 6 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Download the code generator binary
description: Downloads the code generator binary to `bin/`.

runs:
using: "composite"
steps:

- name: Download the code generator binary for #{{ .Config.Provider }}#
uses: #{{ .Config.ActionVersions.DownloadArtifact }}#
with:
#{{- if .Config.NoUpstream }}#
name: pulumi-gen-#{{ .Config.Provider }}#
#{{- else }}#
name: pulumi-tfgen-#{{ .Config.Provider }}#
#{{- end }}#
path: ${{ github.workspace }}/bin

- name: Ensure the code generator binary for #{{ .Config.Provider }}# is executable
shell: bash
run: |
find ${{ github.workspace }} -name "pulumi-*-#{{ .Config.Provider }}#" -print -exec chmod +x {} \;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
tools: pulumictl, pulumicli, ${{ matrix.language }}
- name: Prepare local workspace
run: make prepare_local_workspace
- name: Download tfgen
uses: ./.github/actions/download-tfgen
- name: Download codegen
uses: ./.github/actions/download-codegen
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Restore makefile progress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,14 @@ jobs:
fi
#{{- end }}#

- name: Upload pulumi-tfgen-#{{ .Config.Provider }}#
- name: Upload codegen binary for #{{ .Config.Provider }}#
uses: #{{ .Config.ActionVersions.UploadArtifact }}#
with:
#{{- if .Config.NoUpstream }}#
name: pulumi-gen-#{{ .Config.Provider }}#
#{{- else }}#
name: pulumi-tfgen-#{{ .Config.Provider }}#
#{{- end }}#
path: ${{ github.workspace }}/bin/pulumi-tfgen-#{{ .Config.Provider }}#
retention-days: 30

Expand Down
40 changes: 22 additions & 18 deletions provider-ci/internal/pkg/templates/bridged-provider/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ PROVIDER_PATH := provider/v#{{ .Config.MajorVersion }}#
PROVIDER_PATH := provider
#{{- end }}#
VERSION_PATH := $(PROVIDER_PATH)/pkg/version.Version
TFGEN := pulumi-tfgen-$(PACK)
#{{- if .Config.NoUpstream }}#
CODEGEN := pulumi-gen-$(PACK)
#{{- else }}#
CODEGEN := pulumi-tfgen-$(PACK)
#{{- end }}#
PROVIDER := pulumi-resource-$(PACK)
JAVA_GEN := pulumi-java-gen
TESTPARALLELISM := 10
Expand Down Expand Up @@ -111,8 +115,8 @@ GEN_ENVS := PULUMI_HOME=$(GEN_PULUMI_HOME) PULUMI_CONVERT_EXAMPLES_CACHE_DIR=$(G
generate_dotnet: .make/generate_dotnet
build_dotnet: .make/build_dotnet
.make/generate_dotnet: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)
.make/generate_dotnet: .make/install_plugins bin/$(TFGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(TFGEN) dotnet --out sdk/dotnet/
.make/generate_dotnet: .make/install_plugins bin/$(CODEGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(CODEGEN) dotnet --out sdk/dotnet/
cd sdk/dotnet/ && \
printf "module fake_dotnet_module // Exclude this directory from Go tools\n\ngo 1.17\n" > go.mod && \
echo "$(VERSION_GENERIC)" >version.txt
Expand All @@ -125,8 +129,8 @@ build_dotnet: .make/build_dotnet
generate_go: .make/generate_go
build_go: .make/build_go
.make/generate_go: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)
.make/generate_go: .make/install_plugins bin/$(TFGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(TFGEN) go --out sdk/go/
.make/generate_go: .make/install_plugins bin/$(CODEGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(CODEGEN) go --out sdk/go/
@touch $@
.make/build_go: .make/generate_go
cd sdk && go list "$$(grep -e "^module" go.mod | cut -d ' ' -f 2)/go/..." | xargs -I {} bash -c 'go build {} && go clean -i {}'
Expand All @@ -152,8 +156,8 @@ build_java: .make/build_java
generate_nodejs: .make/generate_nodejs
build_nodejs: .make/build_nodejs
.make/generate_nodejs: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)
.make/generate_nodejs: .make/install_plugins bin/$(TFGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(TFGEN) nodejs --out sdk/nodejs/
.make/generate_nodejs: .make/install_plugins bin/$(CODEGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(CODEGEN) nodejs --out sdk/nodejs/
printf "module fake_nodejs_module // Exclude this directory from Go tools\n\ngo 1.17\n" > sdk/nodejs/go.mod
@touch $@
.make/build_nodejs: .make/generate_nodejs
Expand All @@ -167,8 +171,8 @@ build_nodejs: .make/build_nodejs
generate_python: .make/generate_python
build_python: .make/build_python
.make/generate_python: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)
.make/generate_python: .make/install_plugins bin/$(TFGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(TFGEN) python --out sdk/python/
.make/generate_python: .make/install_plugins bin/$(CODEGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(CODEGEN) python --out sdk/python/
printf "module fake_python_module // Exclude this directory from Go tools\n\ngo 1.17\n" > sdk/python/go.mod
cp README.md sdk/python/
@touch $@
Expand All @@ -186,8 +190,8 @@ build_python: .make/build_python
#{{- if .Config.RegistryDocs }}#
# Run the bridge's registry-docs command to generated the content of the installation docs/ folder at provider repo root
build_registry_docs: .make/build_registry_docs
.make/build_registry_docs: .make/install_plugins bin/$(TFGEN)
bin/$(TFGEN) registry-docs --out $(WORKING_DIR)/docs
.make/build_registry_docs: .make/install_plugins bin/$(CODEGEN)
bin/$(CODEGEN) registry-docs --out $(WORKING_DIR)/docs
@touch $@
.PHONY: build_registry_docs
#{{- end }}#
Expand Down Expand Up @@ -226,7 +230,7 @@ install_nodejs_sdk: .make/install_nodejs_sdk
install_python_sdk:
.PHONY: install_dotnet_sdk install_go_sdk install_java_sdk install_nodejs_sdk install_python_sdk

# Install Pulumi plugins required for TFGen to resolve references
# Install Pulumi plugins required for CODEGEN to resolve references
install_plugins: .make/install_plugins
.make/install_plugins: export PULUMI_HOME := $(WORKING_DIR)/.pulumi
.make/install_plugins: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)
Expand Down Expand Up @@ -279,13 +283,13 @@ tfgen_no_deps: .make/schema
.make/schema: export PULUMI_CONVERT_EXAMPLES_CACHE_DIR := $(WORKING_DIR)/.pulumi/examples-cache
.make/schema: export PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION := $(PULUMI_CONVERT)
.make/schema: export PULUMI_MISSING_DOCS_ERROR := $(PULUMI_MISSING_DOCS_ERROR)
.make/schema: bin/$(TFGEN) .make/install_plugins .make/upstream
$(WORKING_DIR)/bin/$(TFGEN) schema --out provider/cmd/$(PROVIDER)
.make/schema: bin/$(CODEGEN) .make/install_plugins .make/upstream
$(WORKING_DIR)/bin/$(CODEGEN) schema --out provider/cmd/$(PROVIDER)
(cd provider && VERSION=$(VERSION_GENERIC) go generate cmd/$(PROVIDER)/main.go)
@touch $@
tfgen_build_only: bin/$(TFGEN)
bin/$(TFGEN): provider/*.go provider/go.* .make/upstream
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(TFGEN) -ldflags "$(LDFLAGS_PROJ_VERSION) $(LDFLAGS_EXTRAS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(TFGEN))
tfgen_build_only: bin/$(CODEGEN)
bin/$(CODEGEN): provider/*.go provider/go.* .make/upstream
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(CODEGEN) -ldflags "$(LDFLAGS_PROJ_VERSION) $(LDFLAGS_EXTRAS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(CODEGEN))
.PHONY: tfgen schema tfgen_no_deps tfgen_build_only
#{{ if .Config.NoUpstream }}#
upstream: .make/upstream
Expand Down Expand Up @@ -342,7 +346,7 @@ ci-mgmt: .ci-mgmt.yaml

# Start debug server for tfgen
debug_tfgen:
dlv --listen=:2345 --headless=true --api-version=2 exec $(WORKING_DIR)/bin/$(TFGEN) -- schema --out provider/cmd/$(PROVIDER)
dlv --listen=:2345 --headless=true --api-version=2 exec $(WORKING_DIR)/bin/$(CODEGEN) -- schema --out provider/cmd/$(PROVIDER)
.PHONY: debug_tfgen

# Provider cross-platform build & packaging
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: Download the tfgen binary
description: Downloads the tfgen binary to `bin/`.
name: Download the code generator binary
description: Downloads the code generator binary to `bin/`.

runs:
using: "composite"
steps:

- name: Download pulumi-tfgen-acme
- name: Download the code generator binary for acme
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: pulumi-tfgen-acme
path: ${{ github.workspace }}/bin

- name: Ensure pulumi-tfgen-acme is executable
- name: Ensure the code generator binary for acme is executable
shell: bash
run: |
find ${{ github.workspace }} -name "pulumi-*-acme" -print -exec chmod +x {} \;
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ jobs:
tools: pulumictl, pulumicli, ${{ matrix.language }}
- name: Prepare local workspace
run: make prepare_local_workspace
- name: Download tfgen
uses: ./.github/actions/download-tfgen
- name: Download codegen
uses: ./.github/actions/download-codegen
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Restore makefile progress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:

Maintainer note: consult the [runbook](https://github.com/pulumi/platform-providers-team/blob/main/playbooks/tf-provider-updating.md) for dealing with any breaking changes.

- name: Upload pulumi-tfgen-acme
- name: Upload codegen binary for acme
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: pulumi-tfgen-acme
Expand Down
32 changes: 16 additions & 16 deletions provider-ci/test-providers/acme/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ORG := pulumiverse
PROJECT := github.com/$(ORG)/pulumi-$(PACK)
PROVIDER_PATH := provider
VERSION_PATH := $(PROVIDER_PATH)/pkg/version.Version
TFGEN := pulumi-tfgen-$(PACK)
CODEGEN := pulumi-tfgen-$(PACK)
PROVIDER := pulumi-resource-$(PACK)
JAVA_GEN := pulumi-java-gen
TESTPARALLELISM := 10
Expand Down Expand Up @@ -95,8 +95,8 @@ GEN_ENVS := PULUMI_HOME=$(GEN_PULUMI_HOME) PULUMI_CONVERT_EXAMPLES_CACHE_DIR=$(G
generate_dotnet: .make/generate_dotnet
build_dotnet: .make/build_dotnet
.make/generate_dotnet: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)
.make/generate_dotnet: .make/install_plugins bin/$(TFGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(TFGEN) dotnet --out sdk/dotnet/
.make/generate_dotnet: .make/install_plugins bin/$(CODEGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(CODEGEN) dotnet --out sdk/dotnet/
cd sdk/dotnet/ && \
printf "module fake_dotnet_module // Exclude this directory from Go tools\n\ngo 1.17\n" > go.mod && \
echo "$(VERSION_GENERIC)" >version.txt
Expand All @@ -109,8 +109,8 @@ build_dotnet: .make/build_dotnet
generate_go: .make/generate_go
build_go: .make/build_go
.make/generate_go: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)
.make/generate_go: .make/install_plugins bin/$(TFGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(TFGEN) go --out sdk/go/
.make/generate_go: .make/install_plugins bin/$(CODEGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(CODEGEN) go --out sdk/go/
@touch $@
.make/build_go: .make/generate_go
cd sdk && go list "$$(grep -e "^module" go.mod | cut -d ' ' -f 2)/go/..." | xargs -I {} bash -c 'go build {} && go clean -i {}'
Expand All @@ -136,8 +136,8 @@ build_java: .make/build_java
generate_nodejs: .make/generate_nodejs
build_nodejs: .make/build_nodejs
.make/generate_nodejs: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)
.make/generate_nodejs: .make/install_plugins bin/$(TFGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(TFGEN) nodejs --out sdk/nodejs/
.make/generate_nodejs: .make/install_plugins bin/$(CODEGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(CODEGEN) nodejs --out sdk/nodejs/
printf "module fake_nodejs_module // Exclude this directory from Go tools\n\ngo 1.17\n" > sdk/nodejs/go.mod
@touch $@
.make/build_nodejs: .make/generate_nodejs
Expand All @@ -151,8 +151,8 @@ build_nodejs: .make/build_nodejs
generate_python: .make/generate_python
build_python: .make/build_python
.make/generate_python: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)
.make/generate_python: .make/install_plugins bin/$(TFGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(TFGEN) python --out sdk/python/
.make/generate_python: .make/install_plugins bin/$(CODEGEN)
$(GEN_ENVS) $(WORKING_DIR)/bin/$(CODEGEN) python --out sdk/python/
printf "module fake_python_module // Exclude this directory from Go tools\n\ngo 1.17\n" > sdk/python/go.mod
cp README.md sdk/python/
@touch $@
Expand Down Expand Up @@ -193,7 +193,7 @@ install_nodejs_sdk: .make/install_nodejs_sdk
install_python_sdk:
.PHONY: install_dotnet_sdk install_go_sdk install_java_sdk install_nodejs_sdk install_python_sdk

# Install Pulumi plugins required for TFGen to resolve references
# Install Pulumi plugins required for CODEGEN to resolve references
install_plugins: .make/install_plugins
.make/install_plugins: export PULUMI_HOME := $(WORKING_DIR)/.pulumi
.make/install_plugins: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)
Expand Down Expand Up @@ -243,13 +243,13 @@ tfgen_no_deps: .make/schema
.make/schema: export PULUMI_CONVERT_EXAMPLES_CACHE_DIR := $(WORKING_DIR)/.pulumi/examples-cache
.make/schema: export PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION := $(PULUMI_CONVERT)
.make/schema: export PULUMI_MISSING_DOCS_ERROR := $(PULUMI_MISSING_DOCS_ERROR)
.make/schema: bin/$(TFGEN) .make/install_plugins .make/upstream
$(WORKING_DIR)/bin/$(TFGEN) schema --out provider/cmd/$(PROVIDER)
.make/schema: bin/$(CODEGEN) .make/install_plugins .make/upstream
$(WORKING_DIR)/bin/$(CODEGEN) schema --out provider/cmd/$(PROVIDER)
(cd provider && VERSION=$(VERSION_GENERIC) go generate cmd/$(PROVIDER)/main.go)
@touch $@
tfgen_build_only: bin/$(TFGEN)
bin/$(TFGEN): provider/*.go provider/go.* .make/upstream
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(TFGEN) -ldflags "$(LDFLAGS_PROJ_VERSION) $(LDFLAGS_EXTRAS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(TFGEN))
tfgen_build_only: bin/$(CODEGEN)
bin/$(CODEGEN): provider/*.go provider/go.* .make/upstream
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(CODEGEN) -ldflags "$(LDFLAGS_PROJ_VERSION) $(LDFLAGS_EXTRAS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(CODEGEN))
.PHONY: tfgen schema tfgen_no_deps tfgen_build_only

# Apply patches to the upstream submodule, if it exists
Expand Down Expand Up @@ -295,7 +295,7 @@ ci-mgmt: .ci-mgmt.yaml

# Start debug server for tfgen
debug_tfgen:
dlv --listen=:2345 --headless=true --api-version=2 exec $(WORKING_DIR)/bin/$(TFGEN) -- schema --out provider/cmd/$(PROVIDER)
dlv --listen=:2345 --headless=true --api-version=2 exec $(WORKING_DIR)/bin/$(CODEGEN) -- schema --out provider/cmd/$(PROVIDER)
.PHONY: debug_tfgen

# Provider cross-platform build & packaging
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: Download the tfgen binary
description: Downloads the tfgen binary to `bin/`.
name: Download the code generator binary
description: Downloads the code generator binary to `bin/`.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should just be cosmetic renames.


runs:
using: "composite"
steps:

- name: Download pulumi-tfgen-aws
- name: Download the code generator binary for aws
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: pulumi-tfgen-aws
path: ${{ github.workspace }}/bin

- name: Ensure pulumi-tfgen-aws is executable
- name: Ensure the code generator binary for aws is executable
shell: bash
run: |
find ${{ github.workspace }} -name "pulumi-*-aws" -print -exec chmod +x {} \;
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ jobs:
tools: pulumictl, pulumicli, ${{ matrix.language }}
- name: Prepare local workspace
run: make prepare_local_workspace
- name: Download tfgen
uses: ./.github/actions/download-tfgen
- name: Download codegen
uses: ./.github/actions/download-codegen
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Restore makefile progress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:

Maintainer note: consult the [runbook](https://github.com/pulumi/platform-providers-team/blob/main/playbooks/tf-provider-updating.md) for dealing with any breaking changes.

- name: Upload pulumi-tfgen-aws
- name: Upload codegen binary for aws
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: pulumi-tfgen-aws
Expand Down
Loading
Loading