Skip to content

ci: fix MySQL 8 service container health check in Magento compatibility workflow#183

Merged
dermatz merged 2 commits into
mainfrom
copilot/update-mysql-health-check
May 11, 2026
Merged

ci: fix MySQL 8 service container health check in Magento compatibility workflow#183
dermatz merged 2 commits into
mainfrom
copilot/update-mysql-health-check

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 11, 2026

The Magento Compatibility Test workflow was failing at service container startup because the MySQL health check ran without credentials or explicit host, causing authentication failures against MySQL 8's default auth plugin.

Changes

  • .github/workflows/magento-compatibility.yml — replace the bare mysqladmin ping health check with an authenticated variant:
    • Add -h 127.0.0.1 -uroot -pmagento --silent to avoid socket/auth-plugin ambiguity
    • Increase --health-retries from 310
    • Add --health-start-period=30s to give MySQL 8 init time before checks begin
# before
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

# after
options: >-
  --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -pmagento --silent"
  --health-interval=10s
  --health-timeout=5s
  --health-retries=10
  --health-start-period=30s

Image, env vars, and ports are unchanged.

Original prompt

Update the GitHub Actions workflow in repository OpenForgeProject/mageforge to fix the failing MySQL service container startup in the Magento Compatibility Test workflow.

Context:

  • Failing job URL: https://github.com/OpenForgeProject/mageforge/actions/runs/25660803219/job/75320579365
  • Workflow file: .github/workflows/magento-compatibility.yml
  • Commit reference associated with the failing job: 1e1bafd824e62ce1ac4603346d5738684997b95b
  • The failure occurs before Magento installation, during GitHub Actions service container startup.
  • Job logs show:
    • Service container mysql failed.
    • Failed to initialize container mysql:8.0
    • One or more containers failed to start.
  • The workflow currently configures the MySQL service with:
    • image mysql:8.0
    • health check mysqladmin ping

Requested change:

  • Modify the MySQL service definition in .github/workflows/magento-compatibility.yml to use a more reliable health check with explicit host and credentials.
  • Apply this recommended patch:
    • replace the current options line for the MySQL service with a folded multi-line options block containing:
      • --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -pmagento --silent"
      • --health-interval=10s
      • --health-timeout=5s
      • --health-retries=10
      • --health-start-period=30s

Acceptance criteria:

  • Only update the workflow file as needed to implement the recommended patch.
  • Keep the existing MySQL image, environment variables, and ports unchanged.
  • Do not make unrelated changes.
  • Open a pull request with a concise title describing the CI MySQL health check fix.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: The failure is in the MySQL service startup, not in MageForge code or Magento install steps.

Root cause

The workflow defines MySQL like this:

.github/workflows/magento-compatibility.yml

mysql:
  image: mysql:8.0
  env:
    MYSQL_ROOT_PASSWORD: magento
    MYSQL_DATABASE: magento
  ports:
    - 3306:3306
  options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

The job log shows:

  • Service container mysql failed.
  • Failed to initialize container mysql:8.0
  • One or more containers failed to start.

The container log also shows MySQL initialization completed, which strongly suggests the problem is the GitHub Actions service container health/startup configuration rather than schema/setup logic. The most likely issue is the health check command:

--health-cmd="mysqladmin ping"

For MySQL 8 images, that check is often unreliable without explicit credentials and host, especially once the container has initialized with a root password.

Fix

Update the MySQL service health check to authenticate explicitly and give it a bit more time.

Suggested replacement:

services:
  mysql:
    image: mysql:8.0
    env:
      MYSQL_ROOT_PASSWORD: magento
      MYSQL_DATABASE: magento
    ports:
      - 3306:3306
    options: >-
      --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -pmagento --silent"
      --health-interval=10s
      --health-timeout=5s
      --health-retries=10
      --health-start-period=30s

Why this should solve it

  • -uroot -pmagento matches the configured root password.
  • -h 127.0.0.1 avoids socket/auth ambiguity inside the container.
  • --silent makes the health check cleaner and more predictable.
  • More retries and a startup grace period prevent false negatives during MySQL init.

Recommended patch

In magento-compatibility.yml, replace the MySQL service block with:

services:
  mysql:
    image: mysql:8.0
    env:
      MYSQL_ROOT_PASSWORD: magento
      MYSQL_DATABASE: magento
    ports:
      - 3306:3306
    options: >-
      --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -pmagento --silent"
      --health-interval=10s
      --health-timeout=5s
      --health-retries=10
      --health-start-period=30s

Optional hardening

If MySQL 8.0 latest patch behavior keeps shifting, pin to a known-good tag instead of mysql:8.0, for example:

image: mysql:8.0.36

That makes CI more reproducible.

Bottom line

This is a CI service-container startup issue caused by an insufficient MySQL health check. The best solution is to make the health check explicit with credentials/host and increase the startup tolerance.

User: make a pr with the Recommende...

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Update GitHub Actions workflow to fix MySQL service startup ci: fix MySQL 8 service container health check in Magento compatibility workflow May 11, 2026
Copilot AI requested a review from dermatz May 11, 2026 09:12
@dermatz dermatz marked this pull request as ready for review May 11, 2026 09:17
Copilot AI review requested due to automatic review settings May 11, 2026 09:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the Magento Compatibility Test workflow’s MySQL 8 service startup reliability by making the service container health check authenticate explicitly and allowing more startup time before marking the service unhealthy.

Changes:

  • Replace the MySQL service health check with an authenticated mysqladmin ping using explicit host/credentials.
  • Increase health check tolerance (retries) and add a start period to accommodate MySQL 8 initialization.

Comment thread .github/workflows/magento-compatibility.yml
@dermatz dermatz enabled auto-merge (squash) May 11, 2026 09:25
@dermatz dermatz disabled auto-merge May 11, 2026 09:25
@dermatz dermatz merged commit 2c069ad into main May 11, 2026
17 checks passed
@dermatz dermatz deleted the copilot/update-mysql-health-check branch May 11, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants