Skip to content

Use the new GO 1.19 build image #4829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/test-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
lint:
runs-on: ubuntu-20.04
container:
image: quay.io/cortexproject/build-image:update-hugo-0.94.x-96d1d7cdd
image: quay.io/cortexproject/build-image:update-go-1-19-a2f4d2c79
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand All @@ -34,7 +34,7 @@ jobs:
test:
runs-on: ubuntu-20.04
container:
image: quay.io/cortexproject/build-image:update-hugo-0.94.x-96d1d7cdd
image: quay.io/cortexproject/build-image:update-go-1-19-a2f4d2c79
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand All @@ -48,7 +48,7 @@ jobs:
build:
runs-on: ubuntu-20.04
container:
image: quay.io/cortexproject/build-image:update-hugo-0.94.x-96d1d7cdd
image: quay.io/cortexproject/build-image:update-go-1-19-a2f4d2c79
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand Down Expand Up @@ -163,14 +163,14 @@ jobs:
run: |
touch build-image/.uptodate
MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations
make BUILD_IMAGE=quay.io/cortexproject/build-image:update-hugo-0.94.x-96d1d7cdd TTY='' configs-integration-test
make BUILD_IMAGE=quay.io/cortexproject/build-image:update-go-1-19-a2f4d2c79 TTY='' configs-integration-test

deploy_website:
needs: [build, test]
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex'
runs-on: ubuntu-20.04
container:
image: quay.io/cortexproject/build-image:update-hugo-0.94.x-96d1d7cdd
image: quay.io/cortexproject/build-image:update-go-1-19-a2f4d2c79
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand Down Expand Up @@ -207,7 +207,7 @@ jobs:
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex'
runs-on: ubuntu-20.04
container:
image: quay.io/cortexproject/build-image:update-hugo-0.94.x-96d1d7cdd
image: quay.io/cortexproject/build-image:update-go-1-19-a2f4d2c79
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand Down
6 changes: 5 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ output:
linters:
enable:
- goimports
- golint
- revive
- gofmt
- misspell
- depguard

