Skip to content

Phase 1 Step A Complete

Hero

Phase 1, Step A of the MVP Implementation Plan is complete. The goal was simple on paper: get a CI build working on GitHub Actions that creates a Docker image and pushes it to GHCR. In practice, it turned into a valuable learning experience about CI/CD patterns that I wanted to capture for future use.

What We Built

The Mnemonic service now has a proper CI/CD pipeline:

  • CI workflow (mnemonic-ci.yml) - Builds, tests, and saves the Docker image as an artifact
  • CD workflow (mnemonic-cd.yml) - Triggered by successful CI, pushes to GitHub Container Registry

This separation follows a pattern I've come to appreciate: CI validates, CD deploys. PRs get fast feedback without polluting the registry with half-baked images.

Patterns Captured

The real value wasn't just getting the pipeline working - it was distilling the patterns into the DevOps agent's knowledge base. Here's what got added:

New Pattern File: GitHub Actions CD

Created github-actions-cd-pattern.md covering:

  • workflow_run triggers for CI → CD handoff
  • Artifact passing between workflows
  • Conditional latest tag (main branch only)
  • Registry variants (GHCR, ACR, Docker Hub)
  • A troubleshooting section for common issues (artifact not found, workflow not triggering, etc.)

Updated CI Pattern

Added three new sections to github-actions-ci-pattern.md:

  • Permissions for Artifacts - The actions: write/read requirements that tripped me up initially
  • Working Directory for Monorepos - defaults.run.working-directory for when your service lives in a subdirectory
  • PR vs Push Behavior - Using LOCAL_BUILD env var to skip registry push on PRs

Cleanup Trap Pattern

Added the trap cleanup EXIT pattern to the build script documentation. Simple but essential:

cleanup() {
    docker compose down --remove-orphans > /dev/null 2>&1 || true
}
trap cleanup EXIT

No more orphaned containers cluttering up CI runners.

Agent Knowledge Queries

Updated the DevOps agent definition with Cognee queries for:

  • GitHub Actions CD workflows
  • CI/CD separation patterns
  • Artifact permissions
  • Monorepo working directories
  • PR vs push behavior
  • Cleanup traps
  • Container registry authentication
  • Conditional latest tagging

Next time I (or the agent) need to set up a similar pipeline, the patterns are there.