Skip to content

nikolaik/calculating neck - #13

Closed
nikolaik wants to merge 61 commits into
hedlund:mainfrom
reMarkable:nikolaik/calculating-neck
Closed

nikolaik wants to merge 61 commits into
hedlund:mainfrom
reMarkable:nikolaik/calculating-neck

Conversation

@nikolaik

Copy link
Copy Markdown
  • chore(ci): Add workflow to deploy charts
  • chore: Add codeowners
  • chore: Rename to new repo
  • fix(chart): Update to new registry
  • chore: Add chart testing workflow
  • fix(chart): Use stable version
  • feat(monitoring): optional Prometheus metrics exporter
  • tests: add unit tests for mcache
  • tests: add unit tests for envconfig
  • tests: add a simple server test
  • tests: add tests for the auth middleware
  • tests: Add tests for the router module
  • tests: Add tests for github module.
  • tests: add tests for the expect module.
  • tests: add tests for the cache service
  • chore(chart): Roll image
  • fix: update type enum to make it less likely to pass an invalid value for metric type
  • chore(chart): roll image
  • feat: add version support, split module and namespace
  • fix: Order labels by name
  • chore: Add renovate config
  • chore(renovate): Fix matching on ghcr.io hosted image
  • chore(deps): update ghcr.io/remarkable/orbit docker tag to v0.1.3
  • chore: Roll chart version
  • fix: add error handling to fix all golangci-lint warnings
  • chore(deps): update actions/setup-go action to v5
  • chore(deps): update docker/build-push-action action to v6
  • chore(deps): update dependency go to 1.24
  • chore(deps): update actions/checkout action to v4
  • docs: improve README
  • chore(deps): update docker/metadata-action action to v5
  • chore(deps): update docker/login-action action to v3
  • chore(deps): update all non-major dependencies
  • chore(deps): update docker.io/library/golang docker tag to v1.25
  • chore(deps): update actions/setup-python action to v6
  • chore(deps): update actions/setup-go action to v6
  • chore(deps): update actions/checkout action to v5
  • chore(deps): update all non-major dependencies
  • chore(deps): update actions/checkout action to v6
  • chore(deps): update all non-major dependencies
  • chore(deps): update docker.io/library/golang docker tag to v1.26
  • chore(deps): update azure/setup-helm action to v5
  • chore(deps): update docker/build-push-action action to v7
  • chore(deps): update docker/login-action action to v4
  • chore(deps): update docker/metadata-action action to v6
  • chore(chart): Add emptyDir volume for cache path
  • fix!: Keep auth semantics when cache is enabled
  • fix(chart): Roll image version to v0.2.0
  • fix(chart): Put cache expiry value in CACHE_EXPIRATION
  • chore(deps): update dependency helm to v4
  • chore(deps): update actions/checkout action to v7
  • chore(deps): update azure/setup-helm action to v5.0.1
  • chore(deps): update actions/setup-go action to v7
  • chore(deps): update actions/setup-python action to v7
  • refactor(cache): Clean up ProxyDownload error handling
  • fix(cache): Write files atomically and mutex cache reads
  • fix(chart): Roll image version to v0.2.1
  • chore(deps): update docker.io/library/golang docker tag to v1.27
  • chore(deps): update all non-major dependencies
  • feat: Cache paginated GitHub tags per repository
  • chore: Update codeowners

nikolaik and others added 30 commits March 25, 2025 14:51
This adds helm chart registry hosting using the wonderful [helm/chart-releaser-action](https://github.com/helm/chart-releaser-action)
Also add chart- prefix to GitHub releases for the chart

Minor fixes
Also modernize some of the go code.
Fix a locking issue and data race issue found by the new unit tests.
Also bumps the min golang version to 1.24
Add a small description of expected repo structure, a table of supported
env variable and some information about deployment.
renovate Bot and others added 26 commits October 1, 2025 11:40
Add a fairly cheap HTTP HEAD request for each cached request,
piggybacking on the GitHub access controls for authorizing a users
permission to repo read contents.

To revert to the old behaviour you can set `CACHE_AUTH_DISABLED=true`
Changes:

1. **Atomic writes (fixes read-while-writing).** `FileStorage.Create` now returns a new `CacheWriter` interface (`io.Writer` + `Commit()` + `Close()`). `StoreInPath.Create` writes to a temp file (`os.CreateTemp` in the same dir) and only `os.Rename`s it into place on `Commit()`. Since rename is atomic on the same filesystem, readers see either the complete old file or the complete new file — never a partial one. Closing without committing discards the temp file, so failed/partial downloads leave no garbage.

2. **Ref-counted keyed mutex (fixes write/write + dedups downloads).** `Cache` gained a `map[string]*keyLock` guarded by a `sync.Mutex`. `lockKey(filename)` serializes work per-artifact and cleans up the entry once no goroutine holds or waits on it. On a cache miss, only one goroutine downloads; others block, then serve the freshly cached file.

3. **Rewrote `ProxyDownload`** into: verify `RepoHead` → serve-from-cache fast path → acquire per-file lock → re-check cache → download-to-cache → serve → fall back to direct proxy if caching is unavailable. `RepoHead` now runs up front on every path, so cached content is never served without an access check.

Prompt:

> Do we need a mutex or similar to protect against two go routines writing to the same file and/or reading from a file while writing in `ProxyDownload`?
Aggregate and cache all tag pages per owner/repo in github.Service so
multiple modules sharing a repo (and repeated calls within the TTL) reuse
a single paginated fetch instead of re-walking every page.
The old team is no more
@nikolaik nikolaik closed this Sep 16, 2026
@nikolaik
nikolaik deleted the nikolaik/calculating-neck branch September 16, 2026 14:01
@nikolaik
nikolaik restored the nikolaik/calculating-neck branch September 16, 2026 14:02
@nikolaik
nikolaik deleted the nikolaik/calculating-neck branch September 16, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants