Skip to content

Commit 4b8d0e7

Browse files
committed
Merge remote-tracking branch 'origin/master' into CLOUDP-320243-dev-2.0.0
2 parents 5a75bcc + a4b1d2c commit 4b8d0e7

File tree

5 files changed

+72
-56
lines changed

5 files changed

+72
-56
lines changed

.github/workflows/generate-changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
"type": "section",
4444
"text": {
4545
"type": "mrkdwn",
46-
"text": "*Automatic Changelog update failed* ${{ secrets.SLACK_ONCALL_TAG }} . <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}|Failed action >"
46+
"text": "*Automatic Changelog update failed* ${{ secrets.SLACK_ONCALL_TAG }} . <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}|Failed action >"
4747
}
4848
}
4949
]

.github/workflows/notify-docs-team.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
check:
9-
if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'skip-docs-notification')
9+
if: github.event.pull_request.draft == false
1010
runs-on: ubuntu-latest
1111
outputs:
1212
files: ${{ steps.changes.outputs.files }}

.github/workflows/test-suite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
"type": "section",
107107
"text": {
108108
"type": "mrkdwn",
109-
"text": "*Test Suite failed* ${{ secrets.SLACK_ONCALL_TAG }} <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}|View Failed Action>"
109+
"text": "*Test Suite failed* ${{ secrets.SLACK_ONCALL_TAG }} <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}|View Failed Action>"
110110
}
111111
}
112112
]

.github/workflows/update-dev-branches.yml

Lines changed: 60 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ on:
66
branches:
77
description: 'Dev branch names to update from master'
88
default: '["CLOUDP-320243-dev-2.0.0"]'
9-
force-auto-resolve:
10-
description: 'Force auto-resolve conflicts by favoring master changes. Some changes in dev branch might be lost.'
11-
required: false
12-
default: false
13-
type: boolean
149
schedule:
1510
- cron: "0 5 * * 3" # workflow runs every Wednesday at 5 AM UTC
1611

@@ -35,14 +30,18 @@ jobs:
3530
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
3631
with:
3732
fetch-depth: 0
38-
33+
token: ${{ secrets.APIX_BOT_PAT }}
34+
- name: Install Go
35+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
36+
with:
37+
go-version-file: 'go.mod'
3938
- name: Config Git
4039
run: |
4140
git config --local user.email [email protected]
4241
git config --local user.name svc-apix-bot
4342
44-
- name: Rebase branch with master
45-
id: rebase-check
43+
- name: Merge branch with master
44+
id: merge-check
4645
run: |
4746
echo "Updating branch: ${{ matrix.branch }}"
4847
@@ -55,49 +54,68 @@ jobs:
5554
git fetch origin ${{ matrix.branch }}
5655
git checkout -B ${{ matrix.branch }} origin/${{ matrix.branch }}
5756
58-
if git rebase origin/master; then
59-
echo "OK: Rebase completed successfully with no conflicts."
57+
# Check if there are commits in master not in dev branch
58+
commits_to_merge=$(git rev-list --count origin/${{ matrix.branch }}..origin/master)
59+
if [ "$commits_to_merge" -eq 0 ]; then
60+
echo "OK: No commits to merge from master. Branch is already up to date."
61+
echo "has-changes=false" >> "${GITHUB_OUTPUT}"
6062
else
61-
# Check if conflicts can be auto-resolved
62-
git rebase --abort
63-
if git rebase origin/master -X theirs; then
64-
if [ "${{ inputs.force-auto-resolve }}" = "true" ]; then
65-
echo "WARNING: Rebase conflicts detected but auto-resolved by favoring master changes because force-auto-resolve is true."
66-
else
67-
echo "ERROR: Rebase conflicts detected that can be auto-resolved by favoring master changes."
68-
echo "Manual review required to ensure no important changes are lost. Set force-auto-resolve to true to auto-resolve these conflicts."
69-
git rebase --abort
70-
exit 1
71-
fi
63+
echo "Found $commits_to_merge commits to merge from master."
64+
if git merge origin/master --no-edit; then
65+
echo "OK: Merge completed successfully with no conflicts."
66+
echo "has-changes=true" >> "${GITHUB_OUTPUT}"
7267
else
73-
echo "ERROR: Rebase conflicts detected that need manual intervention, they can't be auto-resolved."
68+
echo "ERROR: Merge conflicts detected. Manual intervention required:"
69+
echo "1. Perform a manual merge of master into ${{ matrix.branch }}"
70+
echo "2. Resolve all conflicts manually"
71+
echo "3. Add a bypass in dev branch ruleset settings to allow direct push to ${{ matrix.branch }}"
72+
echo "4. Push changes directly to ${{ matrix.branch }} (DO NOT create a PR)"
73+
echo "5. Remove the bypass from ruleset settings"
74+
echo "NOTE: Do not create a PR - squashed commits will cause the same conflicts to appear again in future updates"
75+
git merge --abort
7476
exit 1
7577
fi
7678
fi
77-
78-
# Check if there are any changes between rebased branch and original remote branch
79-
if git diff --quiet origin/${{ matrix.branch }} HEAD; then
80-
echo "No changes detected between rebased branch and original remote branch. PR would not introduce any changes."
81-
echo "has-changes=false" >> "${GITHUB_OUTPUT}"
79+
80+
- name: Push updated branch
81+
if: steps.merge-check.outputs.has-changes == 'true'
82+
run: |
83+
echo "Pushing updated branch ${{ matrix.branch }} to remote"
84+
git push origin ${{ matrix.branch }}
85+
86+
- name: Project check
87+
if: steps.merge-check.outputs.has-changes == 'true'
88+
id: project-check
89+
env:
90+
MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER: "true"
91+
run: |
92+
if make tools build lint test; then
93+
echo "slack-text=✅ Dev branch \`${{ matrix.branch }}\` merged and pushed with latest changes from master. ${{ secrets.SLACK_ONCALL_TAG }} <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}|View Action>" >> "${GITHUB_OUTPUT}"
8294
else
83-
echo "Changes detected between rebased branch and original remote branch. PR will introduce changes."
84-
echo "has-changes=true" >> "${GITHUB_OUTPUT}"
95+
echo "slack-text=⚠️ Dev branch \`${{ matrix.branch }}\` merged and pushed. This is prefered even if checks failed as there were no merge conflicts. Project checks must be fixed. ${{ secrets.SLACK_ONCALL_TAG }} <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}|View Action>" >> "${GITHUB_OUTPUT}"
8596
fi
8697
87-
- name: Create pull request
88-
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e
89-
if: steps.rebase-check.outputs.has-changes == 'true'
98+
- name: Send Slack notification
99+
if: steps.merge-check.outputs.has-changes == 'true'
100+
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52
90101
with:
91-
token: ${{ secrets.APIX_BOT_PAT }}
92-
title: "chore: Update ${{ matrix.branch }} from master"
93-
commit-message: "Update ${{ matrix.branch }} from master"
94-
delete-branch: true
95-
branch: update-${{ matrix.branch }}-from-master
96-
base: ${{ matrix.branch }}
97-
body: "Automated update of `${{ matrix.branch }}` branch with latest changes from master branch."
98-
labels: "skip-docs-notification"
102+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
103+
webhook-type: incoming-webhook
104+
payload: |
105+
{
106+
"text": "Dev branch updated",
107+
"blocks": [
108+
{
109+
"type": "section",
110+
"text": {
111+
"type": "mrkdwn",
112+
"text": "${{ steps.project-check.outputs.slack-text }}"
113+
}
114+
}
115+
]
116+
}
99117
100-
slack-notification:
118+
slack-notification-failure:
101119
needs: update-branches
102120
if: ${{ !cancelled() && needs.update-branches.result == 'failure' }}
103121
runs-on: ubuntu-latest
@@ -116,7 +134,7 @@ jobs:
116134
"type": "section",
117135
"text": {
118136
"type": "mrkdwn",
119-
"text": "*Update dev branches failed* ${{ secrets.SLACK_ONCALL_TAG }} <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}|View Failed Action>"
137+
"text": "*Update dev branches failed* ${{ secrets.SLACK_ONCALL_TAG }} <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}|View Failed Action>"
120138
}
121139
}
122140
]

build/ci/papertrail.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ functions:
2929
sudo dnf install -y gh
3030
3131
"trace release artifacts":
32-
- command: shell.exec
32+
- command: shell.exec
3333
params:
34-
working_dir: /tmp
34+
working_dir: /tmp
3535
script: |
3636
sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
3737
sudo dnf install -y gh
3838
3939
- command: git.get_project
4040
params:
4141
directory: src/github.com/mongodb/terraform-provider-mongodbatlas
42-
42+
4343
- command: shell.exec
4444
params:
4545
working_dir: "src/github.com/mongodb/terraform-provider-mongodbatlas"
@@ -60,12 +60,13 @@ functions:
6060
6161
# get the latest release workflow run
6262
run_id=$(gh run list --workflow release.yml --branch master --limit 1 --json databaseId --jq '.[0].databaseId')
63-
run_json=$(gh run view "$run_id" --json name,jobs)
63+
run_json=$(gh run view "$run_id" --json name,jobs,actor)
6464
6565
conclusion=$(jq -r '.jobs[] | select(.name=="release") | .conclusion' <<<"$run_json")
6666
version=$(jq -r '.name | match("v[0-9]+\\.[0-9]+\\.[0-9]+") | .string' <<<"$run_json")
67+
author=$(jq -r '.actor.login' <<<"$run_json")
6768
68-
echo "conclusion=$conclusion version=$version"
69+
echo "conclusion=$conclusion version=$version author=$author"
6970
7071
# checking the latest tag version (that triggered this task) matches the version in the release workflow run name
7172
if [[ "$version" != "$release_tag" ]]; then
@@ -107,34 +108,31 @@ functions:
107108
108109
cat >trace-expansions.yml <<EOF
109110
release_version: "$version"
111+
release_author: "$author"
110112
EOF
111113
112114
echo "✅ Done."
113115
114-
115-
116116
- command: expansions.update
117117
params:
118118
file: src/github.com/mongodb/terraform-provider-mongodbatlas/trace-expansions.yml
119-
119+
120120
- command: papertrail.trace
121121
params:
122122
key_id: ${papertrail_key_id}
123123
secret_key: ${papertrail_secret_key}
124124
product: "tmp2-terraform-provider-mongodbatlas"
125125
version: ${release_version}
126-
submitter: "svc-apix-Bot"
126+
submitter: "${release_author}"
127127
filenames:
128128
- "src/github.com/mongodb/terraform-provider-mongodbatlas/release_artifacts/*.zip"
129129

130-
131130
tasks:
132131
- name: trace_release_artifacts
133132
tags: ["release"]
134133
commands:
135134
- func: "trace release artifacts"
136135

137-
138136
buildvariants:
139137
- name: papertrail_github_release
140138
display_name: "Papertrail - GitHub Release Artifacts"

0 commit comments

Comments
 (0)