mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-28 09:56:31 +02:00
ci: do not include timestamp into buildmeta (#5215)
This commit is contained in:
parent
1f2f20d792
commit
3483447c37
3 changed files with 19 additions and 4 deletions
2
.github/goreleaser.yaml
vendored
2
.github/goreleaser.yaml
vendored
|
@ -34,7 +34,7 @@ builds:
|
|||
- -s -w
|
||||
- -X github.com/pomerium/pomerium/internal/version.Version={{.Version}}
|
||||
- -X github.com/pomerium/pomerium/internal/version.GitCommit={{.ShortCommit}}
|
||||
- -X github.com/pomerium/pomerium/internal/version.BuildMeta={{.Timestamp}}
|
||||
- -X github.com/pomerium/pomerium/internal/version.Timestamp={{.Timestamp}}
|
||||
- -X github.com/pomerium/pomerium/internal/version.ProjectName=pomerium
|
||||
- -X github.com/pomerium/pomerium/internal/version.ProjectURL=https://www.pomerium.io
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@ package version
|
|||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -18,10 +20,20 @@ var (
|
|||
GitCommit = ""
|
||||
// BuildMeta specifies release type (dev,rc1,beta,etc)
|
||||
BuildMeta = ""
|
||||
// Timestamp specifies the build time, set by the compiler as UNIX timestamp.
|
||||
Timestamp = ""
|
||||
|
||||
runtimeVersion = runtime.Version()
|
||||
)
|
||||
|
||||
func BuildTime() string {
|
||||
tm, err := strconv.Atoi(Timestamp)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return time.Unix(int64(tm), 0).UTC().Format(time.RFC3339)
|
||||
}
|
||||
|
||||
// FullVersion returns a version string.
|
||||
func FullVersion() string {
|
||||
var sb strings.Builder
|
||||
|
|
|
@ -34,10 +34,13 @@ import (
|
|||
func Run(ctx context.Context, src config.Source) error {
|
||||
_, _ = maxprocs.Set(maxprocs.Logger(func(s string, i ...any) { log.Debug(context.Background()).Msgf(s, i...) }))
|
||||
|
||||
log.Info(ctx).
|
||||
evt := log.Info(ctx).
|
||||
Str("envoy_version", files.FullVersion()).
|
||||
Str("version", version.FullVersion()).
|
||||
Msg("cmd/pomerium")
|
||||
Str("version", version.FullVersion())
|
||||
if buildTime := version.BuildTime(); buildTime != "" {
|
||||
evt = evt.Str("built", buildTime)
|
||||
}
|
||||
evt.Msg("cmd/pomerium")
|
||||
|
||||
src, err := config.NewLayeredSource(ctx, src, derivecert_config.NewBuilder())
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue