mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 12:58:02 +08:00
refactor(build): move build metadata to pkg/buildinfo (#4045)
Keep CLI binaries from importing pkg/api/config just for version strings by centralizing Commit/ReleaseTag/BinaryType/GoVersion in a tiny buildinfo package. Update ldflags targets and callers accordingly. Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
This commit is contained in:
@@ -11,20 +11,15 @@ import (
|
||||
distspec "github.com/opencontainers/distribution-spec/specs-go"
|
||||
"github.com/tiendc/go-deepcopy"
|
||||
|
||||
"zotregistry.dev/zot/v2/pkg/buildinfo"
|
||||
"zotregistry.dev/zot/v2/pkg/compat"
|
||||
extconf "zotregistry.dev/zot/v2/pkg/extensions/config"
|
||||
storageConstants "zotregistry.dev/zot/v2/pkg/storage/constants"
|
||||
)
|
||||
|
||||
var (
|
||||
Commit string //nolint: gochecknoglobals
|
||||
ReleaseTag string //nolint: gochecknoglobals
|
||||
BinaryType string //nolint: gochecknoglobals
|
||||
GoVersion string //nolint: gochecknoglobals
|
||||
|
||||
openIDSupportedProviders = [...]string{"google", "gitlab", "oidc"} //nolint: gochecknoglobals
|
||||
oauth2SupportedProviders = [...]string{"github"} //nolint: gochecknoglobals
|
||||
|
||||
)
|
||||
|
||||
type StorageConfig struct {
|
||||
@@ -660,10 +655,10 @@ type Config struct {
|
||||
func New() *Config {
|
||||
return &Config{
|
||||
DistSpecVersion: distspec.Version,
|
||||
GoVersion: GoVersion,
|
||||
Commit: Commit,
|
||||
ReleaseTag: ReleaseTag,
|
||||
BinaryType: BinaryType,
|
||||
GoVersion: buildinfo.GoVersion,
|
||||
Commit: buildinfo.Commit,
|
||||
ReleaseTag: buildinfo.ReleaseTag,
|
||||
BinaryType: buildinfo.BinaryType,
|
||||
Storage: GlobalStorageConfig{
|
||||
StorageConfig: StorageConfig{
|
||||
Dedupe: true,
|
||||
|
||||
Reference in New Issue
Block a user