Communitygithub.com

lguidolin/cloud-delivery-aks

Kubernetes または Azure Kubernetes Service(AKS)へのデプロイ、クラウドシークレット設定、カナリア/ブルーグリーンによる段階的ロールアウト、PR ごとのエフェメラル環境、k8s ヘルスプローブなどで使用します。キーワード:Kubernetes、AKS、Key Vault、Argo Rollouts、Flagger、カナリア、ブルーグリーン、liveness、readiness、PodDisruptionBudget、HPA、ロールバック、GHCR。

cloud-delivery-aks とは?

このスキルは、AKS(Azure Kubernetes Service)における安全なデプロイと検証ゲートを実装します。スタック固有の設計であり、k8s/AKS に関連するタスクでのみ読み込まれ、ローカル専用の Docker Compose プロジェクトなどには影響しません。主な機能として、CI でビルドされたイメージをコンテンツダイジェストで特定し、プレビュー、ステージング、本番環境に変更せずプロモーションする「不変アーティファクト」の原則、PR ごとに AKS 上に隔離されたエフェメラル環境を自動生成・破棄する仕組み、Argo Rollouts や Flagger を使った SLO ゲート付きカナリア/ブルーグリーン デプロイ、Azure Key Vault からのシークレット管理、ゼロダウンタイムマイグレーションの分離実行などが含まれます。また、ロールバックは事前に練習され、不変ダイジェストを用いて即座に実行可能です。CI はすべての変更に対してリント、型チェック、テスト、セキュリティスキャンを実行し、合格したイメージのみをプロモーションします。パイプラインはプレビュー → ステージング → 本番の 3 段階で構成され、本番環境へのプロモーションには承認ゲートが必要です。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/lguidolin/agent-skills/tree/main/skills/cloud-delivery-aks

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

AKS 上のクラウドデリバリー

概要

Kubernetes/Azure 向けのデリバリーメカニズムです。AKS 上でデプロイの安全性と検証ゲートを実装します。スタック固有の設計:このスキルは k8s/AKS に関わるタスクでのみ読み込まれるため、クラウドデプロイを使用しないプロジェクト(ローカル専用の Docker Compose など)ではこの内容は表示されません。

デリバリールール

  • ローカル開発はフルスタックを Docker Compose で一つのコマンドで実行します。包括的であることが第一級の要件です。
  • イメージは CI でビルド → GHCR にコンテンツダイジェストで格納され、プレビュー → ステージング → 本番で変更されずプロモーションされます。環境ごとに再ビルドは行いません。
  • PR ごとのエフェメラルプレビュー環境。 各 PR はレビュー用に AKS 上の独立した名前空間にデプロイされ、マージまたはクローズ時に破棄されます。統合テストの場であり、作成と破棄が低コストです。
  • Kubernetes ヘルスゲーティング。 すべてのワークロードは liveness、readiness、startup プローブ(observability-and-slos のエンドポイントに配線)、maxUnavailable/maxSurge を制限したローリングアップデート戦略、および PodDisruptionBudget を定義します。負荷に応じて HPA を使用します。
  • 本番環境への段階的デリバリー。 Argo Rollouts / Flagger によるカナリアまたはブルーグリーンデプロイを、SLO に連動した自動メトリクス分析とともに行います。失敗したカナリアは自動的に中断されます。
  • ロールバックは第一級で事前に練習します。 不変でダイジェスト指定されたイメージにより、ロールバックは以前の正常なダイジェストを再デプロイするだけです(kubectl rollout undo / ロールアウトの中断)。リスクのある変更をリリースする前に検証します。
  • マイグレーションは独立した順序付けられたパイプラインステップとし、拡張安全(zero-downtime-migrations 参照)にし、依存するコードの前に実行します。新しいスキーマを必要とする Pod にバンドルすることは決してありません。
  • CI がゲート: lint、型チェック、コントラクトチェック、テスト、セキュリティスキャンをすべての変更に対して実行し、enforced モードではマージをブロックします。CI はイメージをビルドし、その来歴証明を公開し、そのダイジェストを変更せずにプロモーションします。
  • 開発/本番のパリティと環境からの設定。 Azure Key Vault からのシークレット(Secrets Store CSI ドライバーまたは sealed secrets 経由)— イメージやコミット済み .env には決して含めません。ポート/設定は環境変数から取得します。開発専用ツール(pgTAP、テストランナー)は本番イメージには決して含めません。

パイプライン

