From 5914f96de4dd6c52c3764948ad67aaee75cb5206 Mon Sep 17 00:00:00 2001 From: Amir Zarrinkafsh Date: Mon, 13 Jan 2020 11:30:05 +1100 Subject: [PATCH] Add git tag back to binary artifact. --- Dockerfile | 2 +- Dockerfile.arm32v7 | 2 +- Dockerfile.arm64v8 | 2 +- cmd/authelia-scripts/cmd_docker.go | 6 ++++-- cmd/authelia/main.go | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index fe6ad53fb..1e0e5c69d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ COPY internal internal # Set the build version and time RUN echo "Write tag ${BUILD_TAG} and commit ${BUILD_COMMIT} in binary." && \ - BUILD_TIME=`date +"%Y-%m-%d %T"` && \ + sed -i "s/__BUILD_TAG__/${BUILD_TAG}/" cmd/authelia/constants.go && \ sed -i "s/__BUILD_COMMIT__/${BUILD_COMMIT}/" cmd/authelia/constants.go # CGO_ENABLED=1 is mandatory for building go-sqlite3 diff --git a/Dockerfile.arm32v7 b/Dockerfile.arm32v7 index ab11879bb..7abc6a53d 100644 --- a/Dockerfile.arm32v7 +++ b/Dockerfile.arm32v7 @@ -23,7 +23,7 @@ COPY internal internal # Set the build version and time RUN echo "Write tag ${BUILD_TAG} and commit ${BUILD_COMMIT} in binary." && \ - BUILD_TIME=`date +"%Y-%m-%d %T"` && \ + sed -i "s/__BUILD_TAG__/${BUILD_TAG}/" cmd/authelia/constants.go && \ sed -i "s/__BUILD_COMMIT__/${BUILD_COMMIT}/" cmd/authelia/constants.go # CGO_ENABLED=1 is mandatory for building go-sqlite3 diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 index b35a5ffbe..9682b94d7 100644 --- a/Dockerfile.arm64v8 +++ b/Dockerfile.arm64v8 @@ -23,7 +23,7 @@ COPY internal internal # Set the build version and time RUN echo "Write tag ${BUILD_TAG} and commit ${BUILD_COMMIT} in binary." && \ - BUILD_TIME=`date +"%Y-%m-%d %T"` && \ + sed -i "s/__BUILD_TAG__/${BUILD_TAG}/" cmd/authelia/constants.go && \ sed -i "s/__BUILD_COMMIT__/${BUILD_COMMIT}/" cmd/authelia/constants.go # CGO_ENABLED=1 is mandatory for building go-sqlite3 diff --git a/cmd/authelia-scripts/cmd_docker.go b/cmd/authelia-scripts/cmd_docker.go index 1998fc3b2..d01b14ae0 100644 --- a/cmd/authelia-scripts/cmd_docker.go +++ b/cmd/authelia-scripts/cmd_docker.go @@ -18,12 +18,14 @@ var supportedArch = []string{"amd64", "arm32v7", "arm64v8", "CI"} var defaultArch = "amd64" var buildkite = os.Getenv("BUILDKITE") var buildkiteQEMU = os.Getenv("BUILDKITE_AGENT_META_DATA_QEMU") + //TODO(nightah): Uncomment when turning off Travis //var ciBranch = os.Getenv("BUILDKITE_BRANCH") //var ciPullRequest = os.Getenv("BUILDKITE_PULL_REQUEST") //var ciTag = os.Getenv("BUILDKITE_TAG") var dockerTags = regexp.MustCompile(`v(?P(?P(?P\d+)\.\d+)\.\d+.*)`) var ignoredSuffixes = regexp.MustCompile("alpha|beta") + //var tags = dockerTags.FindStringSubmatch(ciTag) //TODO(nightah): Uncomment when turning off Travis @@ -92,8 +94,8 @@ func dockerBuildOfficialImage(arch string) error { gitTag := ciTag if gitTag == "" { - // If commit is not tagged, mark the build has having unknown tag. - gitTag = "unknown" + // If commit is not tagged, mark the build has having master tag. + gitTag = "master" } cmd := utils.Shell("git rev-parse HEAD") diff --git a/cmd/authelia/main.go b/cmd/authelia/main.go index f69e02731..3a24a0fcf 100644 --- a/cmd/authelia/main.go +++ b/cmd/authelia/main.go @@ -114,7 +114,7 @@ func main() { versionCmd := &cobra.Command{ Use: "version", Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("build git commit: %s\n", BuildCommit) + fmt.Printf("Authelia version %s, build %s", BuildTag, BuildCommit) }, }