Skip to content

Commit

Permalink
feat: log cartesi-rollups-node version on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
torives committed Feb 23, 2024
1 parent 53b2c16 commit 92081a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ARG ROOTFS_VERSION
ARG LINUX_VERSION
ARG LINUX_KERNEL_VERSION
ARG ROM_VERSION
ARG ROLLUPS_NODE_VERSION

# Build directories.
ARG SNAPSHOT_BUILD_PATH=/build/snapshot
Expand Down Expand Up @@ -284,6 +285,7 @@ RUN cargo build --release
# First it downloads the external dependencies and then it builds the binaries.
FROM golang:${GO_VERSION}-bookworm as go-builder
ARG GO_BUILD_PATH
ARG ROLLUPS_NODE_VERSION
WORKDIR ${GO_BUILD_PATH}

# Download external dependencies.
Expand All @@ -293,7 +295,7 @@ RUN go mod download

# Build application.
COPY . .
RUN go build -ldflags "-s -w" ./cmd/cartesi-rollups-node
RUN go build -ldflags "-s -w -X 'main.buildVersion=${ROLLUPS_NODE_VERSION}'" ./cmd/cartesi-rollups-node

# STAGE: server-manager
#
Expand Down
1 change: 1 addition & 0 deletions build/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ target "common" {
LINUX_VERSION = "0.17.0"
LINUX_KERNEL_VERSION = "5.15.63-ctsi-2-v0.17.0"
ROM_VERSION = "0.17.0"
ROLLUPS_NODE_VERSION = "${TAG}"
}
}

Expand Down
8 changes: 7 additions & 1 deletion cmd/cartesi-rollups-node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ import (
"github.com/cartesi/rollups-node/internal/services"
)

var (
// Should be overridden during the final release build with ldflags
// to contain the actual version number
buildVersion = "devel"
)

func main() {
startTime := time.Now()
var s []services.Service
Expand All @@ -23,7 +29,7 @@ func main() {

nodeConfig := config.NewNodeConfigFromEnv()
config.InitLog(nodeConfig)
slog.Info("Starting Cartesi Rollups Node", "config", nodeConfig)
slog.Info("Starting Cartesi Rollups Node", "version", buildVersion, "config", nodeConfig)

sunodoValidatorEnabled := nodeConfig.CartesiExperimentalSunodoValidatorEnabled
if !sunodoValidatorEnabled {
Expand Down

0 comments on commit 92081a1

Please sign in to comment.