agentleFS
AnthonyPoschenAnthonyPoschen/agent-skills/skills/flux-ghcr-image-automation/SKILL.md

flux-ghcr-image-automation

Skill2 starsChanged 3 months agoMITView on GitHub

Build, review, debug, or fix GitHub Actions to GHCR to FluxCD image automation loops. Use whenever the user mentions Flux image automation, ImageRepository, ImagePolicy, ImageUpdateAutomation, GHCR, Docker metadata tags, Kubernetes pods not rolling after an image push, mutable latest tags, digest updates, or GitHub Actions publishing container images for Flux-managed Kubernetes workloads.

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 8 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create a reliable GitOps image release loop:

    line 16
  2. Very specific:

    Prefer traceable, orderable image tags over mutable-only latest deployments.

    line 25
  3. Distinctive:

    If a live cluster is available and the user is debugging a rollout, inspect live state before changing files:

    line 41
  4. Very specific:

    Do not rely on plain sha-* tags for "latest commit" selection.

    line 54
  5. Distinctive:

    Prefer branch, short SHA, and timestamp tags for branch builds:

    line 56
  6. Very specific:

    Keep Flux image update commits from triggering fresh image builds by ignoring the manifest paths that Flux mutates, commonly kustomization/.

    line 64
  7. Distinctive:

    Keep the inline Flux setter comment on every image field Flux should update.

    line 66
  8. Very specific:

    When a Flux Kustomization has targetNamespace, remember that namespaced resources without an explicit namespace may land in that target …

    line 69
  9. Very specific:

    Keep ImageUpdateAutomation.update.path pointed at the directory that contains the file with the image setter comment.

    line 73
  10. Distinctive:

    Ensure the GitHub Actions workflow publishes an orderable, commit-traceable tag for that branch.

    line 91
  11. Very specific:

    Ensure ImageRepository scans the correct GHCR image.

    line 93
  12. Very specific:

    Ensure ImagePolicy selects the intended branch builds.

    line 94
  13. Distinctive:

    Ensure the workload image field has a correct Flux setter comment.

    line 95
  14. Very specific:

    Ensure ImageUpdateAutomation can read and push to the correct GitRepository.

    line 96
  15. Distinctive:

    If a cluster is available, use server-side dry-run and live Flux status.

    line 99
  16. Distinctive:

    Run the strongest practical checks:

    line 103

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Flux GHCR Image Automation

Goal

Create a reliable GitOps image release loop:

  1. GitHub Actions builds and pushes a container image to GHCR.
  2. Flux image-reflector-controller discovers the new tag or digest.
  3. Flux image-automation-controller commits the selected image reference back to Git.
  4. Flux kustomize-controller applies that commit and rolls the Kubernetes workload.

Prefer traceable, orderable image tags over mutable-only latest deployments. The operator should be able to answer "which Git commit produced this running pod?" from the image tag.

When Starting

Inspect the repo and cluster shape before editing:

  • .github/workflows/*.yml
  • Dockerfile
  • kustomization/**
  • any ImageRepository, ImagePolicy, ImageUpdateAutomation, Deployment, and Flux Kustomization resources
  • the current branch name and default branch
  • whether the Flux app Kustomization uses targetNamespace

If a live cluster is available and the user is debugging a rollout, inspect live state before changing files:

flux get images all -n <image-resource-namespace>
kubectl get kustomization -A -o wide
kubectl describe imageupdateautomation <name> -n <namespace>
kubectl get deploy <name> -n <namespace> -o yaml
kubectl get gitrepository -A -o wide

Design Rules

  • Do not rely on plain sha-* tags for "latest commit" selection. SHA strings identify commits but do not sort by time.
  • Prefer branch, short SHA, and timestamp tags for branch builds:
<branch>-<short-git-sha>-<unix-timestamp>
  • Configure Flux ImagePolicy to filter the branch tag pattern, extract the timestamp, and use numerical ordering.
  • Keep Flux image update commits from triggering fresh image builds by ignoring the manifest paths that Flux mutates, commonly kustomization/**.
  • Keep the inline Flux setter comment on every image field Flux should update.
  • Make the image setter comment reference the namespace where the ImagePolicy actually exists after Flux applies the manifests.
  • When a Flux Kustomization has targetNamespace, remember that namespaced resources without an explicit namespace may land in that target namespace.
  • Set ImageUpdateAutomation.spec.sourceRef.namespace when the referenced GitRepository is in a different namespace.
  • Keep ImageUpdateAutomation.update.path pointed at the directory that contains the file with the image setter comment.

References

Load only the reference needed for the task:

  • tagging-policy.md for GitHub Actions Docker metadata tags and orderable Flux policies.
  • flux-manifests.md for ImageRepository, ImagePolicy, ImageUpdateAutomation, setter comments, and namespace rules.
  • diagnostics.md for live cluster debugging and rollout verification.

Implementation Workflow

  1. Identify the workload image and the registry repository.
  2. Confirm which Git branch should drive deployments.
  3. Ensure the GitHub Actions workflow publishes an orderable, commit-traceable tag for that branch.
  4. Ensure ImageRepository scans the correct GHCR image.
  5. Ensure ImagePolicy selects the intended branch builds.
  6. Ensure the workload image field has a correct Flux setter comment.
  7. Ensure ImageUpdateAutomation can read and push to the correct GitRepository.
  8. Validate the rendered manifests.
  9. If a cluster is available, use server-side dry-run and live Flux status.

Validation

Run the strongest practical checks:

kubectl kustomize <overlay>
kubectl apply --dry-run=server -k <overlay>
git diff --check

For live rollout debugging, confirm each stage:

flux get images all -n <image-resource-namespace>
kubectl describe imageupdateautomation <name> -n <namespace>
kubectl get gitrepository <name> -n <namespace> -o wide
kubectl get kustomization <name> -n <namespace> -o wide
kubectl get deploy <name> -n <namespace> -o jsonpath='{.spec.template.spec.containers[0].image}{"\n"}'
kubectl get pods -n <namespace> -l <selector> -o wide

Report exactly where the loop is stopped: image build, registry scan, image policy selection, Git update commit, Kustomization apply, or Deployment rollout.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.