Skip to content

Commit

Permalink
Cross build Promtail for ARM with journald support. (#8131)
Browse files Browse the repository at this point in the history
This is the follow up to #8111 and adds journald support for Promatil
ARM and ARM64 builds.

I've tested it locally with my Raspberry Pi and it works.

Fixes #1459
  • Loading branch information
jeschkies authored Jan 13, 2023
1 parent cd1ba19 commit 4504ed2
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 30 deletions.
40 changes: 20 additions & 20 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: check-drone-drift
- commands:
- make BUILD_IN_CONTAINER=false check-generated-files
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: check-generated-files
- commands:
- cd ..
Expand All @@ -110,7 +110,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: clone-target-branch
when:
event:
Expand All @@ -121,15 +121,15 @@ steps:
- clone-target-branch
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: test
- commands:
- cd ../loki-target-branch
- BUILD_IN_CONTAINER=false make test
depends_on:
- clone-target-branch
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: test-target-branch
when:
event:
Expand All @@ -142,7 +142,7 @@ steps:
- test
- test-target-branch
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: compare-coverage
when:
event:
Expand All @@ -158,7 +158,7 @@ steps:
TOKEN:
from_secret: github_token
USER: grafanabot
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: report-coverage
when:
event:
Expand All @@ -168,15 +168,15 @@ steps:
depends_on:
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: lint
- commands:
- make BUILD_IN_CONTAINER=false check-mod
depends_on:
- test
- lint
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: check-mod
- commands:
- apk add make bash && make lint-scripts
Expand All @@ -187,28 +187,28 @@ steps:
depends_on:
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: loki
- commands:
- make BUILD_IN_CONTAINER=false check-doc
depends_on:
- loki
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: check-doc
- commands:
- make BUILD_IN_CONTAINER=false validate-example-configs
depends_on:
- loki
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: validate-example-configs
- commands:
- make BUILD_IN_CONTAINER=false check-example-config-doc
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: check-example-config-doc
trigger:
ref:
Expand All @@ -235,7 +235,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: loki-mixin-check
when:
event:
Expand All @@ -260,7 +260,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: documentation-helm-reference-check
trigger:
ref:
Expand Down Expand Up @@ -1360,15 +1360,15 @@ steps:
NFPM_SIGNING_KEY:
from_secret: gpg_private_key
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: write-key
- commands:
- make BUILD_IN_CONTAINER=false packages
environment:
NFPM_PASSPHRASE:
from_secret: gpg_passphrase
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: test packaging
- commands:
- ./tools/packaging/verify-deb-install.sh
Expand All @@ -1394,7 +1394,7 @@ steps:
NFPM_PASSPHRASE:
from_secret: gpg_passphrase
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: publish
when:
event:
Expand Down Expand Up @@ -1428,7 +1428,7 @@ steps:
from_secret: docker_password
DOCKER_USERNAME:
from_secret: docker_username
image: grafana/loki-build-image:0.26.0
image: grafana/loki-build-image:0.27.0
name: build and push
privileged: true
volumes:
Expand Down Expand Up @@ -1665,6 +1665,6 @@ kind: secret
name: gpg_private_key
---
kind: signature
hmac: ed3348c4c33a2b5463ba942f1aad31e36d8e37d8c95075e85883f30de6886367
hmac: 9b93dca0a196074b7125892e9df0c5e6eed5bdabaa98f3c64277f836cf188171

...
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* [7978](https://github.com/grafana/loki/pull/7978) **chaudum**: Shut down query frontend gracefully to allow inflight requests to complete.
* [8047](https://github.com/grafana/loki/pull/8047) **bboreham**: Dashboards: add k8s resource requests to CPU and memory panels.
* [8061](https://github.com/grafana/loki/pull/8061) **kavirajk**: Remove circle from Loki OSS
* [8131](https://github.com/grafana/loki/pull/8131) **jeschkies**: Compile Promtail ARM and ARM64 with journald support.

##### Fixes

Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ DOCKER_IMAGE_DIRS := $(patsubst %/Dockerfile,%,$(DOCKERFILES))
BUILD_IN_CONTAINER ?= true

# ensure you run `make drone` after changing this
BUILD_IMAGE_VERSION := 0.26.0
BUILD_IMAGE_VERSION := 0.27.0

# Docker image info
IMAGE_PREFIX ?= grafana
Expand Down Expand Up @@ -261,7 +261,9 @@ dist: clean
CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/loki
CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/logcli
CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/loki-canary
CGO_ENABLED=0 $(GOX) -osarch="linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 windows/386 freebsd/amd64" ./clients/cmd/promtail
CGO_ENABLED=0 $(GOX) -osarch="darwin/amd64 darwin/arm64 windows/amd64 windows/386 freebsd/amd64" ./clients/cmd/promtail
PKG_CONFIG_PATH="/usr/lib/aarch64-linux-gnu/pkgconfig" CC="aarch64-linux-gnu-gcc" $(CGO_GOX) -tags promtail_journal_enabled -osarch="linux/arm64" ./clients/cmd/promtail
PKG_CONFIG_PATH="/usr/lib/arm-linux-gnueabihf/pkgconfig" CC="arm-linux-gnueabihf-gcc" $(CGO_GOX) -tags promtail_journal_enabled -osarch="linux/arm" ./clients/cmd/promtail
CGO_ENABLED=1 $(CGO_GOX) -osarch="linux/amd64" ./clients/cmd/promtail
for i in dist/*; do zip -j -m $$i.zip $$i; done
pushd dist && sha256sum * > SHA256SUMS && popd
Expand Down
2 changes: 1 addition & 1 deletion clients/cmd/docker-driver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.26.0
ARG BUILD_IMAGE=grafana/loki-build-image:0.27.0
# Directories in this file are referenced from the root of the project not this folder
# This file is intended to be called from the root like so:
# docker build -t grafana/loki -f cmd/loki/Dockerfile .
Expand Down
2 changes: 1 addition & 1 deletion clients/cmd/promtail/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.26.0
ARG BUILD_IMAGE=grafana/loki-build-image:0.27.0
# Directories in this file are referenced from the root of the project not this folder
# This file is intended to be called from the root like so:
# docker build -t grafana/promtail -f clients/cmd/promtail/Dockerfile .
Expand Down
2 changes: 1 addition & 1 deletion clients/cmd/promtail/Dockerfile.debug
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is intended to be called from the root like so:
# docker build -t grafana/promtail -f clients/cmd/promtail/Dockerfile.debug .

FROM grafana/loki-build-image:0.26.0 as build
FROM grafana/loki-build-image:0.27.0 as build
ARG GOARCH="amd64"
COPY . /src/loki
WORKDIR /src/loki
Expand Down
2 changes: 1 addition & 1 deletion cmd/loki-canary/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.26.0
ARG BUILD_IMAGE=grafana/loki-build-image:0.27.0
# Directories in this file are referenced from the root of the project not this folder
# This file is intended to be called from the root like so:
# docker build -t grafana/promtail -f cmd/promtail/Dockerfile .
Expand Down
2 changes: 1 addition & 1 deletion cmd/loki/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.26.0
ARG BUILD_IMAGE=grafana/loki-build-image:0.27.0
# Directories in this file are referenced from the root of the project not this folder
# This file is intended to be called from the root like so:
# docker build -t grafana/loki -f cmd/loki/Dockerfile .
Expand Down
2 changes: 1 addition & 1 deletion cmd/loki/Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Directories in this file are referenced from the root of the project not this folder
# This file is intended to be called from the root like so:
# docker build -t grafana/loki -f cmd/loki/Dockerfile.debug .
FROM grafana/loki-build-image:0.26.0 as build
FROM grafana/loki-build-image:0.27.0 as build
ARG GOARCH="amd64"
COPY . /src/loki
WORKDIR /src/loki
Expand Down
2 changes: 1 addition & 1 deletion cmd/querytee/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.26.0
ARG BUILD_IMAGE=grafana/loki-build-image:0.27.0
# Directories in this file are referenced from the root of the project not this folder
# This file is intended to be called from the root like so:
# docker build -t grafana/promtail -f cmd/promtail/Dockerfile .
Expand Down
2 changes: 1 addition & 1 deletion operator/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.26.0
ARG BUILD_IMAGE=grafana/loki-build-image:0.27.0

FROM golang:1.19.1-alpine as goenv
RUN go env GOARCH > /goarch && \
Expand Down

0 comments on commit 4504ed2

Please sign in to comment.