From 17800d114e61b26f4fdb5cc8a58b7524ec032e2c Mon Sep 17 00:00:00 2001 From: Pulumi Bot Date: Tue, 30 Apr 2024 05:39:08 +0000 Subject: [PATCH] [internal] Update GitHub Actions workflow files --- .github/workflows/license.yml | 2 -- .github/workflows/master.yml | 28 +++++++++--------- .github/workflows/prerelease.yml | 26 ++++++++--------- .github/workflows/release.yml | 34 +++++++++++----------- .github/workflows/resync-build.yml | 2 -- .github/workflows/run-acceptance-tests.yml | 18 ++++++------ Makefile | 26 ++++++++++------- 7 files changed, 67 insertions(+), 69 deletions(-) diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml index 2fe54c5..824e824 100644 --- a/.github/workflows/license.yml +++ b/.github/workflows/license.yml @@ -44,8 +44,6 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ env.PR_COMMIT_SHA }} - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v5 with: diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index fa5ce6c..9e0a69f 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -36,6 +36,9 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' - name: Checkout Scripts Repo uses: actions/checkout@v4 with: @@ -43,8 +46,6 @@ jobs: repository: pulumi/scripts ref: deca2c5c6015ad7aaea6f572a1c2b198ca323592 - run: echo "ci-scripts" >> .git/info/exclude # actions/checkout#197 - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v5 with: @@ -104,9 +105,6 @@ jobs: run: make install_plugins - name: Update path run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - - name: Set PACKAGE_VERSION to Env - run: echo "PACKAGE_VERSION=$(pulumictl get version --language generic)" >> - "$GITHUB_ENV" - name: Build SDK run: make build_${{ matrix.language }} - name: Check worktree clean @@ -157,8 +155,6 @@ jobs: aws-access-key-id: ${{ secrets.AWS_CORP_S3_UPLOAD_ACCESS_KEY_ID }} aws-region: us-west-2 aws-secret-access-key: ${{ secrets.AWS_CORP_S3_UPLOAD_SECRET_ACCESS_KEY }} - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v5 with: @@ -206,14 +202,15 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' - name: Cache examples generation uses: actions/cache@v4 with: path: | .pulumi/examples-cache key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Prepare upstream code run: make upstream - name: Install Go @@ -330,8 +327,6 @@ jobs: swap-storage: false - name: Checkout Repo uses: actions/checkout@v4 - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v5 with: @@ -357,10 +352,12 @@ jobs: role-external-id: upload-pulumi-release role-session-name: ${{ env.PROVIDER }}@githubActions role-to-assume: ${{ secrets.AWS_UPLOAD_ROLE_ARN }} - - name: Set PreRelease Version - run: echo "GORELEASER_CURRENT_TAG=v$(pulumictl get version --language generic)" >> "$GITHUB_ENV" + - id: version + uses: pulumi/provider-version-action@v1 - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 + env: + GORELEASER_CURRENT_TAG: v${{ steps.version.outputs.version }} with: args: -p 3 -f .goreleaser.prerelease.yml --rm-dist --skip-validate --timeout 60m0s @@ -420,8 +417,9 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' - name: Install Go uses: actions/setup-go@v5 with: diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 881cee4..71790e0 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -37,6 +37,9 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' - name: Checkout Scripts Repo uses: actions/checkout@v4 with: @@ -44,8 +47,6 @@ jobs: repository: pulumi/scripts ref: deca2c5c6015ad7aaea6f572a1c2b198ca323592 - run: echo "ci-scripts" >> .git/info/exclude # actions/checkout#197 - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v5 with: @@ -105,9 +106,6 @@ jobs: run: make install_plugins - name: Update path run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - - name: Set PACKAGE_VERSION to Env - run: echo "PACKAGE_VERSION=$(pulumictl get version --language generic)" >> - "$GITHUB_ENV" - name: Build SDK run: make build_${{ matrix.language }} - name: Check worktree clean @@ -151,14 +149,15 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' - name: Cache examples generation uses: actions/cache@v4 with: path: | .pulumi/examples-cache key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Prepare upstream code run: make upstream - name: Install Go @@ -275,8 +274,6 @@ jobs: swap-storage: false - name: Checkout Repo uses: actions/checkout@v4 - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v5 with: @@ -302,10 +299,12 @@ jobs: role-external-id: upload-pulumi-release role-session-name: ${{ env.PROVIDER }}@githubActions role-to-assume: ${{ secrets.AWS_UPLOAD_ROLE_ARN }} - - name: Set PreRelease Version - run: echo "GORELEASER_CURRENT_TAG=v$(pulumictl get version --language generic)" >> "$GITHUB_ENV" + - id: version + uses: pulumi/provider-version-action@v1 - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 + env: + GORELEASER_CURRENT_TAG: v${{ steps.version.outputs.version }} with: args: -p 3 -f .goreleaser.prerelease.yml --rm-dist --skip-validate --timeout 60m0s @@ -347,8 +346,9 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' - name: Install Go uses: actions/setup-go@v5 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21cb0b9..e59f3b0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,6 +36,9 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' - name: Checkout Scripts Repo uses: actions/checkout@v4 with: @@ -43,8 +46,6 @@ jobs: repository: pulumi/scripts ref: deca2c5c6015ad7aaea6f572a1c2b198ca323592 - run: echo "ci-scripts" >> .git/info/exclude # actions/checkout#197 - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v5 with: @@ -104,9 +105,6 @@ jobs: run: make install_plugins - name: Update path run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - - name: Set PACKAGE_VERSION to Env - run: echo "PACKAGE_VERSION=$(pulumictl get version --language generic)" >> - "$GITHUB_ENV" - name: Build SDK run: make build_${{ matrix.language }} - name: Check worktree clean @@ -165,14 +163,15 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' - name: Cache examples generation uses: actions/cache@v4 with: path: | .pulumi/examples-cache key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Prepare upstream code run: make upstream - name: Install Go @@ -289,8 +288,6 @@ jobs: swap-storage: false - name: Checkout Repo uses: actions/checkout@v4 - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v5 with: @@ -316,10 +313,12 @@ jobs: role-external-id: upload-pulumi-release role-session-name: ${{ env.PROVIDER }}@githubActions role-to-assume: ${{ secrets.AWS_UPLOAD_ROLE_ARN }} - - name: Set PreRelease Version - run: echo "GORELEASER_CURRENT_TAG=v$(pulumictl get version --language generic)" >> "$GITHUB_ENV" + - id: version + uses: pulumi/provider-version-action@v1 - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 + env: + GORELEASER_CURRENT_TAG: v${{ steps.version.outputs.version }} with: args: -p 3 release --rm-dist --timeout 60m0s version: latest @@ -362,9 +361,11 @@ jobs: with: tag: v0.0.46 repo: pulumi/pulumictl + - id: version + uses: pulumi/provider-version-action@v1 - name: Add SDK version tag - run: git tag "sdk/v$(pulumictl get version --language generic)" && git push origin - "sdk/v$(pulumictl get version --language generic)" + run: git tag "sdk/v${{ steps.version.outputs.version }}" && git push origin + "sdk/v${{ steps.version.outputs.version }}" clean_up_release_labels: name: Clean up release labels @@ -374,8 +375,6 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 - - name: Unshallow clone for PR merge bases - run: git fetch --prune --unshallow --tags - name: Clean up release labels uses: pulumi/action-release-by-pr-label@main with: @@ -395,8 +394,9 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' - name: Install Go uses: actions/setup-go@v5 with: diff --git a/.github/workflows/resync-build.yml b/.github/workflows/resync-build.yml index 9c36b48..3c39452 100644 --- a/.github/workflows/resync-build.yml +++ b/.github/workflows/resync-build.yml @@ -45,8 +45,6 @@ jobs: - id: run-url name: Create URL to the run output run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> "$GITHUB_OUTPUT" - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v5 with: diff --git a/.github/workflows/run-acceptance-tests.yml b/.github/workflows/run-acceptance-tests.yml index 61484be..4c9c308 100644 --- a/.github/workflows/run-acceptance-tests.yml +++ b/.github/workflows/run-acceptance-tests.yml @@ -46,6 +46,9 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ env.PR_COMMIT_SHA }} + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' - name: Checkout Scripts Repo uses: actions/checkout@v4 with: @@ -53,8 +56,6 @@ jobs: repository: pulumi/scripts ref: deca2c5c6015ad7aaea6f572a1c2b198ca323592 - run: echo "ci-scripts" >> .git/info/exclude # actions/checkout#197 - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v5 with: @@ -114,9 +115,6 @@ jobs: run: make install_plugins - name: Update path run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - - name: Set PACKAGE_VERSION to Env - run: echo "PACKAGE_VERSION=$(pulumictl get version --language generic)" >> - "$GITHUB_ENV" - name: Build SDK run: make build_${{ matrix.language }} - name: Check worktree clean @@ -175,14 +173,15 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' - name: Cache examples generation uses: actions/cache@v4 with: path: | .pulumi/examples-cache key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Prepare upstream code run: make upstream - name: Install Go @@ -337,14 +336,15 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ env.PR_COMMIT_SHA }} + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' - name: Checkout p/examples if: matrix.testTarget == 'pulumiExamples' uses: actions/checkout@v4 with: repository: pulumi/examples path: p-examples - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v5 with: diff --git a/Makefile b/Makefile index 28e7e5d..7d36c6d 100644 --- a/Makefile +++ b/Makefile @@ -7,12 +7,17 @@ PROVIDER_PATH := provider/v3 VERSION_PATH := $(PROVIDER_PATH)/pkg/version.Version TFGEN := pulumi-tfgen-$(PACK) PROVIDER := pulumi-resource-$(PACK) -VERSION := $(shell pulumictl get version) JAVA_GEN := pulumi-java-gen TESTPARALLELISM := 10 WORKING_DIR := $(shell pwd) PULUMI_CONVERT := 1 +# Override during CI using `make [TARGET] PROVIDER_VERSION=""` or by setting a PROVIDER_VERSION environment variable +# Local & branch builds will just used this fixed default version unless specified +PROVIDER_VERSION ?= 3.0.0-alpha.0+dev +# Use this normalised version everywhere rather than the raw input to ensure consistency. +VERSION_GENERIC = $(shell pulumictl convert-version --language generic --version "$(PROVIDER_VERSION)") + development: install_plugins provider build_sdks install_sdks build: install_plugins provider build_sdks install_sdks @@ -29,16 +34,15 @@ install_sdks: install_dotnet_sdk install_python_sdk install_nodejs_sdk install_j only_build: build -build_dotnet: DOTNET_VERSION := $(shell pulumictl get version --language dotnet) +build_dotnet: DOTNET_VERSION := $(shell pulumictl convert-version --language dotnet -v "$(VERSION_GENERIC)") build_dotnet: export PULUMI_HOME := $(WORKING_DIR)/.pulumi build_dotnet: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH) build_dotnet: export PULUMI_CONVERT_EXAMPLES_CACHE_DIR := $(WORKING_DIR)/.pulumi/examples-cache build_dotnet: upstream - pulumictl get version --language dotnet PULUMI_CONVERT=$(PULUMI_CONVERT) PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION=$(PULUMI_CONVERT) $(WORKING_DIR)/bin/$(TFGEN) 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 "$(DOTNET_VERSION)" >version.txt && \ + echo "$(VERSION_GENERIC)" >version.txt && \ dotnet build /p:Version=$(DOTNET_VERSION) build_go: export PULUMI_HOME := $(WORKING_DIR)/.pulumi @@ -48,7 +52,7 @@ build_go: upstream PULUMI_CONVERT=$(PULUMI_CONVERT) PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION=$(PULUMI_CONVERT) $(WORKING_DIR)/bin/$(TFGEN) go --out sdk/go/ cd sdk && go list "$$(grep -e "^module" go.mod | cut -d ' ' -f 2)/go/..." | xargs -I {} bash -c 'go build {} && go clean -i {}' -build_java: PACKAGE_VERSION := $(shell pulumictl get version --language generic) +build_java: PACKAGE_VERSION := $(VERSION_GENERIC) build_java: export PULUMI_HOME := $(WORKING_DIR)/.pulumi build_java: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH) build_java: export PULUMI_CONVERT_EXAMPLES_CACHE_DIR := $(WORKING_DIR)/.pulumi/examples-cache @@ -59,7 +63,7 @@ build_java: bin/pulumi-java-gen upstream gradle --console=plain build && \ gradle --console=plain javadoc -build_nodejs: VERSION := $(shell pulumictl get version --language javascript) +build_nodejs: NODE_VERSION := $(shell pulumictl convert-version --language javascript -v "$(VERSION_GENERIC)") build_nodejs: export PULUMI_HOME := $(WORKING_DIR)/.pulumi build_nodejs: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH) build_nodejs: export PULUMI_CONVERT_EXAMPLES_CACHE_DIR := $(WORKING_DIR)/.pulumi/examples-cache @@ -70,9 +74,9 @@ build_nodejs: upstream yarn install && \ yarn run tsc && \ cp ../../README.md ../../LICENSE* package.json yarn.lock ./bin/ && \ - sed -i.bak -e "s/\$${VERSION}/$(VERSION)/g" ./bin/package.json + sed -i.bak -e "s/\$${VERSION}/$(NODE_VERSION)/g" ./bin/package.json -build_python: PYPI_VERSION := $(shell pulumictl get version --language python) +build_python: PYPI_VERSION := $(shell pulumictl convert-version --language python -v "$(VERSION_GENERIC)") build_python: export PULUMI_HOME := $(WORKING_DIR)/.pulumi build_python: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH) build_python: export PULUMI_CONVERT_EXAMPLES_CACHE_DIR := $(WORKING_DIR)/.pulumi/examples-cache @@ -126,7 +130,7 @@ lint_provider.fix: # `cmd/pulumi-resource-mysql/schema.json` is valid and up to date. # To create a release ready binary, you should use `make provider`. provider_no_deps: - (cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "-X $(PROJECT)/$(VERSION_PATH)=$(VERSION)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)) + (cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "-X $(PROJECT)/$(VERSION_PATH)=$(VERSION_GENERIC)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)) provider: tfgen provider_no_deps @@ -149,10 +153,10 @@ tfgen_no_deps: export PULUMI_CONVERT_EXAMPLES_CACHE_DIR := $(WORKING_DIR)/.pulum tfgen_no_deps: export PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION := $(PULUMI_CONVERT) tfgen_no_deps: tfgen_build_only $(WORKING_DIR)/bin/$(TFGEN) schema --out provider/cmd/$(PROVIDER) - (cd provider && VERSION=$(VERSION) go generate cmd/$(PROVIDER)/main.go) + (cd provider && VERSION=$(VERSION_GENERIC) go generate cmd/$(PROVIDER)/main.go) tfgen_build_only: - (cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(TFGEN) -ldflags "-X $(PROJECT)/$(VERSION_PATH)=$(VERSION)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(TFGEN)) + (cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(TFGEN) -ldflags "-X $(PROJECT)/$(VERSION_PATH)=$(VERSION_GENERIC)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(TFGEN)) upstream: ifneq ("$(wildcard upstream)","")