From 476a4fa806f62eeee5899c8d43d924510e354085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=9Fur=20=C3=96zy=C4=B1lmazel?= Date: Tue, 24 Dec 2024 13:15:35 +0300 Subject: [PATCH] remove build information --- .bumpversion.toml | 6 ++++++ .github/workflows/push-to-dockerhub.yml | 5 ----- .github/workflows/push-to-github-cr.yml | 5 ----- Dockerfile | 3 +-- Rakefile | 3 --- main.go | 2 +- release/release.go | 4 ++-- 7 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.bumpversion.toml b/.bumpversion.toml index 29b48e0..18ea7ab 100644 --- a/.bumpversion.toml +++ b/.bumpversion.toml @@ -28,3 +28,9 @@ replace = "version-{new_version}-orange.svg" filename = "release/release.go" search = "{current_version}" replace = "{new_version}" + +[[tool.bumpversion.files]] +filename = "release/release.go" +search = "var BuildInformation = \"[a-f0-9]{{1,12}}\"" +replace = "var BuildInformation = \"{commit_sha}\"" +regex = true diff --git a/.github/workflows/push-to-dockerhub.yml b/.github/workflows/push-to-dockerhub.yml index 4d72c56..64ea0f4 100644 --- a/.github/workflows/push-to-dockerhub.yml +++ b/.github/workflows/push-to-dockerhub.yml @@ -10,10 +10,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set short-sha - id: vars - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -27,7 +23,6 @@ jobs: uses: docker/build-push-action@v6 with: context: . - build-args: "BUILD_INFORMATION= - ${{ steps.vars.outputs.sha_short }}" platforms: linux/amd64,linux/arm64 push: true provenance: false diff --git a/.github/workflows/push-to-github-cr.yml b/.github/workflows/push-to-github-cr.yml index 88ca913..0eca152 100644 --- a/.github/workflows/push-to-github-cr.yml +++ b/.github/workflows/push-to-github-cr.yml @@ -10,10 +10,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set short-sha - id: vars - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -28,7 +24,6 @@ jobs: uses: docker/build-push-action@v6 with: context: . - build-args: "BUILD_INFORMATION= - ${{ steps.vars.outputs.sha_short }}" platforms: linux/amd64,linux/arm64 push: true provenance: false diff --git a/Dockerfile b/Dockerfile index 2adbe03..7eb4de6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,7 @@ COPY . . ARG GOOS ARG GOARCH -ARG BUILD_INFORMATION -RUN CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags="-X 'github.com/vbyazilim/basichttpdebugger/release.BuildInformation=${BUILD_INFORMATION}'" -o server . +RUN CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build -o server . FROM alpine:latest AS certs RUN apk add --update --no-cache ca-certificates diff --git a/Rakefile b/Rakefile index 9694560..dd53aee 100644 --- a/Rakefile +++ b/Rakefile @@ -45,12 +45,9 @@ namespace :docker do desc "build docker image locally" task :build do system %{ - BUILD_INFORMATION=" - $(git rev-parse --short HEAD)" GOOS="linux" GOARCH=$(go env GOARCH) - docker build \ - --build-arg="BUILD_INFORMATION=${BUILD_INFORMATION}" \ --build-arg="GOOS=${GOOS}" \ --build-arg="GOARCH=${GOARCH}" \ -t #{DOCKER_IMAGE_NAME} . diff --git a/main.go b/main.go index 1ea433d..1338857 100644 --- a/main.go +++ b/main.go @@ -135,7 +135,7 @@ func debugHandlerFunc(cn *accept.ContentNegotiation, fwriter *os.File, hmsv stri w.WriteHeader(http.StatusOK) fmt.Fprintln(w, "OK") - mainTitle := "Basic HTTP Debugger - v" + release.Version + release.BuildInformation + mainTitle := "Basic HTTP Debugger - v" + release.Version + " - " + release.BuildInformation fmt.Fprintln(fwriter, strings.Repeat("-", terminalWidth)) t := table.NewWriter() diff --git a/release/release.go b/release/release.go index 8070ceb..802fad5 100644 --- a/release/release.go +++ b/release/release.go @@ -1,7 +1,7 @@ package release // Version is the current version of service. -const Version string = "0.2.2" +const Version = "0.2.2" // BuildInformation holds current build information. -var BuildInformation string +var BuildInformation = "000"