Skip to content

Commit

Permalink
[release-2.7.x] Use 0.28.1 build image and update go and alpine versi…
Browse files Browse the repository at this point in the history
…ons (#8583) (#8623)

(cherry picked from commit 4f8d324)

---------

Co-authored-by: Michel Hollands <[email protected]>
  • Loading branch information
DylanGuedes and MichelHollands authored Feb 24, 2023
1 parent 3f5f6b1 commit 6f76a96
Show file tree
Hide file tree
Showing 37 changed files with 118 additions and 106 deletions.
36 changes: 18 additions & 18 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.27.1
image: grafana/loki-build-image:0.28.1
name: check-drone-drift
- commands:
- make BUILD_IN_CONTAINER=false check-generated-files
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: check-generated-files
- commands:
- cd ..
Expand All @@ -109,23 +109,23 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: clone-main
- commands:
- make BUILD_IN_CONTAINER=false test
depends_on:
- clone
- clone-main
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: test
- commands:
- cd ../loki-main
- BUILD_IN_CONTAINER=false make test
depends_on:
- clone-main
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: test-main
- commands:
- make BUILD_IN_CONTAINER=false compare-coverage old=../loki-main/test_results.txt
Expand All @@ -135,7 +135,7 @@ steps:
- test
- test-main
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: compare-coverage
- commands:
- pull=$(echo $CI_COMMIT_REF | awk -F '/' '{print $3}')
Expand All @@ -148,15 +148,15 @@ steps:
TOKEN:
from_secret: github_token
USER: grafanabot
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: report-coverage
- commands:
- make BUILD_IN_CONTAINER=false lint
depends_on:
- clone
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: lint
- commands:
- make BUILD_IN_CONTAINER=false check-mod
Expand All @@ -165,7 +165,7 @@ steps:
- test
- lint
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: check-mod
- commands:
- apk add make bash && make lint-scripts
Expand All @@ -177,21 +177,21 @@ steps:
- clone
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: loki
- commands:
- make BUILD_IN_CONTAINER=false validate-example-configs
depends_on:
- loki
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: validate-example-configs
- commands:
- make BUILD_IN_CONTAINER=false check-example-config-doc
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: check-example-config-doc
trigger:
ref:
Expand All @@ -218,7 +218,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: loki-mixin-check
trigger:
ref:
Expand All @@ -238,7 +238,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: documentation-helm-reference-check
trigger:
ref:
Expand Down Expand Up @@ -1369,15 +1369,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.27.1
image: grafana/loki-build-image:0.28.1
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.27.1
image: grafana/loki-build-image:0.28.1
name: test packaging
- commands:
- ./tools/packaging/verify-deb-install.sh
Expand All @@ -1403,7 +1403,7 @@ steps:
NFPM_PASSPHRASE:
from_secret: gpg_passphrase
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.27.1
image: grafana/loki-build-image:0.28.1
name: publish
when:
event:
Expand Down Expand Up @@ -1648,6 +1648,6 @@ kind: secret
name: gpg_private_key
---
kind: signature
hmac: ec77034ab90d10b2a9f927372d9c4c4472b36f588966e54a26251b58dbabe89e
hmac: de666c125b41d3affaa6db91e0ef93c39bdf35b208cccc87bbf1fbd614380544

...
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# options for analysis running
run:
# define go version
go: "1.19"
go: "1.20"

# default concurrency is a available CPU number
concurrency: 16
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

##### Changes

##### Build

#### Promtail

##### Enhancements
Expand All @@ -28,7 +30,7 @@

### Dependencies

## 2.7.4 (2023-02-23)
## 2.7.4 (2023-02-24)

#### Loki

Expand All @@ -39,6 +41,11 @@
* [7988](https://github.com/grafana/loki/pull/7988) **ashwanthgoli**: store: write overlapping chunks to multiple stores.
* [7925](https://github.com/grafana/loki/pull/7925) **sandeepsukhani**: Fix bugs in logs results caching causing query-frontend to return logs outside of query window.

##### Build

* [8575](https://github.com/grafana/loki/pull/8575) **MichelHollands**: Update build image to go 1.20.1 and alpine 3.16.4.
* [8583](https://github.com/grafana/loki/pull/8583) **MichelHollands**: Use 0.28.1 build image and update go and alpine versions.

#### Promtail

##### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ DOCKER_IMAGE_DIRS := $(patsubst %/Dockerfile,%,$(DOCKERFILES))
BUILD_IN_CONTAINER ?= true

# ensure you run `make drone` after changing this
BUILD_IMAGE_VERSION := 0.27.1
BUILD_IMAGE_VERSION := 0.28.1

# Docker image info
IMAGE_PREFIX ?= grafana
Expand Down
4 changes: 2 additions & 2 deletions 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.27.1
ARG BUILD_IMAGE=grafana/loki-build-image:0.28.1
# 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 All @@ -9,7 +9,7 @@ COPY . /src/loki
WORKDIR /src/loki
RUN make clean && make BUILD_IN_CONTAINER=false clients/cmd/docker-driver/docker-driver

FROM alpine:3.16.2
FROM alpine:3.16.4
RUN apk add --update --no-cache ca-certificates tzdata
COPY --from=build /src/loki/clients/cmd/docker-driver/docker-driver /bin/docker-driver
WORKDIR /bin/
Expand Down
2 changes: 1 addition & 1 deletion clients/cmd/promtail/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19.5-bullseye as build
FROM golang:1.20.1-bullseye as build

COPY . /src/loki
WORKDIR /src/loki
Expand Down
2 changes: 1 addition & 1 deletion clients/cmd/promtail/Dockerfile.arm32
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19.5-bullseye as build
FROM golang:1.20.1-bullseye as build

COPY . /src/loki
WORKDIR /src/loki
Expand Down
4 changes: 2 additions & 2 deletions clients/cmd/promtail/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.27.1
ARG BUILD_IMAGE=grafana/loki-build-image:0.28.1
# 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 .
FROM golang:1.19.5-alpine as goenv
FROM golang:1.20.1-alpine as goenv
RUN go env GOARCH > /goarch && \
go env GOARM > /goarm

Expand Down
4 changes: 2 additions & 2 deletions clients/cmd/promtail/Dockerfile.debug
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# 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.27.1 as build
FROM grafana/loki-build-image:0.28.1 as build
ARG GOARCH="amd64"
COPY . /src/loki
WORKDIR /src/loki
RUN make clean && make BUILD_IN_CONTAINER=false promtail-debug


FROM alpine:3.16.2
FROM alpine:3.16.4
RUN apk add --update --no-cache ca-certificates tzdata
COPY --from=build /src/loki/clients/cmd/promtail/promtail-debug /usr/bin/promtail-debug
COPY --from=build /go/bin/dlv /usr/bin/dlv
Expand Down
7 changes: 2 additions & 5 deletions clients/pkg/promtail/promtail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/grafana/loki/clients/pkg/promtail/server"
pserver "github.com/grafana/loki/clients/pkg/promtail/server"
file2 "github.com/grafana/loki/clients/pkg/promtail/targets/file"
"github.com/grafana/loki/clients/pkg/promtail/targets/testutils"

"github.com/grafana/loki/pkg/logproto"
"github.com/grafana/loki/pkg/util"
Expand All @@ -54,7 +55,7 @@ func TestPromtail(t *testing.T) {
logger = level.NewFilter(logger, level.AllowInfo())
util_log.Logger = logger

initRandom()
testutils.InitRandom()
dirName := "/tmp/promtail_test_" + randName()
positionsFileName := dirName + "/positions.yml"

Expand Down Expand Up @@ -641,10 +642,6 @@ func buildTestConfig(t *testing.T, positionsFileName string, logDirName string)
return cfg
}

func initRandom() {
rand.Seed(time.Now().UnixNano())
}

var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")

func randName() string {
Expand Down
6 changes: 4 additions & 2 deletions clients/pkg/promtail/targets/testutils/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ import (
"time"
)

var randomGenerator *rand.Rand

func InitRandom() {
rand.Seed(time.Now().UnixNano())
randomGenerator = rand.New(rand.NewSource(time.Now().UnixNano()))
}

var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")

func RandName() string {
b := make([]rune, 10)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
b[i] = letters[randomGenerator.Intn(len(letters))]
}
return string(b)
}
4 changes: 2 additions & 2 deletions cmd/logcli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.19.5 as build
FROM golang:1.20.1 as build

COPY . /src/loki
WORKDIR /src/loki
RUN make clean && make BUILD_IN_CONTAINER=false logcli

FROM alpine:3.16.2
FROM alpine:3.16.4

RUN apk add --no-cache ca-certificates

Expand Down
6 changes: 3 additions & 3 deletions cmd/logql-analyzer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM golang:1.19.5 as build
FROM golang:1.20.1 as build

COPY . /src/loki
WORKDIR /src/loki
RUN make clean && CGO_ENABLED=0 go build ./cmd/logql-analyzer/

FROM alpine:3.15.4
FROM alpine:3.16.4

RUN apk add --no-cache ca-certificates

COPY --from=build /src/loki/logql-analyzer /usr/bin/logql-analyzer

ENTRYPOINT [ "/usr/bin/logql-analyzer" ]
ENTRYPOINT [ "/usr/bin/logql-analyzer" ]
4 changes: 2 additions & 2 deletions cmd/loki-canary/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.19.5 as build
FROM golang:1.20.1 as build

COPY . /src/loki
WORKDIR /src/loki
RUN make clean && make BUILD_IN_CONTAINER=false loki-canary

FROM alpine:3.16.2
FROM alpine:3.16.4
RUN apk add --update --no-cache ca-certificates
COPY --from=build /src/loki/cmd/loki-canary/loki-canary /usr/bin/loki-canary
ENTRYPOINT [ "/usr/bin/loki-canary" ]
6 changes: 3 additions & 3 deletions cmd/loki-canary/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.27.1
ARG BUILD_IMAGE=grafana/loki-build-image:0.28.1
# 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 .
FROM golang:1.19.5-alpine as goenv
FROM golang:1.20.1-alpine as goenv
RUN go env GOARCH > /goarch && \
go env GOARM > /goarm

Expand All @@ -12,7 +12,7 @@ COPY . /src/loki
WORKDIR /src/loki
RUN make clean && GOARCH=$(cat /goarch) GOARM=$(cat /goarm) make BUILD_IN_CONTAINER=false loki-canary

FROM alpine:3.16.2
FROM alpine:3.16.4
RUN apk add --update --no-cache ca-certificates
COPY --from=build /src/loki/cmd/loki-canary/loki-canary /usr/bin/loki-canary
ENTRYPOINT [ "/usr/bin/loki-canary" ]
7 changes: 2 additions & 5 deletions cmd/loki/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.19.5 as build
FROM golang:1.20.1 as build

COPY . /src/loki
WORKDIR /src/loki
RUN make clean && make BUILD_IN_CONTAINER=false loki

FROM alpine:3.16.2
FROM alpine:3.16.4

RUN apk add --no-cache ca-certificates libcap

Expand All @@ -17,9 +17,6 @@ RUN mkdir -p /loki/rules && \
mkdir -p /loki/rules-temp && \
chown -R loki:loki /etc/loki /loki

# See https://github.com/grafana/loki/issues/1928
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf

USER 10001
EXPOSE 3100
ENTRYPOINT [ "/usr/bin/loki" ]
Expand Down
Loading

0 comments on commit 6f76a96

Please sign in to comment.