-
Notifications
You must be signed in to change notification settings - Fork 484
chore: production deploy #5657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore: production deploy #5657
Changes from all commits
b1864cb
41159af
7c35fd6
3d3ca02
53ea9e5
ca86ec7
57111ae
21b0c12
cbbcd06
c6127da
aa764ec
049e95b
79fdcbd
32ef81c
17546b3
df41fbc
a60a532
1d113d7
4f94f6d
e09cf29
3016806
557e3eb
7264b7c
0d63164
3eb35e5
82e5fe2
62f7b83
88c94c9
e404074
979afe5
23a5db6
8e119e1
8de126c
f3b6c38
9612825
893960a
39d6bda
fbbc609
17a84e6
50fcced
dfceef8
db5c4a3
d775bb3
ba7ef28
64260c1
afcaa27
b4dec62
74c88c8
39c21c0
90222aa
69205ff
2ce303a
41d9f2b
64cdb69
df3c740
6296610
1bf3611
0df4840
d314f76
b672b15
6fa5fd5
3f583a0
242812b
04f3907
04b9db4
7a6d456
71338e6
fefe607
346fec8
89e3ccd
88062fc
e26ac14
5a7d2e5
6ff1a86
dcb9e53
148d4b4
4bb2574
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/usr/bin/env bash | ||
| # Delete every staging project whose name starts with the given prefix (the live | ||
| # e2e job's per-run prefix). Shared by the in-run retry sweep (called best-effort | ||
| # with `|| true`) and the always() cleanup step (which propagates the exit code). | ||
| # | ||
| # Reads SUPABASE_ACCESS_TOKEN + CLI_E2E_API_URL from the environment. Exits | ||
| # non-zero if any DELETE failed; a failed *listing* also exits non-zero (pipefail). | ||
| set -o pipefail | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the initial Useful? React with 👍 / 👎. |
||
|
|
||
| PREFIX="${1:?usage: sweep-live-projects.sh PREFIX}" | ||
| : "${SUPABASE_ACCESS_TOKEN:?SUPABASE_ACCESS_TOKEN required}" | ||
| : "${CLI_E2E_API_URL:?CLI_E2E_API_URL required}" | ||
|
|
||
| # Capture the list in a var (not a pipe-to-while subshell) so a failed delete is | ||
| # recorded in $failed; a failed listing aborts here via pipefail. | ||
| refs=$(curl -fsS -H "Authorization: Bearer ${SUPABASE_ACCESS_TOKEN}" \ | ||
| "${CLI_E2E_API_URL}/v1/projects" \ | ||
| | jq -r --arg p "$PREFIX" '.[] | select(.name|startswith($p)) | .ref // .id') | ||
|
|
||
| failed=0 | ||
| for ref in $refs; do | ||
| [ -n "$ref" ] || continue | ||
| echo "deleting leftover project $ref" | ||
| if ! curl -fsS -X DELETE -H "Authorization: Bearer ${SUPABASE_ACCESS_TOKEN}" \ | ||
| "${CLI_E2E_API_URL}/v1/projects/${ref}" >/dev/null; then | ||
| echo "::error::failed to delete leftover project $ref" | ||
| failed=1 | ||
| fi | ||
| done | ||
| exit "$failed" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,71 +9,18 @@ permissions: | |
| contents: read | ||
|
|
||
| jobs: | ||
| detect: | ||
| name: Detect OpenAPI changes | ||
| runs-on: blacksmith-8vcpu-ubuntu-2404 | ||
| outputs: | ||
| has_changes: ${{ steps.compare.outputs.has_changes }} | ||
| steps: | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Compare upstream OpenAPI spec | ||
| id: compare | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| remote_spec="$RUNNER_TEMP/openapi.remote.json" | ||
| remote_normalized="$RUNNER_TEMP/openapi.remote.normalized.json" | ||
| tracked_normalized="$RUNNER_TEMP/openapi.tracked.normalized.json" | ||
| normalize_filter="$RUNNER_TEMP/normalize-openapi.jq" | ||
|
|
||
| curl -fsS https://api.supabase.com/api/v1-json -o "$remote_spec" | ||
|
|
||
| cat > "$normalize_filter" <<'JQ' | ||
| def pointer_path($p): $p | split("/")[1:] | map(gsub("~1"; "/") | gsub("~0"; "~")); | ||
| reduce ($overrides[0] // [])[] as $op (.; | ||
| if $op.op == "test" then | ||
| if getpath(pointer_path($op.path)) == $op.value then | ||
| . | ||
| else | ||
| error("OpenAPI override test failed at \($op.path)") | ||
| end | ||
| elif $op.op == "replace" then | ||
| setpath(pointer_path($op.path); $op.value) | ||
| else | ||
| error("Unsupported OpenAPI override op \($op.op)") | ||
| end | ||
| ) | ||
| JQ | ||
|
|
||
| jq -S --slurpfile overrides packages/api/scripts/openapi-overrides.json \ | ||
| -f "$normalize_filter" "$remote_spec" > "$remote_normalized" | ||
| jq -S . packages/api/src/generated/openapi.json > "$tracked_normalized" | ||
|
|
||
| if cmp -s "$remote_normalized" "$tracked_normalized"; then | ||
| echo "No upstream OpenAPI changes detected." | ||
| echo "has_changes=false" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "Upstream OpenAPI changes detected." | ||
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | ||
| diff -u "$tracked_normalized" "$remote_normalized" | sed -n '1,160p' || true | ||
| fi | ||
|
|
||
| sync: | ||
| name: Sync API package | ||
| needs: detect | ||
| if: needs.detect.outputs.has_changes == 'true' | ||
| runs-on: blacksmith-8vcpu-ubuntu-2404 | ||
| steps: | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup | ||
| uses: ./.github/actions/setup | ||
| with: | ||
| dependency-firewall-token: ${{ secrets.DF_FIREWALL_TOKEN }} | ||
|
|
||
| - name: Regenerate API package | ||
| run: pnpm generate | ||
|
|
@@ -105,6 +52,7 @@ jobs: | |
|
|
||
| - name: Create Pull Request | ||
| if: steps.check.outputs.has_changes == 'true' | ||
| id: cpr | ||
| uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 | ||
| with: | ||
| token: ${{ steps.app-token.outputs.token }} | ||
|
|
@@ -116,3 +64,18 @@ jobs: | |
| Changes were detected in the upstream OpenAPI document exposed by `https://api.supabase.com/api/v1-json`. | ||
| branch: sync/api-package | ||
| base: develop | ||
|
|
||
| - name: Approve a PR | ||
| if: steps.check.outputs.has_changes == 'true' && steps.cpr.outputs.pull-request-operation == 'created' | ||
| continue-on-error: true | ||
| run: gh pr review --approve --repo "${{ github.repository }}" "${STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER}" | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER: ${{ steps.cpr.outputs.pull-request-number }} | ||
|
|
||
| - name: Enable Pull Request Automerge | ||
| if: steps.check.outputs.has_changes == 'true' | ||
| run: gh pr merge --auto --squash --repo "${{ github.repository }}" "${STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Severity: MEDIUM This new auto-approve + auto-merge pipeline, combined with the CODEOWNERS change making 💡 Fix SuggestionSuggestion: This supply-chain risk requires a coordinated set of changes across multiple files to ensure generated code cannot be merged without human review:
Implementing steps 1–3 together ensures that auto-created sync PRs require a genuine human review and approval from a codeowner before they can be merged into the |
||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER: ${{ steps.cpr.outputs.pull-request-number }} | ||
Uh oh!
There was an error while loading. Please reload this page.