chore: develop廃止に伴うdependabot刷新 + release公開トリガーのCD化 - #295
Merged
Conversation
dependabotがpython:3.15.0b4-slimへbumpしたが、pyprojectはpython = "3.12.*"のためpoetry installが失敗しGHAビルドが落ちる。dependabotにはpythonイメージのmajor/minor更新をignoreさせ、patch更新のみ許可する。 Claude-Session: https://claude.ai/code/session_01QAJGNVYDiLgpVXjSEiTg9Q
- target-branch: developを削除(default branchのmainを使用) - deprecatedなreviewersを削除しassigneesに集約 - pipにdiscord/dbの個別lockfileを追加(本番イメージが使う依存が未追跡だった) - docker 2セクションをdirectoriesで統合 - version-updatesをecosystemごとに1PRへ集約、security-updatesは別グループで即時 - schedule weekly化 + cooldown(default 3日 / patch 1日)追加 Claude-Session: https://claude.ai/code/session_01QAJGNVYDiLgpVXjSEiTg9Q
- main pushではなくGitHub Releaseのpublishedイベントでbuild + deployを実行 - イメージにreleaseタグ名のタグを追加(:latest / :sha / :tag_name) Claude-Session: https://claude.ai/code/session_01QAJGNVYDiLgpVXjSEiTg9Q
- discord / db-migrator に image タグを明示し、buildx bake ビルドと compose up のイメージ参照を一致させる - up:ci ターゲットを追加(--wait でヘルスチェック完了まで待機、 ビルド済みイメージを使用するため --build なし) Claude-Session: https://claude.ai/code/session_01N5gGjuCpmBNB88oXHTgeZZ
pull_request_target + デフォルトcheckoutはbaseブランチのコードを ビルドするため、PRの変更が一切検証されていなかった(#294が Dockerfileを修正してもCIが落ち続ける原因)。 あわせてCI全体を改善: - concurrency で同一PRの多重実行をキャンセル - timeout-minutes を設定 - buildx bake + GHAレイヤーキャッシュでビルドを高速化 - compose up --wait による起動待ちでリトライループを廃止 - ステータス・ログ出力とクリーンアップを if: always() で常時実行 Claude-Session: https://claude.ai/code/session_01N5gGjuCpmBNB88oXHTgeZZ
- pipのdirectoriesを"/"のみに戻す(discord/db配下のpyproject/poetry.lockはrootへのsymlinkで重複走査になるため) - github-actions/dockerのcooldownからsemver-patch-daysを削除(両ecosystemはsemver別cooldown非対応) - pre-release時はビルド・デプロイをskip - release tag名をDocker tagとして使う前にサニタイズ(/等の非対応文字を-に置換) - サーバー側でgithub.shaがorigin/mainのancestorであることを検証(main外commitのreleaseを本番に載せない) Claude-Session: https://claude.ai/code/session_01QAJGNVYDiLgpVXjSEiTg9Q
- workflow に permissions: contents: read と persist-credentials: false を追加 - GHA cache scope をターゲット別に分離(デフォルト共通scopeでの上書き防止) - Makefile の PHONY を .PHONY に修正 - dependabot.yml のignoreコメントを正確な表現に修正(security updateは対象外) Claude-Session: https://claude.ai/code/session_01N5gGjuCpmBNB88oXHTgeZZ
…e-cd-and-dependabot # Conflicts: # .github/dependabot.yml
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.
概要
develop ブランチ廃止に伴い dependabot 設定を刷新し、デプロイのトリガーを main push から GitHub Release の公開に変更する。
やったこと
dependabot 設定の刷新(develop 廃止 + 規約準拠)
target-branch: developを全 entry から削除(default branch = main を使用)reviewersキーを削除しassigneesに集約directoriesで 1 entry に統合pythonイメージの major / minor 更新は ignore(pyproject のpython = "3.12.*"制約と整合しないため。fix: ベースイメージをpyprojectのPython制約(3.12.*)に整合する3.12.13-slimに戻す #294 と同内容)デプロイの release トリガー化
on: push(main)→on: release: types: [published]に変更:latest/:<sha>/:<サニタイズ済み tag_name>)/等の Docker tag 非対応文字は-に置換やらなかったこと
/discord・/dbの追加(配下の pyproject / poetry.lock は root への symlink のため/のみで全依存をカバーできる)compose.dev.yml/compose.prod.ymlというカスタムファイル名を dependabot が検出できないため。dependabot-core#12134)pr:create(git switch developするため現状 broken)、check_healthy.yml のbranches: [main, develop]、sync-template / update-pr-labels)影響範囲
テスト方法
チェックリスト
補足
https://claude.ai/code/session_01QAJGNVYDiLgpVXjSEiTg9Q