From 9b785df9c62f5b7499c607ae6c8f9ae9338145fb Mon Sep 17 00:00:00 2001 From: Guilherme Oliveira Date: Wed, 4 Mar 2026 10:56:18 +0100 Subject: [PATCH] feat(backend): log version at boot Log the application version immediately after logger initialization in both control-plane and artifact-cas services, making it available in logs even when the API is not yet reachable. Closes #1070 Signed-off-by: ghophp Signed-off-by: Guilherme Oliveira --- app/artifact-cas/cmd/main.go | 4 +++- app/controlplane/cmd/main.go | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/artifact-cas/cmd/main.go b/app/artifact-cas/cmd/main.go index 5483653d9..48f282264 100644 --- a/app/artifact-cas/cmd/main.go +++ b/app/artifact-cas/cmd/main.go @@ -1,5 +1,5 @@ // -// Copyright 2024 The Chainloop Authors. +// Copyright 2024-2026 The Chainloop Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -118,6 +118,8 @@ func main() { panic(err) } + _ = logger.Log(log.LevelInfo, "msg", "starting artifact-cas service", "version", Version) + flush, err := initSentry(&bc, logger) defer flush() if err != nil { diff --git a/app/controlplane/cmd/main.go b/app/controlplane/cmd/main.go index 422a94473..aad2e6eb0 100644 --- a/app/controlplane/cmd/main.go +++ b/app/controlplane/cmd/main.go @@ -121,6 +121,8 @@ func main() { logger = log.NewFilter(logger, log.FilterFunc(filterSensitiveArgs)) + _ = logger.Log(log.LevelInfo, "msg", "starting control-plane service", "version", Version) + flush, err := initSentry(&bc, logger) defer flush() if err != nil { @@ -177,17 +179,17 @@ func main() { if app.casBackendChecker != nil { go app.casBackendChecker.Start(ctx, &biz.CASBackendCheckerOpts{ - CheckInterval: 30 * time.Minute, - InitialDelay: initialDelay, - OnlyDefaultsOrFallbacks: toPtr(true), + CheckInterval: 30 * time.Minute, + InitialDelay: initialDelay, + OnlyDefaultsOrFallbacks: toPtr(true), }) // Start the background CAS Backend checker for ALL backends (every 24 hours) // Start around 24h mark to avoid overlap with default checker go app.casBackendChecker.Start(ctx, &biz.CASBackendCheckerOpts{ - CheckInterval: 24 * time.Hour, - InitialDelay: (24 * time.Hour) + jitter, - OnlyDefaultsOrFallbacks: toPtr(false), + CheckInterval: 24 * time.Hour, + InitialDelay: (24 * time.Hour) + jitter, + OnlyDefaultsOrFallbacks: toPtr(false), }) }