constants: make VersionInfo readonly (#1316)

The variable VersionInfo is supposed to be set by `go build -X ...` during link time but should not be modified at runtime.
This change ensures the underlying var is private and can only be accessed by a public getter.
This commit is contained in:
Malte Poll 2023-03-01 11:55:12 +01:00 committed by GitHub
parent 0157537852
commit fc33a74c78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 43 additions and 43 deletions

View File

@ -46,7 +46,7 @@ add_custom_target(upgrade-agent ALL
# cli # cli
# #
add_custom_target(cli ALL add_custom_target(cli ALL
CGO_ENABLED=0 go build -o ${CMAKE_BINARY_DIR}/constellation -tags='${CLI_BUILD_TAGS}' -ldflags "-buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.VersionInfo=${PROJECT_VERSION}" CGO_ENABLED=0 go build -o ${CMAKE_BINARY_DIR}/constellation -tags='${CLI_BUILD_TAGS}' -ldflags "-buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.versionInfo=${PROJECT_VERSION}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/cli WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/cli
BYPRODUCTS constellation BYPRODUCTS constellation
) )
@ -73,7 +73,7 @@ add_custom_target(debugd ALL
# cdbg # cdbg
# #
add_custom_target(cdbg ALL add_custom_target(cdbg ALL
CGO_ENABLED=0 go build -o ${CMAKE_BINARY_DIR}/cdbg -buildvcs=false -ldflags "-buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.VersionInfo=${PROJECT_VERSION}" CGO_ENABLED=0 go build -o ${CMAKE_BINARY_DIR}/cdbg -buildvcs=false -ldflags "-buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.versionInfo=${PROJECT_VERSION}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/debugd/cmd/cdbg WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/debugd/cmd/cdbg
BYPRODUCTS cdbg BYPRODUCTS cdbg
) )

View File

@ -28,19 +28,19 @@ FROM build AS build-bootstrapper
WORKDIR /constellation/bootstrapper/ WORKDIR /constellation/bootstrapper/
ARG PROJECT_VERSION ARG PROJECT_VERSION
RUN --mount=type=cache,target=/root/.cache/go-build go build -o bootstrapper -tags=disable_tpm_simulator -buildvcs=false -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.VersionInfo=${PROJECT_VERSION}" ./cmd/bootstrapper/ RUN --mount=type=cache,target=/root/.cache/go-build go build -o bootstrapper -tags=disable_tpm_simulator -buildvcs=false -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.versionInfo=${PROJECT_VERSION}" ./cmd/bootstrapper/
FROM build AS build-disk-mapper FROM build AS build-disk-mapper
WORKDIR /constellation/disk-mapper/ WORKDIR /constellation/disk-mapper/
ARG PROJECT_VERSION ARG PROJECT_VERSION
RUN --mount=type=cache,target=/root/.cache/go-build go build -o disk-mapper -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.VersionInfo=${PROJECT_VERSION}" ./cmd/ RUN --mount=type=cache,target=/root/.cache/go-build go build -o disk-mapper -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.versionInfo=${PROJECT_VERSION}" ./cmd/
FROM build AS build-upgrade-agent FROM build AS build-upgrade-agent
WORKDIR /constellation/upgrade-agent/ WORKDIR /constellation/upgrade-agent/
ARG PROJECT_VERSION ARG PROJECT_VERSION
RUN --mount=type=cache,target=/root/.cache/go-build go build -o upgrade-agent -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.VersionInfo=${PROJECT_VERSION}" ./cmd/ RUN --mount=type=cache,target=/root/.cache/go-build go build -o upgrade-agent -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.versionInfo=${PROJECT_VERSION}" ./cmd/
FROM scratch AS bootstrapper FROM scratch AS bootstrapper
COPY --from=build-bootstrapper /constellation/bootstrapper/bootstrapper / COPY --from=build-bootstrapper /constellation/bootstrapper/bootstrapper /

View File

@ -32,7 +32,7 @@ func run(issuer atls.Issuer, tpm vtpm.TPMOpenFunc, fileHandler file.Handler,
) { ) {
defer cloudLogger.Close() defer cloudLogger.Close()
log.With(zap.String("version", constants.VersionInfo)).Infof("Starting bootstrapper") log.With(zap.String("version", constants.VersionInfo())).Infof("Starting bootstrapper")
cloudLogger.Disclose("bootstrapper started running...") cloudLogger.Disclose("bootstrapper started running...")
uuid, err := getDiskUUID() uuid, err := getDiskUUID()

View File

@ -250,7 +250,6 @@ func TestConfigFetchMeasurements(t *testing.T) {
gcpConfig := defaultConfigWithExpectedMeasurements(t, config.Default(), cloudprovider.GCP) gcpConfig := defaultConfigWithExpectedMeasurements(t, config.Default(), cloudprovider.GCP)
gcpConfig.Image = "v999.999.999" gcpConfig.Image = "v999.999.999"
constants.VersionInfo = "v999.999.999"
err := fileHandler.WriteYAML(constants.ConfigFilename, gcpConfig, file.OptMkdirAll) err := fileHandler.WriteYAML(constants.ConfigFilename, gcpConfig, file.OptMkdirAll)
require.NoError(err) require.NoError(err)

View File

@ -79,7 +79,7 @@ func runUpgradeCheck(cmd *cobra.Command, args []string) error {
client: http.DefaultClient, client: http.DefaultClient,
rekor: rekor, rekor: rekor,
flags: flags, flags: flags,
cliVersion: compatibility.EnsurePrefixV(constants.VersionInfo), cliVersion: compatibility.EnsurePrefixV(constants.VersionInfo()),
log: log, log: log,
}, },
log: log, log: log,

View File

@ -233,7 +233,6 @@ func TestUpgradeCheck(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)
require := require.New(t) require := require.New(t)
constants.VersionInfo = "v0.0.0"
fileHandler := file.NewHandler(afero.NewMemMapFs()) fileHandler := file.NewHandler(afero.NewMemMapFs())
cfg := defaultConfigWithExpectedMeasurements(t, config.Default(), tc.csp) cfg := defaultConfigWithExpectedMeasurements(t, config.Default(), tc.csp)
require.NoError(fileHandler.WriteYAML(tc.flags.configPath, cfg)) require.NoError(fileHandler.WriteYAML(tc.flags.configPath, cfg))

View File

@ -34,7 +34,7 @@ func runVersion(cmd *cobra.Command, args []string) {
commit, state, date, goVersion, compiler, platform := parseBuildInfo(buildInfo) commit, state, date, goVersion, compiler, platform := parseBuildInfo(buildInfo)
cmd.Printf("Version:\t%s (%s)\n", constants.VersionInfo, constants.VersionBuild) cmd.Printf("Version:\t%s (%s)\n", constants.VersionInfo(), constants.VersionBuild)
cmd.Printf("GitCommit:\t%s\n", commit) cmd.Printf("GitCommit:\t%s\n", commit)
cmd.Printf("GitTreeState:\t%s\n", state) cmd.Printf("GitTreeState:\t%s\n", state)
cmd.Printf("BuildDate:\t%s\n", date) cmd.Printf("BuildDate:\t%s\n", date)

View File

@ -28,7 +28,7 @@ func TestVersionCmd(t *testing.T) {
s, err := io.ReadAll(b) s, err := io.ReadAll(b)
assert.NoError(err) assert.NoError(err)
assert.Contains(string(s), constants.VersionInfo) assert.Contains(string(s), constants.VersionInfo())
} }
func TestParseBuildInfo(t *testing.T) { func TestParseBuildInfo(t *testing.T) {

View File

@ -149,11 +149,11 @@ func (c *Client) upgradeRelease(
values = loader.loadCertManagerValues() values = loader.loadCertManagerValues()
case conOperatorsReleaseName: case conOperatorsReleaseName:
// ensure that the operator chart has the same version as the CLI // ensure that the operator chart has the same version as the CLI
updateVersions(chart, compatibility.EnsurePrefixV(constants.VersionInfo)) updateVersions(chart, compatibility.EnsurePrefixV(constants.VersionInfo()))
values, err = loader.loadOperatorsValues() values, err = loader.loadOperatorsValues()
case conServicesReleaseName: case conServicesReleaseName:
// ensure that the services chart has the same version as the CLI // ensure that the services chart has the same version as the CLI
updateVersions(chart, compatibility.EnsurePrefixV(constants.VersionInfo)) updateVersions(chart, compatibility.EnsurePrefixV(constants.VersionInfo()))
values, err = loader.loadConstellationServicesValues() values, err = loader.loadConstellationServicesValues()
default: default:
return fmt.Errorf("invalid release name: %s", releaseName) return fmt.Errorf("invalid release name: %s", releaseName)

View File

@ -283,7 +283,7 @@ func (i *ChartLoader) loadOperators() (helm.Release, error) {
return helm.Release{}, fmt.Errorf("loading operators chart: %w", err) return helm.Release{}, fmt.Errorf("loading operators chart: %w", err)
} }
updateVersions(chart, compatibility.EnsurePrefixV(constants.VersionInfo)) updateVersions(chart, compatibility.EnsurePrefixV(constants.VersionInfo()))
values, err := i.loadOperatorsValues() values, err := i.loadOperatorsValues()
if err != nil { if err != nil {
@ -370,7 +370,7 @@ func (i *ChartLoader) loadConstellationServices() (helm.Release, error) {
return helm.Release{}, fmt.Errorf("loading constellation-services chart: %w", err) return helm.Release{}, fmt.Errorf("loading constellation-services chart: %w", err)
} }
updateVersions(chart, compatibility.EnsurePrefixV(constants.VersionInfo)) updateVersions(chart, compatibility.EnsurePrefixV(constants.VersionInfo()))
values, err := i.loadConstellationServicesValues() values, err := i.loadConstellationServicesValues()
if err != nil { if err != nil {

View File

@ -57,7 +57,7 @@ func main() {
flag.Parse() flag.Parse()
log := logger.New(logger.JSONLog, logger.VerbosityFromInt(*verbosity)) log := logger.New(logger.JSONLog, logger.VerbosityFromInt(*verbosity))
log.With(zap.String("version", constants.VersionInfo), zap.String("cloudProvider", *csp)). log.With(zap.String("version", constants.VersionInfo()), zap.String("cloudProvider", *csp)).
Infof("Starting disk-mapper") Infof("Starting disk-mapper")
// set up metadata API and quote issuer for aTLS connections // set up metadata API and quote issuer for aTLS connections

View File

@ -14,7 +14,6 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/edgelesssys/constellation/v2/internal/constants"
"golang.org/x/mod/semver" "golang.org/x/mod/semver"
) )
@ -93,8 +92,8 @@ func IsValidUpgrade(a, b string) error {
} }
// BinaryWith tests that this binarie's version is greater or equal than some target version, but not further away than one minor version. // BinaryWith tests that this binarie's version is greater or equal than some target version, but not further away than one minor version.
func BinaryWith(target string) error { func BinaryWith(binaryVersion, target string) error {
binaryVersion := EnsurePrefixV(constants.VersionInfo) binaryVersion = EnsurePrefixV(binaryVersion)
target = EnsurePrefixV(target) target = EnsurePrefixV(target)
if !semver.IsValid(binaryVersion) || !semver.IsValid(target) { if !semver.IsValid(binaryVersion) || !semver.IsValid(target) {
return ErrSemVer return ErrSemVer

View File

@ -9,7 +9,6 @@ package compatibility
import ( import (
"testing" "testing"
"github.com/edgelesssys/constellation/v2/internal/constants"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
@ -144,8 +143,7 @@ func TestBinaryWith(t *testing.T) {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)
constants.VersionInfo = tc.cli err := BinaryWith(tc.cli, tc.target)
err := BinaryWith(tc.target)
if tc.wantError { if tc.wantError {
assert.Error(err) assert.Error(err)
return return

View File

@ -279,7 +279,7 @@ func Default() *Config {
Version: Version2, Version: Version2,
Image: defaultImage, Image: defaultImage,
Name: defaultName, Name: defaultName,
MicroserviceVersion: compatibility.EnsurePrefixV(constants.VersionInfo), MicroserviceVersion: compatibility.EnsurePrefixV(constants.VersionInfo()),
KubernetesVersion: string(versions.Default), KubernetesVersion: string(versions.Default),
StateDiskSizeGB: 30, StateDiskSizeGB: 30,
DebugCluster: toPtr(false), DebugCluster: toPtr(false),

View File

@ -366,18 +366,19 @@ func registerVersionCompatibilityError(ut ut.Translator) error {
} }
func translateVersionCompatibilityError(ut ut.Translator, fe validator.FieldError) string { func translateVersionCompatibilityError(ut ut.Translator, fe validator.FieldError) string {
err := validateVersionCompatibilityHelper(fe.Field(), fe.Value().(string)) binaryVersion := constants.VersionInfo()
err := validateVersionCompatibilityHelper(binaryVersion, fe.Field(), fe.Value().(string))
var msg string var msg string
switch { switch {
case errors.Is(err, compatibility.ErrSemVer): case errors.Is(err, compatibility.ErrSemVer):
msg = fmt.Sprintf("configured version (%s) does not adhere to SemVer syntax", fe.Value().(string)) msg = fmt.Sprintf("configured version (%s) does not adhere to SemVer syntax", fe.Value().(string))
case errors.Is(err, compatibility.ErrMajorMismatch): case errors.Is(err, compatibility.ErrMajorMismatch):
msg = fmt.Sprintf("the CLI's major version (%s) has to match your configured major version (%s). Use --force to ignore the version mismatch.", constants.VersionInfo, fe.Value().(string)) msg = fmt.Sprintf("the CLI's major version (%s) has to match your configured major version (%s). Use --force to ignore the version mismatch.", constants.VersionInfo(), fe.Value().(string))
case errors.Is(err, compatibility.ErrMinorDrift): case errors.Is(err, compatibility.ErrMinorDrift):
msg = fmt.Sprintf("the CLI's minor version (%s) and the configured version (%s) are more than one minor version apart. Use --force to ignore the version mismatch.", constants.VersionInfo, fe.Value().(string)) msg = fmt.Sprintf("the CLI's minor version (%s) and the configured version (%s) are more than one minor version apart. Use --force to ignore the version mismatch.", constants.VersionInfo(), fe.Value().(string))
case errors.Is(err, compatibility.ErrOutdatedCLI): case errors.Is(err, compatibility.ErrOutdatedCLI):
msg = fmt.Sprintf("the CLI's version (%s) is older than the configured version (%s). Use --force to ignore the version mismatch.", constants.VersionInfo, fe.Value().(string)) msg = fmt.Sprintf("the CLI's version (%s) is older than the configured version (%s). Use --force to ignore the version mismatch.", constants.VersionInfo(), fe.Value().(string))
default: default:
msg = err.Error() msg = err.Error()
} }
@ -389,14 +390,15 @@ func translateVersionCompatibilityError(ut ut.Translator, fe validator.FieldErro
// Check that the validated field and the CLI version are not more than one minor version apart. // Check that the validated field and the CLI version are not more than one minor version apart.
func validateVersionCompatibility(fl validator.FieldLevel) bool { func validateVersionCompatibility(fl validator.FieldLevel) bool {
if err := validateVersionCompatibilityHelper(fl.FieldName(), fl.Field().String()); err != nil { binaryVersion := constants.VersionInfo()
if err := validateVersionCompatibilityHelper(binaryVersion, fl.FieldName(), fl.Field().String()); err != nil {
return false return false
} }
return true return true
} }
func validateVersionCompatibilityHelper(fieldName string, configuredVersion string) error { func validateVersionCompatibilityHelper(binaryVersion, fieldName, configuredVersion string) error {
if fieldName == "Image" { if fieldName == "Image" {
imageVersion, err := versionsapi.NewVersionFromShortPath(configuredVersion, versionsapi.VersionKindImage) imageVersion, err := versionsapi.NewVersionFromShortPath(configuredVersion, versionsapi.VersionKindImage)
if err != nil { if err != nil {
@ -406,14 +408,14 @@ func validateVersionCompatibilityHelper(fieldName string, configuredVersion stri
} }
if fieldName == "MicroserviceVersion" { if fieldName == "MicroserviceVersion" {
cliVersion := compatibility.EnsurePrefixV(constants.VersionInfo) cliVersion := compatibility.EnsurePrefixV(binaryVersion)
serviceVersion := compatibility.EnsurePrefixV(configuredVersion) serviceVersion := compatibility.EnsurePrefixV(configuredVersion)
if semver.Compare(cliVersion, serviceVersion) == -1 { if semver.Compare(cliVersion, serviceVersion) == -1 {
return fmt.Errorf("the CLI's version (%s) is older than the configured version (%s)", cliVersion, serviceVersion) return fmt.Errorf("the CLI's version (%s) is older than the configured version (%s)", cliVersion, serviceVersion)
} }
} }
return compatibility.BinaryWith(configuredVersion) return compatibility.BinaryWith(binaryVersion, configuredVersion)
} }
func returnsTrue(fl validator.FieldLevel) bool { func returnsTrue(fl validator.FieldLevel) bool {

View File

@ -9,7 +9,6 @@ package config
import ( import (
"testing" "testing"
"github.com/edgelesssys/constellation/v2/internal/constants"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
@ -39,8 +38,7 @@ func TestValidateVersionCompatibilityHelper(t *testing.T) {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)
constants.VersionInfo = tc.cli err := validateVersionCompatibilityHelper(tc.cli, "Image", tc.target)
err := validateVersionCompatibilityHelper("Image", tc.target)
if tc.wantError { if tc.wantError {
assert.Error(err) assert.Error(err)
return return

View File

@ -182,5 +182,10 @@ const (
CDNAPIPrefix = "constellation/v1" CDNAPIPrefix = "constellation/v1"
) )
// VersionInfo is the version of a binary. Left as a separate variable to allow override during build. // VersionInfo returns the version of a binary.
var VersionInfo = "0.0.0" func VersionInfo() string {
return versionInfo
}
// versionInfo is the version of a binary. Left as a separate variable to allow override during build.
var versionInfo = "0.0.0"

View File

@ -70,7 +70,7 @@ func (v Semver) IsUpgradeTo(other Semver) bool {
// CompatibleWithBinary returns if a version is compatible version of the current built binary. // CompatibleWithBinary returns if a version is compatible version of the current built binary.
// It checks if the version of the binary is equal or greater than the current version and allows a drift of at most one minor version. // It checks if the version of the binary is equal or greater than the current version and allows a drift of at most one minor version.
func (v Semver) CompatibleWithBinary() bool { func (v Semver) CompatibleWithBinary() bool {
binaryVersion, err := NewSemver(constants.VersionInfo) binaryVersion, err := NewSemver(constants.VersionInfo())
if err != nil { if err != nil {
return false return false
} }

View File

@ -23,7 +23,7 @@ RUN rm -rf ./hack/
WORKDIR /constellation/joinservice WORKDIR /constellation/joinservice
ARG PROJECT_VERSION=0.0.0 ARG PROJECT_VERSION=0.0.0
RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -o join-service -trimpath -buildvcs=false -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.VersionInfo=${PROJECT_VERSION}" ./cmd/ RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -o join-service -trimpath -buildvcs=false -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.versionInfo=${PROJECT_VERSION}" ./cmd/
# Use gcr.io/distroless/static here since we need CA certificates to be installed for aTLS operations on GCP. # Use gcr.io/distroless/static here since we need CA certificates to be installed for aTLS operations on GCP.
FROM gcr.io/distroless/static@sha256:5b2fa762fb6ebf66ff88ae1db2dc4ad8fc6ddf1164477297dfac1a09f20e7339 as release FROM gcr.io/distroless/static@sha256:5b2fa762fb6ebf66ff88ae1db2dc4ad8fc6ddf1164477297dfac1a09f20e7339 as release

View File

@ -45,7 +45,7 @@ func main() {
flag.Parse() flag.Parse()
log := logger.New(logger.JSONLog, logger.VerbosityFromInt(*verbosity)) log := logger.New(logger.JSONLog, logger.VerbosityFromInt(*verbosity))
log.With(zap.String("version", constants.VersionInfo), zap.String("cloudProvider", *provider)). log.With(zap.String("version", constants.VersionInfo()), zap.String("cloudProvider", *provider)).
Infof("Constellation Node Join Service") Infof("Constellation Node Join Service")
handler := file.NewHandler(afero.NewOsFs()) handler := file.NewHandler(afero.NewOsFs())

View File

@ -24,7 +24,7 @@ RUN rm -rf ./hack/
RUN mkdir -p /constellation/build RUN mkdir -p /constellation/build
WORKDIR /constellation/keyservice/cmd WORKDIR /constellation/keyservice/cmd
ARG PROJECT_VERSION=0.0.0 ARG PROJECT_VERSION=0.0.0
RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -o /constellation/build/keyservice -trimpath -buildvcs=false -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.VersionInfo=${PROJECT_VERSION}" RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -o /constellation/build/keyservice -trimpath -buildvcs=false -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.versionInfo=${PROJECT_VERSION}"
FROM gcr.io/distroless/static:nonroot@sha256:9ec950c09380320e203369982691eb821df6a6974edf9f4bb8e661d4b77b9d99 as release FROM gcr.io/distroless/static:nonroot@sha256:9ec950c09380320e203369982691eb821df6a6974edf9f4bb8e661d4b77b9d99 as release
COPY --from=build /constellation/build/keyservice /keyservice COPY --from=build /constellation/build/keyservice /keyservice

View File

@ -33,7 +33,7 @@ func main() {
flag.Parse() flag.Parse()
log := logger.New(logger.JSONLog, logger.VerbosityFromInt(*verbosity)) log := logger.New(logger.JSONLog, logger.VerbosityFromInt(*verbosity))
log.With(zap.String("version", constants.VersionInfo)). log.With(zap.String("version", constants.VersionInfo())).
Infof("Constellation Key Management Service") Infof("Constellation Key Management Service")
// read master secret and salt // read master secret and salt

View File

@ -23,7 +23,7 @@ RUN rm -rf ./hack/
WORKDIR /constellation/verify WORKDIR /constellation/verify
ARG PROJECT_VERSION=0.0.0 ARG PROJECT_VERSION=0.0.0
RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -o verify-service -trimpath -buildvcs=false -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.VersionInfo=${PROJECT_VERSION}" ./cmd/ RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -o verify-service -trimpath -buildvcs=false -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/v2/internal/constants.versionInfo=${PROJECT_VERSION}" ./cmd/
FROM scratch AS release FROM scratch AS release
COPY --from=build /constellation/verify/verify-service /verify COPY --from=build /constellation/verify/verify-service /verify

View File

@ -29,7 +29,7 @@ func main() {
flag.Parse() flag.Parse()
log := logger.New(logger.JSONLog, logger.VerbosityFromInt(*verbosity)) log := logger.New(logger.JSONLog, logger.VerbosityFromInt(*verbosity))
log.With(zap.String("version", constants.VersionInfo), zap.String("cloudProvider", *provider)). log.With(zap.String("version", constants.VersionInfo()), zap.String("cloudProvider", *provider)).
Infof("Constellation Verification Service") Infof("Constellation Verification Service")
var issuer server.AttestationIssuer var issuer server.AttestationIssuer