Skip to content

ci: auto-dispatch showcase_deploy after aimock release - #126

Closed
jpr5 wants to merge 1 commit into
mainfrom
ci/auto-propagate-to-showcase
Closed

ci: auto-dispatch showcase_deploy after aimock release#126
jpr5 wants to merge 1 commit into
mainfrom
ci/auto-propagate-to-showcase

Conversation

@jpr5

@jpr5 jpr5 commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Automate propagation so the showcase-aimock wrapper image (and the Railway service that pulls it) auto-rebuilds when aimock publishes a release.
  • Adds one dispatch step to the Docker publish workflow: after GHCR push succeeds on a tag build, dispatch showcase_deploy.yml on CopilotKit/CopilotKit with service=aimock using the existing copilotkit-devops-bot GitHub App identity.

Why

Today's v1.14.5 hotfix sat on GHCR for ~3 minutes because the wrapper image (ghcr.io/copilotkit/showcase-aimock:latest) builds FROM ghcr.io/copilotkit/aimock:latest but only rebuilds when showcase/aimock/** files change in the CopilotKit repo — never on aimock release. A manual gh workflow run showcase_deploy.yml -f service=aimock was needed to unstick production. This closes that gap.

Mechanism

Approach A (direct cross-repo workflow_dispatch):

  • actions/create-github-app-token@v2 with app-id: 1108748 → mints a short-lived installation token scoped to owner=CopilotKit, repositories=[CopilotKit] (minimum blast radius).
  • actions/github-script@v7 calls github.rest.actions.createWorkflowDispatch with workflow_id: 'showcase_deploy.yml', ref: 'main', inputs: { service: 'aimock' }.
  • Gated on startsWith(github.ref, 'refs/tags/v') && steps.build.outcome == 'success' — PR previews and workflow_dispatch runs never trigger prod redeploys; a failed GHCR push never cascades into a no-op showcase rebuild.
  • Slack fallback on dispatch failure via the existing SLACK_WEBHOOK secret, with the exact manual recovery command inlined.

Prerequisite — must configure before first aimock release

The DEVOPS_BOT_PRIVATE_KEY secret is not yet configured on CopilotKit/aimock (confirmed via gh secret list). It exists on CopilotKit/CopilotKit and CopilotKit/internal-skills. Before merging, set it:

gh secret set DEVOPS_BOT_PRIVATE_KEY --repo CopilotKit/aimock < <devops-bot-private-key>.pem

If the secret is missing at runtime the mint step fails loud, the dispatch step is skipped, and the Slack alert fires — no silent failure.

Test plan

  • YAML validated (python3 -c "import yaml; yaml.safe_load(...)").
  • pnpm format:check, pnpm lint, pnpm test all green.
  • devops-bot app confirmed via gh api /orgs/CopilotKit/installations — permissions include actions: write, repository_selection: all, org-wide.
  • CopilotKit/CopilotKit showcase_deploy.yml confirmed to accept service: aimock input (line 52 of the choice options, with ALL_SERVICES matrix entry at line 164).
  • End-to-end validation on the next aimock release — expect to see showcase_deploy.yml auto-fire with service=aimock within seconds of the GHCR push completing.

Not changed / out of scope

  • No changes needed on the CopilotKit side — showcase_deploy.yml already handles the service: aimock dispatch path.
  • Not switching showcase/aimock/Dockerfile off :latest to pinned versions (Approach D) — explicit-pin workflow is heavier and not required here.

Close the propagation gap between an aimock release and the
showcase-aimock wrapper image + Railway redeploy.

## Problem

Today's v1.14.5 hotfix exposed a gap in the release chain:

1. aimock release → GHCR push (ghcr.io/copilotkit/aimock:X.Y.Z + :latest) — works.
2. CopilotKit/CopilotKit showcase-aimock wrapper image builds
   FROM ghcr.io/copilotkit/aimock:latest via showcase/aimock/Dockerfile,
   but the workflow that builds it (showcase_deploy.yml) only triggers on
   showcase/aimock/** path changes in the CopilotKit repo — NOT on aimock
   release. Wrapper image kept pointing at the stale digest.
3. Railway showcase-aimock service pulls ghcr.io/copilotkit/showcase-aimock:latest —
   never auto-redeployed because step 2 didn't run.

Net result: aimock v1.14.5 sat on GHCR for ~3 minutes until someone manually
ran `gh workflow run showcase_deploy.yml -f service=aimock`. Unacceptable
for a prod hotfix path.

## Fix

Append a dispatch step to publish-docker.yml that fires
CopilotKit/CopilotKit's showcase_deploy.yml with service=aimock after
the GHCR push step succeeds on a tag build. showcase_deploy.yml already
knows how to rebuild the wrapper and redeploy the Railway service.

## Mechanism

Approach A from the design options — cross-repo workflow_dispatch via
`actions.createWorkflowDispatch`. Chosen over repository_dispatch /
scheduled-diff / explicit version pinning because it is the directest
path, has the shortest tail, and the existing copilotkit-devops-bot
GitHub App (app-id 1108748) already has actions:write on
CopilotKit/CopilotKit (target_type: Organization, repository_selection: all,
same identity used by showcase_docs-sync.yml).

## Auth / identity

- Mints a scoped installation token via actions/create-github-app-token@v2
  restricted to owner=CopilotKit, repositories=[CopilotKit] — minimum
  blast radius.
- Gated on `startsWith(github.ref, 'refs/tags/v')` so PR preview builds
  and workflow_dispatch runs never trigger production redeploys.
- Gated on `steps.build.outcome == 'success'` so a failed GHCR push
  never cascades into a no-op showcase rebuild (the wrapper would
  just rebuild on the old digest).

## Slack fallback

Posts a 🚨 alert via the existing SLACK_WEBHOOK secret if
the dispatch step fails. Message includes the exact manual recovery
command so a human can unstick the chain without reading source.

## Prerequisite

The `DEVOPS_BOT_PRIVATE_KEY` secret MUST be configured on the
CopilotKit/aimock repo before this can work. Add it via:
  gh secret set DEVOPS_BOT_PRIVATE_KEY --repo CopilotKit/aimock < <key>.pem
If the secret is missing the mint step fails loud, the dispatch step is
skipped, and the Slack alert fires — no silent failure.
@jpr5
jpr5 requested a review from AlemTuzlak April 22, 2026 21:31
@pkg-pr-new

pkg-pr-new Bot commented Apr 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@126

commit: 577e02e

@jpr5

jpr5 commented Apr 22, 2026

Copy link
Copy Markdown
Contributor Author

Closing — superseded by PR #128 (feat: --fixtures https URL support, v1.14.6), which enables retiring the showcase-aimock wrapper image entirely. The cross-repo dispatch automated propagation of a soon-to-be-dead wrapper; once Phase 2 (Railway switchover to ghcr.io/copilotkit/aimock:latest + URL-loaded fixtures + start-command config) lands, the wrapper goes away and this automation has nothing to propagate. See the wrapper-elimination plan: https://www.notion.so/34a3aa38185281148ae1ff7e2926c9d6

@jpr5 jpr5 closed this Apr 22, 2026
@jpr5
jpr5 deleted the ci/auto-propagate-to-showcase branch May 4, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant