Skip to content

fix: use SERVICE_VERSION env var for ccip-server version logging#7674

Merged
paulbalaji merged 1 commit intomainfrom
pbio/ccip-server-version-fix
Dec 30, 2025
Merged

fix: use SERVICE_VERSION env var for ccip-server version logging#7674
paulbalaji merged 1 commit intomainfrom
pbio/ccip-server-version-fix

Conversation

@paulbalaji
Copy link
Collaborator

@paulbalaji paulbalaji commented Dec 29, 2025

Summary

  • Use CI-generated Docker tag (SHA + date) as SERVICE_VERSION instead of package.json version
  • Multiple Docker images can be built from the same npm package version, so the package version doesn't uniquely identify a build
  • Same pattern as applied to rebalancer and warp-monitor

Test plan

  • Verify Docker build succeeds with SERVICE_VERSION build arg
  • Verify logs show correct version in deployed container

🤖 Generated with Claude Code

Greptile Summary

Switched ccip-server version logging from package.json version to SERVICE_VERSION environment variable, which gets set during Docker builds using a unique SHA+date identifier.

  • Workflow passes SERVICE_VERSION build arg with format {7-char-sha}-{timestamp} (e.g., b9c592a-20250129-143022)
  • Dockerfile accepts SERVICE_VERSION as ARG (defaults to dev) and exposes it as ENV variable
  • Server code reads process.env.SERVICE_VERSION instead of importing from package.json
  • Removed unused package.json import from server.ts

This matches the pattern the team applied to other services and ensures each Docker image has a unique version identifier even when multiple images are built from the same npm package version.

Confidence Score: 5/5

  • Safe to merge - straightforward versioning change with proper fallback handling
  • Clean implementation that properly threads the version through CI build args, Dockerfile ARG/ENV, and runtime code. The fallback to 'dev' is sensible, and removing the unused import keeps things tidy.
  • No files require special attention

Important Files Changed

Filename Overview
.github/workflows/ccip-server-docker.yml Added SERVICE_VERSION build arg using SHA+date tag for Docker versioning
typescript/ccip-server/Dockerfile Added SERVICE_VERSION ARG and ENV to pass build-time version through to runtime
typescript/ccip-server/src/server.ts Replaced package.json version with SERVICE_VERSION env var for logging

Sequence Diagram

sequenceDiagram
    participant GHA as GitHub Actions
    participant Docker as Docker Build
    participant Container as Running Container
    participant Logger as Service Logger
    
    GHA->>GHA: Generate TAG_SHA (first 7 chars of commit)
    GHA->>GHA: Generate TAG_DATE (timestamp)
    GHA->>Docker: Build with SERVICE_VERSION arg<br/>(SHA-DATE format)
    Docker->>Docker: Set ARG SERVICE_VERSION=dev (default)
    Docker->>Docker: Build stage: install deps
    Docker->>Docker: Runner stage: accept SERVICE_VERSION arg
    Docker->>Docker: Set ENV SERVICE_VERSION=${SERVICE_VERSION}
    Docker->>Container: Start container with env var
    Container->>Container: Read process.env.SERVICE_VERSION
    Container->>Logger: createServiceLogger({version: VERSION})
    Logger->>Logger: Log with unique build identifier
Loading

Summary by CodeRabbit

  • Chores
    • Improved service versioning to support dynamic version configuration during container builds, replacing static package-based version sourcing.

✏️ Tip: You can customize this high-level summary in your review settings.

Use CI-generated Docker tag (SHA + date) as SERVICE_VERSION instead of
package.json version, since multiple Docker images can be built from
the same npm package version.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Dec 29, 2025

⚠️ No Changeset found

Latest commit: b9c592a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@hyper-gonk
Copy link
Contributor

hyper-gonk bot commented Dec 29, 2025

🐳 Monorepo Docker Image Built Successfully

Image Tags:

gcr.io/abacus-labs-dev/hyperlane-monorepo:pr-7674
gcr.io/abacus-labs-dev/hyperlane-monorepo:b9c592a-20251229-184625

@hyper-gonk
Copy link
Contributor

hyper-gonk bot commented Dec 29, 2025

🔍 CCIP Server Docker Image Built Successfully

Image Tags:

gcr.io/abacus-labs-dev/hyperlane-offchain-lookup-server:pr-7674
gcr.io/abacus-labs-dev/hyperlane-offchain-lookup-server:b9c592a-20251229-184628

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 29, 2025

📝 Walkthrough

Walkthrough

Version management gets a makeover. SERVICE_VERSION build argument introduced to Docker workflow and Dockerfile with default 'dev', propagated to runtime environment. Server logger now reads from SERVICE_VERSION environment variable instead of importing package.json, decoupling build versioning from package metadata.