層トリガー環境ダイジェスト
previewPR 作成 / 同期エフェメラル名前空間 preview-<app>-pr-<N>ここでビルド、sha-<pr-head> でタグ付け
stagingmain へのマージ永続名前空間 stagingpreview ダイジェストを sha-<merge> として再タグ付け
productionリリース公開 + 承認名前空間 productionリリースコミットの親のダイジェスト

なぜ親コミットか。 release-please のリリースコミットは CHANGELOG.md とマニフェストのみを変更するため、そのツリーはステージングで浸されたものではありません。リリース PR 自体のためにプレビューでビルドされたものは、プレビューを超えてプロモーションされることはありません。その親は最後の機能マージであり、release-please がリリースブランチを main の先端に保つ限り(デフォルトの動作)、ステージングが検証してきたものと正確に一致します。ライブクラスターの状態ではなく git からダイジェストを導出することで、プロモーションを再現可能に保ちます。

再タグ付けの安全性。 スカッシュマージは異なるコミット SHA を生成し、PR がオープン中に main が進んでいた場合は異なるツリーを生成します。二つの防御策:

  • 「マージ前にブランチを最新にする」 を必須とします。これは必須ステータスチェックルールの一部であり、スカッシュツリーが PR ヘッドツリーと構造的に一致することを保証します。この防御策はブランチ保護が必要なため、enforced モードでのみ存在します。advisory モードのプロジェクトは、以下のツリー比較を唯一の防御策とし、再ビルドパスが例外的ではなく日常的に発生することを想定する必要があります。
  • 仮定せずに検証:git rev-parse <merge>^{tree} と PR ヘッドツリーを比較します。等しい → 再タグ付け。異なる → マージ SHA で再ビルド。これはデリバリールールが禁止する環境ごとの再ビルドではありません。ツリーが異なるということは、コンテンツ自体がプレビューで検証されたものと異なることを意味するため、プロモーション可能なアーティファクトは存在せず、再ビルドされたイメージはプロモーションではなく新しい候補としてステージングに入ります。このパスを取った場合に失われるものに注意してください。そのイメージはプレビュー環境でレビューされたことがないため、「出荷されたイメージはレビューされたイメージである」という原則は成立しません。ステージングはそのイメージにとって初めての検証環境となり、二度目の検証ではありません。

再タグ付けはポインタ操作であり、再ビルドもプルも行いません。

docker buildx imagetools create -t "$REPO:sha-$MERGE_SHA" "$REPO@sha256:$DIGEST"

来歴証明は PR ヘッド SHA にバインドされたままのため、ヘッド→マージのマッピングをデプロイメント記録に記録します。イメージ設定は再ビルドなしでは編集できません。

承認ゲート — 1 つのプロパティ、2 つのメカニズム:

モードメカニズム
enforcedGitHub Environment production、必須レビューア
advisoryworkflow_dispatch プロモーションジョブ。実行すること自体が意思決定

クイックリファレンス

対象メカニズム
シークレットKey Vault → CSI ドライバー、ローテーション、イメージに含めない
ヘルスチェックliveness + readiness + startup プローブ。readiness は実際の依存関係をチェック
安全なロールアウトカナリア/ブルーグリーン、SLO ゲート、失敗時に自動中断
ロールバック以前の正常なダイジェストを再デプロイ。リスクのあるリリース前に練習
PR ごとの環境隔離された名前空間、マージ時に破棄
スキーママイグレーション独立した順序付けられたステップ、拡張安全、コードの前に実行
プロモーションダイジェストを再タグ付け、環境ごとに再ビルドしない
承認環境レビューア(enforced)または手動ディスパッチ(advisory)

なぜ分離されているか: Azure/k8s 固有の詳細はすべてスタック固有のトリガーの背後にあります。ローカル専用や別のクラウドのプロジェクトは、独自のデリバリースキルに置き換えます。原則(不変アーティファクト、リバーシブルかつ段階的なデプロイ、疎結合なマイグレーション)は resilience-and-deploy-safety に由来します。

完全な根拠は、憲法第 XIX 条「engineering-constitution/references/engineering-constitution.md」にバンドルされています。

Individual skills in this repo

This repo contains 18 individual skills — each has its own dedicated page.

lguidolin/change-hygiene-and-code-craft

Use when writing or refactoring code, structuring a commit or PR, or deciding whether to abstract duplication. Symptoms — mixing reorg with logic changes, a PR doing several things at once, a file growing large, the second copy of similar code, or unsure whether to DRY something up.

lguidolin/commit-history-rewrite

Use when an existing repository has messy commit history that needs to conform to conventional commits before adopting release-please, or when intermediate WIP/fixup/merge commits need to be cleaned up.

lguidolin/conventional-commits-and-releases

Use when committing, writing a commit message, opening a PR that will be squash-merged, or configuring automated versioning/changelogs. Keywords — conventional commits, release-please, semver, feat/fix/chore, breaking change, changelog.

lguidolin/defense-in-depth-security

Use when handling untrusted input, secrets, authentication/authorization, or dependencies — or threat-modeling a new surface. Keywords — STRIDE, threat model, least privilege, secrets management, supply chain, dependency scanning, input validation, audit log, defense in depth.

lguidolin/designing-before-building

Use when starting a feature, fixing a non-trivial bug, or about to write implementation code — before any code exists. Symptoms you need this: "this is simple, I'll just code it", reaching for the editor before a design is approved, or an idea that hasn't been turned into a spec and plan.

lguidolin/engineering-constitution

Use when starting work in a project that follows the engineering constitution, orienting to its rules, or deciding which engineering practice applies to a task — spec writing, commits, testing, security, deploys, database, or UI work.

lguidolin/graphql-contract-testing

Use when writing a GraphQL query/mutation that the UI and a test will share, or building route/schema contract or smoke tests. Symptoms — copying a query into a test, a test asserting on query text, schema change that didn't break the UI build, or RLS/permission drift. Keywords — graphql-codegen, typed document, contract test, route smoke test.

lguidolin/init-repo-CI

Use when setting up a new repository with conventional commits, release-please, and CI automation, or when retrofitting an existing repository that lacks automated versioning and PR validation workflows.

lguidolin/interface-craft-and-accessibility

Use when building or styling UI — components, layouts, forms, design tokens — or making accessibility decisions. Keywords — a11y, WCAG, keyboard navigation, focus state, contrast, design system, minimalist UI, component reuse, ARIA, semantic HTML.

lguidolin/merge-gates-and-automation

Use when setting up or changing CI, pre-push hooks, or a task runner, or deciding what must pass before merge. Symptoms — tempted to put authoritative checks only in a local hook, skip CI, bypass with --no-verify, or unsure what gates a merge vs. runs locally.

lguidolin/observability-and-slos

Use when adding logging, metrics, tracing, health checks, SLOs, or alerting — or when building a service surface that needs to be operable and debuggable. Keywords — structured logs, OpenTelemetry, correlation id, RED metrics, liveness, readiness, SLI, SLO, error budget, alerting.

lguidolin/performance-and-scale

Use when working on hot paths, list endpoints, pagination, data-access in loops, or public interfaces/schemas. Symptoms — unbounded queries, N+1 access, no latency budget, optimizing without measuring, or changing an interface many consumers depend on. Keywords — pagination, N+1, Hyrum's Law, performance budget, bundle size.

lguidolin/postgres-postgraphile-rls-and-sql

Use when writing PostgreSQL, PostGraphile config, Row-Level Security policies, SQL schema files, or working on the Browser→App→PostGraphile→Postgres data path. Keywords — RLS, SECURITY DEFINER, search_path, pgSettings, grants, roles, GraphQL depth limit, query cost, statement_timeout, SQL file organization.

lguidolin/recording-decisions

Use when a design or architecture decision has been made and needs to be captured — writing a decision record or ADR, updating a decision index, noting a deferred idea, or superseding a past decision. Keywords — ADR, decision record, rationale, rejected alternatives, dependency index.

lguidolin/resilience-and-deploy-safety

Use when planning a deploy, designing a rollback, or responding to an incident or writing a postmortem. Keywords — deploy safety, rollback, immutable artifact, progressive delivery, canary, blast radius, incident response, blameless postmortem, error budget.

lguidolin/ship-it

Use when the user wants to ship work — push, PR, archive decision records, merge, and clean up. Handles the full lifecycle from committing final changes through post-merge cleanup including converting specs/plans to compact decision records.

lguidolin/tests-as-a-control

Use when writing or modifying tests, when a test breaks during a refactor, or when testing permission/role rules. Symptoms — tempted to edit a test to make it pass, testing only the happy path, a deny-test that started passing, flaky tests, or unsure what to assert.

lguidolin/zero-downtime-migrations

Use when changing a database schema where data must survive the change — adding/removing/renaming columns, constraints, indexes, or backfilling. Symptoms — a destructive migration bundled with a code deploy, a NOT NULL column with a backfill, a table-locking UPDATE, or a rename. Keywords — expand/contract, parallel change, backfill, NOT VALID, CREATE INDEX CONCURRENTLY, graphile-migrate.

関連スキル