Skip to content

Commit 2f380de

Browse files
authored
Merge branch 'google:master' into jesseward/oomparser-ignore-old
2 parents fbf2a42 + a1160cf commit 2f380de

File tree

112 files changed

+2798
-1704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+2798
-1704
lines changed

.github/workflows/release-binaries.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ jobs:
4949
# Create a Docker container with the appropriate architecture
5050
docker run --rm -v ${PWD}:/go/src/github.com/google/cadvisor \
5151
--platform linux/${{ matrix.arch }} \
52-
golang:1.24 \
53-
/bin/bash -c "cd /go/src/github.com/google/cadvisor && GOARCH=${{ matrix.arch }} OUTPUT_NAME_WITH_ARCH=true VERSION=${{ env.VERSION }} GO_FLAGS='-buildvcs=false -tags=netgo' ./build/build.sh"
52+
golang:1.25 \
53+
/bin/bash -c "cd /go/src/github.com/google/cadvisor && GOARCH=${{ matrix.arch }} OUTPUT_NAME_WITH_ARCH=true VERSION=${{ env.VERSION }} GO_FLAGS='-buildvcs=false -tags=netgo' GO_CGO_ENABLED=0 ./build/build.sh"
5454
5555
- name: Generate SHA256 checksums
5656
run: |

.github/workflows/stale.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Stale issues and pull requests
2+
3+
on:
4+
schedule:
5+
- cron: "21 4 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
stale:
10+
permissions:
11+
issues: write
12+
pull-requests: write
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/stale@v10
17+
with:
18+
stale-issue-message: 'This issue is stale because it has been open 90 days with no activity. This issue will be closed in 30 days unless new comments are made or the stale label is removed. To skip these checks, apply the "lifecycle/frozen" label.'
19+
stale-pr-message: 'This PR is stale because it has been open 90 days with no activity. This PR will be closed in 30 days unless new comments are made or the stale label is removed. To skip these checks, apply the "lifecycle/frozen" label.'
20+
stale-issue-label: 'lifecycle/stale'
21+
stale-pr-label: 'lifecycle/stale'
22+
exempt-issue-labels: 'lifecycle/frozen'
23+
exempt-pr-labels: 'lifecycle/frozen'
24+
days-before-stale: 90
25+
close-issue-message: 'This issue was automatically closed due to inactivity.'
26+
close-pr-message: 'This pull request was automatically closed due to inactivity.'
27+
days-before-issue-close: 30
28+
days-before-pr-close: 30
29+
remove-stale-when-updated: true
30+
operations-per-run: 300

.github/workflows/test.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ jobs:
44
test:
55
strategy:
66
matrix:
7-
go-versions: ['1.24']
8-
platform: [ubuntu-22.04]
7+
go-versions: ['1.25']
8+
platform: [ubuntu-24.04]
99
environment-variables: [build/config/plain.sh, build/config/libpfm4.sh, build/config/libipmctl.sh]
1010
runs-on: ${{ matrix.platform }}
1111
timeout-minutes: 30
@@ -31,8 +31,8 @@ jobs:
3131
test-integration:
3232
strategy:
3333
matrix:
34-
go-versions: ['1.24']
35-
platform: [ubuntu-22.04]
34+
go-versions: ['1.25']
35+
platform: [ubuntu-24.04]
3636
environment-variables: [build/config/plain.sh, build/config/libpfm4.sh, build/config/libipmctl.sh]
3737
runs-on: ${{ matrix.platform }}
3838
timeout-minutes: 30
@@ -52,3 +52,26 @@ jobs:
5252
with:
5353
name: cadvisor.log
5454
path: ${{ github.workspace }}/go/src/github.com/google/cadvisor/cadvisor.log
55+
test-integration-crio:
56+
strategy:
57+
matrix:
58+
go-versions: ['1.25']
59+
platform: [ubuntu-24.04]
60+
runs-on: ${{ matrix.platform }}
61+
timeout-minutes: 30
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v4
65+
- name: Run CRI-O integration tests
66+
env:
67+
GOLANG_VERSION: ${{ matrix.go-versions }}
68+
run: |
69+
set -ex
70+
source build/config/crio.sh
71+
make docker-test-integration-crio
72+
- name: Upload cAdvisor log file
73+
uses: actions/upload-artifact@v4
74+
if: failure()
75+
with:
76+
name: cadvisor-crio.log
77+
path: ${{ github.workspace }}/go/src/github.com/google/cadvisor/cadvisor.log

