1
0
Fork 0
mirror of https://github.com/imjasonh/git-k8s synced 2026-07-09 07:06:52 +00:00
Commit graph

54 commits

Author SHA1 Message Date
61cd4e55a1 compile all the things
Signed-off-by: Jason Hall <imjasonh@gmail.com>
2026-02-28 10:55:18 -05:00
464993b785
Merge branch 'main' into claude/agentic-workflows-setup-8tZ9u 2026-02-28 10:54:12 -05:00
Claude
24fad12ea9
Make compile workflow a check that fails on outdated lock files
Runs on both PRs and pushes to main. Compiles all agentic workflow
markdown files and fails if the resulting lock files differ from what's
committed. This ensures contributors run `gh aw compile` before merging.

https://claude.ai/code/session_01JTYNSeJrGzdW6wfAUbdjjw
2026-02-28 15:48:44 +00:00
Claude
a828ef7992
Add workflow to auto-compile agentic workflow lock files
Triggers on pushes to main that touch .github/workflows/*.md files.
Installs gh-aw, compiles all agentic workflow markdown files, and
commits the resulting .lock.yml files back to the repo.

https://claude.ai/code/session_01JTYNSeJrGzdW6wfAUbdjjw
2026-02-28 15:47:38 +00:00
e7baaf7b4a
Add GitHub Agentic Workflows for automated repo maintenance (#14) 2026-02-28 10:43:58 -05:00
Claude
7ff753a73c
Use Claude engine, fix network schema, remove pr-fix workflow
- Add engine: claude to all agentic workflows (uses ANTHROPIC_API_KEY)
- Fix dependency-update.md network field: use object format instead of
  array to match the oneOf schema (string | object)
- Remove pr-fix.md since ci-doctor.md already handles CI failure
  investigation and auto-fixing

https://claude.ai/code/session_01JTYNSeJrGzdW6wfAUbdjjw
2026-02-28 15:37:13 +00:00
516b395a23
Switch agentic workflows from COPILOT_GITHUB_TOKEN to ANTHROPIC_API_KEY (#16) 2026-02-28 10:32:36 -05:00
copilot-swe-agent[bot]
3ef5ade37d Update agentic workflow lock files to use ANTHROPIC_API_KEY instead of COPILOT_GITHUB_TOKEN
Co-authored-by: imjasonh <210737+imjasonh@users.noreply.github.com>
2026-02-28 15:29:23 +00:00
copilot-swe-agent[bot]
6501554dde Initial plan 2026-02-28 15:26:18 +00:00
d278e9cc47
Switch auto-merge to merge commits (#15)
Auto-merge workflow was using squash merges; change it to use standard
merge commits.

- **`auto-merge.yaml`**: Set `merge_method: 'merge'` (was `'squash'`)

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
2026-02-28 10:25:47 -05:00
copilot-swe-agent[bot]
ce29a2bed8 fix: use merge commits instead of squash in auto-merge workflow
Co-authored-by: imjasonh <210737+imjasonh@users.noreply.github.com>
2026-02-28 15:19:09 +00:00
copilot-swe-agent[bot]
a43f77ad5f Initial plan 2026-02-28 15:18:30 +00:00
185560dfea gh aw compile
Signed-off-by: Jason Hall <imjasonh@gmail.com>
2026-02-28 10:17:50 -05:00
Claude
9df8fbb1ff
Add GitHub Agentic Workflows for automated repo maintenance
Set up five workflows to automate repository maintenance:

- code-review.md: Automated PR review on open/sync, checks for bugs,
  security issues, and Go/K8s anti-patterns. Auto-fixes formatting and
  linting. Escalates to maintainer only for CRD/architecture changes.

- ci-doctor.md: Triggers on CI failure, investigates root cause from logs,
  auto-fixes mechanical issues (mod tidy, fmt, simple compilation errors),
  and creates detailed issues for complex failures.

- pr-fix.md: On-demand /pr-fix command to analyze and fix failing CI checks
  on any PR.

- dependency-update.md: Weekly scheduled check for Go module updates.
  Groups updates logically (k8s, knative, go-git), fixes breaking changes,
  and creates per-batch PRs. Escalates only when fixes need design decisions.

- auto-merge.yaml: Standard GitHub Actions workflow that auto-merges PRs
  labeled "automation" once all CI checks pass (squash merge).

All agentic workflows assign @imjasonh only when human judgment is needed,
with specific questions rather than generic notifications.

https://claude.ai/code/session_01JTYNSeJrGzdW6wfAUbdjjw
2026-02-28 15:02:17 +00:00
aadf6ad4af
Merge pull request #13 from imjasonh/claude/write-readme-docs-Z7b57
Add comprehensive README documentation for git-k8s project
2026-02-28 09:53:46 -05:00
Claude
eb8d13d41c
Add README with installation, auth, and architecture docs
Covers ko-based deployment, Kubernetes Secret setup for Git
authentication, controller responsibilities, and resource
lifecycle using mermaid diagrams.

https://claude.ai/code/session_01Dg28Ex9qLvZWRHtYwBwnVs
2026-02-28 14:45:13 +00:00
2798083edc
Merge pull request #12 from imjasonh/claude/git-event-crd-sync-FakvN
Add Repo Watcher Controller for remote polling and GitBranch sync
2026-02-28 09:40:03 -05:00
Claude
e631dba802
Fix repo-watcher deleting manually-created GitBranch CRDs
The repo-watcher's delete loop was unconditionally removing any
GitBranch whose branch name didn't appear on the remote. This caused
a race with the push controller: when a GitBranch is created for a
branch that doesn't yet exist (e.g., before a push transaction),
the watcher would delete it before the push could complete.

Fix: only delete GitBranch CRDs that the repo-watcher itself created,
identified by having an owner reference pointing to the GitRepository.
Branches created manually or by other controllers are left alone.

This fixes the flaky TestPushTransaction e2e test, where the watcher
would delete "e2e-push-feature" before the push controller could
update its headCommit.

https://claude.ai/code/session_01P7xfBqARU5DFS8QJ4uDPVj
2026-02-28 14:32:09 +00:00
Claude
6f803bf10e
Add comprehensive e2e tests for repo-watcher-controller
Tests cover the key behaviors of the repo-watcher:
- Branch discovery: auto-creates GitBranch CRDs from remote refs
- Owner references: created branches correctly reference GitRepository
- New branch detection: branches added on Gitea are picked up
- Commit update detection: new pushes to Gitea update headCommit
- Branch deletion: branches removed from Gitea trigger CRD deletion
- Multiple branches: all branches on a repo are discovered
- LastFetchTime: status is updated and advances on each poll
- Labels: repository label is set on created branches
- Slash branch names: feature/foo naming handled correctly

Also adds shared e2e helpers for Gitea branch/file operations and
updates CI workflow to deploy and monitor the repo-watcher-controller.

https://claude.ai/code/session_01P7xfBqARU5DFS8QJ4uDPVj
2026-02-28 14:15:28 +00:00
Claude
ee281430b6
Add repo-watcher-controller for polling remote Git refs
Introduces a fourth controller that watches GitRepository resources and
polls their remotes via git ls-remote on a configurable per-repo interval
(spec.pollInterval, defaulting to 30s). It auto-creates, updates, and
deletes GitBranch CRDs to reflect the actual state of the remote,
enabling fast detection of external pushes to trigger downstream sync.

Key changes:
- Add PollInterval field to GitRepositorySpec
- New pkg/reconciler/repowatcher with controller and reconciler
- New cmd/repo-watcher-controller binary
- CRD manifest updated for pollInterval
- Deployment manifest for the new controller
- Unit tests for ref filtering, naming, and poll interval logic
- CLAUDE.md updated with new controller docs and Go module workaround

https://claude.ai/code/session_01P7xfBqARU5DFS8QJ4uDPVj
2026-02-28 14:09:58 +00:00
4e9968a725
Merge pull request #11 from imjasonh/claude/add-claude-documentation-9zv9x 2026-02-28 00:24:50 -05:00
Claude
6bb9c77a82
Add CLAUDE.md with comprehensive codebase documentation
Document the project architecture (three-controller design, CRDs),
directory structure, build commands, testing workflows, key dependencies,
and development conventions for AI assistants working on this codebase.

https://claude.ai/code/session_016QCVChhEZLuYZbhcfxyCzw
2026-02-28 05:17:27 +00:00
eca535e617
Merge pull request #10 from imjasonh/claude/refactor-reconcile-kind-method-1J0HP 2026-02-28 00:12:21 -05:00
Claude
b122fb297f
Refactor reconcilers to use Knative ReconcileKind pattern
Move the key-splitting, resource-fetching, and not-found handling into a
generic internal.NewReconciler wrapper so that each reconciler only
implements ReconcileKind(ctx, *TypedResource) — matching the Knative
generated reconciler convention. The controller setup wraps the
reconciler with internal.NewReconciler, which bridges Reconcile(ctx, key)
to ReconcileKind(ctx, *T).

This removes duplicated boilerplate from all three reconcilers (push,
sync, resolver), eliminates their Reconcile/LeaderAware methods, and
makes splitKey an unexported implementation detail.

https://claude.ai/code/session_01Eu3LyxX3G1KCcw4aDzmHvp
2026-02-28 05:06:22 +00:00
f6e819e939
Merge pull request #9 from imjasonh/claude/code-review-fixes-Dvlds
Fix multiple code review issues: dedup splitKey, fix merge bug, remov…
2026-02-27 23:47:30 -05:00
527389b6cb
Merge pull request #8 from imjasonh/claude/speed-up-e2e-tests-6Ol5J 2026-02-27 23:41:33 -05:00
Claude
0cb9e4aa1d
Fix multiple code review issues: dedup splitKey, fix merge bug, remove dead code
- Extract triplicated splitKey into shared pkg/reconciler/internal package
  using strings.Cut and removing the unnecessary error return
- Fix resolver merge bug: attemptMerge was using treeA.Hash as the merge
  commit tree, silently dropping all of branch B's changes. Now builds a
  proper merged tree that applies B's non-conflicting changes onto A's tree
- Replace hand-rolled nestedFieldNoCopy/unstructuredNestedStringMap with
  k8s.io/apimachinery's unstructured.NestedStringMap stdlib equivalent
- Hoist branch listing out of per-refspec loop in updateBranches to avoid
  redundant API calls
- Add not-found handling in all three reconcilers so deleted resources
  don't cause infinite requeue loops
- Fix client.Get() to use checked type assertion with a clear panic message
  instead of an opaque nil-pointer dereference
- Remove dead code: unused addDefaultingFuncs wrapper, unused context
  injection in push controller setup

https://claude.ai/code/session_01634JRpHEoM9FzuBjZ7qHcY
2026-02-28 04:39:00 +00:00
Claude
0075761012
Speed up e2e tests by removing Knative and parallelizing setup
- Remove Setup Knative step: the project only uses knative.dev/pkg as a
  Go library for the controller framework, not Knative Serving/Eventing.
  This eliminates the slowest setup step entirely.
- Create config-logging and config-observability ConfigMaps directly,
  which is all knative.dev/pkg/injection/sharedmain needs at runtime.
- Deploy Gitea in parallel with ko controller builds instead of
  sequentially, so both can start at the same time.
- Combine the "wait for controllers" and "wait for Gitea" steps into one.
- Reduce Gitea readiness probe initialDelaySeconds from 10s to 3s and
  periodSeconds from 5s to 3s.
- Reduce Gitea API wait loop sleep from 2s to 1s.
- Reduce e2e test poll interval from 2s to 1s for faster feedback.

https://claude.ai/code/session_018itccL4SXV3eD7iuPwLGYa
2026-02-28 04:35:38 +00:00
9d5cd83734
Merge pull request #7 from imjasonh/claude/add-go-cache-ci-DaLrQ 2026-02-27 23:27:07 -05:00
3ef44447ef
Merge pull request #6 from imjasonh/copilot/update-go-sum-file 2026-02-27 23:25:02 -05:00
Claude
f9a44c22ec
Enable Go module and build caching in CI
Add cache-dependency-path: go.mod to both setup-go steps so that
actions/setup-go caches ~/go/pkg/mod and ~/.cache/go-build across
runs. Since go.sum is not checked in, go.mod is used as the cache key.

https://claude.ai/code/session_011joWLHyHc8v7nDfpNoWkEY
2026-02-28 04:18:53 +00:00
27d1bfe910
Merge pull request #5 from imjasonh/claude/git-k8s-control-plane-ksW2i
Rewrite e2e tests in Go, replace bash-in-YAML test steps
2026-02-27 23:17:28 -05:00
copilot-swe-agent[bot]
f060222c42 go get -u ./... && go mod tidy: update dependencies
Co-authored-by: imjasonh <210737+imjasonh@users.noreply.github.com>
2026-02-28 04:14:23 +00:00
copilot-swe-agent[bot]
bb45f40db9 Initial plan 2026-02-28 04:11:38 +00:00
Claude
765007bb87
Fix stale resourceVersion bug in push controller
The push controller updates status to InProgress then later to
Succeeded/Failed. The first UpdateStatus call returns a new object with
an updated resourceVersion, but the code was discarding it. Subsequent
status updates used the stale resourceVersion, causing 409 Conflict
errors and an infinite retry loop where transactions never reached a
terminal phase.

Fix: capture the returned object from the InProgress UpdateStatus so
subsequent calls use the correct resourceVersion.

Also adds better timeout diagnostics in e2e test helpers.

https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
2026-02-28 04:09:56 +00:00
Claude
32137c3bc4
Rewrite e2e tests in Go, replace bash-in-YAML test steps
Move all e2e test logic from bash steps in ci.yaml into Go test files
under test/e2e/. CI now sets up infrastructure (KinD, Knative, CRDs,
controllers, Gitea) then runs `go test -tags=e2e ./test/e2e/`.

Benefits:
- Tests run concurrently via t.Parallel()
- No more bash-in-YAML maintenance burden
- Each test creates its own isolated resources with cleanup
- Proper Go test output with -v
- Build-tagged so `go test ./...` skips them

Tests:
- TestPushTransaction: push main to a new branch, verify on git server
- TestPushTransactionMultipleRefSpecs: push to two branches at once
- TestRepoSync: create two repos, set up GitRepoSync, verify controller

https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
2026-02-28 02:04:29 +00:00
163e810858
Merge pull request #4 from imjasonh/claude/git-k8s-control-plane-ksW2i
Add unit tests and GitRepoSync e2e test
2026-02-27 20:59:29 -05:00
Claude
4e4f5f923f
Add unit tests and GitRepoSync e2e test
Add unit tests for all packages that previously had zero test coverage:
- pkg/apis/git/v1alpha1: defaults, deepcopy, scheme registration, constants
- pkg/client: toUnstructured/fromUnstructured round-trips, context injection
- pkg/reconciler/push: splitKey, nestedFieldNoCopy, unstructuredNestedStringMap, base64 decoding
- pkg/reconciler/sync: splitKey
- pkg/reconciler/resolver: splitKey, changeName

Add e2e test exercising the sync controller:
- Creates second Gitea repo and GitRepository CR
- Creates GitBranch CRs with headCommit set via status subresource patch
- Creates GitRepoSync CR and verifies the sync controller processes it

https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
2026-02-28 01:52:05 +00:00
3bbfe8b4d4
Merge pull request #3 from imjasonh/claude/git-k8s-control-plane-ksW2i
Improve e2e smoke test with real git server and push controller exercise
2026-02-27 20:43:04 -05:00
Claude
890c2b7ec9
Use gitea rootless image in e2e test
Gitea 1.21 refuses to run as root. The non-rootless image's
entrypoint switches to the git user, but kubectl exec still runs
as root, causing `gitea admin user create` to fail with:
  "Gitea is not supposed to be run as root"

Switch to gitea/gitea:1.21-rootless which runs as UID 1000,
and mount emptyDir volumes at /var/lib/gitea and /etc/gitea.

https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
2026-02-28 01:36:42 +00:00
Claude
de30422c67
Improve e2e Gitea initialization robustness
- Add explicit API readiness check inside the pod before running
  admin commands (readiness probe alone may pass before DB is ready)
- Split "Initialize Gitea" into separate steps for better failure
  diagnostics: "Create Gitea admin user" and "Create test repository"

https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
2026-02-28 01:27:31 +00:00
Claude
6db30c9fe3
Run build and e2e jobs concurrently
Remove `needs: build` from the e2e job so both jobs start
immediately instead of running in sequence.

https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
2026-02-28 01:23:05 +00:00
Claude
5eb8ab49bd
Fix YAML document separator in e2e heredoc
The `---` between the Deployment and Service was indented inside
the heredoc, so kubectl didn't recognize it as a document separator.
Split into two separate kubectl apply calls.

https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
2026-02-28 01:18:30 +00:00
Claude
aebe5c6c67
Improve e2e smoke test with real git server and push controller exercise
Replace the stub smoke test (which only verified CRD creation) with a
full end-to-end test that:

- Deploys Gitea as an in-cluster git server (emptyDir, auto-install)
- Initializes a test repository with an admin user and initial commit
- Creates GitRepository, GitBranch, and GitPushTransaction CRDs
- Verifies the push controller clones, pushes main to a new branch,
  and transitions the transaction to Succeeded
- Verifies the controller updates the GitBranch CR's headCommit
- Verifies the new branch actually exists on the git server

Also fixes a bug in the push controller's resolveAuth: Secret data
values are base64-encoded when accessed via the dynamic client, but
were being used directly without decoding, causing authentication
failures.

https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
2026-02-28 01:07:51 +00:00
fe3fe95983
Merge pull request #2 from imjasonh/claude/git-k8s-control-plane-ksW2i
Initial plan
2026-02-27 19:44:45 -05:00
Claude
cc391645e1
Change API group from git.k8s.io to git-k8s.imjasonh.com
The *.k8s.io group is protected in Kubernetes and requires an
api-approved.kubernetes.io annotation. Switch to a custom domain
to avoid the restriction entirely.

https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
2026-02-28 00:34:34 +00:00
Claude
2f694f6f1f
Add api-approved.kubernetes.io annotation to CRDs
The *.k8s.io API group is protected in Kubernetes and requires
the api-approved.kubernetes.io annotation on CRDs.

https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
2026-02-28 00:30:22 +00:00
Claude
ffc7c82ae4
Fix LeaderAware interface: use correct Promote signature
The Knative reconciler.LeaderAware interface requires:
  Promote(Bucket, func(Bucket, types.NamespacedName)) error
Our code had the wrong enqueue function signature using
(Bucket, string) error instead.

https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
2026-02-28 00:21:24 +00:00
6ddba9902d
Merge pull request #1 from imjasonh/copilot/add-gha-workflow-for-prs
Add GHA CI workflow: build, test, and e2e on KinD with Knative
2026-02-27 19:16:26 -05:00
Claude
9c51925fc7
Add .gitignore for Go binaries and IDE files
https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
2026-02-28 00:14:29 +00:00