-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
test: MM 1525 - Create a production sync job to sync feature flags from PROD #27405
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
Merged
+1,145
−0
Merged
Changes from 50 commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
b08bf04
test: init
LeVinhGithub 20c2194
test: fix prettier
LeVinhGithub 658c54f
test: fix format ci
LeVinhGithub c96d92f
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 40f754f
test: fix lint+add unittest
LeVinhGithub dcc70a9
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 519995b
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 4a64d31
test: fix comment
LeVinhGithub 55c1311
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub b70fc31
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 2fd977b
test: fix cursor comment
LeVinhGithub 41b305b
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub a4d9025
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 84486b0
test: fix cursor comment
LeVinhGithub d2d60f6
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 4a260ac
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub aaf2ce6
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 6270264
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub d078aef
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub b308a0d
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub f669778
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 8cc61ef
test: fix lint
LeVinhGithub 741da4f
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 88933aa
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 6efc330
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 03de4f2
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub b5b1b6e
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 74816ae
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub a1b0d1b
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 32c5b27
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 8506dc9
test: reflect new workflow
LeVinhGithub 3df2806
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 89fe35b
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub c30bb5c
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub ad47a59
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 9bcc59b
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 458c240
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub a3e8e90
test: fix comment
LeVinhGithub 133cc7e
test: update unittest
LeVinhGithub b3f13ae
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub a83dda0
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub b845427
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 5fd6de7
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 0099675
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub cea7a65
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 69c3590
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub ee71164
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 277b881
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 9e1f052
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub dddc947
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 8ca917e
test: pass new input
LeVinhGithub 59aaa22
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub d2bf37f
test: fix CR
LeVinhGithub c6cfef4
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub 0754e50
test: fix comment
LeVinhGithub 0bc4a67
Merge branch 'main' into harry/MMQA-1525
LeVinhGithub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
.github/workflows/check-feature-flag-registry-drift.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| name: Check Feature Flag Registry Drift PROD | ||
|
|
||
| on: | ||
| schedule: | ||
| # Run every Tuesday at 01:00 UTC | ||
| - cron: "0 1 * * 2" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| check-feature-flag-registry: | ||
| name: Check feature flag registry against production | ||
| environment: default-branch | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| outputs: | ||
| has-drift: ${{ steps.check.outputs.HAS_DRIFT }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
| cache: "yarn" | ||
|
|
||
| - name: Install dependencies with retry | ||
| uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 #v3.0.2 | ||
| with: | ||
| timeout_minutes: 10 | ||
| max_attempts: 3 | ||
| retry_wait_seconds: 30 | ||
| command: yarn install --immutable | ||
|
|
||
| - name: Check for drift and generate report | ||
| id: check | ||
| shell: bash | ||
| run: | | ||
| set +e | ||
| yarn feature-flags:sync:check 2>&1 | tee sync-report.txt | ||
| EXIT="${PIPESTATUS[0]}" | ||
| set -e | ||
| echo "HAS_DRIFT=$( [ "$EXIT" -eq 1 ] && echo true || echo false )" >> "$GITHUB_OUTPUT" | ||
| echo "HAS_ERROR=$( [ "$EXIT" -eq 2 ] && echo true || echo false )" >> "$GITHUB_OUTPUT" | ||
LeVinhGithub marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Succeed for 0 (no drift) and 1 (drift); fail for 2 (API/script error) | ||
| [ "$EXIT" -eq 0 ] || [ "$EXIT" -eq 1 ] || exit "$EXIT" | ||
|
|
||
| - name: Update registry and prepare artifacts | ||
| if: steps.check.outputs.HAS_DRIFT == 'true' | ||
| shell: bash | ||
| run: | | ||
| yarn feature-flags:sync:update | ||
| cp sync-report.json report.json | ||
LeVinhGithub marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Upload drift report | ||
| if: steps.check.outputs.HAS_DRIFT == 'true' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: drift-report | ||
| path: report.json | ||
|
|
||
| - name: Upload updated registry | ||
| if: steps.check.outputs.HAS_DRIFT == 'true' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: updated-registry | ||
| path: tests/feature-flags/feature-flag-registry.ts | ||
|
|
||
| create-drift-pr: | ||
| name: Create PR for feature flag registry drift | ||
| needs: check-feature-flag-registry | ||
| if: needs.check-feature-flag-registry.outputs.has-drift == 'true' | ||
| uses: MetaMask/github-tools/.github/workflows/create-pr-feature-flag-registry-drift.yml@main | ||
LeVinhGithub marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| with: | ||
| repository: metamask-mobile | ||
| registry-file-path: tests/feature-flags/feature-flag-registry.ts | ||
| registry-artifact-name: updated-registry | ||
| report-artifact-name: drift-report | ||
| workflow-run-url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| secrets: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| notify-slack: | ||
| name: Notify Slack on drift | ||
| needs: [check-feature-flag-registry, create-drift-pr] | ||
| if: always() && needs.check-feature-flag-registry.outputs.has-drift == 'true' && !cancelled() | ||
| runs-on: ubuntu-latest | ||
| environment: default-branch | ||
| steps: | ||
| - name: Send Slack notification | ||
| uses: MetaMask/github-tools/.github/actions/feature-flag-drift-slack-noti@main | ||
LeVinhGithub marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| with: | ||
| title: MetaMask Mobile | ||
| slack-webhook: ${{ secrets.SLACK_WEBHOOK_FEATURE_FLAG_DRIFT }} | ||
| workflow-run-url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| pr-url: ${{ needs.create-drift-pr.outputs.pr-url || '' }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.