Repository navigation
ci: improve performance - #3203
Conversation
📝 WalkthroughWalkthroughRemoves Dagger-based Go CI/Test entrypoints, refactors GitHub Actions to use Nix and explicit steps, bumps Dagger engine/tooling versions, adds Actionlint config, updates Makefile and editor build tags, removes a Nix package, and adds a docker-compose health-wait script. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
151492f to
4d6722c
Compare
There was a problem hiding this comment.
Actionable comments posted: 8
🔭 Outside diff range comments (1)
.github/workflows/sdk-javascript-release.yaml (1)
25-31: Replace deprecated ::set-output with GITHUB_OUTPUT.set-output is deprecated; switch to GITHUB_OUTPUT for forward compatibility and to satisfy actionlint.
Apply:
- - name: Get short SHA - id: get-short-sha - run: | - id=$(echo ${{github.sha}} | cut -c 1-12) - echo "::set-output name=id::$id" + - name: Get short SHA + id: get-short-sha + run: | + id=$(echo "${GITHUB_SHA}" | cut -c 1-12) + echo "id=${id}" >> "$GITHUB_OUTPUT"
🧹 Nitpick comments (4)
.vscode/settings.json (1)
27-28: Dynamic build tag addition looks good; document local deps.Good call to include dynamic for local librdkafka. Ensure dev docs mention required system libs (e.g., librdkafka via brew/apt) so VS Code builds/tests don’t fail locally.
Confirm the contributor docs (README/development) call out installing librdkafka when dynamic is used.
.github/actionlint.yaml (1)
1-5: Actionlint config added – consider narrower ignores and CI integration.
- SC2046 ignore can hide real issues globally; if possible, scope it to the specific workflows/steps that require it.
- Suggest adding Actionlint to PR checks to enforce this config.
I can draft a minimal actionlint job for pr-checks.yaml if you want.
.dagger/versions.go (1)
4-4: Confirm golangci-lint version in Nix flakeThe flake.nix lists
golangci-lint(line 92) but doesn’t pin a version there. Please check your pinned nixpkgs (in flake.lock) to see whichgolangci-lintversion is provided:
- If it’s already v2.2.1, you’re all set.
- If it’s older, add a Nix overlay to bump it to v2.2.1 —or downgrade the
golangciLintVersionconstant here to match.Let me know what you find or if you need help crafting the overlay.
Makefile (1)
55-86: Build flags propagation looks correctPassing
${GO_BUILD_FLAGS}into eachgo buildis consistent. Consider adding-trimpathand-ldflagsfor reproducible builds in CI if desired.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
flake.lockis excluded by!**/*.lock
📒 Files selected for processing (16)
.dagger/ci.go(0 hunks).dagger/test.go(0 hunks).dagger/versions.go(1 hunks).github/actionlint.yaml(1 hunks).github/workflows/ci-exp.yaml(0 hunks).github/workflows/ci.yaml(3 hunks).github/workflows/pr-checks.yaml(1 hunks).github/workflows/release.yaml(1 hunks).github/workflows/sdk-javascript-release.yaml(1 hunks).github/workflows/sdk-javascript.yaml(1 hunks).github/workflows/sdk-python.yaml(1 hunks).vscode/settings.json(1 hunks)Makefile(3 hunks)dagger.json(1 hunks)flake.nix(0 hunks)tools/wait-for-compose.sh(1 hunks)
💤 Files with no reviewable changes (4)
- .dagger/test.go
- flake.nix
- .github/workflows/ci-exp.yaml
- .dagger/ci.go
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-03-31T11:48:09.170Z
Learnt from: chrisgacsal
PR: openmeterio/openmeter#2563
File: .dagger/versions.go:4-4
Timestamp: 2025-03-31T11:48:09.170Z
Learning: The project uses Nix for package management, and golangci-lint versions are constrained by what's available in the Nix package repository.
Applied to files:
.dagger/versions.go
🪛 Shellcheck (0.10.0)
tools/wait-for-compose.sh
[error] 18-18: Double quote array expansions to avoid re-splitting elements.
(SC2068)
[warning] 47-47: i appears unused. Verify use (or export if used externally).
(SC2034)
🪛 Gitleaks (8.27.2)
Makefile
4-4: Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data.
(jwt)
.github/workflows/ci.yaml
161-161: Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data.
(jwt)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: E2E
- GitHub Check: Analyze (go)
🔇 Additional comments (18)
dagger.json (1)
3-3: All Dagger engine versions are in sync at v0.18.14– dagger.json “engineVersion” is set to v0.18.14
– All workflows’ DAGGER_VERSION env vars are 0.18.14
– dagger-for-github remains pinned at commit e47aba4… (# v8.0.0), which is compatibleNo stale references detected.
.github/workflows/sdk-javascript-release.yaml (1)
12-12: Aligns with dagger.json – LGTM.
No concerns with the version bump to 0.18.14..github/workflows/sdk-python.yaml (1)
18-18: Version bump to 0.18.14 – consistent with dagger.json.
No further changes required here..github/workflows/sdk-javascript.yaml (1)
16-16: Version bump to 0.18.14 – consistent and fine.
No additional issues spotted..github/workflows/release.yaml (1)
14-14: Release workflow aligned to 0.18.14 – LGTM.
Pinned dagger-for-github is retained; no issues..github/workflows/pr-checks.yaml (1)
7-9: Good use of concurrency to cancel superseded runsThe group key
${{ github.workflow }}-${{ github.ref }}is appropriate for PRs and avoids cross-workflow collisions. No further changes needed.tools/wait-for-compose.sh (1)
48-48: Quote expansions when invoking the checker
checkServices $CONTAINER_IDSwill re-split by IFS and can mis-handle empty/newline-delimited IDs. Use the array with quotes.Apply the refactor above to populate
CONTAINER_IDSas an array and invoke:checkServices "${CONTAINER_IDS[@]}".Makefile (3)
49-51: Nice: consolidated build targetThe aggregate
buildtarget is clear and speeds up CI with-j. No issues.
125-130: Test target: good quick check for PostgresLightweight readiness check via psql works. Note: This will fail if
psqlis not installed locally; acceptable for CI/dev expectations.If you want to make it optional, guard with
command -v psql >/dev/null || echo "psql not installed".
131-137: Good: end-to-end test orchestration via compose + wait scriptThis aligns with the new CI strategy. Once the JWT is moved out of VCS, this target will also be clean for scanners.
.github/workflows/ci.yaml (8)
12-12: DAGGER_VERSION bump looks good0.18.14 matches other tooling updates in the PR. Keep dagger.json in sync (it appears updated in this PR).
14-16: Concurrency block is correctThis will cancel superseded runs per branch/PR without cross-workflow interference.
19-56: Cache rebuild job: solid foundationNix quick installer + store cache + Go module cache keys look sane. Good use of branch-scoped keys with fallbacks.
95-105: Pre-commit validation addedGood to run both standard and manual hooks. No issues.
114-118: Starting compose early to hide latency is a nice optimizationThis overlaps setup time effectively.
153-156: Wait step integrates with new wait scriptLGTM pending the shell fixes suggested for tools/wait-for-compose.sh.
208-208: Verify runner label syntax for Depot with additional "dagger=0.18.14"
runs-ontypically accepts a single label or an array. A comma within a single string is unusual and may not match any runner.Please confirm that
depot-ubuntu-latest-8,dagger=0.18.14is a valid single runner label in your Depot setup. If multiple labels are required by GitHub, use an array:runs-on: - depot-ubuntu-latest-8 - dagger=0.18.14If Depot expects a single composite label, ignore this.
271-319: Quickstart: pragmatic checksUsing curl retries and exporting container logs is solid. No change requested.
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (4)
Makefile (2)
6-8: Good: fixed invalid--parallelto-paralleland centralized flagsKeeps test/build flags in sync across targets.
3-4: Remove hardcoded JWT (use env/CI var instead) — leaks flagged by GitleaksDo not commit JWTs. Make it overridable and empty by default.
-# Docker-local svix secret, only used for testing -SVIX_JWT_SECRET = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MjI5NzYyNzMsImV4cCI6MjAzODMzNjI3MywibmJmIjoxNzIyOTc2MjczLCJpc3MiOiJzdml4LXNlcnZlciIsInN1YiI6Im9yZ18yM3JiOFlkR3FNVDBxSXpwZ0d3ZFhmSGlyTXUifQ.PomP6JWRI62W5N4GtNdJm2h635Q5F54eij0J3BU-_Ds +# Docker-local svix secret for tests. Provide via env or repo var/secret. +# Example: make test-all SVIX_JWT_SECRET=... or export SVIX_JWT_SECRET before running. +SVIX_JWT_SECRET ?=.github/workflows/ci.yaml (2)
166-169: LGTM: correctdocker compose down -vusageDropping service names fixes the previously noted misuse.
157-165: Remove hardcoded JWT from workflow; use repo variable/secretDo not embed JWTs in workflows. Reference ${{ vars.SVIX_JWT_SECRET }} or ${{ secrets.SVIX_JWT_SECRET }}.
- name: Run tests env: SVIX_HOST: localhost - # Dev JWT secret, non-sensitive - SVIX_JWT_SECRET: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MjI5NzYyNzMsImV4cCI6MjAzODMzNjI3MywibmJmIjoxNzIyOTc2MjczLCJpc3MiOiJzdml4LXNlcnZlciIsInN1YiI6Im9yZ18yM3JiOFlkR3FNVDBxSXpwZ0d3ZFhmSGlyTXUifQ.PomP6JWRI62W5N4GtNdJm2h635Q5F54eij0J3BU-_Ds + SVIX_JWT_SECRET: ${{ vars.SVIX_JWT_SECRET }} # or: ${{ secrets.SVIX_JWT_SECRET }} # count=1 is needed to force retest run: | nix develop --impure .#ci -c go test -p 128 -tags=dynamic -parallel 16 -count=1 ./...
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/ci.yaml(3 hunks)Makefile(3 hunks)tools/wait-for-compose.sh(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- tools/wait-for-compose.sh
🧰 Additional context used
🪛 Gitleaks (8.27.2)
Makefile
4-4: Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data.
(jwt)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: E2E
- GitHub Check: Quickstart
- GitHub Check: Migration Checks
- GitHub Check: Build
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (go)
🔇 Additional comments (8)
Makefile (1)
128-130: Test target looks goodLocal postgres check via psql is clear and fails fast; test flags consistent with CI.
.github/workflows/ci.yaml (7)
12-16: LGTM: tool version bump and concurrency guardPinned Dagger version and cancel-in-progress reduce queue times and flakiness.
19-56: LGTM: cache-rebuild job warms Nix/Go caches on pushGood use of flake check, develop to upsert store, and keyed cache saves.
66-83: LGTM: Nix setup + Nix store restorePinned action SHAs and first-match restore prefixes are solid.
84-94: LGTM: go.mod cache restoreConsistent keys, branch-preferred restore keys make sense.
95-105: LGTM: unified build and commit checksConsolidating with
make -j 10 buildand running pre-commit in CI aligns tooling.
114-118: LGTM: start Compose early to overlap setupThis helps shave seconds while Nix env initializes.
153-156: Verification Passed: tools/wait-for-compose.sh is Present and Executabletools/wait-for-compose.sh exists with
-rwxr-xr-xpermissions and a valid#!/usr/bin/env bashshebang. No further action required.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (5)
tools/wait-for-compose.sh (2)
10-15: Fix container discovery and error message; use an array for IDsUse an array to safely capture multiple IDs and reflect requested services in the error. This also prepares for correct, quoted argument passing downstream.
-# Get the container ID for the service -CONTAINER_IDS=$(docker compose ps -q "$@") -if [[ -z "$CONTAINER_IDS" ]]; then - echo "Error: Could not find container ids." - exit 1 -fi +# Get the container IDs for the requested services +# Preserve elements to avoid word splitting/globbing +mapfile -t CONTAINER_IDS < <(docker compose ps -q "$@") +if [[ ${#CONTAINER_IDS[@]} -eq 0 ]]; then + echo "Error: Could not find containers for services: $*" + exit 1 +fi
17-21: Harden quoting and guard docker inspect under set -e (SC2068)Iterate over "$@" to avoid re-splitting, and guard all docker inspect calls so a failure won’t abort the script under set -e.
-checkServices() { - for CONTAINER_ID in $@; do - STATUS="$(docker inspect --format='{{.State.Health.Status}}' "$CONTAINER_ID" 2>/dev/null || true)" - SERVICE_NAME="$(docker inspect --format='{{.Name}}' "$CONTAINER_ID" 2>/dev/null | sed 's|^/||')" +checkServices() { + for CONTAINER_ID in "$@"; do + STATUS="$(docker inspect --format='{{.State.Health.Status}}' "$CONTAINER_ID" 2>/dev/null || true)" + # Don’t let a failing inspect terminate the script; strip leading slash safely + SERVICE_NAME_RAW="$(docker inspect --format='{{.Name}}' "$CONTAINER_ID" 2>/dev/null || true)" + SERVICE_NAME="${SERVICE_NAME_RAW#/}" @@ - STATUS="$(docker inspect --format='{{.State.Status}}' "$CONTAINER_ID" 2>/dev/null)" + STATUS="$(docker inspect --format='{{.State.Status}}' "$CONTAINER_ID" 2>/dev/null || true)"Also applies to: 28-29
Makefile (3)
6-9: go test flags look correct (-parallel single hyphen)Nice fix; this matches go test semantics.
135-140: Fail fast if SVIX_JWT_SECRET is unset before running testsAvoid surprising test failures and make the dependency explicit.
docker compose up -d postgres svix redis ./tools/wait-for-compose.sh postgres svix redis -SVIX_HOST="localhost" SVIX_JWT_SECRET="$(SVIX_JWT_SECRET)" go test ${GO_TEST_FLAGS} -count=1 ./... +@ if [ -z "$(SVIX_JWT_SECRET)" ]; then \ + echo "SVIX_JWT_SECRET not set; export it or pass SVIX_JWT_SECRET=..."; \ + exit 1; \ +fi +SVIX_HOST="localhost" SVIX_JWT_SECRET="$(SVIX_JWT_SECRET)" go test ${GO_TEST_FLAGS} -count=1 ./...
3-4: Remove hardcoded JWT; use a variable and supply via env/CICommitting secrets (even dev-only) is unsafe and will trip scanners. Use a configurable var.
-# Docker-local svix secret, only used for testing -SVIX_JWT_SECRET = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MjI5NzYyNzMsImV4cCI6MjAzODMzNjI3MywibmJmIjoxNzIyOTc2MjczLCJpc3MiOiJzdml4LXNlcnZlciIsInN1YiI6Im9yZ18yM3JiOFlkR3FNVDBxSXpwZ0d3ZFhmSGlyTXUifQ.PomP6JWRI62W5N4GtNdJm2h635Q5F54eij0J3BU-_Ds +# Docker-local svix secret, only used for testing. Provide via env or repo variable. +# Example: make test-all SVIX_JWT_SECRET=... or export SVIX_JWT_SECRET before running. +SVIX_JWT_SECRET ?=
🧹 Nitpick comments (2)
tools/wait-for-compose.sh (1)
46-54: Pass array safely and improve timeout messageWith CONTAINER_IDS captured into an array, pass it as "${CONTAINER_IDS[@]}". Also surface the requested services in the timeout for better diagnostics.
-while (( attempts > 0 )); do - if checkServices "${CONTAINER_IDS[@]}"; then +while (( attempts > 0 )); do + if checkServices "${CONTAINER_IDS[@]}"; then exit 0 fi sleep 2 ((attempts--)) done -echo "❌ Failed to start services: timeout" +echo "❌ Failed to start services ($*): timeout" exit 1Also applies to: 56-57
Makefile (1)
132-134: Postgres readiness gate is helpful; small enhancement optionalCurrent check is fine. Consider printing which host/port/user/db are probed to aid debugging across envs. No action required.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
Makefile(3 hunks)tools/wait-for-compose.sh(1 hunks)
🧰 Additional context used
🪛 Gitleaks (8.27.2)
Makefile
4-4: Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data.
(jwt)
🪛 Shellcheck (0.10.0)
tools/wait-for-compose.sh
[error] 18-18: Double quote array expansions to avoid re-splitting elements.
(SC2068)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Artifacts / Benthos Collector Container image
- GitHub Check: Migration Checks
- GitHub Check: E2E
- GitHub Check: Build
- GitHub Check: Quickstart
- GitHub Check: Test
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
Makefile (1)
49-55: Good: ensure build/ exists before emitting binariesAdding build-dir and wiring it as an order-only prerequisite to all build-* targets is robust, especially under parallel make.
Also applies to: 57-90
Overview
Changes/fixes:
This allows for the whole CI to execute in ~2 mins except of quickstart and e2e tests.
Summary by CodeRabbit
CI
Developer Experience
Chores