Maint: rename BUILD_DATE to CREATED

This commit is contained in:
Quentin McGaw (desktop)
2021-07-20 15:28:02 +00:00
parent cb0e89a38e
commit 1e0bfc3b0c
5 changed files with 16 additions and 16 deletions

View File

@@ -73,7 +73,7 @@ jobs:
BRANCH=${GITHUB_REF#refs/heads/} BRANCH=${GITHUB_REF#refs/heads/}
TAG=${GITHUB_REF#refs/tags/} TAG=${GITHUB_REF#refs/tags/}
echo ::set-output name=commit::$(git rev-parse --short HEAD) echo ::set-output name=commit::$(git rev-parse --short HEAD)
echo ::set-output name=build_date::$(date -u +%Y-%m-%dT%H:%M:%SZ) echo ::set-output name=created::$(date -u +%Y-%m-%dT%H:%M:%SZ)
if [ "$TAG" != "$GITHUB_REF" ]; then if [ "$TAG" != "$GITHUB_REF" ]; then
echo ::set-output name=version::$TAG echo ::set-output name=version::$TAG
echo ::set-output name=platforms::linux/amd64,linux/386,linux/arm64,linux/arm/v6,linux/arm/v7,linux/ppc64le echo ::set-output name=platforms::linux/amd64,linux/386,linux/arm64,linux/arm/v6,linux/arm/v7,linux/ppc64le
@@ -90,7 +90,7 @@ jobs:
with: with:
platforms: ${{ steps.vars.outputs.platforms }} platforms: ${{ steps.vars.outputs.platforms }}
build-args: | build-args: |
BUILD_DATE=${{ steps.vars.outputs.build_date }} CREATED=${{ steps.vars.outputs.created }}
COMMIT=${{ steps.vars.outputs.commit }} COMMIT=${{ steps.vars.outputs.commit }}
VERSION=${{ steps.vars.outputs.version }} VERSION=${{ steps.vars.outputs.version }}
ALLTARGETPLATFORMS=${{ steps.vars.outputs.platforms }} ALLTARGETPLATFORMS=${{ steps.vars.outputs.platforms }}

View File

@@ -43,24 +43,24 @@ FROM --platform=${BUILDPLATFORM} base AS build
ARG TARGETPLATFORM ARG TARGETPLATFORM
ARG ALLTARGETPLATFORMS=${TARGETPLATFORM} ARG ALLTARGETPLATFORMS=${TARGETPLATFORM}
ARG VERSION=unknown ARG VERSION=unknown
ARG BUILD_DATE="an unknown date" ARG CREATED="an unknown date"
ARG COMMIT=unknown ARG COMMIT=unknown
RUN xcputranslate sleep -targetplatform ${TARGETPLATFORM} -buildtime=10s -order=${ALLTARGETPLATFORMS} RUN xcputranslate sleep -targetplatform ${TARGETPLATFORM} -buildtime=10s -order=${ALLTARGETPLATFORMS}
RUN GOARCH="$(xcputranslate translate -field arch -targetplatform ${TARGETPLATFORM})" \ RUN GOARCH="$(xcputranslate translate -field arch -targetplatform ${TARGETPLATFORM})" \
GOARM="$(xcputranslate translate -field arm -targetplatform ${TARGETPLATFORM})" \ GOARM="$(xcputranslate translate -field arm -targetplatform ${TARGETPLATFORM})" \
go build -trimpath -ldflags="-s -w \ go build -trimpath -ldflags="-s -w \
-X 'main.version=$VERSION' \ -X 'main.version=$VERSION' \
-X 'main.buildDate=$BUILD_DATE' \ -X 'main.buildDate=$CREATED' \
-X 'main.commit=$COMMIT' \ -X 'main.commit=$COMMIT' \
" -o entrypoint cmd/gluetun/main.go " -o entrypoint cmd/gluetun/main.go
FROM alpine:${ALPINE_VERSION} FROM alpine:${ALPINE_VERSION}
ARG VERSION=unknown ARG VERSION=unknown
ARG BUILD_DATE="an unknown date" ARG CREATED="an unknown date"
ARG COMMIT=unknown ARG COMMIT=unknown
LABEL \ LABEL \
org.opencontainers.image.authors="quentin.mcgaw@gmail.com" \ org.opencontainers.image.authors="quentin.mcgaw@gmail.com" \
org.opencontainers.image.created=$BUILD_DATE \ org.opencontainers.image.created=$CREATED \
org.opencontainers.image.version=$VERSION \ org.opencontainers.image.version=$VERSION \
org.opencontainers.image.revision=$COMMIT \ org.opencontainers.image.revision=$COMMIT \
org.opencontainers.image.url="https://github.com/qdm12/gluetun" \ org.opencontainers.image.url="https://github.com/qdm12/gluetun" \

View File

@@ -43,9 +43,9 @@ import (
//nolint:gochecknoglobals //nolint:gochecknoglobals
var ( var (
version = "unknown" version = "unknown"
commit = "unknown" commit = "unknown"
buildDate = "an unknown date" created = "an unknown date"
) )
var ( var (
@@ -55,9 +55,9 @@ var (
func main() { func main() {
buildInfo := models.BuildInformation{ buildInfo := models.BuildInformation{
Version: version, Version: version,
Commit: commit, Commit: commit,
BuildDate: buildDate, Created: created,
} }
ctx := context.Background() ctx := context.Background()

View File

@@ -15,7 +15,7 @@ func Splash(buildInfo models.BuildInformation) string {
lines := title() lines := title()
lines = append(lines, "") lines = append(lines, "")
lines = append(lines, fmt.Sprintf("Running version %s built on %s (commit %s)", lines = append(lines, fmt.Sprintf("Running version %s built on %s (commit %s)",
buildInfo.Version, buildInfo.BuildDate, buildInfo.Commit)) buildInfo.Version, buildInfo.Created, buildInfo.Commit))
lines = append(lines, "") lines = append(lines, "")
lines = append(lines, announcement()...) lines = append(lines, announcement()...)
lines = append(lines, "") lines = append(lines, "")

View File

@@ -1,7 +1,7 @@
package models package models
type BuildInformation struct { type BuildInformation struct {
Version string `json:"version"` Version string `json:"version"`
Commit string `json:"commit"` Commit string `json:"commit"`
BuildDate string `json:"build_date"` Created string `json:"created"`
} }