Add commit ReleaseVersion to routing to return to clients in version request

Signed-off-by: Brian Meek <brian@hntlabs.com>
This commit is contained in:
Brian Meek 2022-09-16 13:28:03 -07:00
parent b95657fe94
commit d7dc087953
No known key found for this signature in database
GPG key ID: ACBD71263BF42D00
3 changed files with 9 additions and 3 deletions

View file

@ -72,6 +72,8 @@ jobs:
file: ./build/docker/Dockerfile.monolith
platforms: ${{ env.PLATFORMS }}
push: true
build-args: |
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
tags: |
${{ env.DOCKER_NAMESPACE }}/dendrite-monolith:latest
${{ env.DOCKER_NAMESPACE }}/dendrite-monolith:${{ env.RELEASE_VERSION }}

View file

@ -2,12 +2,14 @@ FROM docker.io/golang:1.19-alpine AS base
RUN apk --update --no-cache add bash build-base
ARG RELEASE_VERSION="Unreleased"
WORKDIR /build
COPY . /build
RUN mkdir -p bin
RUN go build -trimpath -o bin/ ./cmd/dendrite-monolith-server
RUN go build -trimpath -o bin/ -ldflags="-X routing.ReleaseVersion=$RELEASE_VERSION" ./cmd/dendrite-monolith-server
RUN go build -trimpath -o bin/ ./cmd/create-account
RUN go build -trimpath -o bin/ ./cmd/generate-keys

View file

@ -41,6 +41,8 @@ import (
"github.com/sirupsen/logrus"
)
var ReleaseVersion string
// Setup registers HTTP handlers with the given ServeMux. It also supplies the given http.Client
// to clients which need to make outbound HTTP requests.
//
@ -101,7 +103,7 @@ func Setup(
JSON: struct {
Versions []string `json:"versions"`
UnstableFeatures map[string]bool `json:"unstable_features"`
BuildVersion string `json:"build_version"`
ReleaseVersion string `json:"release_version"`
}{Versions: []string{
"r0.0.1",
"r0.1.0",
@ -113,7 +115,7 @@ func Setup(
"v1.0",
"v1.1",
"v1.2",
}, UnstableFeatures: unstableFeatures, BuildVersion: "TODO"},
}, UnstableFeatures: unstableFeatures, ReleaseVersion: ReleaseVersion},
}
}),
).Methods(http.MethodGet, http.MethodOptions)