BXUP Track progress & test yourself — free
DevOps / SRE / Platform · Playbook · Foundation · ~4 min read
DEVOPS / SRE / PLATFORM · PLAYBOOK · FOUNDATION

Author a CI/CD Pipeline from a Natural-Language Spec

Pipeline YAML is boilerplate-heavy, syntax-fussy, and perfectly suited to AI drafting — as long as you treat the draft as untrusted until it survives a dry run.

Tier: Foundation · Workflow area: CI/CD & release engineering

This playbook turns a plain-English description of your build into a working GitHub Actions or GitLab CI pipeline, with a validation loop that catches the hallucinated action versions and invented syntax that assistants routinely produce.

When to use

  • Standing up CI for a new service or repo where you would otherwise copy-paste from an old pipeline.
  • Adding a nontrivial stage (matrix builds, caching, artifact promotion) to an existing workflow.
  • You know exactly what the pipeline should do but not the exact syntax of this CI system.

Skip AI for one-line changes to a working pipeline — editing directly is faster than reviewing a regenerated file.

Prerequisites

  • An AI coding assistant (Claude Code, GitHub Copilot, GitLab Duo, or a chat assistant).
  • Local linting for your CI system: actionlint for GitHub Actions, glab ci lint or the CI Lint API for GitLab.
  • A branch where you can trigger throwaway runs.

The workflow

  1. Write the spec before you prompt. List stages, triggers, secrets, and constraints as bullets. A vague prompt yields a generic pipeline you will rewrite anyway.

  2. Prompt with your real constraints.

    Write a GitHub Actions workflow for a Go 1.22 monorepo service in ./services/payments.
    
    Requirements:
    - Trigger: PRs touching services/payments/** and pushes to main.
    - Jobs: lint (golangci-lint), test with race detector and coverage,
      build a distroless image, push to ECR only on main.
    - Cache Go modules and build cache between runs.
    - Auth to AWS via OIDC (role arn passed as a repo variable) — no long-lived keys.
    - Pin all third-party actions to a full commit SHA, not a tag.
    - Add nothing I did not ask for. If a requirement is ambiguous, ask first.
    
  3. Lint before you run. Hallucinated action inputs and bad needs: graphs surface here for free:

    actionlint .github/workflows/payments.yml
    
  4. Verify every third-party action exists at the pinned SHA. This is the top hallucination site — assistants invent plausible action names and versions. Open each uses: line on the marketplace or git ls-remote the repo.

  5. Dry-run on a branch. Push to a test branch, let the pipeline execute against a no-op change, and read the logs for silent misbehavior: caches that never hit, jobs that skip when they should run, secrets referenced but empty.

  6. Iterate in the same conversation. Paste failing run logs back to the assistant with "fix only the failing job, change nothing else" — scoped instructions prevent regenerate-the-world churn.

Key Takeaway:

The assistant writes the YAML; the linter, the SHA check, and the branch run decide whether it ships. Never merge a pipeline whose first-ever execution happens on main.

Tool variants

  • Claude Code / IDE agent in the repo: best option — it reads your existing workflows and matches house conventions (runner labels, reusable workflows) without being told.
  • GitLab Duo / GitHub Copilot Chat in the web UI: convenient for small edits; still run the lint step locally or via CI Lint, the inline suggestion has no validation of its own.
  • Plain chat assistant: works fine if you paste an existing workflow as a style example; expect more invented action versions, so step 4 matters more.

Verification

Run the pipeline-flavored version of the standard gate chain before merge:

  • Validate:actionlint (or glab ci lint) passes with zero warnings.
  • Plan/dry-run: a full branch execution completes; every job that should run ran, every conditional job skipped for the stated reason.
  • Policy: all uses: pinned to SHAs; no pull_request_target with checkout of PR code; secrets scoped to the jobs that need them; OIDC instead of static keys.
  • Cost: check the run duration and runner sizes — AI-drafted pipelines love oversized runners and redundant matrix cells; a 2x runtime is a real bill.

Pitfalls

  • Invented action names/versions.actions/setup-go@v6 may not exist. Verify every external reference by hand — the linter cannot know the marketplace.
  • Over-scoped triggers. Drafts default to on: push for everything; you get a full build on every doc edit. Path filters are your job to demand.
  • Secrets in the wrong place. Assistants happily interpolate secrets into run: echo lines while "debugging." Grep the draft for secrets. before running it.
  • Cargo-culted caching. A cache key without the lockfile hash gives you stale dependencies that pass CI and fail prod.

Restricted-environment variant

Services-company delivery teams working in client repos: check the client's AI policy before pointing any assistant at their code. If public tools are prohibited, describe the pipeline abstractly (no client names, repo paths, or internal hostnames) to an approved assistant, or run a local model (Ollama + an 8B–14B coder model) for drafting and keep validation identical — actionlint and branch dry-runs work the same offline. Replace real registry URLs and role ARNs with placeholders in the prompt and substitute them locally.

Success criteria

  • Pipeline drafted and merged in under an hour, including verification.
  • First run on main succeeds — every failure mode was caught on the branch.
  • All external actions SHA-pinned and confirmed to exist.
  • You can explain every line of the merged YAML; nothing survives that you cannot justify in review.
This is the free reading view. Open BXUP to track your progress, run the hands-on labs, and prove it with original, exam-pattern assessments.
© Anvi Innovate · BXUP — Be Exponentially Upskilled · BXUP is an independent learning platform, not affiliated with or endorsed by AWS, Microsoft, Google, NVIDIA, IBM, Salesforce, Databricks, Oracle or Anthropic. All trademarks belong to their respective owners. · bxup.in