Skip to content

Commit

Permalink
Unblock Feature branch by no merging main if BASE_BRANCH != main (#9040)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottSuarez authored Sep 21, 2023
1 parent a98d8fb commit 63fe377
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
25 changes: 12 additions & 13 deletions .ci/gcb-community-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,31 @@ steps:
- user.name
- "Modular Magician Diff Process"

# Fetch main (only if it's not already present)
- name: "gcr.io/cloud-builders/git"
args:
- fetch
- origin
- main

# Display commit log for clarity
- name: "gcr.io/cloud-builders/git"
args:
- log
- "--oneline"
- "-n 10"

# Find common ancestor commit and apply diff for the .ci folder
# Find common ancestor commit and apply diff for the .ci folder.
- name: "gcr.io/cloud-builders/git"
id: findMergeBase
entrypoint: "bash"
args:
- "-c"
- |
base_commit=$(git merge-base origin/main HEAD)
echo "Common ancestor commit: $base_commit"
git diff $base_commit origin/main -- .ci/
git diff $base_commit origin/main -- .ci/ > /workspace/ci.diff
git apply /workspace/ci.diff --allow-empty
git fetch origin main
if [ "$_BASE_BRANCH" != "main" ]; then
echo "Checking out .ci/ folder from main"
git checkout origin/main -- .ci/
else
base_commit=$(git merge-base origin/main HEAD)
echo "Common ancestor commit: $base_commit"
git diff $base_commit upstream/main -- .ci/
git diff $base_commit upstream/main -- .ci/ > /workspace/ci.diff
git apply ./ci.diff --allow-empty
fi
- name: 'gcr.io/graphite-docker-images/go-plus'
entrypoint: '/workspace/.ci/scripts/go-plus/magician/exec.sh'
Expand Down
25 changes: 12 additions & 13 deletions .ci/gcb-contributor-membership-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,31 @@ steps:
- user.name
- "Modular Magician Diff Process"

# Fetch main (only if it's not already present)
- name: "gcr.io/cloud-builders/git"
args:
- fetch
- origin
- main

# Display commit log for clarity
- name: "gcr.io/cloud-builders/git"
args:
- log
- "--oneline"
- "-n 10"

# Find common ancestor commit and apply diff for the .ci folder
# Find common ancestor commit and apply diff for the .ci folder.
- name: "gcr.io/cloud-builders/git"
id: findMergeBase
entrypoint: "bash"
args:
- "-c"
- |
base_commit=$(git merge-base origin/main HEAD)
echo "Common ancestor commit: $base_commit"
git diff $base_commit origin/main -- .ci/
git diff $base_commit origin/main -- .ci/ > /workspace/ci.diff
git apply /workspace/ci.diff --allow-empty
git fetch origin main
if [ "$_BASE_BRANCH" != "main" ]; then
echo "Checking out .ci/ folder from main"
git checkout origin/main -- .ci/
else
base_commit=$(git merge-base origin/main HEAD)
echo "Common ancestor commit: $base_commit"
git diff $base_commit upstream/main -- .ci/
git diff $base_commit upstream/main -- .ci/ > /workspace/ci.diff
git apply ./ci.diff --allow-empty
fi
- name: "gcr.io/graphite-docker-images/go-plus"
entrypoint: "/workspace/.ci/scripts/go-plus/magician/exec.sh"
Expand Down

0 comments on commit 63fe377

Please sign in to comment.