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 Mar 28, 2024
1 parent f728c4f commit 060026f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ jobs:
${{ steps.docker_meta.outputs.bake-file }}
./docker-bake.platforms.hcl
targets: rollups-node
set: rollups-node.args.ROLLUPS_NODE_VERSION=${{ steps.docker_meta.outputs.version }}
push: true
project: ${{ vars.DEPOT_PROJECT }}
workdir: build
Expand Down
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 @@ -280,6 +281,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 @@ -289,7 +291,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
3 changes: 3 additions & 0 deletions build/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ target "common" {
target "rollups-node" {
inherits = ["common"]
target = "rollups-node"
args = {
ROLLUPS_NODE_VERSION = "devel"
}
}

target "rollups-node-snapshot" {
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 @@ -17,6 +17,12 @@ import (
"github.com/mattn/go-isatty"
)

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

func main() {
startTime := time.Now()

Expand All @@ -34,7 +40,7 @@ func main() {
handler := tint.NewHandler(os.Stdout, opts)
logger := slog.New(handler)
slog.SetDefault(logger)
slog.Info("Starting the Cartesi Rollups Node", "config", config)
slog.Info("Starting the Cartesi Rollups Node", "version", buildVersion, "config", config)

// create the node supervisor
supervisor, err := node.Setup(ctx, config)
Expand Down

0 comments on commit 060026f

Please sign in to comment.