Changes

Cohort / File(s) Summary
CI/CD Workflow
.github/workflows/ccip-server-docker.yml
Adds SERVICE_VERSION build argument to Docker build step, sourcing from TAG_SHA-TAG_DATE metadata produced by taggen step
Docker Configuration
typescript/ccip-server/Dockerfile
Introduces SERVICE_VERSION build-time argument with default value 'dev'; propagates to final image via ENV SERVICE_VERSION for runtime availability
Application Code
typescript/ccip-server/src/server.ts
Removes package.json import; introduces VERSION constant from SERVICE_VERSION environment variable (defaults to 'dev'); updates logger initialization to use VERSION instead of packageJson.version

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • nambrot
  • Mo-Hussain

Poem

🏗️ Like layers in an onion, versions now flow,
From build-time down to the runtime's soft glow,
No package.json needed, just ENV so true,
The service knows who it is—through and through! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The PR description covers the key aspects with a clear summary, test plan, and detailed explanation of changes. However, it doesn't follow the repository's template structure (missing formal Description/Drive-by/Related issues/Backward compatibility/Testing sections). Consider reformatting the description to match the repository template structure for consistency, though the content itself is substantive and informative.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: switching ccip-server version logging to use the SERVICE_VERSION environment variable instead of package.json.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pbio/ccip-server-version-fix

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
typescript/ccip-server/Dockerfile (1)

11-11: Builder stage ARG appears unused.

The SERVICE_VERSION argument in the builder stage isn't referenced anywhere before the runner stage. Since multi-stage builds don't automatically propagate ARGs, this declaration has no effect. You only need the ARG in the runner stage (line 97) where it's actually used.

🔎 Proposed cleanup
 ARG FOUNDRY_VERSION
-ARG SERVICE_VERSION=dev
 ARG TARGETARCH
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f0351a and b9c592a.

📒 Files selected for processing (3)
  • .github/workflows/ccip-server-docker.yml
  • typescript/ccip-server/Dockerfile
  • typescript/ccip-server/src/server.ts
🧰 Additional context used
📓 Path-based instructions (1)
typescript/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

typescript/**/*.{ts,tsx}: Use ChainMap for per-chain configurations in TypeScript
Import types from @hyperlane-xyz/sdk when using TypeScript SDK types

Files:

  • typescript/ccip-server/src/server.ts
🧠 Learnings (1)
📚 Learning: 2025-12-22T16:50:19.890Z
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 7565
File: typescript/ccip-server/Dockerfile:10-11
Timestamp: 2025-12-22T16:50:19.890Z
Learning: Standardize Foundry installation in Dockerfiles by using the official curl -L https://foundry.paradigm.xyz | bash followed by foundryup. This pattern is already used across multiple Dockerfiles in the repo and should be retained for consistency and reliability wherever Foundry is installed.

Applied to files:

  • typescript/ccip-server/Dockerfile
