Skip to content

Commit 6ecef7a

Browse files
ci(finalize_rollout): compose existing CLI commands in workflow (#75238)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 5cc0c28 commit 6ecef7a

1 file changed

Lines changed: 209 additions & 23 deletions

File tree

Lines changed: 209 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
name: Finalize connector rollout
2-
# This workflow is called by the backend Temporal workflow "finalizeRollout"
3-
# as a part of its response to calls to `/connector_rollout/manual_finalize`,
4-
# or in response to automatic fallback/finalization.
1+
name: Finalize Progressive Rollout
2+
# Dispatched by the platform's Temporal connector-rollout worker
3+
# (PromoteOrRollbackActivityImpl) after a promote/rollback decision.
4+
# After this workflow completes, verifyDefaultVersionActivity polls
5+
# for up to 3 hours for the GA version to become default, then
6+
# finalizeRolloutActivity unpins actors.
57
#
6-
# The workflow performs these tasks:
7-
# 1. Generate an `auto-merge/bypass`-labeled PR to version-bump forward
8-
# the named connector, including changelog entry.
9-
# 2. Delete the `.../release_candidate` subdirectory in the GCS Registry Store.
8+
# See: airbyte-platform-internal/.../connector-rollout-worker/
109

1110
on:
1211
repository_dispatch:
@@ -19,40 +18,41 @@ on:
1918
action:
2019
description: "Action to perform"
2120
required: true
21+
type: choice
2222
options: ["promote", "rollback"]
23+
24+
permissions:
25+
contents: write
26+
pull-requests: write
27+
28+
# ---------------------------------------------------------------------------
29+
# Job 1: Registry cleanup (runs for both promote and rollback)
30+
# ---------------------------------------------------------------------------
2331
jobs:
24-
finalize_rollout:
25-
name: Finalize connector rollout for ${{ github.event.inputs.connector_name }}
32+
rc-registry-cleanup:
33+
name: "Registry cleanup (${{ github.event_name == 'workflow_dispatch' && github.event.inputs.action || github.event.client_payload.action }})"
2634
runs-on: ubuntu-24.04
2735
env:
2836
ACTION: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.action || github.event.client_payload.action }}
2937
CONNECTOR_NAME: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.connector_name || github.event.client_payload.connector_name }}
3038
steps:
31-
- name: Check action value
39+
- name: Validate action
3240
run: |
3341
if [[ "${ACTION}" != "promote" && "${ACTION}" != "rollback" ]]; then
34-
echo "Invalid action: ${ACTION}"
42+
echo "::error::Invalid action: '${ACTION}'. Must be 'promote' or 'rollback'."
3543
exit 1
3644
fi
3745
shell: bash
3846

39-
- name: Checkout Airbyte repo
40-
uses: actions/checkout@v4
41-
with:
42-
fetch-depth: 1
43-
4447
- name: Install uv
4548
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
4649

4750
- name: Install Ops CLI
4851
run: uv tool install airbyte-internal-ops
4952

50-
# Delete the release_candidate/ metadata marker from GCS.
51-
# This is the same operation for both promote and rollback:
52-
# it removes the RC pointer so the platform knows the rollout
53-
# is finalized. The versioned blob (e.g. 1.2.3-rc.1/) is
54-
# intentionally preserved as an audit trail.
55-
- name: "GCS cleanup: delete RC metadata marker"
53+
# Deletes the release_candidate/ metadata marker from GCS.
54+
# The versioned blob (e.g. 1.2.3-rc.1/) is preserved as audit trail.
55+
- name: "Delete RC metadata marker"
5656
shell: bash
5757
env:
5858
GCS_CREDENTIALS: ${{ secrets.METADATA_SERVICE_PROD_GCS_CREDENTIALS }}
@@ -61,3 +61,189 @@ jobs:
6161
airbyte-ops registry rc cleanup
6262
--name "${CONNECTOR_NAME}"
6363
--store "${REGISTRY_STORE}"
64+
65+
# Recompile the registry JSON indexes so the RC entry is removed.
66+
- name: "Recompile registry for connector"
67+
shell: bash
68+
env:
69+
GCS_CREDENTIALS: ${{ secrets.METADATA_SERVICE_PROD_GCS_CREDENTIALS }}
70+
REGISTRY_STORE: "coral:prod"
71+
run: >
72+
airbyte-ops registry store compile
73+
--store "${REGISTRY_STORE}"
74+
--connector-name "${CONNECTOR_NAME}"
75+
76+
# --- Notifications ---
77+
- name: Notify Slack on rollback success
78+
if: success() && env.ACTION == 'rollback'
79+
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
80+
env:
81+
SLACK_WEBHOOK_URL: ${{ secrets.PUBLISH_ON_MERGE_SLACK_WEBHOOK }}
82+
with:
83+
payload: |
84+
{
85+
"channel": "#connector-publish-failures",
86+
"username": "Connectors CI/CD Bot",
87+
"text": "↩️ Successfully rolled back RC for `${{ env.CONNECTOR_NAME }}` — GCS marker deleted:\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
88+
}
89+
90+
- name: Notify Slack on failure
91+
if: failure()
92+
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
93+
env:
94+
SLACK_WEBHOOK_URL: ${{ secrets.PUBLISH_ON_MERGE_SLACK_WEBHOOK }}
95+
with:
96+
payload: |
97+
{
98+
"channel": "#connector-publish-failures",
99+
"username": "Connectors CI/CD Bot",
100+
"text": "🚨 Registry cleanup failed for `${{ env.CONNECTOR_NAME }}` (${{ env.ACTION }}):\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
101+
}
102+
103+
# ---------------------------------------------------------------------------
104+
# Job 2: Create and merge cleanup PR (promote only)
105+
# ---------------------------------------------------------------------------
106+
create-promotion-pr:
107+
name: "Create and Merge Promotion PR"
108+
needs: rc-registry-cleanup
109+
if: >-
110+
github.event.inputs.action == 'promote'
111+
|| github.event.client_payload.action == 'promote'
112+
runs-on: ubuntu-24.04
113+
env:
114+
CONNECTOR_NAME: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.connector_name || github.event.client_payload.connector_name }}
115+
steps:
116+
# Authenticate as OCTAVIA_BOT so PRs trigger downstream CI.
117+
- name: Authenticate as GitHub App
118+
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
119+
id: get-app-token
120+
with:
121+
owner: "airbytehq"
122+
repositories: "airbyte"
123+
app-id: ${{ secrets.OCTAVIA_BOT_APP_ID }}
124+
private-key: ${{ secrets.OCTAVIA_BOT_PRIVATE_KEY }}
125+
126+
- name: Configure git identity
127+
run: |
128+
git config --global user.name "Octavia Squidington III"
129+
git config --global user.email "octavia-squidington-iii@users.noreply.github.com"
130+
131+
- name: Checkout Airbyte repo
132+
uses: actions/checkout@v4
133+
with:
134+
token: ${{ steps.get-app-token.outputs.token }}
135+
fetch-depth: 1
136+
137+
- name: Install uv
138+
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
139+
140+
- name: Install Ops CLI
141+
run: uv tool install airbyte-internal-ops
142+
143+
# bump-version --bump-type promote strips -rc.N suffix, sets
144+
# enableProgressiveRollout to false, and bumps the version.
145+
# --no-changelog because we don't have a PR number yet.
146+
- name: "Version bump and cleanup"
147+
shell: bash
148+
run: >
149+
airbyte-ops local connector bump-version
150+
--name "${CONNECTOR_NAME}"
151+
--repo-path "${{ github.workspace }}"
152+
--bump-type promote
153+
--no-changelog
154+
155+
# Commits cleanup changes (version bump + progressive rollout
156+
# flag removal) and opens a draft PR. This gives us a PR
157+
# number for the changelog entry.
158+
- name: Create cleanup PR
159+
id: create-pr
160+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
161+
with:
162+
token: ${{ steps.get-app-token.outputs.token }}
163+
commit-message: "chore: finalize promote for ${{ env.CONNECTOR_NAME }}"
164+
branch: "finalize-rollout/promote/${{ env.CONNECTOR_NAME }}"
165+
base: ${{ github.event.repository.default_branch }}
166+
delete-branch: true
167+
title: "chore: finalize promote for ${{ env.CONNECTOR_NAME }}"
168+
body: |
169+
Automated cleanup after connector rollout **promote** for `${{ env.CONNECTOR_NAME }}`.
170+
171+
Generated by [`finalize_rollout` workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
172+
labels: |
173+
area/connectors
174+
auto-merge/bypass-ci-checks
175+
draft: true
176+
177+
# changelog add reads the current version from metadata.yaml
178+
# (already bumped to GA by the promote step above) and writes
179+
# a changelog entry — no version files are modified.
180+
- name: "Add changelog entry"
181+
if: steps.create-pr.outputs.pull-request-number
182+
shell: bash
183+
run: >
184+
airbyte-ops local connector changelog add
185+
--connector-name "${CONNECTOR_NAME}"
186+
--repo-path "${{ github.workspace }}"
187+
--message "Promoted release candidate to GA"
188+
--pr-number "${{ steps.create-pr.outputs.pull-request-number }}"
189+
190+
# Second create-pull-request call pushes the changelog commit
191+
# to the existing PR branch.
192+
- name: "Push changelog to PR"
193+
if: steps.create-pr.outputs.pull-request-number
194+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
195+
with:
196+
token: ${{ steps.get-app-token.outputs.token }}
197+
commit-message: "chore: add changelog for ${{ env.CONNECTOR_NAME }}"
198+
branch: "finalize-rollout/promote/${{ env.CONNECTOR_NAME }}"
199+
base: ${{ github.event.repository.default_branch }}
200+
title: "chore: finalize promote for ${{ env.CONNECTOR_NAME }}"
201+
body: |
202+
Automated cleanup after connector rollout **promote** for `${{ env.CONNECTOR_NAME }}`.
203+
204+
Generated by [`finalize_rollout` workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
205+
206+
# The merge triggers the publish pipeline that
207+
# verifyDefaultVersionActivity is waiting for.
208+
- name: Mark PR ready for review
209+
if: steps.create-pr.outputs.pull-request-number
210+
env:
211+
GH_TOKEN: ${{ steps.get-app-token.outputs.token }}
212+
run: gh pr ready "${{ steps.create-pr.outputs.pull-request-number }}"
213+
214+
- name: Force-merge cleanup PR
215+
if: steps.create-pr.outputs.pull-request-number
216+
env:
217+
GH_TOKEN: ${{ steps.get-app-token.outputs.token }}
218+
run: |
219+
gh pr merge "${{ steps.create-pr.outputs.pull-request-number }}" \
220+
--repo "${{ github.repository }}" \
221+
--squash \
222+
--admin
223+
224+
# --- Notifications ---
225+
- name: Notify Slack on promote success
226+
if: success() && steps.create-pr.outputs.pull-request-number
227+
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
228+
env:
229+
SLACK_WEBHOOK_URL: ${{ secrets.PUBLISH_ON_MERGE_SLACK_WEBHOOK }}
230+
with:
231+
payload: |
232+
{
233+
"channel": "#connector-publish-failures",
234+
"username": "Connectors CI/CD Bot",
235+
"text": "↗️ Successfully promoted `${{ env.CONNECTOR_NAME }}` — cleanup PR merged:\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
236+
}
237+
238+
- name: Notify Slack on failure
239+
if: failure()
240+
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
241+
env:
242+
SLACK_WEBHOOK_URL: ${{ secrets.PUBLISH_ON_MERGE_SLACK_WEBHOOK }}
243+
with:
244+
payload: |
245+
{
246+
"channel": "#connector-publish-failures",
247+
"username": "Connectors CI/CD Bot",
248+
"text": "🚨 Promote PR failed for `${{ env.CONNECTOR_NAME }}`:\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
249+
}

0 commit comments

Comments
 (0)