From a823b6368a4b2a77acc7e4f090f481f96b4c6d81 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Sat, 11 Jan 2020 12:20:32 +0100 Subject: [PATCH] Remove build time and git tag from binary artifact. That way it's easy to build a given commit and check whether it's the same binary than the one published on Github. --- Dockerfile | 6 ++---- Dockerfile.arm32v7 | 6 ++---- Dockerfile.arm64v8 | 6 ++---- cmd/authelia/constants.go | 1 - cmd/authelia/main.go | 2 -- 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 12c67e5fc..fe6ad53fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,9 +21,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 && \ - sed -i "s/__BUILD_TIME__/${BUILD_TIME}/" cmd/authelia/constants.go + sed -i "s/__BUILD_COMMIT__/${BUILD_COMMIT}/" cmd/authelia/constants.go # CGO_ENABLED=1 is mandatory for building go-sqlite3 RUN cd cmd/authelia && \ @@ -59,4 +57,4 @@ EXPOSE 9091 VOLUME /etc/authelia VOLUME /var/lib/authelia -CMD ["./authelia", "--config", "/etc/authelia/configuration.yml"] \ No newline at end of file +CMD ["./authelia", "--config", "/etc/authelia/configuration.yml"] diff --git a/Dockerfile.arm32v7 b/Dockerfile.arm32v7 index 5d901127b..ab11879bb 100644 --- a/Dockerfile.arm32v7 +++ b/Dockerfile.arm32v7 @@ -24,9 +24,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 && \ - sed -i "s/__BUILD_TIME__/${BUILD_TIME}/" cmd/authelia/constants.go + sed -i "s/__BUILD_COMMIT__/${BUILD_COMMIT}/" cmd/authelia/constants.go # CGO_ENABLED=1 is mandatory for building go-sqlite3 RUN cd cmd/authelia && \ @@ -66,4 +64,4 @@ EXPOSE 9091 VOLUME /etc/authelia VOLUME /var/lib/authelia -CMD ["./authelia", "--config", "/etc/authelia/configuration.yml"] \ No newline at end of file +CMD ["./authelia", "--config", "/etc/authelia/configuration.yml"] diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 index 2f7ea06b7..b35a5ffbe 100644 --- a/Dockerfile.arm64v8 +++ b/Dockerfile.arm64v8 @@ -24,9 +24,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 && \ - sed -i "s/__BUILD_TIME__/${BUILD_TIME}/" cmd/authelia/constants.go + sed -i "s/__BUILD_COMMIT__/${BUILD_COMMIT}/" cmd/authelia/constants.go # CGO_ENABLED=1 is mandatory for building go-sqlite3 RUN cd cmd/authelia && \ @@ -66,4 +64,4 @@ EXPOSE 9091 VOLUME /etc/authelia VOLUME /var/lib/authelia -CMD ["./authelia", "--config", "/etc/authelia/configuration.yml"] \ No newline at end of file +CMD ["./authelia", "--config", "/etc/authelia/configuration.yml"] diff --git a/cmd/authelia/constants.go b/cmd/authelia/constants.go index 2317e6c38..481305a11 100644 --- a/cmd/authelia/constants.go +++ b/cmd/authelia/constants.go @@ -2,4 +2,3 @@ package main var BuildTag = "__BUILD_TAG__" var BuildCommit = "__BUILD_COMMIT__" -var BuildTime = "__BUILD_TIME__" diff --git a/cmd/authelia/main.go b/cmd/authelia/main.go index 34e43e9f5..f69e02731 100644 --- a/cmd/authelia/main.go +++ b/cmd/authelia/main.go @@ -114,9 +114,7 @@ func main() { versionCmd := &cobra.Command{ Use: "version", Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("build git tag: %s\n", BuildTag) fmt.Printf("build git commit: %s\n", BuildCommit) - fmt.Printf("build time: %s\n", BuildTime) }, }