⏰ 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). (63)
  • GitHub Check: cli-evm-e2e-matrix (warp-extend-basic)
  • GitHub Check: cli-evm-e2e-matrix (core-deploy)
  • GitHub Check: cli-evm-e2e-matrix (warp-apply-ism-updates)
  • GitHub Check: cli-evm-e2e-matrix (warp-apply-rebalancing-config)
  • GitHub Check: cli-evm-e2e-matrix (warp-check-2)
  • GitHub Check: cli-evm-e2e-matrix (core-check)
  • GitHub Check: cli-evm-e2e-matrix (warp-rebalancer)
  • GitHub Check: cli-evm-e2e-matrix (warp-check-5)
  • GitHub Check: cli-evm-e2e-matrix (core-apply)
  • GitHub Check: cli-evm-e2e-matrix (warp-send)
  • GitHub Check: cli-evm-e2e-matrix (warp-check-3)
  • GitHub Check: cli-evm-e2e-matrix (warp-bridge-2)
  • GitHub Check: cli-evm-e2e-matrix (core-read)
  • GitHub Check: cli-evm-e2e-matrix (status)
  • GitHub Check: cli-evm-e2e-matrix (warp-read)
  • GitHub Check: cli-evm-e2e-matrix (warp-check-1)
  • GitHub Check: cli-evm-e2e-matrix (warp-deploy-1)
  • GitHub Check: cli-evm-e2e-matrix (warp-extend-recovery)
  • GitHub Check: cli-evm-e2e-matrix (warp-deploy-2)
  • GitHub Check: cli-evm-e2e-matrix (warp-bridge-1)
  • GitHub Check: cli-evm-e2e-matrix (warp-apply-ownership-updates)
  • GitHub Check: cli-evm-e2e-matrix (core-init)
  • GitHub Check: cli-evm-e2e-matrix (warp-extend-config)
  • GitHub Check: cli-evm-e2e-matrix (warp-check-4)
  • GitHub Check: cli-evm-e2e-matrix (relay)
  • GitHub Check: cli-evm-e2e-matrix (warp-init)
  • GitHub Check: cli-evm-e2e-matrix (warp-apply-hook-updates)
  • GitHub Check: cli-evm-e2e-matrix (warp-apply-submitters)
  • GitHub Check: cli-evm-e2e-matrix (warp-apply-simple-updates)
  • GitHub Check: env-test-matrix (testnet4, sepolia, core)
  • GitHub Check: env-test-matrix (mainnet3, optimism, core)
  • GitHub Check: env-test-matrix (mainnet3, ethereum, igp)
  • GitHub Check: env-test-matrix (mainnet3, optimism, igp)
  • GitHub Check: env-test-matrix (mainnet3, arbitrum, core)
  • GitHub Check: cli-cosmos-e2e-matrix (warp-deploy)
  • GitHub Check: env-test-matrix (mainnet3, arbitrum, igp)
  • GitHub Check: cli-cosmos-e2e-matrix (warp-read)
  • GitHub Check: env-test-matrix (mainnet3, ethereum, core)
  • GitHub Check: cli-radix-e2e-matrix (core-apply)
  • GitHub Check: cli-radix-e2e-matrix (warp-deploy)
  • GitHub Check: cli-cosmos-e2e-matrix (core-read)
  • GitHub Check: cli-cosmos-e2e-matrix (core-deploy)
  • GitHub Check: cli-radix-e2e-matrix (core-deploy)
  • GitHub Check: cli-radix-e2e-matrix (warp-apply-ownership-updates)
  • GitHub Check: cli-cosmos-e2e-matrix (core-apply)
  • GitHub Check: cli-cosmos-e2e-matrix (core-check)
  • GitHub Check: cli-radix-e2e-matrix (warp-apply-route-extension)
  • GitHub Check: cli-install-test-run
  • GitHub Check: cli-cross-chain-e2e-matrix (warp-deploy)
  • GitHub Check: aleo-sdk-e2e-run
  • GitHub Check: cli-cross-chain-e2e-matrix (warp-apply)
  • GitHub Check: cosmos-sdk-e2e-run
  • GitHub Check: pnpm-test-run
  • GitHub Check: infra-test
  • GitHub Check: build-and-push-to-gcr
  • GitHub Check: build-and-push-to-gcr
  • GitHub Check: Greptile Review
  • GitHub Check: lint-rs
  • GitHub Check: lander-coverage
  • GitHub Check: test-rs
  • GitHub Check: e2e-matrix (evm)
  • GitHub Check: agent-configs (testnet4)
  • GitHub Check: agent-configs (mainnet3)
🔇 Additional comments (3)
typescript/ccip-server/Dockerfile (1)

97-101: Proper build-arg to runtime ENV propagation.

The pattern correctly captures the build-time SERVICE_VERSION and makes it available at runtime. The 'dev' default ensures the container works even without the build arg, which is handy for local development.

typescript/ccip-server/src/server.ts (1)

26-31: Clean environment-based version handling.

Reading SERVICE_VERSION from the environment with a sensible 'dev' fallback makes this work smoothly in both production and local development. The version now accurately reflects the actual deployed build rather than the package metadata.

.github/workflows/ccip-server-docker.yml (1)

113-113: SERVICE_VERSION build-arg is solid, just make sure the pattern's consistent.

The SHA-timestamp format creates unique, sortable version identifiers that properly distinguish builds from the same commit. This follows the same pattern already used in rust-docker and monorepo-docker workflows, so you're in good company.

@paulbalaji paulbalaji added this pull request to the merge queue Dec 30, 2025
Merged via the queue into main with commit 6938864 Dec 30, 2025
92 checks passed
@paulbalaji paulbalaji deleted the pbio/ccip-server-version-fix branch December 30, 2025 14:04
@github-project-automation github-project-automation bot moved this from In Review to Done in Hyperlane Tasks Dec 30, 2025
@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.02%. Comparing base (9f0351a) to head (b9c592a).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7674   +/-   ##
=======================================
  Coverage   77.02%   77.02%           
=======================================
  Files         117      117           
  Lines        2651     2651           
  Branches      244      244           
=======================================
  Hits         2042     2042           
  Misses        593      593           
  Partials       16       16           
Components Coverage Δ
core 87.80% <ø> (ø)
hooks 71.86% <ø> (ø)
isms 81.10% <ø> (ø)
token 86.67% <ø> (ø)
middlewares 84.98% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants