Skip to content

Commit 317f1d7

Browse files
committed
fix arm build
1 parent 7aa37f1 commit 317f1d7

File tree

8 files changed

+40
-56
lines changed

8 files changed

+40
-56
lines changed

.github/workflows/release.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717
- name: Get git describe
1818
id: get-version
1919
run: |
2020
describe=$(git describe --tags --always --dirty)
2121
echo "GIT_COMMIT_REF_NAME=$describe" >> $GITHUB_ENV
2222
- name: Setup go
23-
uses: actions/setup-go@v4
23+
uses: actions/setup-go@v5
2424
with:
2525
go-version: '1.23'
2626
check-latest: true
@@ -29,7 +29,7 @@ jobs:
2929
run: make clean build test clean
3030
- name: Docker meta
3131
id: meta
32-
uses: docker/metadata-action@v4
32+
uses: docker/metadata-action@v5
3333
with:
3434
images: |
3535
grepplabs/kafka-proxy
@@ -42,7 +42,7 @@ jobs:
4242
type=sha
4343
- name: Docker meta - all
4444
id: meta-all
45-
uses: docker/metadata-action@v4
45+
uses: docker/metadata-action@v5
4646
with:
4747
images: |
4848
grepplabs/kafka-proxy
@@ -56,16 +56,16 @@ jobs:
5656
type=semver,pattern={{major}}
5757
type=sha
5858
- name: Set up QEMU
59-
uses: docker/setup-qemu-action@v2
59+
uses: docker/setup-qemu-action@v3
6060
- name: Set up Docker Buildx
61-
uses: docker/setup-buildx-action@v2
61+
uses: docker/setup-buildx-action@v3
6262
- name: Login to DockerHub
63-
uses: docker/login-action@v2
63+
uses: docker/login-action@v3
6464
with:
6565
username: ${{ secrets.DOCKERHUB_USERNAME }}
6666
password: ${{ secrets.DOCKERHUB_TOKEN }}
6767
- name: Docker build and push
68-
uses: docker/build-push-action@v4
68+
uses: docker/build-push-action@v6
6969
with:
7070
context: .
7171
push: true
@@ -74,7 +74,7 @@ jobs:
7474
labels: ${{ steps.meta.outputs.labels }}
7575
build-args: VERSION=${{ env.GIT_COMMIT_REF_NAME }}
7676
- name: Docker build and push - all
77-
uses: docker/build-push-action@v4
77+
uses: docker/build-push-action@v6
7878
with:
7979
context: .
8080
push: true
@@ -84,10 +84,10 @@ jobs:
8484
labels: ${{ steps.meta-all.outputs.labels }}
8585
build-args: VERSION=${{ env.GIT_COMMIT_REF_NAME }}
8686
- name: Run GoReleaser
87-
uses: goreleaser/goreleaser-action@v4
87+
uses: goreleaser/goreleaser-action@v6
8888
if: startsWith(github.ref, 'refs/tags/')
8989
with:
90-
version: latest
90+
version: '~> v2'
9191
args: release --clean
9292
env:
9393
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Dockerfile

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,29 @@
1-
FROM --platform=$BUILDPLATFORM golang:1.23-alpine3.21 AS builder
2-
RUN apk add alpine-sdk ca-certificates
1+
FROM golang:1.23-alpine3.21 AS builder
2+
3+
RUN apk add --no-cache alpine-sdk ca-certificates
34

4-
ARG TARGETOS
5-
ARG TARGETARCH
6-
ARG TARGETVARIANT
75
ARG VERSION
86

97
ENV CGO_ENABLED=0 \
108
GO111MODULE=on \
11-
GOOS=${TARGETOS} \
12-
GOARCH=${TARGETARCH} \
13-
GOARM=${TARGETVARIANT} \
149
LDFLAGS="-X github.com/grepplabs/kafka-proxy/config.Version=${VERSION} -w -s"
1510

1611
WORKDIR /go/src/github.com/grepplabs/kafka-proxy
1712
COPY . .
1813

