diff --git a/Makefile b/Makefile index 1e66999ba..39d9ff2ea 100644 --- a/Makefile +++ b/Makefile @@ -119,17 +119,17 @@ tfgen: install_plugins upstream upstream: ifneq ("$(wildcard upstream)","") - @$(SHELL) ./scripts/upstream.sh "$@" apply + scripts/upstream.sh "$@" apply endif upstream.finalize: - @$(SHELL) ./scripts/upstream.sh "$@" end_rebase + scripts/upstream.sh "$@" end_rebase upstream.rebase: - @$(SHELL) ./scripts/upstream.sh "$@" start_rebase + 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) + pulumictl download-binary -n pulumi-language-java -v $(JAVA_GEN_VERSION) -r pulumi/pulumi-java # To make an immediately observable change to .ci-mgmt.yaml: # diff --git a/scripts/upstream.sh b/scripts/upstream.sh old mode 100644 new mode 100755 index c455b4655..84f57d7b1 --- a/scripts/upstream.sh +++ b/scripts/upstream.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # WARNING: This file is autogenerated - changes will be overwritten if not made via https://github.com/pulumi/ci-mgmt set -e @@ -163,8 +164,11 @@ EOF # It is used to make the error message more actionable. end_rebase() { assert_rebase_in_progress "$1" + # Use git to resolve the possible location of files indicating a rebase might be in progress. + rebase_merge_dir=$(cd upstream && git rev-parse --git-path rebase-merge) + rebase_apply_dir=$(cd upstream && git rev-parse --git-path rebase-apply) - if [ -d .git/modules/upstream/rebase-merge ]; then + if [[ -d "${rebase_merge_dir}" || -d "${rebase_apply_dir}" ]]; then echo "rebase still in progress in './upstream'. Please resolve the rebase in" echo "'./upstream' and then run 'make \"$1\"' again." exit 1 @@ -172,8 +176,10 @@ end_rebase() { rm patches/*.patch cd upstream - git format-patch local -o ../patches - rm ../rebase-in-progress + git format-patch local -o ../patches --no-prefix --zero-commit --no-signature --no-stat + cd .. + rm rebase-in-progress + apply "$1" } case $2 in