Skip to content

Commit 3beb8ff

Browse files
authored
fix(build): Use Debian Bullseye base image for build image (#14368)
This change is necessary to allow the binaries built using the Loki build image to run on operating systems with older libc version. Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
1 parent b7bccfc commit 3beb8ff

File tree

13 files changed

+80
-90
lines changed

13 files changed

+80
-90
lines changed

‎.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"check":
33
"uses": "grafana/loki-release/.github/workflows/check.yml@main"
44
"with":
5-
"build_image": "grafana/loki-build-image:0.34.0"
5+
"build_image": "grafana/loki-build-image:0.34.1"
66
"golang_ci_lint_version": "v1.60.3"
77
"release_lib_ref": "main"
88
"skip_validation": false

‎.github/workflows/images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"check":
33
"uses": "grafana/loki-release/.github/workflows/check.yml@main"
44
"with":
5-
"build_image": "grafana/loki-build-image:0.34.0"
5+
"build_image": "grafana/loki-build-image:0.34.1"
66
"golang_ci_lint_version": "v1.60.3"
77
"release_lib_ref": "main"
88
"skip_validation": false

‎.github/workflows/minor-release-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
check:
1717
uses: "grafana/loki-release/.github/workflows/check.yml@main"
1818
with:
19-
build_image: "grafana/loki-build-image:0.34.0"
19+
build_image: "grafana/loki-build-image:0.34.1"
2020
golang_ci_lint_version: "v1.60.3"
2121
release_lib_ref: "main"
2222
skip_validation: false
@@ -143,7 +143,7 @@ jobs:
143143
--env SKIP_ARM \
144144
--volume .:/src/loki \
145145
--workdir /src/loki \
146-
--entrypoint /bin/sh "grafana/loki-build-image:0.34.0"
146+
--entrypoint /bin/sh "grafana/loki-build-image:0.34.1"
147147
git config --global --add safe.directory /src/loki
148148
echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE
149149
make dist packages

‎.github/workflows/patch-release-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
check:
1717
uses: "grafana/loki-release/.github/workflows/check.yml@main"
1818
with:
19-
build_image: "grafana/loki-build-image:0.34.0"
19+
build_image: "grafana/loki-build-image:0.34.1"
2020
golang_ci_lint_version: "v1.60.3"
2121
release_lib_ref: "main"
2222
skip_validation: false
@@ -143,7 +143,7 @@ jobs:
143143
--env SKIP_ARM \
144144
--volume .:/src/loki \
145145
--workdir /src/loki \
146-
--entrypoint /bin/sh "grafana/loki-build-image:0.34.0"
146+
--entrypoint /bin/sh "grafana/loki-build-image:0.34.1"
147147
git config --global --add safe.directory /src/loki
148148
echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE
149149
make dist packages

‎.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,4 @@ name: "create release"
219219
permissions:
220220
contents: "write"
221221
id-token: "write"
222-
pull-requests: "write"
222+
pull-requests: "write"

‎Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ DOCKER_IMAGE_DIRS := $(patsubst %/Dockerfile,%,$(DOCKERFILES))
3737
BUILD_IN_CONTAINER ?= true
3838

3939
# ensure you run `make release-workflows` after changing this
40-
BUILD_IMAGE_VERSION ?= 0.34.0
40+
BUILD_IMAGE_VERSION ?= 0.34.1
4141
GO_VERSION := 1.23.1
4242

4343
# Docker image info
@@ -664,7 +664,7 @@ else
664664
endif
665665

666666
build-image: ensure-buildx-builder
667-
$(SUDO) $(BUILD_OCI) --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki-build-image:$(IMAGE_TAG) ./loki-build-image
667+
$(SUDO) $(BUILD_OCI) --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki-build-image:$(BUILD_IMAGE_VERSION) ./loki-build-image
668668
build-image-push: build-image ## push the docker build image
669669
ifneq (,$(findstring WIP,$(IMAGE_TAG)))
670670
@echo "Cannot push a WIP image, commit changes first"; \

‎docs/sources/community/maintaining/release-loki-build-image.md

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,11 @@ if any changes were made in the folder `./loki-build-image/`.
1414

1515
**To build and use the `loki-build-image`:**
1616

17-
## Step 1
18-
19-
1. Create a branch with the desired changes to the Dockerfile.
20-
2. Update the version tag of the `loki-build-image` pipeline defined in `.drone/drone.jsonnet` (search for `pipeline('loki-build-image')`) to a new version number (try to follow semver).
21-
3. Run `DRONE_SERVER=https://drone.grafana.net/ DRONE_TOKEN=<token> make drone` and commit the changes to the same branch.
22-
1. The `<token>` is your personal drone token, which can be found by navigating to https://drone.grafana.net/account.
23-
4. Create a PR.
24-
5. Once approved and merged to `main`, the image with the new version is built and published.
25-
{{% admonition type="note" %}}
26-
Keep an eye on https://drone.grafana.net/grafana/loki for the build after merging ([example](https://drone.grafana.net/grafana/loki/17760/1/2)).
27-
{{% /admonition %}}
28-
29-
## Step 2
30-
31-
1. Create a branch.
32-
2. Update the `BUILD_IMAGE_VERSION` variable in the `Makefile`.
33-
3. Run `loki-build-image/version-updater.sh <new-version>` to update all the references.
34-
4. Run `DRONE_SERVER=https://drone.grafana.net/ DRONE_TOKEN=<token> make drone` to update the Drone config to use the new build image.
35-
5. Create a new PR.
36-
17+
1. Create a branch with the desired changes to the `./loki-build-image/Dockerfile`.
18+
1. Update the `BUILD_IMAGE_VERSION` variable in the `Makefile`.
19+
1. Commit your changes.
20+
1. Run `make build-image-push` to build and publish the new version of the build image.
21+
1. Run `make release-workflows` to update the Github workflows.
22+
1. Commit your changes.
23+
1. Push your changes to the remote branch.
24+
1. Open a PR against the `main` branch.

‎loki-build-image/Dockerfile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
# See ../docs/sources/community/maintaining/release-loki-build-image.md for instructions
66
# on how to publish a new build image.
77
ARG GO_VERSION=1.23
8+
ARG GOLANG_BASE_IMAGE=golang:${GO_VERSION}-bullseye
9+
810
# Install helm (https://helm.sh/) and helm-docs (https://github.com/norwoodj/helm-docs) for generating Helm Chart reference.
9-
FROM golang:${GO_VERSION}-bookworm AS helm
11+
FROM ${GOLANG_BASE_IMAGE} AS helm
1012
ARG TARGETARCH
1113
ARG HELM_VER="v3.2.3"
1214
RUN curl -L "https://get.helm.sh/helm-${HELM_VER}-linux-$TARGETARCH.tar.gz" | tar zx && \
@@ -38,7 +40,7 @@ RUN apk add --no-cache curl && \
3840
FROM alpine:3.20.3 AS docker
3941
RUN apk add --no-cache docker-cli docker-cli-buildx
4042

41-
FROM golang:${GO_VERSION}-bookworm AS drone
43+
FROM ${GOLANG_BASE_IMAGE} AS drone
4244
ARG TARGETARCH
4345
RUN curl -L "https://github.com/drone/drone-cli/releases/download/v1.7.0/drone_linux_$TARGETARCH".tar.gz | tar zx && \
4446
install -t /usr/local/bin drone
@@ -48,35 +50,35 @@ RUN curl -L "https://github.com/drone/drone-cli/releases/download/v1.7.0/drone_l
4850
# Error:
4951
# github.com/fatih/faillint@v1.5.0 requires golang.org/x/tools@v0.0.0-20200207224406-61798d64f025
5052
# (not golang.org/x/tools@v0.0.0-20190918214920-58d531046acd from golang.org/x/tools/cmd/goyacc@58d531046acdc757f177387bc1725bfa79895d69)
51-
FROM golang:${GO_VERSION}-bookworm AS faillint
53+
FROM ${GOLANG_BASE_IMAGE} AS faillint
5254
RUN GO111MODULE=on go install github.com/fatih/faillint@v1.12.0
5355
RUN GO111MODULE=on go install golang.org/x/tools/cmd/goimports@v0.7.0
5456

55-
FROM golang:${GO_VERSION}-bookworm AS delve
57+
FROM ${GOLANG_BASE_IMAGE} AS delve
5658
RUN GO111MODULE=on go install github.com/go-delve/delve/cmd/dlv@latest
5759

5860
# Install ghr used to push binaries and template the release
5961
# This collides with the version of go tools used in the base image, thus we install it in its own image and copy it over.
60-
FROM golang:${GO_VERSION}-bookworm AS ghr
62+
FROM ${GOLANG_BASE_IMAGE} AS ghr
6163
RUN GO111MODULE=on go install github.com/tcnksm/ghr@9349474
6264

6365
# Install nfpm (https://nfpm.goreleaser.com) for creating .deb and .rpm packages.
64-
FROM golang:${GO_VERSION}-bookworm AS nfpm
66+
FROM ${GOLANG_BASE_IMAGE} AS nfpm
6567
RUN GO111MODULE=on go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.11.3
6668

6769
# Install gotestsum
68-
FROM golang:${GO_VERSION}-bookworm AS gotestsum
70+
FROM ${GOLANG_BASE_IMAGE} AS gotestsum
6971
RUN GO111MODULE=on go install gotest.tools/gotestsum@v1.8.2
7072

7173
# Install tools used to compile jsonnet.
72-
FROM golang:${GO_VERSION}-bookworm AS jsonnet
74+
FROM ${GOLANG_BASE_IMAGE} AS jsonnet
7375
RUN GO111MODULE=on go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.5.1
7476
RUN GO111MODULE=on go install github.com/monitoring-mixins/mixtool/cmd/mixtool@16dc166166d91e93475b86b9355a4faed2400c18
7577
RUN GO111MODULE=on go install github.com/google/go-jsonnet/cmd/jsonnet@v0.20.0
7678

7779
FROM aquasec/trivy AS trivy
7880

79-
FROM golang:${GO_VERSION}-bookworm
81+
FROM ${GOLANG_BASE_IMAGE}
8082
RUN apt-get update && \
8183
apt-get install -qy \
8284
musl gnupg ragel \

���pkg/querier/queryrange/queryrangebase/queryrange.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pkg/querier/stats/stats.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pkg/ruler/base/ruler.pb.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pkg/ruler/rulespb/rules.pb.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)