From 4cd908bac618a65b0595ddc76c5845bc77f0a6b9 Mon Sep 17 00:00:00 2001 From: Pulumi Bot <30351955+pulumi-bot@users.noreply.github.com> Date: Mon, 29 Apr 2024 22:30:56 -0700 Subject: [PATCH] Update GitHub Actions workflows. (#695) This PR was automatically generated by the update-workflows-ecosystem-providers workflow in the pulumi/ci-mgmt repo, from commit 9334037674fdb25e0313fab78cf346e62c0ba901. --- .github/workflows/check-upstream-upgrade.yml | 3 -- .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 ++++++++------- 8 files changed, 67 insertions(+), 72 deletions(-) diff --git a/.github/workflows/check-upstream-upgrade.yml b/.github/workflows/check-upstream-upgrade.yml index fc483816..352bc4d9 100644 --- a/.github/workflows/check-upstream-upgrade.yml +++ b/.github/workflows/check-upstream-upgrade.yml @@ -16,9 +16,6 @@ jobs: go-version: 1.21.x - name: Checkout Repo uses: actions/checkout@v4 - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - shell: bash - name: Install upgrade-provider run: go install github.com/pulumi/upgrade-provider@main shell: bash diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml index 509ce5a0..65bd457c 100644 --- a/.github/workflows/license.yml +++ b/.github/workflows/license.yml @@ -45,8 +45,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 bd1c6fb3..db187529 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.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 @@ -158,8 +156,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: @@ -207,14 +203,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 @@ -331,8 +328,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: @@ -358,10 +353,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 @@ -421,8 +418,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 6c62de3f..386800c2 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -38,6 +38,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: @@ -45,8 +48,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: @@ -106,9 +107,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 @@ -152,14 +150,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 @@ -276,8 +275,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: @@ -303,10 +300,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 @@ -348,8 +347,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 6d17d91f..203f0bb6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.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 @@ -166,14 +164,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 @@ -290,8 +289,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: @@ -317,10 +314,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 @@ -363,9 +362,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 @@ -375,8 +376,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: @@ -396,8 +395,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 c0b1c988..44fe6d1b 100644 --- a/.github/workflows/resync-build.yml +++ b/.github/workflows/resync-build.yml @@ -46,8 +46,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 3f1b7c65..4df7708a 100644 --- a/.github/workflows/run-acceptance-tests.yml +++ b/.github/workflows/run-acceptance-tests.yml @@ -47,6 +47,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: @@ -54,8 +57,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: @@ -115,9 +116,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 @@ -176,14 +174,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 @@ -338,14 +337,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 bcf7bdcd..5c401bd3 100644 --- a/Makefile +++ b/Makefile @@ -7,12 +7,17 @@ PROVIDER_PATH := provider/v4 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 := 0 +# 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 ?= 4.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-digitalocean/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)","")