linters-settings:
staticcheck:
checks:
- all
- "-SA1019" # Disable because too many file uses io/ioutil now, will fix later
errcheck:
# path to a file containing a list of functions to exclude from checking
# see https://github.com/kisielk/errcheck#excluding-functions for details
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
* [CHANGE] Disables TSDB isolation. #4825
* [ENHANCEMENT] Querier/Ruler: Retry store-gateway in case of unexpected failure, instead of failing the query. #4532
* [ENHANCEMENT] Ring: DoBatch prioritize 4xx errors when failing. #4783
* [ENHANCEMENT] Cortex now built with Go 1.18. #4829
* [FEATURE] Compactor: Added `-compactor.block-files-concurrency` allowing to configure number of go routines for download/upload block files during compaction. #4784
* [FEATURE] Compactor: Added -compactor.blocks-fetch-concurrency` allowing to configure number of go routines for blocks during compaction. #4787
* [FEATURE] Compactor: Added configurations for Azure MSI in blocks-storage, ruler-storage and alertmanager-storage. #4818
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ build-image/$(UPTODATE): build-image/*
SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E")
BUILD_IN_CONTAINER := true
BUILD_IMAGE ?= $(IMAGE_PREFIX)build-image
LATEST_BUILD_IMAGE_TAG ?= update-hugo-0.94.x-96d1d7cdd
LATEST_BUILD_IMAGE_TAG ?= update-go-1-19-a2f4d2c79

# TTY is parameterized to allow Google Cloud Builder to run builds,
# as it currently disallows TTY devices. This value needs to be overridden
Expand Down
3 changes: 1 addition & 2 deletions cmd/cortex/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"flag"
"io"
"io/ioutil"
"os"
"strings"
"sync"
Expand Down Expand Up @@ -111,7 +110,7 @@ func testSingle(t *testing.T, arguments []string, yaml string, stdoutMessage, st
defer restoreIfNeeded()

if yaml != "" {
tempFile, err := ioutil.TempFile("", "test")
tempFile, err := os.CreateTemp("", "test")
require.NoError(t, err)

defer func() {
Expand Down
3 changes: 1 addition & 2 deletions cmd/thanosconvert/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"flag"
"fmt"
"io/ioutil"
"os"
"strings"

Expand Down Expand Up @@ -42,7 +41,7 @@ func main() {
}

if configFilename != "" {
buf, err := ioutil.ReadFile(configFilename)
buf, err := os.ReadFile(configFilename)
if err != nil {
fatal("failed to load config file from %s: %v", configFilename, err)
}
Expand Down
11 changes: 6 additions & 5 deletions docs/contributing/how-to-run-website-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ The Cortex documentation is compiled into a website published at [cortexmetrics.

The following initial setup is required only once:

1. Install [Hugo](https://gohugo.io/) `v0.94.2` (**extended** version)
2. Install [Node.js](https://nodejs.org/en/) `v14` or above (alternatively via [`nvm`](https://github.com/nvm-sh/nvm))
3. Install required Node modules with:
1. Install [Hugo](https://gohugo.io/) (**extended** version)
* Look for value of `HUGO_VERSION` in `build-image/Dockerfile`.
1. Install [Node.js](https://nodejs.org/en/) `v14` or above (alternatively via [`nvm`](https://github.com/nvm-sh/nvm))
1. Install required Node modules with:
```
cd website && npm install && cd -
```
4. Install [embedmd](https://github.com/campoy/embedmd) `v1.0.0`:
1. Install [embedmd](https://github.com/campoy/embedmd) `v1.0.0`:
```
go install github.com/campoy/[email protected]
```
5. Run `make BUILD_IN_CONTAINER=false web-build`
1. Run `make BUILD_IN_CONTAINER=false web-build`


## Run it
Expand Down
1 change: 1 addition & 0 deletions integration/asserts.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
1 change: 1 addition & 0 deletions integration/blocks_storage_backends_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
1 change: 1 addition & 0 deletions integration/e2e/scenario_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package e2e_test
Expand Down
1 change: 1 addition & 0 deletions integration/e2e/service_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package e2e
Expand Down
9 changes: 4 additions & 5 deletions integration/e2ecortex/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -171,7 +170,7 @@ func (c *Client) query(addr string) (*http.Response, []byte, error) {
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -234,7 +233,7 @@ func (c *Client) GetPrometheusRules() ([]*ruler.RuleGroup, error) {
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -278,7 +277,7 @@ func (c *Client) GetRuleGroups() (map[string][]rulefmt.RuleGroup, error) {
defer res.Body.Close()
rgs := map[string][]rulefmt.RuleGroup{}

data, err := ioutil.ReadAll(res.Body)
data, err := io.ReadAll(res.Body)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -412,7 +411,7 @@ func (c *Client) getRawPage(ctx context.Context, url string) ([]byte, error) {
}
defer resp.Body.Close()

content, err := ioutil.ReadAll(resp.Body)
content, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
Expand Down
1 change: 1 addition & 0 deletions integration/getting_started_single_process_config_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
1 change: 1 addition & 0 deletions integration/getting_started_with_gossiped_ring_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
1 change: 1 addition & 0 deletions integration/ingester_limits_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
1 change: 1 addition & 0 deletions integration/ingester_sharding_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
1 change: 1 addition & 0 deletions integration/integration_memberlist_single_binary_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
1 change: 1 addition & 0 deletions integration/querier_remote_read_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
1 change: 1 addition & 0 deletions integration/querier_sharding_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
1 change: 1 addition & 0 deletions integration/querier_tenant_federation_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
1 change: 1 addition & 0 deletions integration/querier_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
1 change: 1 addition & 0 deletions integration/query_frontend_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
1 change: 1 addition & 0 deletions integration/util.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build requires_docker
// +build requires_docker

package integration
Expand Down
4 changes: 2 additions & 2 deletions pkg/configs/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"flag"
"fmt"
"io/ioutil"
"net/url"
"os"

"github.com/cortexproject/cortex/pkg/configs/db/memory"
"github.com/cortexproject/cortex/pkg/configs/db/postgres"
Expand Down Expand Up @@ -73,7 +73,7 @@ func New(cfg Config) (DB, error) {
if u.User == nil {
return nil, fmt.Errorf("--database.password-file requires username in --database.uri")
}
passwordBytes, err := ioutil.ReadFile(cfg.PasswordFile)
passwordBytes, err := os.ReadFile(cfg.PasswordFile)
if err != nil {
return nil, fmt.Errorf("Could not read database password file: %v", err)
}
Expand Down
15 changes: 7 additions & 8 deletions pkg/configs/legacy_promql/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//nolint //Since this was copied from Prometheus leave it as is
// nolint //Since this was copied from Prometheus leave it as is
package promql

import (
Expand All @@ -27,13 +27,12 @@ import (
// or a chain of function definitions (e.g. String(), expr(), etc.) convention is
// to list them as follows:
//
// - Statements
// - statement types (alphabetical)
// - ...
// - Expressions
// - expression types (alphabetical)
// - ...
//
// - Statements
// - statement types (alphabetical)
// - ...
// - Expressions
// - expression types (alphabetical)
// - ...
type Node interface {
// String representation of the node that returns the given node when parsed
// as part of a valid query.
Expand Down
2 changes: 1 addition & 1 deletion pkg/configs/legacy_promql/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//nolint //Since this was copied from Prometheus leave it as is
// nolint //Since this was copied from Prometheus leave it as is
package promql

import (
Expand Down
Loading