From 56c6ed3fa4df4ade62e8921ad2db50d35de40198 Mon Sep 17 00:00:00 2001 From: Oleg Zaytsev Date: Thu, 21 Dec 2023 12:00:37 +0100 Subject: [PATCH 1/9] mimir-build-image: update to Debian Bookworm Current image has an old sed 4.7 version installed, which fails to work properly under certain conditions on OSX, failing as: /bin/sed: couldn't open temporary file ...: Permission denied This seems to be fixed in 4.8 [1], which is available in Bookworm, and I could workaround by bringing the backports, but it's just easier to update the build image. [1]: https://forums.docker.com/t/sed-couldnt-open-temporary-file-xyz-permission-denied-when-using-virtiofs/125473 Signed-off-by: Oleg Zaytsev --- mimir-build-image/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mimir-build-image/Dockerfile b/mimir-build-image/Dockerfile index 1bc4721e595..12bb04b1477 100644 --- a/mimir-build-image/Dockerfile +++ b/mimir-build-image/Dockerfile @@ -5,7 +5,7 @@ FROM registry.k8s.io/kustomize/kustomize:v5.2.1 as kustomize FROM alpine/helm:3.13.2 as helm -FROM golang:1.21.5-bullseye +FROM golang:1.21.5-bookworm ARG goproxyValue ENV GOPROXY=${goproxyValue} ENV SKOPEO_DEPS="libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev pkg-config" From 1230cca4aebfc6e57f1993b7325499ecac99412b Mon Sep 17 00:00:00 2001 From: Ying WANG <74549700+ying-jeanne@users.noreply.github.com> Date: Thu, 21 Dec 2023 11:49:13 +0000 Subject: [PATCH 2/9] make the author_association wider than just member --- .github/workflows/push-mimir-build-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push-mimir-build-image.yml b/.github/workflows/push-mimir-build-image.yml index c994dc04472..da9c65aaf75 100644 --- a/.github/workflows/push-mimir-build-image.yml +++ b/.github/workflows/push-mimir-build-image.yml @@ -21,7 +21,7 @@ jobs: pull-requests: write # We want to allow running github actions for all contributors, but don't want all contributors to be able to # publish new build images just by sending the PR. Hence this change. - if: github.event.pull_request.author_association == 'MEMBER' || github.actor == 'renovate[bot]' + if: ${{ contains(fromJSON('["OWNER", "MEMBER"]'), github.event.pull_request.author_association )}} || github.actor == 'renovate[bot]' steps: - name: Checkout Repository uses: actions/checkout@v4 From fbf2ef8de2149c6aecfaa9a48e1814cf597a82fa Mon Sep 17 00:00:00 2001 From: colega Date: Thu, 21 Dec 2023 12:23:05 +0000 Subject: [PATCH 3/9] Update build image version to pr6980-478aa31e45 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 90a5c0be1e1..5ca2123a931 100644 --- a/Makefile +++ b/Makefile @@ -212,7 +212,7 @@ mimir-build-image/$(UPTODATE): mimir-build-image/* # All the boiler plate for building golang follows: SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E") BUILD_IN_CONTAINER ?= true -LATEST_BUILD_IMAGE_TAG ?= pr6868-e4be452cf9 +LATEST_BUILD_IMAGE_TAG ?= pr6980-478aa31e45 # TTY is parameterized to allow Google Cloud Builder to run builds, # as it currently disallows TTY devices. This value needs to be overridden From e23b182ba9adc373728d9b77763d83ac411d23e6 Mon Sep 17 00:00:00 2001 From: Oleg Zaytsev Date: Thu, 21 Dec 2023 15:25:30 +0100 Subject: [PATCH 4/9] Empty commit Signed-off-by: Oleg Zaytsev From 0e56fdd3fc2c07d3756b5c7f6a56c9b85068a053 Mon Sep 17 00:00:00 2001 From: Oleg Zaytsev Date: Thu, 21 Dec 2023 16:02:28 +0100 Subject: [PATCH 5/9] make shellcheck happy again Signed-off-by: Oleg Zaytsev --- packaging/nfpm/mimir/postinstall.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/nfpm/mimir/postinstall.sh b/packaging/nfpm/mimir/postinstall.sh index a8d8212c5be..fa199db1628 100644 --- a/packaging/nfpm/mimir/postinstall.sh +++ b/packaging/nfpm/mimir/postinstall.sh @@ -4,7 +4,7 @@ # Provenance-includes-license: Apache-2.0 # Provenance-includes-copyright: The Cortex Authors. -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 . "$OS_ENV_DIR/mimir" if ! command -V systemctl >/dev/null 2>&1; then @@ -28,7 +28,7 @@ install() { fi chmod 640 /etc/mimir/config.example.yaml - chown root:$MIMIR_GROUP /etc/mimir/config.example.yaml + chown root:"$MIMIR_GROUP" /etc/mimir/config.example.yaml printf "\033[32m Reload the service unit from disk\033[0m\n" systemctl daemon-reload ||: From fb4b047267554555c7695ac15ff598e0020965de Mon Sep 17 00:00:00 2001 From: Oleg Zaytsev Date: Thu, 21 Dec 2023 16:36:31 +0100 Subject: [PATCH 6/9] make check-protos Seems that asome String() methods have changed Signed-off-by: Oleg Zaytsev --- pkg/frontend/querymiddleware/model.pb.go | 4 ++-- pkg/querier/stats/stats.pb.go | 6 +++--- pkg/ruler/ruler.pb.go | 24 ++++++++++++------------ pkg/ruler/rulespb/rules.pb.go | 10 +++++----- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pkg/frontend/querymiddleware/model.pb.go b/pkg/frontend/querymiddleware/model.pb.go index aed31f9e433..352d5213135 100644 --- a/pkg/frontend/querymiddleware/model.pb.go +++ b/pkg/frontend/querymiddleware/model.pb.go @@ -12,9 +12,9 @@ import ( proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/duration" github_com_grafana_mimir_pkg_mimirpb "github.com/grafana/mimir/pkg/mimirpb" mimirpb "github.com/grafana/mimir/pkg/mimirpb" + _ "google.golang.org/protobuf/types/known/durationpb" io "io" math "math" math_bits "math/bits" @@ -2799,7 +2799,7 @@ func (this *PrometheusRangeQueryRequest) String() string { `Start:` + fmt.Sprintf("%v", this.Start) + `,`, `End:` + fmt.Sprintf("%v", this.End) + `,`, `Step:` + fmt.Sprintf("%v", this.Step) + `,`, - `Timeout:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timeout), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, + `Timeout:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timeout), "Duration", "durationpb.Duration", 1), `&`, ``, 1) + `,`, `Query:` + fmt.Sprintf("%v", this.Query) + `,`, `Options:` + strings.Replace(strings.Replace(this.Options.String(), "Options", "Options", 1), `&`, ``, 1) + `,`, `Id:` + fmt.Sprintf("%v", this.Id) + `,`, diff --git a/pkg/querier/stats/stats.pb.go b/pkg/querier/stats/stats.pb.go index 468e7bc159a..0d66288d281 100644 --- a/pkg/querier/stats/stats.pb.go +++ b/pkg/querier/stats/stats.pb.go @@ -8,7 +8,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/duration" + _ "google.golang.org/protobuf/types/known/durationpb" io "io" math "math" math_bits "math/bits" @@ -383,7 +383,7 @@ func (this *Stats) String() string { return "nil" } s := strings.Join([]string{`&Stats{`, - `WallTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.WallTime), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, + `WallTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.WallTime), "Duration", "durationpb.Duration", 1), `&`, ``, 1) + `,`, `FetchedSeriesCount:` + fmt.Sprintf("%v", this.FetchedSeriesCount) + `,`, `FetchedChunkBytes:` + fmt.Sprintf("%v", this.FetchedChunkBytes) + `,`, `FetchedChunksCount:` + fmt.Sprintf("%v", this.FetchedChunksCount) + `,`, @@ -391,7 +391,7 @@ func (this *Stats) String() string { `SplitQueries:` + fmt.Sprintf("%v", this.SplitQueries) + `,`, `FetchedIndexBytes:` + fmt.Sprintf("%v", this.FetchedIndexBytes) + `,`, `EstimatedSeriesCount:` + fmt.Sprintf("%v", this.EstimatedSeriesCount) + `,`, - `QueueTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.QueueTime), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, + `QueueTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.QueueTime), "Duration", "durationpb.Duration", 1), `&`, ``, 1) + `,`, `}`, }, "") return s diff --git a/pkg/ruler/ruler.pb.go b/pkg/ruler/ruler.pb.go index 17786920926..a2bd34ada74 100644 --- a/pkg/ruler/ruler.pb.go +++ b/pkg/ruler/ruler.pb.go @@ -10,14 +10,14 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/duration" - _ "github.com/golang/protobuf/ptypes/timestamp" _ "github.com/grafana/mimir/pkg/mimirpb" github_com_grafana_mimir_pkg_mimirpb "github.com/grafana/mimir/pkg/mimirpb" rulespb "github.com/grafana/mimir/pkg/ruler/rulespb" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" @@ -1749,8 +1749,8 @@ func (this *GroupStateDesc) String() string { s := strings.Join([]string{`&GroupStateDesc{`, `Group:` + strings.Replace(fmt.Sprintf("%v", this.Group), "RuleGroupDesc", "rulespb.RuleGroupDesc", 1) + `,`, `ActiveRules:` + repeatedStringForActiveRules + `,`, - `EvaluationTimestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.EvaluationTimestamp), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, - `EvaluationDuration:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.EvaluationDuration), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, + `EvaluationTimestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.EvaluationTimestamp), "Timestamp", "timestamppb.Timestamp", 1), `&`, ``, 1) + `,`, + `EvaluationDuration:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.EvaluationDuration), "Duration", "durationpb.Duration", 1), `&`, ``, 1) + `,`, `}`, }, "") return s @@ -1770,8 +1770,8 @@ func (this *RuleStateDesc) String() string { `Health:` + fmt.Sprintf("%v", this.Health) + `,`, `LastError:` + fmt.Sprintf("%v", this.LastError) + `,`, `Alerts:` + repeatedStringForAlerts + `,`, - `EvaluationTimestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.EvaluationTimestamp), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, - `EvaluationDuration:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.EvaluationDuration), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, + `EvaluationTimestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.EvaluationTimestamp), "Timestamp", "timestamppb.Timestamp", 1), `&`, ``, 1) + `,`, + `EvaluationDuration:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.EvaluationDuration), "Duration", "durationpb.Duration", 1), `&`, ``, 1) + `,`, `}`, }, "") return s @@ -1785,12 +1785,12 @@ func (this *AlertStateDesc) String() string { `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, `Annotations:` + fmt.Sprintf("%v", this.Annotations) + `,`, `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `ActiveAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ActiveAt), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, - `FiredAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.FiredAt), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, - `ResolvedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ResolvedAt), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, - `LastSentAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastSentAt), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, - `ValidUntil:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ValidUntil), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, - `KeepFiringSince:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.KeepFiringSince), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, + `ActiveAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ActiveAt), "Timestamp", "timestamppb.Timestamp", 1), `&`, ``, 1) + `,`, + `FiredAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.FiredAt), "Timestamp", "timestamppb.Timestamp", 1), `&`, ``, 1) + `,`, + `ResolvedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ResolvedAt), "Timestamp", "timestamppb.Timestamp", 1), `&`, ``, 1) + `,`, + `LastSentAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastSentAt), "Timestamp", "timestamppb.Timestamp", 1), `&`, ``, 1) + `,`, + `ValidUntil:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ValidUntil), "Timestamp", "timestamppb.Timestamp", 1), `&`, ``, 1) + `,`, + `KeepFiringSince:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.KeepFiringSince), "Timestamp", "timestamppb.Timestamp", 1), `&`, ``, 1) + `,`, `}`, }, "") return s diff --git a/pkg/ruler/rulespb/rules.pb.go b/pkg/ruler/rulespb/rules.pb.go index 06f456cbbe1..0c6da9276ae 100644 --- a/pkg/ruler/rulespb/rules.pb.go +++ b/pkg/ruler/rulespb/rules.pb.go @@ -9,9 +9,9 @@ import ( proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/duration" _ "github.com/grafana/mimir/pkg/mimirpb" github_com_grafana_mimir_pkg_mimirpb "github.com/grafana/mimir/pkg/mimirpb" + _ "google.golang.org/protobuf/types/known/durationpb" io "io" math "math" math_bits "math/bits" @@ -743,12 +743,12 @@ func (this *RuleGroupDesc) String() string { s := strings.Join([]string{`&RuleGroupDesc{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `Interval:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Interval), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, + `Interval:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Interval), "Duration", "durationpb.Duration", 1), `&`, ``, 1) + `,`, `Rules:` + repeatedStringForRules + `,`, `User:` + fmt.Sprintf("%v", this.User) + `,`, `Options:` + repeatedStringForOptions + `,`, `SourceTenants:` + fmt.Sprintf("%v", this.SourceTenants) + `,`, - `EvaluationDelay:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.EvaluationDelay), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, + `EvaluationDelay:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.EvaluationDelay), "Duration", "durationpb.Duration", 1), `&`, ``, 1) + `,`, `AlignEvaluationTimeOnInterval:` + fmt.Sprintf("%v", this.AlignEvaluationTimeOnInterval) + `,`, `}`, }, "") @@ -762,10 +762,10 @@ func (this *RuleDesc) String() string { `Expr:` + fmt.Sprintf("%v", this.Expr) + `,`, `Record:` + fmt.Sprintf("%v", this.Record) + `,`, `Alert:` + fmt.Sprintf("%v", this.Alert) + `,`, - `For:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.For), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, + `For:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.For), "Duration", "durationpb.Duration", 1), `&`, ``, 1) + `,`, `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, `Annotations:` + fmt.Sprintf("%v", this.Annotations) + `,`, - `KeepFiringFor:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.KeepFiringFor), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, + `KeepFiringFor:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.KeepFiringFor), "Duration", "durationpb.Duration", 1), `&`, ``, 1) + `,`, `}`, }, "") return s From c4d5596ce761d13e70ee5f61fa72064d635b7392 Mon Sep 17 00:00:00 2001 From: Oleg Zaytsev Date: Thu, 21 Dec 2023 17:00:44 +0100 Subject: [PATCH 7/9] make mod-check Signed-off-by: Oleg Zaytsev --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 5dbd3c935ab..dd028cd3dca 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/go-openapi/swag v0.22.5 github.com/gogo/protobuf v1.3.2 github.com/gogo/status v1.1.1 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 github.com/google/gopacket v1.1.19 github.com/gorilla/mux v1.8.1 From 793c9219817f1edf4a7a23324b9d58def795114a Mon Sep 17 00:00:00 2001 From: colega Date: Tue, 2 Jan 2024 09:55:57 +0000 Subject: [PATCH 8/9] Update build image version to pr6980-2a47130a83 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0974da989a8..9927b85cb4f 100644 --- a/Makefile +++ b/Makefile @@ -212,7 +212,7 @@ mimir-build-image/$(UPTODATE): mimir-build-image/* # All the boiler plate for building golang follows: SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E") BUILD_IN_CONTAINER ?= true -LATEST_BUILD_IMAGE_TAG ?= pr7008-376952b029 +LATEST_BUILD_IMAGE_TAG ?= pr6980-2a47130a83 # TTY is parameterized to allow Google Cloud Builder to run builds, # as it currently disallows TTY devices. This value needs to be overridden From 43eaa1c3d510bf9fcfe6966a0ca80d2e7d4bdf8e Mon Sep 17 00:00:00 2001 From: Oleg Zaytsev Date: Tue, 2 Jan 2024 11:21:35 +0100 Subject: [PATCH 9/9] Trigger CI Signed-off-by: Oleg Zaytsev