ci: caches, prebuilt linters, image from the built binaries #184

Merged
Sebi merged 2 commits from ci/optimize-pipelines into main 2026-12-05 16:16:27 +00:00
Owner

What

  • Caches in the runners' S3 cache (actions/cache restore/save) for lint, test and build: Go modules, Go build cache, golangci-lint cache (lint), npm cache. Only main saves (one entry per commit, the bucket expires them after 7 days); PRs and tags restore the newest entry from main. release.yaml restores the build cache read-only.
  • golangci-lint from the release tarball (sha256-checked) instead of go install, which compiled the linter from source on every run.
  • shellcheck v0.12.0 from the static release binary instead of apt-get update && apt-get install on every run.
  • Image without a second build: the build job uploads its dist/linux_amd64 binaries as an artifact; the image job packs them with Dockerfile.ci (same distroless base, nonroot, entrypoint api) using the runner's Docker daemon. Previously Kaniko cloned the repo and built frontend and Go a second time, without cache. The binaries carry the same Version/Commit ldflags as the old image build ($VERSION from the build job, short SHA). Dockerfile stays for make image and local builds.

Tags and channels (<version>, edge, beta, latest/stable/X.Y), the push rules (only main and tags, only with PACKAGE_TOKEN) and the agent images are unchanged.

Not changed

The test job's six service images (timescaledb, mongo, mariadb, kafka, rabbitmq, redis) are still pulled cold on ephemeral runners; that needs a registry pull-through mirror in the cluster, not a workflow change.

Tested locally

  • Dockerfile.ci built from a context like the workflow's: api, checker, launcher, statuspage start in the image.
  • golangci-lint tarball checksum and archive layout verified; shellcheck archive layout verified.
  • Workflows parse as YAML.

The first run on this PR restores no cache yet (none saved from main); the effect shows after the first main run.

🤖 Generated with Claude Code

## What - **Caches in the runners' S3 cache** (`actions/cache` restore/save) for `lint`, `test` and `build`: Go modules, Go build cache, golangci-lint cache (lint), npm cache. Only `main` saves (one entry per commit, the bucket expires them after 7 days); PRs and tags restore the newest entry from `main`. `release.yaml` restores the build cache read-only. - **golangci-lint from the release tarball** (sha256-checked) instead of `go install`, which compiled the linter from source on every run. - **shellcheck v0.12.0 from the static release binary** instead of `apt-get update && apt-get install` on every run. - **Image without a second build**: the build job uploads its `dist/linux_amd64` binaries as an artifact; the image job packs them with `Dockerfile.ci` (same distroless base, `nonroot`, entrypoint `api`) using the runner's Docker daemon. Previously Kaniko cloned the repo and built frontend and Go a second time, without cache. The binaries carry the same `Version`/`Commit` ldflags as the old image build (`$VERSION` from the build job, short SHA). `Dockerfile` stays for `make image` and local builds. Tags and channels (`<version>`, `edge`, `beta`, `latest`/`stable`/`X.Y`), the push rules (only main and tags, only with `PACKAGE_TOKEN`) and the agent images are unchanged. ## Not changed The test job's six service images (timescaledb, mongo, mariadb, kafka, rabbitmq, redis) are still pulled cold on ephemeral runners; that needs a registry pull-through mirror in the cluster, not a workflow change. ## Tested locally - `Dockerfile.ci` built from a context like the workflow's: `api`, `checker`, `launcher`, `statuspage` start in the image. - golangci-lint tarball checksum and archive layout verified; shellcheck archive layout verified. - Workflows parse as YAML. The first run on this PR restores no cache yet (none saved from main); the effect shows after the first main run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sebi added 1 commit 2026-12-05 14:04:57 +00:00
ci: caches, prebuilt linters, image from the built binaries
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 4m38s
ci / build (pull_request) Canceled after 0s
ci / image (pull_request) Canceled after 0s
ci / test (pull_request) Canceled after 5m37s
b5864632bb
- Go module/build cache, golangci-lint cache and npm cache in the runners'
  S3 cache for lint, test and build; only main saves (one entry per
  commit), PRs and tags restore; release restores the build cache
- golangci-lint from the release tarball (sha256-checked) instead of
  compiling it with go install on every run
- shellcheck from its static release binary instead of apt-get on every run
- the image job packs the build job's amd64 binaries (Dockerfile.ci,
  distroless, same entrypoint) with the runner's Docker daemon instead of
  Kaniko rebuilding frontend and Go from the git context; Dockerfile stays
  for local/make builds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sebi added 1 commit 2026-12-05 14:10:08 +00:00
ci: build the image with BuildKit (docker-cli-buildx)
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 7m34s
ci / test (pull_request) Successful in 8m45s
ci / build (pull_request) Successful in 16m13s
ci / image (pull_request) Successful in 28s
d224ddcee2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sebi merged commit 220bc5f3d8 into main 2026-12-05 16:16:27 +00:00
Sebi deleted branch ci/optimize-pipelines 2026-12-05 16:16:29 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ZB-Server/uptimesebi#184