Skip to content

Commit b47e7b6

Browse files
mehrdadbn9alvinlin123friedrichg
authored
Update Dockerfile (#5159)
* Update Dockerfile to upgrade Go runtime version. Signed-off-by: mehrdadbn9 <[email protected]> Signed-off-by: Alvin Lin <[email protected]> Signed-off-by: Alvin Lin <[email protected]> Co-authored-by: Alvin Lin <[email protected]> Co-authored-by: Alvin Lin <[email protected]> Co-authored-by: Friedrich Gonzalez <[email protected]>
1 parent 47733dd commit b47e7b6

File tree

18 files changed

+80
-36
lines changed

18 files changed

+80
-36
lines changed

.github/workflows/test-build-deploy.yml

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ jobs:
1111
lint:
1212
runs-on: ubuntu-20.04
1313
container:
14-
image: quay.io/cortexproject/build-image:upgrade-to-go1.19.3-e8b98ddc0
14+
image: quay.io/cortexproject/build-image:upgrade-to-go1.20.1-pr-5159
1515
steps:
1616
- name: Checkout Repo
1717
uses: actions/checkout@v2
18+
- name: Setup Git safe.directory
19+
run: |
20+
echo "this step is needed because when running in container, actions/checkout does not set safe.directory effectively."
21+
echo "See https://github.com/actions/runner/issues/2033. We should use --system instead of --global"
22+
git config --system --add safe.directory $GITHUB_WORKSPACE
1823
# Commands in the Makefile are hardcoded with an assumed file structure of the CI container
1924
# Symlink ensures paths specified in previous commands don’t break
2025
- name: Sym Link Expected Path to Workspace
@@ -35,10 +40,15 @@ jobs:
3540
test:
3641
runs-on: ubuntu-20.04
3742
container:
38-
image: quay.io/cortexproject/build-image:upgrade-to-go1.19.3-e8b98ddc0
43+
image: quay.io/cortexproject/build-image:upgrade-to-go1.20.1-pr-5159
3944
steps:
4045
- name: Checkout Repo
4146
uses: actions/checkout@v2
47+
- name: Setup Git safe.directory
48+
run: |
49+
echo "this step is needed because when running in container, actions/checkout does not set safe.directory effectively."
50+
echo "See https://github.com/actions/runner/issues/2033. We should use --system instead of --global"
51+
git config --system --add safe.directory $GITHUB_WORKSPACE
4252
- name: Sym Link Expected Path to Workspace
4353
run: |
4454
mkdir -p /go/src/github.com/cortexproject/cortex
@@ -49,10 +59,15 @@ jobs:
4959
build:
5060
runs-on: ubuntu-20.04
5161
container:
52-
image: quay.io/cortexproject/build-image:upgrade-to-go1.19.3-e8b98ddc0
62+
image: quay.io/cortexproject/build-image:upgrade-to-go1.20.1-pr-5159
5363
steps:
5464
- name: Checkout Repo
5565
uses: actions/checkout@v2
66+
- name: Setup Git safe.directory
67+
run: |
68+
echo "this step is needed because when running in container, actions/checkout does not set safe.directory effectively."
69+
echo "See https://github.com/actions/runner/issues/2033. We should use --system instead of --global"
70+
git config --system --add safe.directory $GITHUB_WORKSPACE
5671
- name: Install Docker Client
5772
run: ./.github/workflows/scripts/install-docker.sh
5873
- name: Sym Link Expected Path to Workspace
@@ -92,17 +107,17 @@ jobs:
92107
fail-fast: false
93108
matrix:
94109
tags:
95-
- requires_docker
96-
- integration_alertmanager
97-
- integration_backward_compatibility
98-
- integration_memberlist
99-
- integration_querier
100-
- integration_ruler
110+
- requires_docker
111+
- integration_alertmanager
112+
- integration_backward_compatibility
113+
- integration_memberlist
114+
- integration_querier
115+
- integration_ruler
101116
steps:
102117
- name: Upgrade golang
103118
uses: actions/setup-go@v2
104119
with:
105-
go-version: 1.19.x
120+
go-version: 1.20.1
106121
- name: Checkout Repo
107122
uses: actions/checkout@v2
108123
- name: Install Docker Client
@@ -173,20 +188,25 @@ jobs:
173188
run: |
174189
touch build-image/.uptodate
175190
MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations
176-
make BUILD_IMAGE=quay.io/cortexproject/build-image:upgrade-to-go1.19.3-e8b98ddc0 TTY='' configs-integration-test
191+
make BUILD_IMAGE=quay.io/cortexproject/build-image:upgrade-to-go1.20.1-pr-5159 TTY='' configs-integration-test
177192
178193
deploy_website:
179194
needs: [build, test]
180195
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex'
181196
runs-on: ubuntu-20.04
182197
container:
183-
image: quay.io/cortexproject/build-image:upgrade-to-go1.19.3-e8b98ddc0
198+
image: quay.io/cortexproject/build-image:upgrade-to-go1.20.1-pr-5159
184199
steps:
185200
- name: Checkout Repo
186201
uses: actions/checkout@v2
187202
with:
188203
# web-deploy script expects repo to be cloned with ssh for some commands to work
189204
ssh-key: ${{ secrets.WEBSITE_DEPLOY_SSH_PRIVATE_KEY }}
205+
- name: Setup Git safe.directory
206+
run: |
207+
echo "this step is needed because when running in container, actions/checkout does not set safe.directory effectively."
208+
echo "See https://github.com/actions/runner/issues/2033. We should use --system instead of --global"
209+
git config --system --add safe.directory $GITHUB_WORKSPACE
190210
- name: Sym Link Expected Path to Workspace
191211
run: |
192212
mkdir -p /go/src/github.com/cortexproject/cortex
@@ -217,10 +237,15 @@ jobs:
217237
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex'
218238
runs-on: ubuntu-20.04
219239
container:
220-
image: quay.io/cortexproject/build-image:upgrade-to-go1.19.3-e8b98ddc0
240+
image: quay.io/cortexproject/build-image:upgrade-to-go1.20.1-pr-5159
221241
steps:
222242
- name: Checkout Repo
223243
uses: actions/checkout@v2
244+
- name: Setup Git safe.directory
245+
run: |
246+
echo "this step is needed because when running in container, actions/checkout does not set safe.directory effectively."
247+
echo "See https://github.com/actions/runner/issues/2033. We should use --system instead of --global"
248+
git config --system --add safe.directory $GITHUB_WORKSPACE
224249
- name: Install Docker Client
225250
run: ./.github/workflows/scripts/install-docker.sh
226251
- name: Sym link Expected Path to Workspace

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* [ENHANCEMENT] Alertmanager: Added `-alertmanager.enabled-tenants` and `-alertmanager.disabled-tenants` to explicitly enable or disable alertmanager for specific tenants. #5116
2020
* [ENHANCEMENT] Upgraded Docker base images to `alpine:3.17`. #5132
2121
* [ENHANCEMENT] Add retry logic to S3 bucket client. #5135
22+
* [ENHANCEMENT] Update Go version to 1.20.1. #5159
2223
* [FEATURE] Querier/Query Frontend: support Prometheus /api/v1/status/buildinfo API. #4978
2324
* [FEATURE] Ingester: Add active series to all_user_stats page. #4972
2425
* [FEATURE] Ingester: Added `-blocks-storage.tsdb.head-chunks-write-queue-size` allowing to configure the size of the in-memory queue used before flushing chunks to the disk . #5000

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ build-image/$(UPTODATE): build-image/*
122122
SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E")
123123
BUILD_IN_CONTAINER := true
124124
BUILD_IMAGE ?= $(IMAGE_PREFIX)build-image
125-
LATEST_BUILD_IMAGE_TAG ?= upgrade-to-go1.19.3-e8b98ddc0
125+
LATEST_BUILD_IMAGE_TAG ?= upgrade-to-go1.20.1-e6945e022
126126

127127
# TTY is parameterized to allow Google Cloud Builder to run builds,
128128
# as it currently disallows TTY devices. This value needs to be overridden

build-image/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.19.3-buster
1+
FROM golang:1.20.1-buster
22
ARG goproxyValue
33
ENV GOPROXY=${goproxyValue}
44
RUN apt-get update && apt-get install -y curl python-requests python-yaml file jq unzip protobuf-compiler libprotobuf-dev && \
@@ -23,7 +23,7 @@ RUN GOARCH=$(go env GOARCH) && \
2323
chmod +x shfmt && \
2424
mv shfmt /usr/bin
2525

26-
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /usr/bin v1.48.0
26+
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /usr/bin v1.51.2
2727

2828
ENV HUGO_VERSION=v0.101.0
2929
RUN go install github.com/client9/misspell/cmd/[email protected] &&\

docs/contributing/how-to-update-the-build-image.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ The build image currently can only be updated by a Cortex maintainer. If you're
1212
1. `docker login quay.io`. Note that pushing to `quay.io/cortexproject/build-image` repository can only be done by a maintainer.
1313
1. Build the and publish the image by using `make push-multiarch-build-image`. This will build and push multiplatform docker image (for linux/amd64 and linux/arm64). Running this step successfully requires [Docker Buildx](https://docs.docker.com/buildx/working-with-buildx/), but does not require a specific platform.
1414
1. Replace the image tag in `.github/workflows/*` (_there may be multiple references_) and Makefile (variable `LATEST_BUILD_IMAGE_TAG`).
15+
1. If you are updating Go's runtime version be sure to change `actions/setup-go`'s `go-version` in ``.github/workflows/*`.
1516
1. Open a PR and make sure the CI with new build-image passes

docs/contributing/how-to-upgrade-golang-version.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ weight: 4
55
slug: how-to-upgrade-golang-version
66
---
77

8-
To upgrade the Golang version:
8+
To upgrade the Go's runtime version:
99

1010
1. Upgrade build image version with golang version as describe [here](./how-to-update-the-build-image.md)
1111

12-
If the minimum support Golang version should be upgraded as well:
12+
If the minimum support Go's language version should be upgraded as well:
1313

1414
1. Upgrade `go` version in `go.mod`

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ require (
204204
go.uber.org/goleak v1.2.0 // indirect
205205
go.uber.org/multierr v1.9.0 // indirect
206206
go.uber.org/zap v1.21.0 // indirect
207-
go4.org/intern v0.0.0-20220617035311-6925f38cc365 // indirect
208-
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 // indirect
207+
go4.org/intern v0.0.0-20230205224052-192e9f60865c // indirect
208+
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230221090011-e4bae7ad2296 // indirect
209209
golang.org/x/crypto v0.6.0 // indirect
210210
golang.org/x/exp v0.0.0-20230124195608-d38c7dcee874 // indirect
211211
golang.org/x/mod v0.7.0 // indirect

go.sum

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,10 +1693,11 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
16931693
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
16941694
go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
16951695
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
1696-
go4.org/intern v0.0.0-20220617035311-6925f38cc365 h1:t9hFvR102YlOqU0fQn1wgwhNvSbHGBbbJxX9JKfU3l0=
1697-
go4.org/intern v0.0.0-20220617035311-6925f38cc365/go.mod h1:WXRv3p7T6gzt0CcJm43AAKdKVZmcQbwwC7EwquU5BZU=
1698-
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 h1:FyBZqvoA/jbNzuAWLQE2kG820zMAkcilx6BMjGbL/E4=
1699-
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E=
1696+
go4.org/intern v0.0.0-20230205224052-192e9f60865c h1:b8WZ7Ja8nKegYxfwDLLwT00ZKv4lXAQrw8LYPK+cHSI=
1697+
go4.org/intern v0.0.0-20230205224052-192e9f60865c/go.mod h1:RJ0SVrOMpxLhgb5noIV+09zI1RsRlMsbUcSxpWHqbrE=
1698+
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230204201903-c31fa085b70e/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E=
1699+
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230221090011-e4bae7ad2296 h1:QJ/xcIANMLApehfgPCHnfK1hZiaMmbaTVmPv7DAoTbo=
1700+
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230221090011-e4bae7ad2296/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E=
17001701
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
17011702
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
17021703
golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=

integration/ruler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func TestRulerEvaluationDelay(t *testing.T) {
223223
now := time.Now()
224224

225225
// Generate series that includes stale nans
226-
var samplesToSend int = 10
226+
samplesToSend := 10
227227
series := prompb.TimeSeries{
228228
Labels: []prompb.Label{
229229
{Name: "__name__", Value: "a_sometimes_stale_nan_series"},

pkg/ingester/instance_limits.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type InstanceLimits struct {
2020
}
2121

2222
// Sets default limit values for unmarshalling.
23-
var defaultInstanceLimits *InstanceLimits = nil
23+
var defaultInstanceLimits *InstanceLimits
2424

2525
// UnmarshalYAML implements the yaml.Unmarshaler interface. If give
2626
func (l *InstanceLimits) UnmarshalYAML(unmarshal func(interface{}) error) error {

pkg/querier/iterators/compatibe_chunk_iterator.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ type compatibleChunksIterator struct {
2525
err error
2626
}
2727

28+
//revive:disable:unexported-return
2829
func NewCompatibleChunksIterator(i compChunksIterator) *compatibleChunksIterator {
2930
return &compatibleChunksIterator{it: i}
3031
}
3132

33+
//revive:enable:unexported-return
34+
3235
func (c *compatibleChunksIterator) Next() chunkenc.ValueType {
3336
if c.it.Next() {
3437
return chunkenc.ValFloat

pkg/ring/kv/dynamodb/client_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,13 @@ type mockDynamodbClient struct {
281281
mock.Mock
282282
}
283283

284+
//revive:disable:unexported-return
284285
func NewDynamodbClientMock() *mockDynamodbClient {
285286
return &mockDynamodbClient{}
286287
}
287288

289+
//revive:enable:unexported-return
290+
288291
func (m *mockDynamodbClient) List(context.Context, dynamodbKey) ([]string, float64, error) {
289292
args := m.Called()
290293
var err error

pkg/ring/kv/dynamodb/dynamodb.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ type dynamoDbClient interface {
3434
}
3535

3636
type dynamodbKV struct {
37-
dynamoDbClient
38-
3937
ddbClient dynamodbiface.DynamoDBAPI
4038
logger log.Logger
4139
tableName *string

pkg/ruler/compat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func DefaultTenantManagerFactory(cfg Config, p Pusher, q storage.Queryable, engi
281281
q = querier.NewErrorTranslateQueryableWithFn(q, WrapQueryableErrors)
282282

283283
return func(ctx context.Context, userID string, notifier *notifier.Manager, logger log.Logger, reg prometheus.Registerer) RulesManager {
284-
var queryTime prometheus.Counter = nil
284+
var queryTime prometheus.Counter
285285
if rulerQuerySeconds != nil {
286286
queryTime = rulerQuerySeconds.WithLabelValues(userID)
287287
}

pkg/util/allowed_tenants_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestAllowedTenants_Combination(t *testing.T) {
3838
}
3939

4040
func TestAllowedTenants_Nil(t *testing.T) {
41-
var a *AllowedTenants = nil
41+
var a *AllowedTenants
4242

4343
// All tenants are allowed when using nil as allowed tenants.
4444
require.True(t, a.IsAllowed("A"))

vendor/go4.org/unsafe/assume-no-moving-gc/assume-no-moving-gc.go

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

vendor/go4.org/unsafe/assume-no-moving-gc/untested.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.

vendor/modules.txt

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

0 commit comments

Comments
 (0)