From 43cb86fe1e618f180bef2b6b917ad78c805e996a Mon Sep 17 00:00:00 2001 From: David Porter Date: Mon, 27 Mar 2023 16:44:04 -0700 Subject: [PATCH 1/6] Fix asset build Pin the version to v3.24.0 which is working (latest version seems to broken). Signed-off-by: David Porter --- build/assets.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/assets.sh b/build/assets.sh index 7faf33003d..19d7b42546 100755 --- a/build/assets.sh +++ b/build/assets.sh @@ -30,7 +30,7 @@ FORCE="${FORCE:-}" # Force assets to be rebuilt if FORCE=true # Install while in a temp dir to avoid polluting go.mod/go.sum pushd "${TMPDIR:-/tmp}" > /dev/null -go install github.com/kevinburke/go-bindata/go-bindata@latest +go install github.com/kevinburke/go-bindata/go-bindata@v3.24.0 popd > /dev/null build_asset () { From ee54f72e0e72dc45b5c001a77d9a34c74684fb15 Mon Sep 17 00:00:00 2001 From: David Porter Date: Fri, 16 Jun 2023 15:25:08 -0700 Subject: [PATCH 2/6] Switch to registry.k8s.io Signed-off-by: David Porter --- integration/framework/framework.go | 2 +- integration/tests/api/docker_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration/framework/framework.go b/integration/framework/framework.go index 27e5baef5c..25508b8b88 100644 --- a/integration/framework/framework.go +++ b/integration/framework/framework.go @@ -213,7 +213,7 @@ func (f *realFramework) ClientV2() *v2.Client { func (a dockerActions) RunPause() string { return a.Run(DockerRunArgs{ - Image: "kubernetes/pause", + Image: "registry.k8s.io/pause", }) } diff --git a/integration/tests/api/docker_test.go b/integration/tests/api/docker_test.go index a775b9b636..665e3af04d 100644 --- a/integration/tests/api/docker_test.go +++ b/integration/tests/api/docker_test.go @@ -90,7 +90,7 @@ func TestDockerContainerByName(t *testing.T) { containerName := fmt.Sprintf("test-docker-container-by-name-%d", os.Getpid()) fm.Docker().Run(framework.DockerRunArgs{ - Image: "kubernetes/pause", + Image: "registry.k8s.io/pause", Args: []string{"--name", containerName}, }) @@ -150,7 +150,7 @@ func TestBasicDockerContainer(t *testing.T) { containerName := fmt.Sprintf("test-basic-docker-container-%d", os.Getpid()) containerID := fm.Docker().Run(framework.DockerRunArgs{ - Image: "kubernetes/pause", + Image: "registry.k8s.io/pause", Args: []string{ "--name", containerName, }, @@ -183,7 +183,7 @@ func TestDockerContainerSpec(t *testing.T) { cpuShares = uint64(2048) cpuMask = "0" memoryLimit = uint64(1 << 30) // 1GB - image = "kubernetes/pause" + image = "registry.k8s.io/pause" env = map[string]string{"test_var": "FOO"} labels = map[string]string{"bar": "baz"} ) From 32f12865fefe7b51e2893d8321c854f81f3db9ab Mon Sep 17 00:00:00 2001 From: David Porter Date: Sat, 25 Feb 2023 01:54:03 -0800 Subject: [PATCH 3/6] build: Update shebang to python3 Signed-off-by: David Porter --- build/boilerplate/boilerplate.py | 2 +- build/boilerplate/boilerplate.py.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/boilerplate/boilerplate.py b/build/boilerplate/boilerplate.py index ce8a68817a..4a3145014c 100755 --- a/build/boilerplate/boilerplate.py +++ b/build/boilerplate/boilerplate.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 Google Inc. All Rights Reserved. # diff --git a/build/boilerplate/boilerplate.py.txt b/build/boilerplate/boilerplate.py.txt index 21183f863a..a8011f5df2 100644 --- a/build/boilerplate/boilerplate.py.txt +++ b/build/boilerplate/boilerplate.py.txt @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright YEAR Google Inc. All Rights Reserved. # From 8c0bae9ce8a22b493cd88352e81c2ecf3b9277fc Mon Sep 17 00:00:00 2001 From: David Porter Date: Sat, 25 Feb 2023 01:54:26 -0800 Subject: [PATCH 4/6] ci: Update golang ci-lint to v1.51.2 Also, remove the deprecated linters from the .golangci.yml config. Signed-off-by: David Porter --- .golangci.yml | 6 ------ Makefile | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index c4ebf1d953..dfe6719e00 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,8 +3,6 @@ run: linters-settings: govet: enable-all: true - golint: - min-confidence: 0 gofmt: simplify: true goimports: @@ -17,12 +15,8 @@ linters: - staticcheck - unused - gosimple - - structcheck - - varcheck - ineffassign - - deadcode - typecheck - - golint - gofmt - goimports issues: diff --git a/Makefile b/Makefile index 9470804054..8ca1a7fecf 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ # limitations under the License. GO := go -GOLANGCI_VER := v1.45.2 +GOLANGCI_VER := v1.51.2 GO_TEST ?= $(GO) test $(or $(GO_FLAGS),-race) arch ?= $(shell go env GOARCH) From 84cf593eb51cc7297030b6c0b4ac59bc6bd6ebfd Mon Sep 17 00:00:00 2001 From: David Porter Date: Wed, 4 Jan 2023 12:31:18 -0800 Subject: [PATCH 5/6] Mark GOPATH as git safe.directory to fix CI build Signed-off-by: David Porter --- build/integration-in-docker.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/integration-in-docker.sh b/build/integration-in-docker.sh index 4cd3dc70e2..05febb55df 100755 --- a/build/integration-in-docker.sh +++ b/build/integration-in-docker.sh @@ -29,7 +29,9 @@ function delete() { trap delete EXIT INT TERM function run_tests() { - BUILD_CMD="env GOOS=linux GOARCH=amd64 GO_FLAGS='$GO_FLAGS' ./build/build.sh && \ + + # Add safe.directory as workaround for https://github.com/actions/runner/issues/2033 + BUILD_CMD="git config --global safe.directory /go/src/github.com/google/cadvisor && env GOOS=linux GOARCH=amd64 GO_FLAGS='$GO_FLAGS' ./build/build.sh && \ env GOOS=linux GOFLAGS='$GO_FLAGS' go test -c github.com/google/cadvisor/integration/tests/api && \ env GOOS=linux GOFLAGS='$GO_FLAGS' go test -c github.com/google/cadvisor/integration/tests/healthz" From 21803f34a7897a1f5472c835160ff0630985bcee Mon Sep 17 00:00:00 2001 From: David Porter Date: Fri, 16 Jun 2023 16:01:00 -0700 Subject: [PATCH 6/6] Regen assets ``` $ make assets FORCE=true ``` Signed-off-by: David Porter --- cmd/internal/pages/static/assets.go | 5 ++--- cmd/internal/pages/templates.go | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cmd/internal/pages/static/assets.go b/cmd/internal/pages/static/assets.go index 72cc5b6743..13168a1e86 100644 --- a/cmd/internal/pages/static/assets.go +++ b/cmd/internal/pages/static/assets.go @@ -1,4 +1,4 @@ -// Copyright 2022 Google Inc. All Rights Reserved. +// Copyright 2023 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -32,7 +32,6 @@ import ( "crypto/sha256" "fmt" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -434,7 +433,7 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + err = os.WriteFile(_filePath(dir, name), data, info.Mode()) if err != nil { return err } diff --git a/cmd/internal/pages/templates.go b/cmd/internal/pages/templates.go index cfd612dc9b..e9ff8c2725 100644 --- a/cmd/internal/pages/templates.go +++ b/cmd/internal/pages/templates.go @@ -1,4 +1,4 @@ -// Copyright 2022 Google Inc. All Rights Reserved. +// Copyright 2023 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ import ( "crypto/sha256" "fmt" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -271,7 +270,7 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + err = os.WriteFile(_filePath(dir, name), data, info.Mode()) if err != nil { return err }