1914
RUN mkdir -p build && \
20-
export GOARM=$( echo "${GOARM}" | cut -c2-) && \
21-
go build -mod=vendor -o build/kafka-proxy \
22-
-ldflags "${LDFLAGS}" .
23-
24-
FROM --platform=$BUILDPLATFORM alpine:3.21
25-
RUN apk add --no-cache ca-certificates libcap
26-
RUN adduser \
27-
--disabled-password \
28-
--gecos "" \
29-
--home "/nonexistent" \
30-
--shell "/sbin/nologin" \
31-
--no-create-home \
32-
kafka-proxy
15+
go build -mod=vendor -o build/kafka-proxy -ldflags "${LDFLAGS}" .
16+
17+
FROM alpine:3.21
18+
19+
RUN apk add --no-cache ca-certificates libcap && \
20+
adduser --disabled-password --gecos "" \
21+
--home "/nonexistent" --shell "/sbin/nologin" \
22+
--no-create-home kafka-proxy
3323

3424
COPY --from=builder /go/src/github.com/grepplabs/kafka-proxy/build /opt/kafka-proxy/bin
3525
RUN setcap 'cap_net_bind_service=+ep' /opt/kafka-proxy/bin/kafka-proxy
3626

3727
USER kafka-proxy
3828
ENTRYPOINT ["/opt/kafka-proxy/bin/kafka-proxy"]
3929
CMD ["--help"]
40-

Dockerfile.all

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
1-
FROM --platform=$BUILDPLATFORM golang:1.23-alpine3.21 AS builder
1+
FROM golang:1.23-alpine3.21 AS builder
22
RUN apk add alpine-sdk ca-certificates
33

4-
ARG TARGETOS
5-
ARG TARGETARCH
6-
ARG TARGETVARIANT
74
ARG VERSION
85

96
ENV CGO_ENABLED=0 \
107
GO111MODULE=on \
11-
GOOS=${TARGETOS} \
12-
GOARCH=${TARGETARCH} \
13-
GOARM=${TARGETVARIANT} \
148
LDFLAGS="-X github.com/grepplabs/kafka-proxy/config.Version=${VERSION} -w -s"
159

1610
WORKDIR /go/src/github.com/grepplabs/kafka-proxy
1711
COPY . .
1812

1913
RUN mkdir -p build && \
20-
export GOARM=$( echo "${GOARM}" | cut -c2-) && \
2114
go build -mod=vendor -o build/kafka-proxy -ldflags "${LDFLAGS}" . && \
2215
go build -mod=vendor -o build/auth-user -ldflags "${LDFLAGS}" cmd/plugin-auth-user/main.go && \
2316
go build -mod=vendor -o build/auth-ldap -ldflags "${LDFLAGS}" cmd/plugin-auth-ldap/main.go && \
@@ -27,7 +20,7 @@ RUN mkdir -p build && \
2720
go build -mod=vendor -o build/unsecured-jwt-provider -ldflags "${LDFLAGS}" cmd/plugin-unsecured-jwt-provider/main.go && \
2821
go build -mod=vendor -o build/oidc-provider -ldflags "${LDFLAGS}" cmd/plugin-oidc-provider/main.go
2922

30-
FROM --platform=$BUILDPLATFORM alpine:3.21
23+
FROM alpine:3.21
3124
RUN apk add --no-cache ca-certificates libcap
3225
RUN adduser \
3326
--disabled-password \

Makefile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ VERSION ?= $(shell git describe --tags --always --dirty)
1010
GOPKGS = $(shell go list ./... | grep -v /vendor/)
1111
BUILD_FLAGS ?=
1212
LDFLAGS ?= -X github.com/grepplabs/kafka-proxy/config.Version=$(VERSION) -w -s
13-
TAG ?= "v0.4.2"
14-
GOOS ?= $(if $(TARGETOS),$(TARGETOS),linux)
15-
GOARCH ?= $(if $(TARGETARCH),$(TARGETARCH),amd64)
16-
GOARM ?= $(TARGETVARIANT)
17-
BUILDPLATFORM ?= $(GOOS)/$(GOARCH)
13+
TAG ?= "v0.4.3"
1814

1915
PROTOC_GO_VERSION ?= v1.33
2016
PROTOC_GRPC_VERSION ?= v1.2
@@ -51,10 +47,13 @@ build: build/$(BINARY)
5147

5248
.PHONY: build/$(BINARY)
5349
build/$(BINARY): $(SOURCES)
54-
GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) CGO_ENABLED=0 go build -mod=vendor -o build/$(BINARY) $(BUILD_FLAGS) -ldflags "$(LDFLAGS)" .
50+
CGO_ENABLED=0 go build -mod=vendor -o build/$(BINARY) $(BUILD_FLAGS) -ldflags "$(LDFLAGS)" .
5551

