mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-24 20:18:13 +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
|
- -s -w
|
||||||
- -X github.com/pomerium/pomerium/internal/version.Version={{.Version}}
|
- -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.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.ProjectName=pomerium
|
||||||
- -X github.com/pomerium/pomerium/internal/version.ProjectURL=https://www.pomerium.io
|
- -X github.com/pomerium/pomerium/internal/version.ProjectURL=https://www.pomerium.io
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,9 @@ package version
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -18,10 +20,20 @@ var (
|
||||||
GitCommit = ""
|
GitCommit = ""
|
||||||
// BuildMeta specifies release type (dev,rc1,beta,etc)
|
// BuildMeta specifies release type (dev,rc1,beta,etc)
|
||||||
BuildMeta = ""
|
BuildMeta = ""
|
||||||
|
// Timestamp specifies the build time, set by the compiler as UNIX timestamp.
|
||||||
|
Timestamp = ""
|
||||||
|
|
||||||
runtimeVersion = runtime.Version()
|
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.
|
// FullVersion returns a version string.
|
||||||
func FullVersion() string {
|
func FullVersion() string {
|
||||||
var sb strings.Builder
|
var sb strings.Builder
|
||||||
|
|
|
@ -34,10 +34,13 @@ import (
|
||||||
func Run(ctx context.Context, src config.Source) error {
|
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...) }))
|
_, _ = 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("envoy_version", files.FullVersion()).
|
||||||
Str("version", version.FullVersion()).
|
Str("version", version.FullVersion())
|
||||||
Msg("cmd/pomerium")
|
if buildTime := version.BuildTime(); buildTime != "" {
|
||||||
|
evt = evt.Str("built", buildTime)
|
||||||
|
}
|
||||||
|
evt.Msg("cmd/pomerium")
|
||||||
|
|
||||||
src, err := config.NewLayeredSource(ctx, src, derivecert_config.NewBuilder())
|
src, err := config.NewLayeredSource(ctx, src, derivecert_config.NewBuilder())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue