From 22ee7251516913f1caaabafe3c83a1ef82c55d30 Mon Sep 17 00:00:00 2001 From: Benjamin Bengfort Date: Fri, 13 Mar 2026 10:31:55 -0500 Subject: [PATCH 1/2] Modernize Vanity Service --- .github/workflows/container.yaml | 14 ++++++++------ .github/workflows/release.yaml | 8 ++++---- .github/workflows/tests.yaml | 24 ++++++++++++------------ Dockerfile | 17 +++++++---------- go.mod | 16 ++++++++-------- go.sum | 29 +++++++++++++++-------------- 6 files changed, 54 insertions(+), 54 deletions(-) diff --git a/.github/workflows/container.yaml b/.github/workflows/container.yaml index aeb3d9f..e2ae273 100644 --- a/.github/workflows/container.yaml +++ b/.github/workflows/container.yaml @@ -16,13 +16,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set Environment id: vars run: | echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT echo "revision=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + echo "::set-output name=build_date::$(date +'%Y-%m-%d')" - name: Docker Metadata id: meta @@ -40,22 +41,22 @@ jobs: type=sha,prefix=,suffix=,format=short - name: Setup QEMU - uses: docker/setup-qemu-action@v3 + uses: docker/setup-qemu-action@v4 - name: Setup Docker Buildx id: buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v4 - name: Login to DockerHub if: github.event_name != 'pull_request' - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} - name: Login to GCR if: github.event_name != 'pull_request' - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: registry: gcr.io username: _json_key @@ -63,7 +64,7 @@ jobs: - name: Build and push id: docker_build - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile @@ -73,3 +74,4 @@ jobs: platforms: linux/amd64,linux/arm64 build-args: | GIT_REVISION=${{ steps.vars.outputs.revision }} + BUILD_DATE=${{ steps.vars.outputs.build_date }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 72f84c3..17b45c6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,14 +10,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: - go-version: 1.23.x + go-version: 1.25.x - name: Import GPG key id: import_gpg @@ -36,4 +36,4 @@ jobs: args: release --clean env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} \ No newline at end of file + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 419f05d..2486001 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -14,15 +14,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: - go-version: 1.23.x + go-version: 1.25.x - name: Install Staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@2024.1.1 + run: go install honnef.co/go/tools/cmd/staticcheck@2026.1 - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Lint Go Code run: staticcheck ./... @@ -33,7 +33,7 @@ jobs: strategy: fail-fast: true matrix: - go-version: [1.22.x, 1.23.x] + go-version: [1.25.x, 1.26.x] env: GOPATH: ${{ github.workspace }}/go GOBIN: ${{ github.workspace }}/go/bin @@ -43,12 +43,12 @@ jobs: working-directory: ${{ env.GOPATH }}/src/go.rtnl.ai/vanity steps: - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} - name: Cache Speedup - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: ${{ env.GOPATH }}/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} @@ -56,7 +56,7 @@ jobs: ${{ runner.os }}-go- - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: path: ${{ env.GOPATH }}/src/go.rtnl.ai/vanity @@ -77,12 +77,12 @@ jobs: working-directory: ${{ env.GOPATH }}/src/go.rtnl.ai/vanity steps: - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: - go-version: 1.23.x + go-version: 1.25.x - name: Cache Speedup - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: ${{ env.GOPATH }}/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} @@ -90,7 +90,7 @@ jobs: ${{ runner.os }}-go- - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: path: ${{ env.GOPATH }}/src/go.rtnl.ai/vanity diff --git a/Dockerfile b/Dockerfile index 925311f..7a3713e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,18 @@ # Dynamic Builds -ARG BUILDER_IMAGE=golang:1.23-bookworm -ARG FINAL_IMAGE=debian:bookworm-slim +ARG BUILDER_IMAGE=dhi.io/golang:1.25-debian13-dev +ARG FINAL_IMAGE=dhi.io/golang:1.25-debian13 # Build stage FROM --platform=${BUILDPLATFORM} ${BUILDER_IMAGE} AS builder # Build Args ARG GIT_REVISION="" +ARG BUILD_DATE="" # Platform args ARG TARGETOS ARG TARGETARCH +ARG TARGETPLATFORM # Ensure ca-certificates are up to date RUN update-ca-certificates @@ -30,8 +32,8 @@ RUN go mod verify COPY . . # Build binary -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \ - -ldflags="-X 'go.rtnl.ai/vanity.GitVersion=${GIT_REVISION}'" \ +RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -v \ + -ldflags="-X 'go.rtnl.ai/vanity.GitVersion=${GIT_REVISION}' -X 'go.rtnl.ai/vanity.BuildDate=${BUILD_DATE}'" \ -o /go/bin/vanityd \ ./cmd/vanityd @@ -41,12 +43,7 @@ FROM --platform=${BUILDPLATFORM} ${FINAL_IMAGE} AS final LABEL maintainer="Rotational Labs " LABEL description="Rotational Vanity URLs server for go modules" -# Ensure ca-certificates are up to date -RUN set -x && apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates && \ - rm -rf /var/lib/apt/lists/* - # Copy the binary to the production image from the builder stage COPY --from=builder /go/bin/vanityd /usr/local/bin/vanityd -CMD [ "/usr/local/bin/vanityd", "serve" ] \ No newline at end of file +CMD [ "/usr/local/bin/vanityd", "serve" ] diff --git a/go.mod b/go.mod index 406b043..14de29b 100644 --- a/go.mod +++ b/go.mod @@ -1,27 +1,27 @@ module go.rtnl.ai/vanity -go 1.23.3 +go 1.25.0 require ( github.com/joho/godotenv v1.5.1 github.com/julienschmidt/httprouter v1.3.0 github.com/rotationalio/confire v1.1.0 - github.com/rs/zerolog v1.33.0 - github.com/stretchr/testify v1.10.0 - github.com/urfave/cli/v2 v2.27.5 + github.com/rs/zerolog v1.34.0 + github.com/stretchr/testify v1.11.1 + github.com/urfave/cli/v2 v2.27.7 gopkg.in/yaml.v3 v3.0.1 ) require ( - github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/kr/pretty v0.3.1 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect - golang.org/x/sys v0.24.0 // indirect + github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect + golang.org/x/sys v0.42.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) diff --git a/go.sum b/go.sum index 2298006..ea79ef9 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= -github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= +github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -16,8 +16,9 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -31,22 +32,22 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rotationalio/confire v1.1.0 h1:h10RDxiO/XH6UStfxY+oMJOVxt3Elqociilb7fIfANs= github.com/rotationalio/confire v1.1.0/go.mod h1:ug7pBDiZZl/4JjXJ2Effmj+L+0T2DBbG+Us1qQcRex0= -github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= -github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= +github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY= +github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w= -github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= -github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= -github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU= +github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4= +github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 h1:FnBeRrxr7OU4VvAzt5X7s6266i6cSVkkFPS0TuXWbIg= +github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= +golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= From 3930a5ce8de2446e3923230ec4fe22e0912d7a3a Mon Sep 17 00:00:00 2001 From: Benjamin Bengfort Date: Fri, 13 Mar 2026 10:38:56 -0500 Subject: [PATCH 2/2] fix tests --- server/render/render_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/render/render_test.go b/server/render/render_test.go index 02bafaa..1b86559 100644 --- a/server/render/render_test.go +++ b/server/render/render_test.go @@ -40,11 +40,11 @@ func TestTextf(t *testing.T) { func TestJSON(t *testing.T) { w := httptest.NewRecorder() out := map[string]interface{}{"status": "foo"} - err := render.JSON(http.StatusEarlyHints, w, out) + err := render.JSON(http.StatusOK, w, out) require.NoError(t, err, "could not render json") rep := w.Result() - require.Equal(t, http.StatusEarlyHints, rep.StatusCode, "unexpected status code") + require.Equal(t, http.StatusOK, rep.StatusCode, "unexpected status code") require.Equal(t, "application/json", rep.Header.Get(render.ContentType), "unexpected content type") body, _ := io.ReadAll(rep.Body)