mirror of
https://github.com/hauler-dev/hauler.git
synced 2026-08-27 14:07:17 +00:00
add hauler version to store metadata
This commit is contained in:
+7
-2
@@ -25,6 +25,7 @@ import (
|
||||
zlog "github.com/rs/zerolog/log"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"hauler.dev/go/hauler/v2/internal/version"
|
||||
"hauler.dev/go/hauler/v2/pkg/artifacts"
|
||||
"hauler.dev/go/hauler/v2/pkg/consts"
|
||||
"hauler.dev/go/hauler/v2/pkg/content"
|
||||
@@ -101,7 +102,8 @@ func NewLayout(rootdir string, opts ...Options) (*Layout, error) {
|
||||
}
|
||||
|
||||
type storeMetadata struct {
|
||||
StoreID string `json:"store-id"`
|
||||
StoreID string `json:"store-id"`
|
||||
HaulerVersion string `json:"hauler-version"`
|
||||
}
|
||||
|
||||
// loadOrCreateStoreID returns the persistent store identity from <rootdir>/store.json,
|
||||
@@ -118,7 +120,10 @@ func loadOrCreateStoreID(rootdir string) string {
|
||||
zlog.Warn().Str("path", metaPath).Msg("store metadata missing store-id... generating new store id")
|
||||
}
|
||||
}
|
||||
m := storeMetadata{StoreID: uuid.New().String()}
|
||||
m := storeMetadata{
|
||||
StoreID: uuid.New().String(),
|
||||
HaulerVersion: version.GetVersionInfo().GitVersion,
|
||||
}
|
||||
data, err := json.Marshal(m)
|
||||
if err != nil {
|
||||
zlog.Warn().Err(err).Msg("failed to marshal store metadata... store id will not persist across runs")
|
||||
|
||||
Reference in New Issue
Block a user