CDのデプロイ対象を明示列挙方式に変更#23
Merged
Merged
Conversation
cmd/* を自動走査する方式だと、ビルド時専用ツール (atlas-loader) や デプロイ不要なジョブ (migrate, apply-table-privileges) まで Cloud Run Job として登録されてしまう。イメージに該当バイナリが無いため、実行すると 必ず失敗する空振りジョブが dev/prd に作られていた。 set-env の matrix 生成を DEPLOY_TARGETS による明示列挙に変更し、 デプロイ対象を以下に限定する: - service: academic-api / announcement-api / user-api - job: build-class-change-notifications-job / dispatch-notifications-job Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kantacky
approved these changes
Jun 20, 2026
kantacky
left a comment
Member
There was a problem hiding this comment.
別PRでもいいけど、mainにマージするときのデプロイ先をstgにして良さそう
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
背景・課題
CD の deploy matrix は
cmd/*を自動走査して、末尾-apiを Cloud Run Service、それ以外を Cloud Run Job として分類していた。この方式だと、デプロイすべきでないターゲットまで Cloud Run Job として登録される問題があった:
atlas-loader… Atlas が GORM スキーマを読むための ビルド時専用ツール。Dockerfile / mise のビルド対象からは正しく除外されており、イメージに/bin/atlas-loaderは存在しない。migrate/apply-table-privileges… 今回の運用ではデプロイ対象に含めない方針。実際、過去の CD 実行で
gcloud run jobs deploy atlas-loaderが成功し、dev/prd に 実行すると必ず失敗する空振りジョブが作られていた(jobs deployはコンテナを起動せず定義登録のみのため、バイナリ不在が deploy 時に検知されない)。変更内容
set-env/action.ymlの matrix 生成をcmd/*自動走査からDEPLOY_TARGETSによる明示列挙 に変更。デプロイ対象を以下に限定:
除外:
atlas-loader/migrate/apply-table-privileges*-api→ service / それ以外 → job の分類ロジックは流用(個別 type 指定不要)cmd/<name>が存在しない場合は fail(タイポ検知)残作業(GCP 側・手動)
本 PR では既存ジョブは削除されない。不要ジョブは別途 GCP 側で削除が必要:
```bash
for env in "" "-dev"; do
for job in atlas-loader migrate apply-table-privileges; do
gcloud run jobs delete "${job}${env}" --region asia-northeast1 --project swift2023groupc
done
done
```
🤖 Generated with Claude Code