-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add VillageSQL flavor support #88
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
Changes from all commits
5f15ba4
040787d
db84004
7d9c2a0
1b92cd3
52aef45
1b514f5
658fa25
21cc569
6ac9722
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,38 @@ | ||
| name: Release | ||
|
|
||
| # Builds and publishes dbdeployer binaries when a version tag is pushed. | ||
| # Uses GoReleaser with the config in .goreleaser.yaml. | ||
| # Produces: linux/darwin x amd64/arm64 tarballs + checksums.txt | ||
| # | ||
| # Security note: no user-controlled inputs are used. Triggers only on | ||
| # version tags pushed by maintainers. | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Build and Release | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.22' | ||
|
|
||
| - name: Run GoReleaser | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| distribution: goreleaser | ||
| version: latest | ||
| args: release --clean | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| name: VillageSQL Flavor Test | ||
|
|
||
| # Tests VillageSQL flavor detection, sandbox deployment, and capability | ||
| # inheritance using the official VillageSQL 0.0.3 release tarball from | ||
| # https://github.com/villagesql/villagesql-server/releases/tag/0.0.3 | ||
| # | ||
| # The workflow verifies: | ||
| # 1. dbdeployer unpack detects the flavor as "villagesql" via the | ||
| # share/villagesql_schema.sql marker file | ||
| # 2. Single sandbox deployment works with --unpack-version mapping | ||
| # 3. Replication deployment works with data verification | ||
| # 4. VillageSQL capabilities correctly inherit MySQL capabilities | ||
| # | ||
| # Note: The 0.0.3 tarball contains two symlinks in | ||
| # mysql-test/suite/villagesql/examples/ that point outside the extraction | ||
| # directory. These are stripped before unpacking. See | ||
| # https://github.com/villagesql/villagesql-server/issues/237 | ||
| # | ||
| # Security note: this workflow uses no user-controlled inputs (issue | ||
| # bodies, PR titles, commit messages, etc.). All values are hardcoded. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| branches: [master] | ||
|
|
||
| env: | ||
| VILLAGESQL_VERSION: "0.0.3" | ||
| VILLAGESQL_SHA256: "8b15522a973b17b430ed9e64e8bdbf97bf858cef028bfbc7f9b9608002406393" | ||
| VILLAGESQL_TARBALL: "villagesql-dev-server-0.0.3-dev-linux-x86_64.tar.gz" | ||
| VILLAGESQL_URL: "https://github.com/villagesql/villagesql-server/releases/download/0.0.3/villagesql-dev-server-0.0.3-dev-linux-x86_64.tar.gz" | ||
| # VillageSQL uses its own version scheme (0.0.3). Map to MySQL 8.0.40 for | ||
| # capability lookups (mysqld --initialize, CREATE USER, GTID, etc.) | ||
| MYSQL_MAPPED_VERSION: "8.0.40" | ||
| GO111MODULE: on | ||
| SANDBOX_BINARY: ${{ github.workspace }}/opt/mysql | ||
|
|
||
| jobs: | ||
| villagesql-deploy: | ||
| name: Deploy (VillageSQL ${{ env.VILLAGESQL_VERSION }}) | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.22' | ||
|
|
||
| - name: Install system libraries | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y libaio1 libnuma1 libncurses5 | ||
|
|
||
| - name: Build dbdeployer | ||
| run: go build -o dbdeployer . | ||
|
|
||
| - name: Cache VillageSQL tarball | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: /tmp/villagesql-tarball | ||
| key: villagesql-${{ env.VILLAGESQL_VERSION }}-linux-x86_64-v1 | ||
|
|
||
| - name: Download and verify VillageSQL tarball | ||
| run: | | ||
| mkdir -p /tmp/villagesql-tarball | ||
| if [ ! -f "/tmp/villagesql-tarball/$VILLAGESQL_TARBALL" ]; then | ||
| echo "Downloading VillageSQL $VILLAGESQL_VERSION..." | ||
| curl -L -f -o "/tmp/villagesql-tarball/$VILLAGESQL_TARBALL" "$VILLAGESQL_URL" | ||
| fi | ||
| echo "Verifying checksum..." | ||
| echo "$VILLAGESQL_SHA256 /tmp/villagesql-tarball/$VILLAGESQL_TARBALL" | sha256sum -c | ||
| ls -lh "/tmp/villagesql-tarball/$VILLAGESQL_TARBALL" | ||
|
|
||
| - name: Repack tarball without broken symlinks | ||
| run: | | ||
| cd /tmp | ||
| mkdir -p villagesql-staging villagesql-clean | ||
| tar xzf "villagesql-tarball/$VILLAGESQL_TARBALL" -C villagesql-staging | ||
| INNER="villagesql-staging/villagesql-dev-server-$VILLAGESQL_VERSION-dev-linux-x86_64" | ||
| # Remove symlinks that point outside the extraction directory | ||
| # (https://github.com/villagesql/villagesql-server/issues/237) | ||
| rm -f "$INNER/mysql-test/suite/villagesql/examples/vsql-complex" | ||
| rm -f "$INNER/mysql-test/suite/villagesql/examples/vsql-tvector" | ||
| tar czf "villagesql-clean/$VILLAGESQL_TARBALL" -C villagesql-staging \ | ||
| "villagesql-dev-server-$VILLAGESQL_VERSION-dev-linux-x86_64" | ||
| rm -rf villagesql-staging | ||
|
|
||
| - name: Test unpack with --unpack-version | ||
| run: | | ||
| mkdir -p "$SANDBOX_BINARY" | ||
| ./dbdeployer unpack "/tmp/villagesql-clean/$VILLAGESQL_TARBALL" \ | ||
| --sandbox-binary="$SANDBOX_BINARY" \ | ||
| --unpack-version="$MYSQL_MAPPED_VERSION" | ||
|
|
||
| # Verify flavor detected as villagesql | ||
| FLAVOR_FILE="$SANDBOX_BINARY/$MYSQL_MAPPED_VERSION/FLAVOR" | ||
| [ -f "$FLAVOR_FILE" ] || { echo "FAIL: No FLAVOR file"; exit 1; } | ||
| FLAVOR=$(cat "$FLAVOR_FILE") | ||
| echo "Detected flavor: $FLAVOR" | ||
| [ "$FLAVOR" = "villagesql" ] || { echo "FAIL: expected 'villagesql', got '$FLAVOR'"; exit 1; } | ||
|
|
||
| # Verify marker file | ||
| MARKER="$SANDBOX_BINARY/$MYSQL_MAPPED_VERSION/share/villagesql_schema.sql" | ||
| [ -f "$MARKER" ] || { echo "FAIL: marker file not found"; exit 1; } | ||
| echo "OK: flavor=villagesql, marker file present" | ||
|
|
||
| - name: Test deploy single sandbox | ||
| run: | | ||
| ./dbdeployer deploy single "$MYSQL_MAPPED_VERSION" --sandbox-binary="$SANDBOX_BINARY" | ||
| VERSION=$(~/sandboxes/msb_*/use -BN -e "SELECT VERSION();") | ||
| echo "Server version: $VERSION" | ||
| echo "$VERSION" | grep -qi villagesql || { echo "FAIL: expected villagesql in VERSION()"; exit 1; } | ||
| echo "OK: VillageSQL single sandbox running" | ||
| ./dbdeployer delete all --skip-confirm | ||
|
|
||
| - name: Test deploy replication sandbox | ||
| run: | | ||
| ./dbdeployer deploy replication "$MYSQL_MAPPED_VERSION" --sandbox-binary="$SANDBOX_BINARY" | ||
| ~/sandboxes/rsandbox_*/check_slaves | ||
| ~/sandboxes/rsandbox_*/test_replication | ||
| echo "OK: VillageSQL replication sandbox works" | ||
| ./dbdeployer delete all --skip-confirm | ||
|
|
||
| - name: Cleanup | ||
| if: always() | ||
| run: | | ||
| ./dbdeployer delete all --skip-confirm 2>/dev/null || true | ||
| pkill -9 -u "$USER" mysqld 2>/dev/null || true | ||
|
|
||
| villagesql-capabilities: | ||
| name: Capability Inheritance Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.22' | ||
|
|
||
| - name: Run capability tests | ||
| run: go test ./common/... -v -run TestHasCapability -count=1 | ||
|
|
||
| - name: Run copy capabilities tests | ||
| run: go test ./common/... -v -run TestCopyCapabilities -count=1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,6 +60,23 @@ dbdeployer deploy replication 16.13 --provider=postgresql | |
|
|
||
| > **Note:** The `apt-get download` command downloads `.deb` files to the current directory without installing anything. Your system is untouched. See the [PostgreSQL provider guide](https://proxysql.github.io/dbdeployer/providers/postgresql/) for details and alternative installation methods. | ||
|
|
||
| ### VillageSQL | ||
|
|
||
| [VillageSQL](https://github.com/villagesql/villagesql-server) is a MySQL drop-in replacement with extensions (custom types, VDFs). Since it uses its own version scheme, unpack with `--unpack-version` mapped to the MySQL base version: | ||
|
|
||
| ```bash | ||
| # Download from GitHub Releases | ||
| curl -L -o villagesql-dev-server-0.0.3-dev-linux-x86_64.tar.gz \ | ||
| https://github.com/villagesql/villagesql-server/releases/download/0.0.3/villagesql-dev-server-0.0.3-dev-linux-x86_64.tar.gz | ||
|
|
||
| # Unpack with MySQL 8.0 version mapping (required for capabilities) | ||
| dbdeployer unpack villagesql-dev-server-0.0.3-dev-linux-x86_64.tar.gz --unpack-version=8.0.40 | ||
|
Comment on lines
+67
to
+73
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. Make the quick-start use the cleaned tarball path. The wiki notes VillageSQL 0.0.3 has out-of-tree symlinks that dbdeployer rejects, so this direct 🤖 Prompt for AI Agents |
||
|
|
||
| # Deploy | ||
| dbdeployer deploy single 8.0.40 | ||
| ~/sandboxes/msb_8_0_40/use -e "SELECT VERSION();" | ||
| ``` | ||
|
|
||
| ## Supported Databases | ||
|
|
||
| | Provider | Single | Replication | Group Replication | ProxySQL Wiring | | ||
|
|
@@ -71,6 +88,7 @@ dbdeployer deploy replication 16.13 --provider=postgresql | |
| | MariaDB | ✓ | ✓ | — | ✓ | | ||
| | NDB Cluster | ✓ | ✓ | — | — | | ||
| | Percona XtraDB Cluster | ✓ | ✓ | — | — | | ||
| | VillageSQL | ✓ | ✓ | — | — | | ||
|
|
||
| ## Key Features | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -52,6 +52,7 @@ const ( | |||||||||||||||||||||
| NdbFlavor = "ndb" | ||||||||||||||||||||||
| PxcFlavor = "pxc" | ||||||||||||||||||||||
| TiDbFlavor = "tidb" | ||||||||||||||||||||||
| VillageSQLFlavor = "villagesql" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Feature names | ||||||||||||||||||||||
| InstallDb = "installdb" | ||||||||||||||||||||||
|
|
@@ -255,6 +256,13 @@ var FlavorCompositionList = []flavorIndicator{ | |||||||||||||||||||||
| }, | ||||||||||||||||||||||
| flavor: PerconaServerFlavor, | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| AllNeeded: false, | ||||||||||||||||||||||
| elements: []elementPath{ | ||||||||||||||||||||||
| {"share", globals.FnVillagesqlSchema}, | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| flavor: VillageSQLFlavor, | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| AllNeeded: false, | ||||||||||||||||||||||
| elements: []elementPath{ | ||||||||||||||||||||||
|
|
@@ -287,6 +295,12 @@ var PerconaCapabilities = Capabilities{ | |||||||||||||||||||||
| Features: MySQLCapabilities.Features, | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| var VillageSQLCapabilities = Capabilities{ | ||||||||||||||||||||||
| Flavor: VillageSQLFlavor, | ||||||||||||||||||||||
| Description: "VillageSQL server", | ||||||||||||||||||||||
| Features: MySQLCapabilities.Features, | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+298
to
+302
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. VillageSQL is described as having extensions (custom types, VDFs). Assigning
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| var TiDBCapabilities = Capabilities{ | ||||||||||||||||||||||
| Flavor: TiDbFlavor, | ||||||||||||||||||||||
| Description: "TiDB isolated server", | ||||||||||||||||||||||
|
|
@@ -382,6 +396,7 @@ var MySQLShellCapabilities = Capabilities{ | |||||||||||||||||||||
| var AllCapabilities = map[string]Capabilities{ | ||||||||||||||||||||||
| MySQLFlavor: MySQLCapabilities, | ||||||||||||||||||||||
| PerconaServerFlavor: PerconaCapabilities, | ||||||||||||||||||||||
| VillageSQLFlavor: VillageSQLCapabilities, | ||||||||||||||||||||||
| MariaDbFlavor: MariadbCapabilities, | ||||||||||||||||||||||
| TiDbFlavor: TiDBCapabilities, | ||||||||||||||||||||||
| NdbFlavor: NdbCapabilities, | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
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.
🧩 Analysis chain
🌐 Web query:
GitHub Actions context availability for jobs.<job_id>.name env💡 Result:
No, the jobs.<job_id>.name (the display name of a specific job) is not directly available as an environment variable or in the job context. The job context provides information about the current running job only, with properties like job.status, job.check_run_id, but does not include a name property listing the display name (official docs list explicit properties without name). The jobs context is available only in reusable workflows and contains outputs and results of previous jobs (e.g., jobs.example_job.result), not names. However, within steps of the current job (after it starts running on the runner): - The job ID (YAML key, e.g., my-job) is available as the environment variable$GITHUB_JOB or $ {{ github.job }}. - The display name (from jobs.<job_id>.name) can be accessed via ${{ jobs[github.job].name }} or $GITHUB_JOB_NAME if using certain third-party actions, but this relies on the jobs context being populated with name info during step execution (community-reported working as of 2023-2025). jobs.<job_id>.name cannot be used in job-level keys like jobs.<job_id>.env (only github, needs, strategy, matrix, vars, secrets, inputs available there per context availability table). To use the current job's display name in env, set it explicitly in job env using allowed contexts (e.g., MY_JOB_NAME: static or $ {{ strategy.job }} if matrix), or compute it in a step and export via $GITHUB_ENV.
Citations:
🏁 Script executed:
Repository: ProxySQL/dbdeployer
Length of output: 554
🏁 Script executed:
rg "VILLAGESQL_VERSION" .github/workflows/villagesql_flavor_test.yml -n -B 2 -A 2Repository: ProxySQL/dbdeployer
Length of output: 1599
envcontext is not available injobs.<job_id>.name.Per GitHub Actions context availability,
jobs.<job_id>.nameonly supportsgithub,needs,vars,inputs,matrix, andstrategy— notenv. The interpolation${{ env.VILLAGESQL_VERSION }}will silently expand to an empty string, producing the job nameDeploy (VillageSQL ).Hardcode the version or move it to
vars/inputs.Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 actionlint (1.7.12)
[error] 41-41: context "env" is not allowed here. available contexts are "github", "inputs", "matrix", "needs", "strategy", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details
(expression)
🤖 Prompt for AI Agents