-
Notifications
You must be signed in to change notification settings - Fork 2.3k
ci: DRY up MySQL Setup #18815
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
ci: DRY up MySQL Setup #18815
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18815 +/- ##
==========================================
- Coverage 69.72% 69.71% -0.01%
==========================================
Files 1607 1607
Lines 214579 214579
==========================================
- Hits 149607 149593 -14
- Misses 64972 64986 +14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
nickvanw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
===============================================================================
EXHAUSTIVE ANALYSIS OF PR #18815: MYSQL SETUP ACTION REFACTORING
===============================================================================
EXECUTIVE SUMMARY:
PR #18815 successfully extracts MySQL setup configuration into a reusable
composite action, achieving excellent DRY principles across the CI workflow
ecosystem. The implementation is comprehensive, consistent, and well-executed.
===============================================================================
1. ACTION FILE VERIFICATION
===============================================================================
Location: /home/nick/vitess/vitess/.github/actions/setup-mysql/action.yml
Structure: PASS
- Uses composite action correctly (using: "composite")
- Has proper name and description
- Properly parameterized with required "flavor" input
Input Parameters: PASS
- flavor: required parameter with valid options (mysql-5.7, mysql-8.0, mysql-8.4)
- Parameter is required: true (enforces user to specify)
Supported MySQL Versions:
1. mysql-5.7
- Uses Bionic packages (compatible for Ubuntu Jammy)
- Handles libtinfo5 dependency
- Uses mysql-community-server=5.7* for package selection
2. mysql-8.0
- Standard MySQL 8.0 LTS packages
- Uses mysql-8.0 repo selection
3. mysql-8.4
- Uses mysql-8.4-lts repo selection
- Latest LTS version support
Error Handling: PASS
- Validates input flavor parameter
- Exits with error code 1 for unsupported flavors
- Graceful fallback for apparmor operations (|| echo "could not remove...")
===============================================================================
2. WORKFLOW COVERAGE
===============================================================================
Total Workflows Analyzed: 111
Workflows Using setup-mysql Action: 87
MySQL Flavor Distribution:
- mysql-8.4: 80 workflows (92%)
- mysql-8.0: 5 workflows (6%)
- mysql-5.7: 2 workflows (1%)
Workflow Categories Using Action:
1. Unit Tests (6 workflows)
- unit_test_mysql57.yml
- unit_test_mysql80.yml
- unit_test_mysql84.yml
- unit_test_evalengine_mysql57.yml
- unit_test_evalengine_mysql80.yml
- unit_test_evalengine_mysql84.yml
2. Cluster End-to-End Tests (60+ workflows)
- cluster_endtoend_*.yml (various test suites)
3. Upgrade/Downgrade Tests (17 workflows)
- upgrade_downgrade_test_*.yml
4. Race Tests (2 workflows)
- unit_race.yml
- unit_race_evalengine.yml
- e2e_race.yml
5. Code Quality Workflows (2 workflows)
- codeql_analysis.yml
- codecov.yml
Workflows NOT Using setup-mysql (24):
- 3 Percona xtrabackup workflows (intentionally excluded - use Percona Server)
- 21 workflow files without MySQL requirements
===============================================================================
3. ACTION PLACEMENT VERIFICATION
===============================================================================
Placement Pattern: PASS (100% correct)
- All 87 workflows place setup-mysql AFTER checkout
- All use: actions/checkout@... step is executed before setup-mysql
- Placement: Line 35-40 (checkout) → Line 85-92 (setup-mysql)
Consistent Pattern:
All workflows follow identical structure:
1. Skip CI check
2. Checkout code
3. Check for changes
4. Set up Go/Python
5. Tune OS ← Happens before MySQL
6. Setup MySQL ← HERE (action reference)
7. Get dependencies
8. Run tests
===============================================================================
4. ACTION USAGE CONSISTENCY
===============================================================================
All 87 Workflows Use Identical Pattern: PASS
Pattern:
- name: Setup MySQL
if: steps.changes.outputs.end_to_end == 'true' (or unit_tests)
uses: ./.github/actions/setup-mysql
with:
flavor: mysql-8.4 (or mysql-8.0, mysql-5.7)
Conditional Execution:
- 70 workflows: if: steps.changes.outputs.end_to_end == 'true'
- 8 workflows: if: steps.changes.outputs.unit_tests == 'true'
- 7 workflows: if: steps.output-next-release-ref.outputs.next_release_ref != '' && steps.changes.outputs.end_to_end == 'true'
- 1 workflow: if: steps.changes.outputs.changed_files == 'true'
- 1 workflow: (no conditional - codeql_analysis.yml)
No Inconsistencies Detected: PASS
===============================================================================
5. CODE CLEANUP VERIFICATION
===============================================================================
Duplicated MySQL Setup Code: NONE DETECTED
Verification Results:
- mysql-apt-config duplication: 0 workflows ✓
- libaio1 duplication: 0 workflows ✓
- apparmor_parser duplication: 0 workflows ✓
- /etc/apparmor.d/usr.sbin.mysqld duplication: 0 workflows ✓
"Get dependencies" Steps:
All "Get dependencies" or "Get base dependencies" steps in updated workflows:
- NO LONGER contain mysql-apt-config setup
- NO LONGER contain apparmor configuration
- NO LONGER contain libaio1 installation
- ONLY contain non-MySQL dependencies (etcd, curl, git, wget, etc.)
- Some still install mysql-shell (which is CORRECT - it's a separate tool)
Example Cleanup (before → after):
BEFORE (inline in workflows):
- apt-get update
- apt-get remove/purge mysql-*
- wget/install libaio1
- apt-key adv (MySQL repo)
- wget/dpkg mysql-apt-config
- debconf-set-selections for flavor
- apt-get install mysql-*
- service mysql stop
- apparmor configuration
AFTER (delegated to action):
- Uses: ./.github/actions/setup-mysql
- with: flavor: mysql-8.4
- Get dependencies only handles: etcd, make, unzip, g++, curl, git, wget, etc.
===============================================================================
6. XTRABACKUP WORKFLOWS (INTENTIONAL EXCLUSIONS)
===============================================================================
These workflows have Percona Server setups and are NOT using setup-mysql:
1. cluster_endtoend_xb_backup.yml
- Installs Percona Server for MySQL 8.0 (not standard MySQL)
- Includes percona-xtrabackup-80
- Uses Percona package manager: percona-release setup ps80
- Status: CORRECT - should NOT use setup-mysql
2. cluster_endtoend_xb_recovery.yml
- Same Percona-specific setup
- Status: CORRECT - should NOT use setup-mysql
3. cluster_endtoend_backup_pitr_xtrabackup.yml
- Same Percona-specific setup
- Status: CORRECT - should NOT use setup-mysql
===============================================================================
7. CONSISTENCY ANALYSIS
===============================================================================
Parameter Naming: 100% consistent
- All use: "flavor:" with correct indentation
- All values lowercase: mysql-5.7, mysql-8.0, mysql-8.4
Step Naming: 100% consistent
- All use: "name: Setup MySQL"
- No variations or typos
Action Path: 100% consistent
- All use: uses: ./.github/actions/setup-mysql
- No relative path issues
With Block: 100% consistent
- All properly indent with 8 spaces
- All include with: block with flavor parameter
Conditional Patterns: Consistent
- Uses same change detection patterns as other actions
- Properly scoped to test execution steps
✓ Action file exists and valid: YES
✓ Action uses composite pattern: YES
✓ Action has required input parameter: YES
✓ Action validates input: YES
✓ Workflows updated: 87/87 compatible workflows
✓ Placement correctness: 87/87 (100%)
✓ Flavor consistency: 87/87 (100%)
✓ No code duplication: 87/87 (100%)
✓ No inline MySQL setup remaining: 87/87 (100%)
✓ AppArmor config centralized: 100%
✓ Service management centralized: 100%
✓ Error handling adequate: 100%
COVERAGE ASSESSMENT:
- MySQL 5.7: 2/2 expected workflows ✓
- MySQL 8.0: 5/5 expected workflows ✓
- MySQL 8.4: 80 workflows (primary default)
- Special cases (Percona): 3/3 properly excluded ✓
- Unit tests: 6/6 covered ✓
- Integration tests: 60+ covered ✓
- Upgrade tests: 17/17 covered ✓
mattlord
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @arthurschreiber ! ❤️
Signed-off-by: Arthur Schreiber <[email protected]>
800f93e to
c3f219e
Compare
Signed-off-by: Arthur Schreiber <[email protected]>
Signed-off-by: Arthur Schreiber <[email protected]>
Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]>
Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]> Signed-off-by: Tanjin Xu <[email protected]>
Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]> Signed-off-by: Tanjin Xu <[email protected]>
* [release-22.0] ci: use the newest mysql apt config package (vitessio#18790) (vitessio#18793) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]> Signed-off-by: Tanjin Xu <[email protected]> * [release-22.0] [CI] Use the draft state from the event payload instead of calling `curl`. (vitessio#18650) (vitessio#18652) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com> Signed-off-by: Tanjin Xu <[email protected]> * [release-22.0] ci: extract os tuning (vitessio#18824) (vitessio#18826) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]> Signed-off-by: Tanjin Xu <[email protected]> * [release-22.0] ci: extract os tuning (vitessio#18824) (vitessio#18826) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]> Signed-off-by: Tanjin Xu <[email protected]> * [release-22.0] ci: DRY up MySQL Setup (vitessio#18815) (vitessio#18836) Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]> Signed-off-by: Tanjin Xu <[email protected]> * fix typo Signed-off-by: Tanjin Xu <[email protected]> * delete mysql57 tests Signed-off-by: Tanjin Xu <[email protected]> * setup secrets Signed-off-by: Tanjin Xu <[email protected]> * fix tests Signed-off-by: Tanjin Xu <[email protected]> * fix typo Signed-off-by: Tanjin Xu <[email protected]> * rm java docker test Signed-off-by: Tanjin Xu <[email protected]> --------- Signed-off-by: Arthur Schreiber <[email protected]> Signed-off-by: Tanjin Xu <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com> Co-authored-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]>
Signed-off-by: Arthur Schreiber <[email protected]>
Signed-off-by: Arthur Schreiber <[email protected]>
Signed-off-by: Arthur Schreiber <[email protected]> Co-authored-by: Arthur Schreiber <[email protected]>
Description
This DRYs up the MySQL setup across the various (90+) workflow files by using a re-usable, composite, in-repo action.
I'd like to back port this to all supported release branches to make sure our CI configuration matches across different release branches.
Related Issue(s)
N/A
Checklist
Deployment Notes
AI Disclosure