From c58e11be9898d3fd6c6f6cf60f6410af2a99d87d Mon Sep 17 00:00:00 2001 From: Periklis Tsirakidis Date: Thu, 4 Apr 2024 15:23:32 +0200 Subject: [PATCH 01/12] chore: [release-2.9.x] Bump build-image 0.33.1 and golang 1.21.9 --- .devcontainer/devcontainer.json | 2 +- .drone/drone.yml | 45 +++++++++---------- Makefile | 2 +- clients/cmd/docker-driver/Dockerfile | 2 +- clients/cmd/fluent-bit/Dockerfile | 2 +- clients/cmd/promtail/Dockerfile | 2 +- clients/cmd/promtail/Dockerfile.arm32 | 2 +- clients/cmd/promtail/Dockerfile.cross | 4 +- clients/cmd/promtail/Dockerfile.debug | 2 +- cmd/logcli/Dockerfile | 2 +- cmd/logql-analyzer/Dockerfile | 2 +- cmd/loki-canary-boringcrypto/Dockerfile | 2 +- cmd/loki-canary/Dockerfile | 2 +- cmd/loki-canary/Dockerfile.cross | 4 +- cmd/loki/Dockerfile | 2 +- cmd/loki/Dockerfile.cross | 4 +- cmd/loki/Dockerfile.debug | 4 +- cmd/migrate/Dockerfile | 2 +- cmd/querytee/Dockerfile | 2 +- cmd/querytee/Dockerfile.cross | 4 +- loki-build-image/Dockerfile | 18 ++++---- operator/Dockerfile.cross | 2 +- production/helm/loki/src/helm-test/Dockerfile | 2 +- .../dev/loki-boltdb-storage-s3/dev.dockerfile | 2 +- tools/lambda-promtail/Dockerfile | 2 +- 25 files changed, 57 insertions(+), 62 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a829bb9dcfe2d..a8145a27bac7f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "image": "grafana/loki-build-image:0.29.0", + "image": "grafana/loki-build-image:0.33.1", "containerEnv": { "BUILD_IN_CONTAINER": "false" }, diff --git a/.drone/drone.yml b/.drone/drone.yml index f53708e1bf909..55593c52abc94 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -93,14 +93,14 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: check-drone-drift - commands: - make BUILD_IN_CONTAINER=false check-generated-files depends_on: - clone environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: check-generated-files - commands: - cd .. @@ -110,7 +110,7 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: clone-target-branch when: event: @@ -121,14 +121,14 @@ steps: - clone-target-branch - check-generated-files environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 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.30.1 + image: grafana/loki-build-image:0.33.1 name: test-target-branch when: event: @@ -141,7 +141,7 @@ steps: - test - test-target-branch environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: compare-coverage when: event: @@ -159,7 +159,7 @@ steps: TOKEN: from_secret: github_token USER: grafanabot - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: report-coverage when: event: @@ -169,7 +169,7 @@ steps: depends_on: - check-generated-files environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: lint - commands: - make BUILD_IN_CONTAINER=false check-mod @@ -177,7 +177,7 @@ steps: - test - lint environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: check-mod - commands: - apk add make bash && make lint-scripts @@ -188,21 +188,21 @@ steps: depends_on: - check-generated-files environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: loki - commands: - make BUILD_IN_CONTAINER=false check-doc depends_on: - loki environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: check-doc - commands: - make BUILD_IN_CONTAINER=false check-format GIT_TARGET_BRANCH="$DRONE_TARGET_BRANCH" depends_on: - loki environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: check-format when: event: @@ -212,14 +212,14 @@ steps: depends_on: - loki environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.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.30.1 + image: grafana/loki-build-image:0.33.1 name: check-example-config-doc - commands: - mkdir -p /hugo/content/docs/loki/latest @@ -252,7 +252,7 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: loki-mixin-check when: event: @@ -277,7 +277,7 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: documentation-helm-reference-check trigger: ref: @@ -1683,7 +1683,7 @@ steps: NFPM_SIGNING_KEY: from_secret: gpg_private_key NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: write-key - commands: - make BUILD_IN_CONTAINER=false packages @@ -1691,7 +1691,7 @@ steps: NFPM_PASSPHRASE: from_secret: gpg_passphrase NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: test packaging - commands: - ./tools/packaging/verify-deb-install.sh @@ -1717,7 +1717,7 @@ steps: NFPM_PASSPHRASE: from_secret: gpg_passphrase NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: publish when: event: @@ -1752,7 +1752,7 @@ steps: from_secret: docker_password DOCKER_USERNAME: from_secret: docker_username - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1 name: build and push privileged: true volumes: @@ -2015,8 +2015,3 @@ get: path: infra/data/ci/packages-publish/gpg kind: secret name: gpg_private_key ---- -kind: signature -hmac: 016d84867476782105e34f5165893b0fbb62e393be4cf5436c199f6e339d79d7 - -... diff --git a/Makefile b/Makefile index f0286223a6d70..7100664b285b8 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ DOCKER_IMAGE_DIRS := $(patsubst %/Dockerfile,%,$(DOCKERFILES)) BUILD_IN_CONTAINER ?= true # ensure you run `make drone` after changing this -BUILD_IMAGE_VERSION := 0.30.1 +BUILD_IMAGE_VERSION := 0.33.1 # Docker image info IMAGE_PREFIX ?= grafana diff --git a/clients/cmd/docker-driver/Dockerfile b/clients/cmd/docker-driver/Dockerfile index f226e5956a8d0..f1782547b9dfa 100644 --- a/clients/cmd/docker-driver/Dockerfile +++ b/clients/cmd/docker-driver/Dockerfile @@ -1,4 +1,4 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.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 . diff --git a/clients/cmd/fluent-bit/Dockerfile b/clients/cmd/fluent-bit/Dockerfile index 563614a75f52e..3e57468798266 100644 --- a/clients/cmd/fluent-bit/Dockerfile +++ b/clients/cmd/fluent-bit/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3-bullseye AS builder +FROM golang:1.21.9-bullseye AS builder COPY . /src diff --git a/clients/cmd/promtail/Dockerfile b/clients/cmd/promtail/Dockerfile index 901fc4050f1c8..651b4ecf9d633 100644 --- a/clients/cmd/promtail/Dockerfile +++ b/clients/cmd/promtail/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3-bullseye as build +FROM golang:1.21.9-bullseye as build COPY . /src/loki WORKDIR /src/loki diff --git a/clients/cmd/promtail/Dockerfile.arm32 b/clients/cmd/promtail/Dockerfile.arm32 index 9469b13a3200a..db32bb5f4519e 100644 --- a/clients/cmd/promtail/Dockerfile.arm32 +++ b/clients/cmd/promtail/Dockerfile.arm32 @@ -1,4 +1,4 @@ -FROM golang:1.20.6-bullseye as build +FROM golang:1.21.9-bullseye as build COPY . /src/loki WORKDIR /src/loki diff --git a/clients/cmd/promtail/Dockerfile.cross b/clients/cmd/promtail/Dockerfile.cross index fa9e01701d133..d90565fb5910a 100644 --- a/clients/cmd/promtail/Dockerfile.cross +++ b/clients/cmd/promtail/Dockerfile.cross @@ -1,8 +1,8 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.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.20.6-alpine as goenv +FROM golang:1.21.9-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/clients/cmd/promtail/Dockerfile.debug b/clients/cmd/promtail/Dockerfile.debug index 7da640a057fc2..5a1acf7277b8f 100644 --- a/clients/cmd/promtail/Dockerfile.debug +++ b/clients/cmd/promtail/Dockerfile.debug @@ -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.29.3 as build +FROM grafana/loki-build-image:0.33.1 as build ARG GOARCH="amd64" COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/logcli/Dockerfile b/cmd/logcli/Dockerfile index e6f92e8878b2b..fba445b0505fe 100644 --- a/cmd/logcli/Dockerfile +++ b/cmd/logcli/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/logql-analyzer/Dockerfile b/cmd/logql-analyzer/Dockerfile index bee40f9152bb4..a872b71a91b1f 100644 --- a/cmd/logql-analyzer/Dockerfile +++ b/cmd/logql-analyzer/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/loki-canary-boringcrypto/Dockerfile b/cmd/loki-canary-boringcrypto/Dockerfile index 1d3cdf43fb426..32e34f8c1f891 100644 --- a/cmd/loki-canary-boringcrypto/Dockerfile +++ b/cmd/loki-canary-boringcrypto/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/loki-canary/Dockerfile b/cmd/loki-canary/Dockerfile index b5aabe0c8aed3..84cf0b00a0051 100644 --- a/cmd/loki-canary/Dockerfile +++ b/cmd/loki-canary/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/loki-canary/Dockerfile.cross b/cmd/loki-canary/Dockerfile.cross index d28ac2b86ba78..e0735dd50c40a 100644 --- a/cmd/loki-canary/Dockerfile.cross +++ b/cmd/loki-canary/Dockerfile.cross @@ -1,8 +1,8 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.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.20.6-alpine as goenv +FROM golang:1.21.9-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/cmd/loki/Dockerfile b/cmd/loki/Dockerfile index 9d2959d3b09d3..1e2da46854b53 100644 --- a/cmd/loki/Dockerfile +++ b/cmd/loki/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/loki/Dockerfile.cross b/cmd/loki/Dockerfile.cross index 119852f9ed851..b8caff677b57d 100644 --- a/cmd/loki/Dockerfile.cross +++ b/cmd/loki/Dockerfile.cross @@ -1,8 +1,8 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.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 . -FROM golang:1.20.7-alpine as goenv +FROM golang:1.21.9-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/cmd/loki/Dockerfile.debug b/cmd/loki/Dockerfile.debug index 99f5862ed21d2..b8506ab613cbe 100644 --- a/cmd/loki/Dockerfile.debug +++ b/cmd/loki/Dockerfile.debug @@ -1,9 +1,9 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.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.debug . -FROM golang:1.20.7-alpine as goenv +FROM golang:1.21.9-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm && \ go install github.com/go-delve/delve/cmd/dlv@latest diff --git a/cmd/migrate/Dockerfile b/cmd/migrate/Dockerfile index 3cb6649f3ebb7..9e97122130b0d 100644 --- a/cmd/migrate/Dockerfile +++ b/cmd/migrate/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki RUN make clean && make BUILD_IN_CONTAINER=false migrate diff --git a/cmd/querytee/Dockerfile b/cmd/querytee/Dockerfile index 11f941820fb0e..3f8044d3d9a3c 100644 --- a/cmd/querytee/Dockerfile +++ b/cmd/querytee/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/querytee/Dockerfile.cross b/cmd/querytee/Dockerfile.cross index b93c6ad362dc4..0616cebf3bb9c 100644 --- a/cmd/querytee/Dockerfile.cross +++ b/cmd/querytee/Dockerfile.cross @@ -1,8 +1,8 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.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.20.6-alpine as goenv +FROM golang:1.21.9-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/loki-build-image/Dockerfile b/loki-build-image/Dockerfile index 11252a288e132..bd64cbbc804d4 100644 --- a/loki-build-image/Dockerfile +++ b/loki-build-image/Dockerfile @@ -5,7 +5,7 @@ # See ../docs/sources/maintaining/release-loki-build-image.md # Install helm (https://helm.sh/) and helm-docs (https://github.com/norwoodj/helm-docs) for generating Helm Chart reference. -FROM golang:1.20.9-bullseye as helm +FROM golang:1.21.9-bullseye as helm ARG HELM_VER="v3.2.3" RUN curl -L -o /tmp/helm-$HELM_VER.tgz https://get.helm.sh/helm-${HELM_VER}-linux-amd64.tar.gz && \ tar -xz -C /tmp -f /tmp/helm-$HELM_VER.tgz && \ @@ -38,7 +38,7 @@ RUN apk add --no-cache docker-cli # TODO this should be fixed to download and extract the specific release binary from github as we do for golangci and helm above # however we need a commit which hasn't been released yet: https://github.com/drone/drone-cli/commit/1fad337d74ca0ecf420993d9d2d7229a1c99f054 # Read the comment below regarding GO111MODULE=on and why it is necessary -FROM golang:1.20.9-bullseye as drone +FROM golang:1.21.9-bullseye as drone RUN curl -L https://github.com/drone/drone-cli/releases/download/v1.4.0/drone_linux_amd64.tar.gz | tar zx && \ install -t /usr/local/bin drone @@ -47,33 +47,33 @@ RUN curl -L https://github.com/drone/drone-cli/releases/download/v1.4.0/drone_li # Error: # github.com/fatih/faillint@v1.5.0 requires golang.org/x/tools@v0.0.0-20200207224406-61798d64f025 # (not golang.org/x/tools@v0.0.0-20190918214920-58d531046acd from golang.org/x/tools/cmd/goyacc@58d531046acdc757f177387bc1725bfa79895d69) -FROM golang:1.20.9-bullseye as faillint +FROM golang:1.21.9-bullseye as faillint RUN GO111MODULE=on go install github.com/fatih/faillint@v1.11.0 RUN GO111MODULE=on go install golang.org/x/tools/cmd/goimports@v0.7.0 -FROM golang:1.20.9-bullseye as delve +FROM golang:1.21.9-bullseye as delve RUN GO111MODULE=on go install github.com/go-delve/delve/cmd/dlv@latest # Install ghr used to push binaries and template the release # 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. -FROM golang:1.20.9-bullseye as ghr +FROM golang:1.21.9-bullseye as ghr RUN GO111MODULE=on go install github.com/tcnksm/ghr@9349474 # Install nfpm (https://nfpm.goreleaser.com) for creating .deb and .rpm packages. -FROM golang:1.20.9-bullseye as nfpm +FROM golang:1.21.9-bullseye as nfpm RUN GO111MODULE=on go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.11.3 # Install gotestsum -FROM golang:1.20.9-bullseye as gotestsum +FROM golang:1.21.9-bullseye as gotestsum RUN GO111MODULE=on go install gotest.tools/gotestsum@v1.8.2 # Install tools used to compile jsonnet. -FROM golang:1.20.9-bullseye as jsonnet +FROM golang:1.21.9-bullseye as jsonnet RUN GO111MODULE=on go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.4.0 RUN GO111MODULE=on go install github.com/monitoring-mixins/mixtool/cmd/mixtool@bca3066 RUN GO111MODULE=on go install github.com/google/go-jsonnet/cmd/jsonnet@v0.18.0 -FROM golang:1.20.9-bullseye +FROM golang:1.21.9-bullseye RUN apt-get update && \ apt-get install -qy \ musl gnupg ragel \ diff --git a/operator/Dockerfile.cross b/operator/Dockerfile.cross index 7cd58c4903a36..49b9318ba0fa8 100644 --- a/operator/Dockerfile.cross +++ b/operator/Dockerfile.cross @@ -1,4 +1,4 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1 FROM golang:1.20.6-alpine as goenv RUN go env GOARCH > /goarch && \ diff --git a/production/helm/loki/src/helm-test/Dockerfile b/production/helm/loki/src/helm-test/Dockerfile index 253a10fd44bf8..91e394cab05ec 100644 --- a/production/helm/loki/src/helm-test/Dockerfile +++ b/production/helm/loki/src/helm-test/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20.4 as build +FROM golang:1.21.9 as build # build via Makefile target helm-test-image in root # Makefile. Building from this directory will not be diff --git a/tools/dev/loki-boltdb-storage-s3/dev.dockerfile b/tools/dev/loki-boltdb-storage-s3/dev.dockerfile index 1795bc19903f4..10af3e7ac417e 100644 --- a/tools/dev/loki-boltdb-storage-s3/dev.dockerfile +++ b/tools/dev/loki-boltdb-storage-s3/dev.dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20.4 +FROM golang:1.21.9 ENV CGO_ENABLED=0 RUN go install github.com/go-delve/delve/cmd/dlv@v1.20.2 diff --git a/tools/lambda-promtail/Dockerfile b/tools/lambda-promtail/Dockerfile index 8ab30d3cbeb7d..13a0b142763ea 100644 --- a/tools/lambda-promtail/Dockerfile +++ b/tools/lambda-promtail/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3-alpine AS build-image +FROM golang:1.21.9-alpine AS build-image COPY tools/lambda-promtail /src/lambda-promtail WORKDIR /src/lambda-promtail From dbde7d3adaed6ec509033f15530bdc6e39f59f59 Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Thu, 4 Apr 2024 14:43:52 +0100 Subject: [PATCH 02/12] add drone signature Signed-off-by: Michel Hollands --- .drone/drone.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.drone/drone.yml b/.drone/drone.yml index 55593c52abc94..6aa366f3de0c0 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -2015,3 +2015,8 @@ get: path: infra/data/ci/packages-publish/gpg kind: secret name: gpg_private_key +--- +kind: signature +hmac: 9a0f19c77ff8e260f3ae1e3751395e65ccc508557787924f5fcf6541b9c1b224 + +... From 7c3e28de347d318844062d8c19dcd9e035efde3a Mon Sep 17 00:00:00 2001 From: Periklis Tsirakidis Date: Thu, 4 Apr 2024 15:56:42 +0200 Subject: [PATCH 03/12] Fix helm test dockerfile --- production/helm/loki/src/helm-test/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production/helm/loki/src/helm-test/Dockerfile b/production/helm/loki/src/helm-test/Dockerfile index 91e394cab05ec..d9f24475c878f 100644 --- a/production/helm/loki/src/helm-test/Dockerfile +++ b/production/helm/loki/src/helm-test/Dockerfile @@ -7,7 +7,7 @@ COPY . /src/loki WORKDIR /src/loki RUN make clean && make BUILD_IN_CONTAINER=false helm-test -FROM alpine:3.16.7 +FROM alpine:3.18.6 RUN apk add --update --no-cache ca-certificates=20230506-r0 COPY --from=build /src/loki/production/helm/loki/src/helm-test/helm-test /usr/bin/helm-test ENTRYPOINT [ "/usr/bin/helm-test" ] From a6e43436e435d0cd5c44e329cef1fd2613c11f60 Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Thu, 4 Apr 2024 15:01:54 +0100 Subject: [PATCH 04/12] Update helm/chart-testing-action Signed-off-by: Michel Hollands --- .github/workflows/helm-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/helm-ci.yml b/.github/workflows/helm-ci.yml index 8e471e48413cf..50dd5d3c9d681 100644 --- a/.github/workflows/helm-ci.yml +++ b/.github/workflows/helm-ci.yml @@ -60,7 +60,7 @@ jobs: python-version: 3.7 - name: Set up chart-testing - uses: helm/chart-testing-action@v2.4.0 + uses: helm/chart-testing-action@v2.5.0 - name: Run chart-testing (list-changed) id: list-changed From 885b8277291abe42c4217b0932904fa3e42c84ec Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Thu, 4 Apr 2024 15:12:58 +0100 Subject: [PATCH 05/12] Fix chart-testing failure Signed-off-by: Michel Hollands --- .github/workflows/helm-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/helm-ci.yml b/.github/workflows/helm-ci.yml index 50dd5d3c9d681..fc0c4759e2d9d 100644 --- a/.github/workflows/helm-ci.yml +++ b/.github/workflows/helm-ci.yml @@ -61,6 +61,8 @@ jobs: - name: Set up chart-testing uses: helm/chart-testing-action@v2.5.0 + with: + version: v3.8.0 - name: Run chart-testing (list-changed) id: list-changed From bab2fa6409e61c97f9708c83090170e6c356ee7c Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Thu, 4 Apr 2024 15:40:50 +0100 Subject: [PATCH 06/12] Fix certificates version Signed-off-by: Michel Hollands --- production/helm/loki/src/helm-test/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production/helm/loki/src/helm-test/Dockerfile b/production/helm/loki/src/helm-test/Dockerfile index d9f24475c878f..7f705ba8ff97a 100644 --- a/production/helm/loki/src/helm-test/Dockerfile +++ b/production/helm/loki/src/helm-test/Dockerfile @@ -8,6 +8,6 @@ WORKDIR /src/loki RUN make clean && make BUILD_IN_CONTAINER=false helm-test FROM alpine:3.18.6 -RUN apk add --update --no-cache ca-certificates=20230506-r0 +RUN apk add --update --no-cache ca-certificates=20240226-r0 COPY --from=build /src/loki/production/helm/loki/src/helm-test/helm-test /usr/bin/helm-test ENTRYPOINT [ "/usr/bin/helm-test" ] From c339fc089b95dd8343358de88db45fbe35040d40 Mon Sep 17 00:00:00 2001 From: Periklis Tsirakidis Date: Fri, 5 Apr 2024 11:25:44 +0200 Subject: [PATCH 07/12] Use loki-build-image tag 0.33.1-golangci.1.51.2 --- .devcontainer/devcontainer.json | 2 +- .drone/drone.yml | 45 ++++++++++++-------------- .github/workflows/check.yml | 2 +- .github/workflows/minor-release-pr.yml | 4 +-- .github/workflows/patch-release-pr.yml | 4 +-- Makefile | 2 +- clients/cmd/docker-driver/Dockerfile | 2 +- clients/cmd/promtail/Dockerfile.cross | 2 +- clients/cmd/promtail/Dockerfile.debug | 2 +- cmd/loki-canary/Dockerfile.cross | 2 +- cmd/loki/Dockerfile.cross | 2 +- cmd/loki/Dockerfile.debug | 2 +- cmd/querytee/Dockerfile.cross | 2 +- operator/Dockerfile.cross | 2 +- 14 files changed, 35 insertions(+), 40 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a8145a27bac7f..22da7ec3383cb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "image": "grafana/loki-build-image:0.33.1", + "image": "grafana/loki-build-image:0.33.1-golangci.1.51.2", "containerEnv": { "BUILD_IN_CONTAINER": "false" }, diff --git a/.drone/drone.yml b/.drone/drone.yml index 6aa366f3de0c0..7fc48548107ff 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -93,14 +93,14 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: check-drone-drift - commands: - make BUILD_IN_CONTAINER=false check-generated-files depends_on: - clone environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: check-generated-files - commands: - cd .. @@ -110,7 +110,7 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: clone-target-branch when: event: @@ -121,14 +121,14 @@ steps: - clone-target-branch - check-generated-files environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 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.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: test-target-branch when: event: @@ -141,7 +141,7 @@ steps: - test - test-target-branch environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: compare-coverage when: event: @@ -159,7 +159,7 @@ steps: TOKEN: from_secret: github_token USER: grafanabot - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: report-coverage when: event: @@ -169,7 +169,7 @@ steps: depends_on: - check-generated-files environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: lint - commands: - make BUILD_IN_CONTAINER=false check-mod @@ -177,7 +177,7 @@ steps: - test - lint environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: check-mod - commands: - apk add make bash && make lint-scripts @@ -188,21 +188,21 @@ steps: depends_on: - check-generated-files environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: loki - commands: - make BUILD_IN_CONTAINER=false check-doc depends_on: - loki environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: check-doc - commands: - make BUILD_IN_CONTAINER=false check-format GIT_TARGET_BRANCH="$DRONE_TARGET_BRANCH" depends_on: - loki environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: check-format when: event: @@ -212,14 +212,14 @@ steps: depends_on: - loki environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: validate-example-configs - commands: - make BUILD_IN_CONTAINER=false check-example-config-doc depends_on: - clone environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: check-example-config-doc - commands: - mkdir -p /hugo/content/docs/loki/latest @@ -252,7 +252,7 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: loki-mixin-check when: event: @@ -277,7 +277,7 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: documentation-helm-reference-check trigger: ref: @@ -1683,7 +1683,7 @@ steps: NFPM_SIGNING_KEY: from_secret: gpg_private_key NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: write-key - commands: - make BUILD_IN_CONTAINER=false packages @@ -1691,7 +1691,7 @@ steps: NFPM_PASSPHRASE: from_secret: gpg_passphrase NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: test packaging - commands: - ./tools/packaging/verify-deb-install.sh @@ -1717,7 +1717,7 @@ steps: NFPM_PASSPHRASE: from_secret: gpg_passphrase NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: publish when: event: @@ -1752,7 +1752,7 @@ steps: from_secret: docker_password DOCKER_USERNAME: from_secret: docker_username - image: grafana/loki-build-image:0.33.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: build and push privileged: true volumes: @@ -2015,8 +2015,3 @@ get: path: infra/data/ci/packages-publish/gpg kind: secret name: gpg_private_key ---- -kind: signature -hmac: 9a0f19c77ff8e260f3ae1e3751395e65ccc508557787924f5fcf6541b9c1b224 - -... diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 50aff9f6ddec4..6a4631a083733 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -2,7 +2,7 @@ "check": "uses": "grafana/loki-release/.github/workflows/check.yml@loki-2.9.x" "with": - "build_image": "grafana/loki-build-image:0.30.1" + "build_image": "grafana/loki-build-image:0.33.1-golangci.1.51.2" "golang_ci_lint_version": "v1.51.2" "release_lib_ref": "loki-2.9.x" "skip_validation": false diff --git a/.github/workflows/minor-release-pr.yml b/.github/workflows/minor-release-pr.yml index 68a65b48b0ba9..926961b7766c3 100644 --- a/.github/workflows/minor-release-pr.yml +++ b/.github/workflows/minor-release-pr.yml @@ -14,7 +14,7 @@ jobs: check: uses: "grafana/loki-release/.github/workflows/check.yml@loki-2.9.x" with: - build_image: "grafana/loki-build-image:0.30.1" + build_image: "grafana/loki-build-image:0.33.1-golangci.1.51.2" golang_ci_lint_version: "v1.51.2" release_lib_ref: "loki-2.9.x" skip_validation: false @@ -136,7 +136,7 @@ jobs: --env SKIP_ARM \ --volume .:/src/loki \ --workdir /src/loki \ - --entrypoint /bin/sh "grafana/loki-build-image:0.30.1" + --entrypoint /bin/sh "grafana/loki-build-image:0.33.1-golangci.1.51.2" git config --global --add safe.directory /src/loki echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE make dist packages diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index 6c25955897441..b1356df814eb1 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -14,7 +14,7 @@ jobs: check: uses: "grafana/loki-release/.github/workflows/check.yml@loki-2.9.x" with: - build_image: "grafana/loki-build-image:0.30.1" + build_image: "grafana/loki-build-image:0.33.1-golangci.1.51.2" golang_ci_lint_version: "v1.51.2" release_lib_ref: "loki-2.9.x" skip_validation: false @@ -136,7 +136,7 @@ jobs: --env SKIP_ARM \ --volume .:/src/loki \ --workdir /src/loki \ - --entrypoint /bin/sh "grafana/loki-build-image:0.30.1" + --entrypoint /bin/sh "grafana/loki-build-image:0.33.1-golangci.1.51.2" git config --global --add safe.directory /src/loki echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE make dist packages diff --git a/Makefile b/Makefile index 7100664b285b8..f70291ca89e48 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ DOCKER_IMAGE_DIRS := $(patsubst %/Dockerfile,%,$(DOCKERFILES)) BUILD_IN_CONTAINER ?= true # ensure you run `make drone` after changing this -BUILD_IMAGE_VERSION := 0.33.1 +BUILD_IMAGE_VERSION := 0.33.1-golangci.1.51.2 # Docker image info IMAGE_PREFIX ?= grafana diff --git a/clients/cmd/docker-driver/Dockerfile b/clients/cmd/docker-driver/Dockerfile index f1782547b9dfa..7638367f78bb5 100644 --- a/clients/cmd/docker-driver/Dockerfile +++ b/clients/cmd/docker-driver/Dockerfile @@ -1,4 +1,4 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 # 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 . diff --git a/clients/cmd/promtail/Dockerfile.cross b/clients/cmd/promtail/Dockerfile.cross index d90565fb5910a..977e2117b066e 100644 --- a/clients/cmd/promtail/Dockerfile.cross +++ b/clients/cmd/promtail/Dockerfile.cross @@ -1,4 +1,4 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 # 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 . diff --git a/clients/cmd/promtail/Dockerfile.debug b/clients/cmd/promtail/Dockerfile.debug index 5a1acf7277b8f..22347f82effdc 100644 --- a/clients/cmd/promtail/Dockerfile.debug +++ b/clients/cmd/promtail/Dockerfile.debug @@ -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.33.1 as build +FROM grafana/loki-build-image:0.33.1-golangci.1.51.2 as build ARG GOARCH="amd64" COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/loki-canary/Dockerfile.cross b/cmd/loki-canary/Dockerfile.cross index e0735dd50c40a..bf2413570beb4 100644 --- a/cmd/loki-canary/Dockerfile.cross +++ b/cmd/loki-canary/Dockerfile.cross @@ -1,4 +1,4 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 # 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 . diff --git a/cmd/loki/Dockerfile.cross b/cmd/loki/Dockerfile.cross index b8caff677b57d..ecaf9ab40bce0 100644 --- a/cmd/loki/Dockerfile.cross +++ b/cmd/loki/Dockerfile.cross @@ -1,4 +1,4 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 # 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 . diff --git a/cmd/loki/Dockerfile.debug b/cmd/loki/Dockerfile.debug index b8506ab613cbe..bd44e5bca2f01 100644 --- a/cmd/loki/Dockerfile.debug +++ b/cmd/loki/Dockerfile.debug @@ -1,4 +1,4 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 # 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 . diff --git a/cmd/querytee/Dockerfile.cross b/cmd/querytee/Dockerfile.cross index 0616cebf3bb9c..6b05f5e6606df 100644 --- a/cmd/querytee/Dockerfile.cross +++ b/cmd/querytee/Dockerfile.cross @@ -1,4 +1,4 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 # 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 . diff --git a/operator/Dockerfile.cross b/operator/Dockerfile.cross index 49b9318ba0fa8..d52765d2d26f4 100644 --- a/operator/Dockerfile.cross +++ b/operator/Dockerfile.cross @@ -1,4 +1,4 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 FROM golang:1.20.6-alpine as goenv RUN go env GOARCH > /goarch && \ From f52cea9bddac78e430ed89f2f1c81fa83de27fc1 Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Fri, 5 Apr 2024 10:32:45 +0100 Subject: [PATCH 08/12] Update drone signature Signed-off-by: Michel Hollands --- .drone/drone.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.drone/drone.yml b/.drone/drone.yml index 7fc48548107ff..5db595df86c51 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -2015,3 +2015,8 @@ get: path: infra/data/ci/packages-publish/gpg kind: secret name: gpg_private_key +--- +kind: signature +hmac: f76dd17855d25e98563815a3248834d72b19bffa5427277ee167dcf28dd5dbad + +... From 681a24ddf2060179a3d6c8a5256e2682888c7aba Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Fri, 5 Apr 2024 14:09:48 +0100 Subject: [PATCH 09/12] Disable linting until this Go version works with it Signed-off-by: Michel Hollands --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f70291ca89e48..5a4166c8dc944 100644 --- a/Makefile +++ b/Makefile @@ -317,7 +317,7 @@ publish: packages lint: ## run linters go version golangci-lint version - GO111MODULE=on golangci-lint run -v --timeout 15m + # GO111MODULE=on golangci-lint run -v --timeout 15m faillint -paths "sync/atomic=go.uber.org/atomic" ./... ######## From df808e1da173358d606c07d046832a3aeb7fcad2 Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Fri, 5 Apr 2024 14:31:54 +0100 Subject: [PATCH 10/12] Turn off validation in the check workflow Signed-off-by: Michel Hollands --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6a4631a083733..fe6fe31a4c56a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -5,7 +5,7 @@ "build_image": "grafana/loki-build-image:0.33.1-golangci.1.51.2" "golang_ci_lint_version": "v1.51.2" "release_lib_ref": "loki-2.9.x" - "skip_validation": false + "skip_validation": true "use_github_app_token": true "name": "check" "on": From 01c0803c46042b88c881e06179ba3bf5388c0852 Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Fri, 5 Apr 2024 16:13:01 +0100 Subject: [PATCH 11/12] Update .golangci.yml and re-enable linting Signed-off-by: Michel Hollands --- .golangci.yml | 7 ++++++- Makefile | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f1d4093919a59..eb387dda2451c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -88,5 +88,10 @@ issues: - Error return value of .*log\.Logger\)\.Log\x60 is not checked - Error return value of .*.Log.* is not checked - Error return value of `` is not checked - + exclude-rules: + - path: pkg/scheduler/scheduler.go + text: 'SA1019: msg.GetHttpRequest is deprecated: Do not use' + - path: '(.+)_test\.go' + linters: + - goconst fix: true diff --git a/Makefile b/Makefile index 5a4166c8dc944..f70291ca89e48 100644 --- a/Makefile +++ b/Makefile @@ -317,7 +317,7 @@ publish: packages lint: ## run linters go version golangci-lint version - # GO111MODULE=on golangci-lint run -v --timeout 15m + GO111MODULE=on golangci-lint run -v --timeout 15m faillint -paths "sync/atomic=go.uber.org/atomic" ./... ######## From b64be219182ae5680558be28047fa75072200085 Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Fri, 5 Apr 2024 16:31:11 +0100 Subject: [PATCH 12/12] Apply changes implied by linter Signed-off-by: Michel Hollands --- clients/pkg/logentry/stages/metrics.go | 1 + pkg/logcli/client/client.go | 1 + pkg/logcli/query/part_file.go | 5 ++--- pkg/logql/evaluator.go | 3 +-- pkg/querier/http.go | 5 ++--- pkg/querier/queryrange/querysharding.go | 3 +-- tools/doc-generator/writer.go | 1 + 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/clients/pkg/logentry/stages/metrics.go b/clients/pkg/logentry/stages/metrics.go index d54f8dce46f7c..14386e3b43a40 100644 --- a/clients/pkg/logentry/stages/metrics.go +++ b/clients/pkg/logentry/stages/metrics.go @@ -179,6 +179,7 @@ func (m *metricStage) Name() string { } // recordCounter will update a counter metric +// nolint:goconst func (m *metricStage) recordCounter(name string, counter *metric.Counters, labels model.LabelSet, v interface{}) { // If value matching is defined, make sure value matches. if counter.Cfg.Value != nil { diff --git a/pkg/logcli/client/client.go b/pkg/logcli/client/client.go index 7fe3233ec4951..964abc13d30bd 100644 --- a/pkg/logcli/client/client.go +++ b/pkg/logcli/client/client.go @@ -324,6 +324,7 @@ func (c *DefaultClient) doRequest(path, query string, quiet bool, out interface{ return json.NewDecoder(resp.Body).Decode(out) } +// nolint:goconst func (c *DefaultClient) getHTTPRequestHeader() (http.Header, error) { h := make(http.Header) diff --git a/pkg/logcli/query/part_file.go b/pkg/logcli/query/part_file.go index 8cb450c1e3f4f..41d724bd8f465 100644 --- a/pkg/logcli/query/part_file.go +++ b/pkg/logcli/query/part_file.go @@ -36,10 +36,9 @@ func (f *PartFile) Exists() (bool, error) { } else if errors.Is(err, os.ErrNotExist) { // File does not exist. return false, nil - } else { - // Unclear if file exists or not, we cannot stat it. - return false, fmt.Errorf("failed to check if part file exists: %s: %s", f.finalName, err) } + // Unclear if file exists or not, we cannot stat it. + return false, fmt.Errorf("failed to check if part file exists: %s: %s", f.finalName, err) } // CreateTempFile creates the temp file to store the data before Finalize is called. diff --git a/pkg/logql/evaluator.go b/pkg/logql/evaluator.go index 89f9a7866a15a..9eff5dac0815a 100644 --- a/pkg/logql/evaluator.go +++ b/pkg/logql/evaluator.go @@ -698,9 +698,8 @@ func matchingSignature(sample promql.Sample, opts *syntax.BinOpOptions) uint64 { return sample.Metric.Hash() } else if opts.VectorMatching.On { return labels.NewBuilder(sample.Metric).Keep(opts.VectorMatching.MatchingLabels...).Labels().Hash() - } else { - return labels.NewBuilder(sample.Metric).Del(opts.VectorMatching.MatchingLabels...).Labels().Hash() } + return labels.NewBuilder(sample.Metric).Del(opts.VectorMatching.MatchingLabels...).Labels().Hash() } func vectorBinop(op string, opts *syntax.BinOpOptions, lhs, rhs promql.Vector, lsigs, rsigs []uint64) (promql.Vector, error) { diff --git a/pkg/querier/http.go b/pkg/querier/http.go index 330a17d7ac639..15914f16a3d44 100644 --- a/pkg/querier/http.go +++ b/pkg/querier/http.go @@ -316,10 +316,9 @@ func (q *QuerierAPI) TailHandler(w http.ResponseWriter, r *http.Request) { break } else if tailer.stopped { return - } else { - level.Error(logger).Log("msg", "Unexpected error from client", "err", err) - break } + level.Error(logger).Log("msg", "Unexpected error from client", "err", err) + break } } doneChan <- struct{}{} diff --git a/pkg/querier/queryrange/querysharding.go b/pkg/querier/queryrange/querysharding.go index 8027afa3c757d..aabf546b2eda8 100644 --- a/pkg/querier/queryrange/querysharding.go +++ b/pkg/querier/queryrange/querysharding.go @@ -333,9 +333,8 @@ func (confs ShardingConfigs) ValidRange(start, end int64) (config.PeriodConfig, } else if end < int64(confs[i+1].From.Time) { // The request is entirely scoped into this shard config return conf, nil - } else { - continue } + continue } return config.PeriodConfig{}, errInvalidShardingRange diff --git a/tools/doc-generator/writer.go b/tools/doc-generator/writer.go index b73877fc45f86..a13613c7fbffd 100644 --- a/tools/doc-generator/writer.go +++ b/tools/doc-generator/writer.go @@ -37,6 +37,7 @@ func (w *specWriter) writeConfigBlock(b *parse.ConfigBlock, indent int) { } } +// nolint:goconst func (w *specWriter) writeConfigEntry(e *parse.ConfigEntry, indent int) { if e.Kind == parse.KindBlock { // If the block is a root block it will have its dedicated section in the doc,