5652
docker.build:
57-
docker buildx build --build-arg BUILDPLATFORM=$(BUILDPLATFORM) --build-arg TARGETARCH=$(GOARCH) -t local/kafka-proxy .
53+
docker build --build-arg VERSION=$(VERSION) -t local/kafka-proxy .
54+
55+
docker.build.all:
56+
docker build --build-arg VERSION=$(VERSION) -t local/kafka-proxy -f Dockerfile.all .
5857

5958
tag:
6059
git tag $(TAG)

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ As not every Kafka release adds new messages/versions which are relevant to the
4949

5050
Linux
5151

52-
curl -Ls https://github.com/grepplabs/kafka-proxy/releases/download/v0.4.2/kafka-proxy-v0.4.2-linux-amd64.tar.gz | tar xz
52+
curl -Ls https://github.com/grepplabs/kafka-proxy/releases/download/v0.4.3/kafka-proxy-v0.4.3-linux-amd64.tar.gz | tar xz
5353

5454
macOS
5555

56-
curl -Ls https://github.com/grepplabs/kafka-proxy/releases/download/v0.4.2/kafka-proxy-v0.4.2-darwin-amd64.tar.gz | tar xz
56+
curl -Ls https://github.com/grepplabs/kafka-proxy/releases/download/v0.4.3/kafka-proxy-v0.4.3-darwin-amd64.tar.gz | tar xz
5757

5858
2. Move the binary in to your PATH.
5959

@@ -71,7 +71,7 @@ Docker images are available on [Docker Hub](https://hub.docker.com/r/grepplabs/k
7171
7272
You can launch a kafka-proxy container for trying it out with
7373
74-
docker run --rm -p 30001-30003:30001-30003 grepplabs/kafka-proxy:0.4.2 \
74+
docker run --rm -p 30001-30003:30001-30003 grepplabs/kafka-proxy:0.4.3 \
7575
server \
7676
--bootstrap-server-mapping "localhost:19092,0.0.0.0:30001" \
7777
--bootstrap-server-mapping "localhost:29092,0.0.0.0:30002" \
@@ -90,7 +90,7 @@ Docker images with precompiled plugins located in `/opt/kafka-proxy/bin/` are ta
9090
9191
You can launch a kafka-proxy container with auth-ldap plugin for trying it out with
9292
93-
docker run --rm -p 30001-30003:30001-30003 grepplabs/kafka-proxy:0.4.2-all \
93+
docker run --rm -p 30001-30003:30001-30003 grepplabs/kafka-proxy:0.4.3-all \
9494
server \
9595
--bootstrap-server-mapping "localhost:19092,0.0.0.0:30001" \
9696
--bootstrap-server-mapping "localhost:29092,0.0.0.0:30002" \

cmd/kafka-proxy/server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package server
33
import (
44
"fmt"
55
"log/slog"
6+
"runtime"
67

78
"github.com/grepplabs/kafka-proxy/config"
89
"github.com/grepplabs/kafka-proxy/proxy"
@@ -224,7 +225,7 @@ func initFlags() {
224225
}
225226

226227
func Run(_ *cobra.Command, _ []string) {
227-
logrus.Infof("Starting kafka-proxy version %s", config.Version)
228+
logrus.Infof("Starting kafka-proxy version %s on platform %s/%s", config.Version, runtime.GOOS, runtime.GOARCH)
228229

229230
var localPasswordAuthenticator apis.PasswordAuthenticator
230231
var localTokenAuthenticator apis.TokenInfo

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module github.com/grepplabs/kafka-proxy
22

33
go 1.23
4-
toolchain go1.24.1
54

65
require (
76
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5

proxy/tls_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ func TestTLSUnknownAuthorityNoCAChainCert(t *testing.T) {
119119
c.Proxy.TLS.ListenerKeyFile = bundle.ServerKey.Name()
120120

121121
_, _, _, err := makeTLSPipe(c, nil)
122-
a.EqualError(err, "tls: failed to verify certificate: x509: certificate signed by unknown authority")
122+
// Can be
123+
// - tls: failed to verify certificate: x509: “localhost” certificate is not standards compliant
124+
// - tls: failed to verify certificate: x509: certificate signed by unknown authority
125+
a.ErrorContains(err, "tls: failed to verify certificate: x509:")
123126
}
124127

125128
func TestTLSUnknownAuthorityWrongCAChainCert(t *testing.T) {

0 commit comments

Comments
 (0)