From fc2f4f7c4fa0e3759460aef85563da882a185509 Mon Sep 17 00:00:00 2001 From: Pulumi Bot Date: Mon, 1 May 2023 05:13:06 +0000 Subject: [PATCH] [internal] Update GitHub Actions workflow files --- .github/workflows/upgrade-provider.yml | 5 - Makefile | 54 ++----- scripts/upstream.sh | 193 +++++++++++++++++++++++++ 3 files changed, 202 insertions(+), 50 deletions(-) create mode 100644 scripts/upstream.sh diff --git a/.github/workflows/upgrade-provider.yml b/.github/workflows/upgrade-provider.yml index b07a834e..7c0013f5 100644 --- a/.github/workflows/upgrade-provider.yml +++ b/.github/workflows/upgrade-provider.yml @@ -12,11 +12,6 @@ jobs: - name: Call upgrade provider action uses: pulumi/pulumi-upgrade-provider-action@v0.0.4 with: - branch: master - gh-token: ${{ secrets.PULUMI_BOT_TOKEN }} - git-email: bot@pulumi.com - git-username: Pulumi bot - provider-repo: pulumi-docker slack-channel: provider-upgrade-status slack-webhook: ${{ secrets.SLACK_WEBHOOK_URL }} name: Upgrade provider diff --git a/Makefile b/Makefile index d5754f39..7a5d4ab3 100644 --- a/Makefile +++ b/Makefile @@ -81,11 +81,6 @@ cleanup: docs: cd provider/pkg/docs-gen/examples/ && go run generate.go ./yaml ./ -finish-patch: - @if [ ! -z "$$(cd upstream && git status --porcelain)" ]; then echo "Please commit your changes before finishing the patch"; exit 1; fi - @cd upstream && \ - git format-patch HEAD~ -o ../patches --start-number $$(($$(ls ../patches | wc -l | xargs)+1)) - help: @grep '^[^.#]\+:\s\+.*#' Makefile | \ sed "s/\(.\+\):\s*\(.*\) #\s*\(.*\)/`printf "\033[93m"`\1`printf "\033[0m"` \3 [\2]/" | \ @@ -108,29 +103,6 @@ lint_provider: provider provider: tfgen install_plugins (cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "-X $(PROJECT)/$(VERSION_PATH)=$(VERSION)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)) -start-patch: upstream -ifeq ("$(wildcard upstream)","") - @echo "No upstream found, so upstream can't be patched" - @exit 1 -else - # To add an additional patch: - # - # 1. Run this command (`make start-patch`). - # - # 2. Edit the `upstream` repo, making whatever changes you want to appear in the new - # patch. It's fine to edit multiple files. - # - # 3. Commit your changes. The slugified first line of your commit description will - # be used to generate the patch file name. Only the diff from the latest commit will - # end up in the final patch. - # - # 4. Run `make finish-patch`. - # - # It is safe to run `make start-patch` as many times as you want, but any changes - # might be reverted until `make finish-patch` is run. - @cd upstream && git commit --quiet -m "existing patches" -endif - test: cd examples && go test -v -tags=all -parallel $(TESTPARALLELISM) -timeout 2h @@ -140,25 +112,17 @@ tfgen: install_plugins upstream docs (cd provider && VERSION=$(VERSION) go generate cmd/$(PROVIDER)/main.go) upstream: -ifeq ("$(wildcard upstream)","") - # upstream doesn't exist, so skip -else ifeq ("$(wildcard patches/*.patch)","") - # upstream exists, but patches don't exist. This is probably an error. - @echo "No patches found within the patch operation" - @echo "patches were expected because upstream exists" - @exit 1 -else - # Checkout the submodule at the pinned commit. - # `--force`: If the submodule is at a different commit, move it to the pinned commit. - # `--init`: If the submodule is not initialized, initialize it. - git submodule update --force --init - # Iterating over the patches folder in sorted order, - # apply the patch using a 3-way merge strategy. This mirrors the default behavior of `git merge` - cd upstream && \ - for patch in $(sort $(wildcard patches/*.patch)); do git apply --3way ../$$patch || exit 1; done +ifneq ("$(wildcard upstream)","") + @$(SHELL) ./scripts/upstream.sh "$@" apply endif +upstream.finalize: + @$(SHELL) ./scripts/upstream.sh "$@" end_rebase + +upstream.rebase: + @$(SHELL) ./scripts/upstream.sh "$@" start_rebase + bin/pulumi-java-gen: $(shell pulumictl download-binary -n pulumi-language-java -v $(JAVA_GEN_VERSION) -r pulumi/pulumi-java) -.PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_dotnet build_go build_java build_nodejs build_python clean cleanup docs finish-patch help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider start-patch test tfgen upstream \ No newline at end of file +.PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_dotnet build_go build_java build_nodejs build_python clean cleanup docs help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider test tfgen upstream upstream.finalize upstream.rebase \ No newline at end of file diff --git a/scripts/upstream.sh b/scripts/upstream.sh new file mode 100644 index 00000000..5d3e80f2 --- /dev/null +++ b/scripts/upstream.sh @@ -0,0 +1,193 @@ +# WARNING: This file is autogenerated - changes will be overwritten if not made via https://github.com/pulumi/ci-mgmt + +set -e + +# $1 is the current make command being run. +# It is used to make the error message more actionable. +err_rebase_in_progress() { + cat <