.golangci.yml

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,62 @@
1+
version: "2"
2+
13
run:
24
timeout: 5m
3-
linters-settings:
4-
govet:
5-
enable-all: true
6-
gofmt:
7-
simplify: true
8-
goimports:
9-
local-prefixes: github.com/google/cadvisor
5+
106
linters:
11-
disable-all: true
7+
default: none
128
enable:
139
- govet
1410
- errcheck
1511
- staticcheck
1612
- unused
17-
- gosimple
1813
- ineffassign
19-
- typecheck
14+
settings:
15+
govet:
16+
disable:
17+
- fieldalignment # too noisy, requires significant refactoring
18+
errcheck:
19+
exclude-functions:
20+
- (io.Closer).Close
21+
- (net.Conn).Close
22+
- (*os.File).Close
23+
- (net/http.ResponseWriter).Write
24+
- os.Remove
25+
- os.RemoveAll
26+
- os.Setenv
27+
- fmt.Fprint
28+
- fmt.Fprintf
29+
- fmt.Fprintln
30+
- syscall.Close
31+
staticcheck:
32+
checks:
33+
- "all"
34+
- "-ST1000" # package comments - too noisy for existing codebase
35+
- "-ST1003" # naming conventions (e.g., CrioId vs CrioID) - would break public API
36+
- "-ST1020" # comment format on exported methods - too many to fix
37+
- "-ST1021" # comment format on exported types - too many to fix
38+
- "-ST1022" # comment format on exported consts - too many to fix
39+
- "-QF*" # disable quickfix suggestions
40+
exclusions:
41+
rules:
42+
# Exclude errcheck in test files for cleaner test code
43+
- linters:
44+
- errcheck
45+
path: "_test\\.go$"
46+
# Exclude errcheck for Close() calls on any type
47+
- linters:
48+
- errcheck
49+
text: "Error return value of .*.Close.* is not checked"
50+
# Exclude govet printf check false positives
51+
- linters:
52+
- govet
53+
text: "printf: non-constant format string"
54+
55+
formatters:
56+
enable:
2057
- gofmt
2158
- goimports
59+
2260
issues:
2361
max-issues-per-linter: 0
2462
max-same-issues: 0

Makefile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
GO := go
16-
GOLANGCI_VER := 1.64.5
16+
GOLANGCI_VER := 2.6.2
1717
GO_TEST ?= $(GO) test $(or $(GO_FLAGS),-race)
1818
arch ?= $(shell go env GOARCH)
1919

@@ -38,12 +38,21 @@ docker-test: container-test
3838
test-integration:
3939
GO_FLAGS=$(or $(GO_FLAGS),-race) ./build/build.sh
4040
$(GO_TEST) -c github.com/google/cadvisor/integration/tests/api
41-
$(GO_TEST) -c github.com/google/cadvisor/integration/tests/healthz
41+
$(GO_TEST) -c github.com/google/cadvisor/integration/tests/common
4242
@./build/integration.sh
4343

4444
docker-test-integration:
4545
@./build/integration-in-docker.sh
4646

47+
docker-test-integration-crio:
48+
@./build/integration-in-docker-crio.sh
49+
50+
test-integration-crio:
51+
GO_FLAGS=$(or $(GO_FLAGS),-race) ./build/build.sh
52+
$(GO_TEST) -c github.com/google/cadvisor/integration/tests/crio
53+
$(GO_TEST) -c github.com/google/cadvisor/integration/tests/common
54+
@./build/integration-crio.sh
55+
4756
test-runner:
4857
@$(GO) build github.com/google/cadvisor/integration/runner
4958

@@ -72,7 +81,7 @@ docker-%:
7281
@docker build -t cadvisor:$(shell git rev-parse --short HEAD) -f deploy/Dockerfile .
7382

7483
docker-build:
75-
@docker run --rm -w /go/src/github.com/google/cadvisor -v ${PWD}:/go/src/github.com/google/cadvisor golang:1.23 make build
84+
@docker run --rm -w /go/src/github.com/google/cadvisor -v ${PWD}:/go/src/github.com/google/cadvisor golang:1.25 make build
7685

7786
presubmit: lint
7887
@echo ">> checking go mod tidy"
@@ -100,4 +109,4 @@ clean:
100109
@rm -f *.test cadvisor
101110
@rm -rf _output/
102111

103-
.PHONY: all build docker format release test test-integration lint presubmit tidy
112+
.PHONY: all build docker format release test test-integration test-integration-crio lint presubmit tidy

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cAdvisor has native support for [Docker](https://github.com/docker/docker) conta
1111
To quickly tryout cAdvisor on your machine with Docker, we have a Docker image that includes everything you need to get started. You can run a single cAdvisor to monitor the whole machine. Simply run:
1212

1313
```
14-
VERSION=v0.49.1 # use the latest release version from https://github.com/google/cadvisor/releases
14+
VERSION=v0.53.0 # use the latest release version from https://github.com/google/cadvisor/releases
1515
sudo docker run \
1616
--volume=/:/rootfs:ro \
1717
--volume=/var/run:/var/run:ro \
@@ -23,7 +23,7 @@ sudo docker run \
2323
--name=cadvisor \
2424
--privileged \
2525
--device=/dev/kmsg \
26-
gcr.io/cadvisor/cadvisor:$VERSION
26+
ghcr.io/google/cadvisor:$VERSION # for versions prior to v0.53.0, use gcr.io/cadvisor/cadvisor instead
2727
```
2828

2929
cAdvisor is now running (in the background) on `http://localhost:8080`. The setup includes directories with Docker state cAdvisor needs to observe.

build/config/crio.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2024 Google Inc. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# CRI-O plain configuration - no special build flags
16+
unset GO_FLAGS
17+
unset PACKAGES
18+
unset BUILD_PACKAGES
19+
unset CADVISOR_ARGS

0 commit comments

Comments
 (0)