Compare commits

...

14 Commits

Author SHA1 Message Date
argoyle 3909811827 Merge pull request 'chore(release): prepare for v0.1.1' (#357) from next-release into main
Release / release (push) Successful in 1m8s
gitlab-cleanup-handler / vulnerabilities (push) Successful in 2m19s
gitlab-cleanup-handler / test (push) Successful in 8m30s
gitlab-cleanup-handler / build (push) Successful in 1m0s
Reviewed-on: #357
2026-01-10 18:52:49 +00:00
releaser f67c45f5ce chore(release): prepare for v0.1.1
gitlab-cleanup-handler / vulnerabilities (pull_request) Successful in 1m9s
gitlab-cleanup-handler / test (pull_request) Successful in 5m14s
gitlab-cleanup-handler / build (pull_request) Successful in 4m9s
2026-01-10 18:40:21 +00:00
releaser 8c9a8c6433 chore(release): prepare for v0.1.1 2026-01-10 18:40:14 +00:00
argoyle 494c451640 Merge pull request 'ci: run workflow on tags' (#356) from ci-run-on-tags into main
Release / release (push) Successful in 4m3s
gitlab-cleanup-handler / test (push) Successful in 5m27s
gitlab-cleanup-handler / vulnerabilities (push) Successful in 6m59s
gitlab-cleanup-handler / build (push) Successful in 1m1s
Reviewed-on: #356
2026-01-10 18:34:32 +00:00
argoyle 70fd5d4c72 ci: run workflow on tags
gitlab-cleanup-handler / vulnerabilities (pull_request) Successful in 1m39s
gitlab-cleanup-handler / test (pull_request) Successful in 2m0s
gitlab-cleanup-handler / build (pull_request) Successful in 3m38s
2026-01-10 19:26:28 +01:00
argoyle 2ccb0b4bf4 Merge pull request 'chore(release): prepare for v0.1.0' (#349) from next-release into main
Release / release (push) Successful in 38s
gitlab-cleanup-handler / vulnerabilities (push) Successful in 1m31s
gitlab-cleanup-handler / test (push) Successful in 2m37s
gitlab-cleanup-handler / build (push) Successful in 10m15s
Reviewed-on: #349
2026-01-09 16:16:03 +00:00
releaser f8ebc95040 chore(release): prepare for v0.1.0 2026-01-09 15:59:25 +00:00
releaser 39f32f9baa chore(release): prepare for v0.1.0 2026-01-09 15:59:06 +00:00
argoyle aaaa3513af Merge pull request 'docs: add CLAUDE.md for Claude Code guidance' (#355) from add-claude-md into main
Release / release (push) Successful in 2m51s
gitlab-cleanup-handler / vulnerabilities (push) Successful in 4m49s
gitlab-cleanup-handler / test (push) Successful in 5m42s
gitlab-cleanup-handler / build (push) Successful in 6m43s
Reviewed-on: #355
2026-01-09 15:55:12 +00:00
releaser 073ad578d4 chore(release): prepare for v0.1.0 2026-01-09 15:54:06 +00:00
releaser 0446db698b chore(release): prepare for v0.1.0 2026-01-09 15:53:51 +00:00
argoyle 4cddc3343a docs: add CLAUDE.md for Claude Code guidance
gitlab-cleanup-handler / vulnerabilities (pull_request) Successful in 3m12s
gitlab-cleanup-handler / test (pull_request) Successful in 4m25s
gitlab-cleanup-handler / build (pull_request) Successful in 6m51s
2026-01-09 16:37:56 +01:00
Unbound Release f884415a4a chore(release): prepare for v0.0.23 2025-12-30 17:25:35 +00:00
Unbound Release bb6f79c49c chore(release): prepare for v0.0.23 2025-12-30 17:25:34 +00:00
4 changed files with 80 additions and 1 deletions
+1
View File
@@ -3,6 +3,7 @@ name: gitlab-cleanup-handler
on:
push:
branches: [main]
tags: ['*']
pull_request:
branches: [main]
+3 -1
View File
@@ -1 +1,3 @@
{"version":"v0.0.22"}
{
"version": "v0.1.1"
}
+24
View File
@@ -2,6 +2,30 @@
All notable changes to this project will be documented in this file.
## [0.1.1] - 2026-01-10
### ⚙️ Miscellaneous Tasks
- Run workflow on tags
## [0.1.0] - 2026-01-09
### 🚀 Features
- Migrate from GitLab CI to Gitea Actions
### 📚 Documentation
- Add CLAUDE.md for Claude Code guidance
### ⚙️ Miscellaneous Tasks
- *(deps)* Update golang:1.25.5 docker digest to ad03ba9
- *(deps)* Update actions/setup-go action to v6
- *(deps)* Update actions/checkout action to v6
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.8.0
- Add release workflow
## [0.0.22] - 2025-12-18
### 🐛 Bug Fixes
+52
View File
@@ -0,0 +1,52 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
A Go service that scans Kubernetes namespaces for container images from GitLab's container registry and automatically updates GitLab project cleanup policies to preserve those images. This ensures images actively running in Kubernetes are protected from automated cleanup.
## Build & Test Commands
```bash
# Run all tests
go test ./...
# Run a specific test
go test ./kube -run TestFetcher
# Run tests with coverage
go test -cover ./...
# Lint (via pre-commit)
pre-commit run golangci-lint --all-files
# Format code
gofumpt -w .
# Run all pre-commit hooks (always add all files first)
git add -A && pre-commit run --all-files
```
## Architecture
The service has three main components:
1. **cmd/handler** - Entry point using Kong for CLI argument parsing. Accepts `--namespaces` (or NAMESPACES env) and `--gitlab-token` (or GITLAB_TOKEN env).
2. **kube** - Kubernetes client that scans Deployments and CronJobs in specified namespaces for images prefixed with `registry.gitlab.com`. Uses provider pattern for in-cluster vs KUBECONFIG-based authentication.
3. **gitlab** - REST client that fetches repository tags and updates container expiration policies via GitLab API. The cleanup policy keeps images matching `main|master|<active-versions>`.
### Data Flow
```
Kubernetes Cluster → kube.Client.GetImages() → ImageCollector
→ gitlab.RestClient.GetTags() + UpdateCleanupPolicy()
```
## Code Conventions
- Uses `github.com/apex/log` for structured JSON logging
- Tests use `github.com/stretchr/testify` assertions and `gitlab.com/unboundsoftware/apex-mocks` for log mocking
- Interfaces defined locally for testability (KubeClient, GitlabClient, ClientProvider, ConfigProvider)
- Follows conventional commits format (enforced by pre-commit commitlint hook)