Skip to content

PMM-7 goreleaser updates #1127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ builds:
- binary: mongodb_exporter
id: mongodb_exporter
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
Expand All @@ -25,16 +26,12 @@ builds:
id: mongodb_exporter-gssapi
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm
- arm64
goarm:
- 7
ignore:
- goos: darwin
goarch: arm
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ build: ## Build exporter binary using plain go build.
build-gssapi: ## Build exporter binary with GSSAPI support (requires CGO enabled).
CGO_ENABLED=1 go build -ldflags="$(GO_BUILD_LDFLAGS)" -tags gssapi -o $(PMM_RELEASE_PATH)/mongodb_exporter

release: ## Build the binaries using goreleaser
docker run --rm --privileged \
release: ## Build and release the binaries using goreleaser
docker build -f goreleaser.Dockerfile -t percona/goreleaser . && docker run --rm --privileged \
-v ${PWD}:/go/src/github.com/user/repo \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/user/repo \
goreleaser/goreleaser release --snapshot --skip=publish --clean
percona/goreleaser release --snapshot --skip=publish --clean

FILES = $(shell find . -type f -name '*.go' -not -path "./vendor/*")

Expand Down
27 changes: 27 additions & 0 deletions goreleaser.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This is a custom goreleaser Dockerfile to help us prepare goreleaser images with kerberos libraries.
# That way, we can release mongodb_exporter binaries with support for GSSAPI authentication.
FROM golang:1.24-bookworm AS installer

RUN go install github.com/goreleaser/goreleaser/v2@latest

FROM golang:1.24-bookworm

RUN apt-get update && apt-get install -y \
git \
make \
bash \
curl \
docker.io \
libkrb5-dev \
gcc \
gcc-x86-64-linux-gnu \
libc6-dev \
libc6-dev-amd64-cross \
ca-certificates \
build-essential \
&& rm -rf /var/lib/apt/lists/*

RUN git config --global --add safe.directory '*'

COPY --from=installer /go/bin/goreleaser /go/bin/goreleaser
ENTRYPOINT ["/go/bin/goreleaser"]
Loading