ci(mysql): verify native pilot contracts before publishing images
This commit is contained in:
1 parent
3e8a0b6a99
commit
8f771b2ce6
5 files changed
+55
No files matched your search
@@ -51,6 +51,10 @@ jobs:
|
||||
shell: bash
|
||||
run: bash tools/ci/test-postgres.sh
|
||||
|
||||
- name: Test native MySQL 8.4 pilot contracts before publishing
|
||||
shell: bash
|
||||
run: bash tools/ci/test-mysql.sh
|
||||
|
||||
- name: Log in to registry
|
||||
uses: https://github.com/docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
|
||||
with:
|
||||
|
||||
@@ -21,6 +21,7 @@ data/*
|
||||
.deployment-backups/
|
||||
*.sh
|
||||
!tools/ci/test-postgres.sh
|
||||
!tools/ci/test-mysql.sh
|
||||
assets/editor/node_modules/
|
||||
assets/city-generator/node_modules/
|
||||
assets/excalidraw-viewer/node_modules/
|
||||
|
||||
@@ -231,3 +231,6 @@ CLI handoffは内部Store保存処理の移植であり、MySQL HTTPログイン
|
||||
read-only/context取消を検証する。実providerや本番ユーザーデータは使わない。
|
||||
SQLite/PostgreSQL 17/MySQL 8.4で上記と`TestAccountBackend*`/`TestCLIAuth*`を
|
||||
`-race -count=1`実行して成功。`go vet ./internal/store ./cmd/pageswiki`も成功。
|
||||
以後の退行検出用に`tools/ci/test-mysql.sh`をイメージ公開前のCIへ追加。
|
||||
同スクリプトも隔離MySQL 8.4で実行成功。PostgreSQLは既存の別ゲートで全体試験し、
|
||||
MySQLゲートでは実装済みpilot契約だけを対象にする。
|
||||
@@ -23,6 +23,12 @@ Kroki、Mermaid、code-server は upstream の配布イメージを使用する
|
||||
3 回の push は原子的ではないため、**ワークフロー全体の成功を確認してから利用**する。
|
||||
最後に当該ジョブのローカル CI タグと専用 builder を後処理する。
|
||||
|
||||
v0.19.0後のmainでは、PostgreSQL 17の全体試験に加え、`tools/ci/test-mysql.sh`で
|
||||
MySQL 8.4の移植済みpilot契約を公開前に検証する。合成データ専用コンテナを使い、
|
||||
ポート公開・新規サブネット・本番DSNは使わない。接続に失敗した場合はSKIPせず失敗する。
|
||||
MySQLの全機能対応や本体起動の受入を示すゲートではなく、ML予算・migration・名前空間・
|
||||
identity/CLI認証の移植済み範囲の退行を防ぐためのもの。
|
||||
|
||||
## runner 環境(初回・環境変更時のみ)
|
||||
|
||||
`ubuntu-latest` は runner を選ぶラベルであり、ツールの存在を保証するものではない。
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Native MySQL pilot contracts only, never production data. Reuse a private
|
||||
# network namespace rather than publishing a port or allocating a new subnet.
|
||||
suffix="${GITHUB_RUN_ID:-local}-$$-${RANDOM}"
|
||||
mysql="pageswiki-mysql-test-${suffix}"
|
||||
tests="pageswiki-mysql-go-${suffix}"
|
||||
test_image="pageswiki-mysql-test:${suffix}"
|
||||
cleanup() {
|
||||
docker rm -fv "$tests" "$mysql" >/dev/null 2>&1 || true
|
||||
docker image rm "$test_image" >/dev/null 2>&1 || true
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
docker build --target source --tag "$test_image" .
|
||||
docker run --detach --name "$mysql" --network none \
|
||||
--env MYSQL_ROOT_PASSWORD=pageswiki-synthetic-ci-only \
|
||||
--env MYSQL_ROOT_HOST=127.0.0.1 \
|
||||
"${PAGESWIKI_CI_MYSQL_IMAGE:-mysql:8.4}"
|
||||
ready=false
|
||||
for ((attempt=0; attempt<60; attempt++)); do
|
||||
if docker exec --env MYSQL_PWD=pageswiki-synthetic-ci-only "$mysql" \
|
||||
mysql --protocol=TCP --host=127.0.0.1 --user=root --execute='SELECT 1' >/dev/null 2>&1; then
|
||||
ready=true
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
if [[ "$ready" != true ]]; then
|
||||
echo 'Synthetic MySQL did not become ready' >&2
|
||||
exit 1
|
||||
fi
|
||||
docker run --rm --name "$tests" --network "container:$mysql" \
|
||||
--tmpfs /test-tmp:rw,exec,size=2147483648 \
|
||||
--env TMPDIR=/test-tmp --env GOTMPDIR=/tmp \
|
||||
--env GOPROXY=off --env GOSUMDB=off \
|
||||
--env PAGESWIKI_TEST_MYSQL_DSN='root:pageswiki-synthetic-ci-only@tcp(127.0.0.1:3306)/mysql' \
|
||||
"$test_image" go test -p 1 ./internal/db ./internal/store ./cmd/pageswiki \
|
||||
-run 'TestMySQL|TestMLBudget|TestMachineLearningPolicyPersistence|TestNamespaceCoreThreeBackendContract|TestStoreNamespaceBackendContract|TestDomainWriteBackend|TestAdminInheritanceBackend|TestGeneralGroupBackend|TestGroupPermissionBackend|TestRoleGrantBackend|TestPrincipalStateBackend|TestAccountBackend' \
|
||||
-count=1 -v
|
||||
Reference in new issue
Block a user