Skip to content

Commit 56432a2

Browse files
authored
Merge pull request #40 from coutinhop/pedro-merge-upstream
Merge branch 'main' from github.com/containernetworking/plugins into 'master'
2 parents bd588f8 + b08eec6 commit 56432a2

File tree

1,519 files changed

+139468
-45386
lines changed

Some content is hidden

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

1,519 files changed

+139468
-45386
lines changed

.github/actions/retest-action/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.10
1+
FROM alpine:3.21
22

33
RUN apk add --no-cache curl jq
44

.github/actions/retest-action/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ runs:
88
using: 'docker'
99
image: 'Dockerfile'
1010
env:
11-
GITHUB_TOKEN: ${{ inputs.token }}
11+
GITHUB_TOKEN: ${{ inputs.token }}

.github/actions/retest-action/entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ curl --request GET \
2727
--header "authorization: Bearer ${GITHUB_TOKEN}" \
2828
--header "content-type: application/json" | jq '.workflow_runs | max_by(.run_number)' > run.json
2929

30-
RERUN_URL=$(jq -r '.rerun_url' run.json)
30+
RUN_URL=$(jq -r '.rerun_url' run.json)
3131

3232
curl --request POST \
33-
--url "${RERUN_URL}" \
33+
--url "${RUN_URL}/rerun-failed-jobs" \
3434
--header "authorization: Bearer ${GITHUB_TOKEN}" \
3535
--header "content-type: application/json"
3636

@@ -42,4 +42,4 @@ curl --request POST \
4242
--header "authorization: Bearer ${GITHUB_TOKEN}" \
4343
--header "accept: application/vnd.github.squirrel-girl-preview+json" \
4444
--header "content-type: application/json" \
45-
--data '{ "content" : "rocket" }'
45+
--data '{ "content" : "rocket" }'

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "docker" # See documentation for possible values
9+
directory: "/.github/actions/retest-action" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
12+
- package-ecosystem: "github-actions" # See documentation for possible values
13+
directory: "/" # Location of package manifests
14+
schedule:
15+
interval: "weekly"
16+
- package-ecosystem: "gomod" # See documentation for possible values
17+
directory: "/" # Location of package manifests
18+
schedule:
19+
interval: "weekly"
20+
groups:
21+
golang:
22+
patterns:
23+
- "*"
24+
exclude-patterns:
25+
- "github.com/containernetworking/*"

.github/go-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.23

.github/workflows/commands.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Check out code
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v4
1313

1414
- name: Re-Test Action
1515
uses: ./.github/actions/retest-action

.github/workflows/release.yaml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
name: Release binaries
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
linux_release:
10+
name: Release linux binaries
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
goarch: [amd64, arm, arm64, mips64le, ppc64le, riscv64, s390x]
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Install Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version-file: .github/go-version
23+
24+
- name: Build
25+
env:
26+
GOARCH: ${{ matrix.goarch }}
27+
CGO_ENABLED: 0
28+
run: ./build_linux.sh -ldflags '-extldflags -static -X github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=${{ github.ref_name }}'
29+
30+
- name: COPY files
31+
run: cp README.md LICENSE bin/
32+
33+
- name: Change plugin file ownership
34+
working-directory: ./bin
35+
run: sudo chown -R root:root .
36+
37+
- name: Create dist directory
38+
run: mkdir dist
39+
40+
- name: Create archive file
41+
working-directory: ./bin
42+
run: tar cfzpv ../dist/cni-plugins-linux-${{ matrix.goarch }}-${{ github.ref_name }}.tgz .
43+
44+
- name: Create sha256 checksum
45+
working-directory: ./dist
46+
run: sha256sum cni-plugins-linux-${{ matrix.goarch }}-${{ github.ref_name }}.tgz | tee cni-plugins-linux-${{ matrix.goarch }}-${{ github.ref_name }}.tgz.sha256
47+
48+
- name: Create sha512 checksum
49+
working-directory: ./dist
50+
run: sha512sum cni-plugins-linux-${{ matrix.goarch }}-${{ github.ref_name }}.tgz | tee cni-plugins-linux-${{ matrix.goarch }}-${{ github.ref_name }}.tgz.sha512
51+
52+
- name: Upload binaries to release
53+
uses: svenstaro/upload-release-action@v2
54+
with:
55+
repo_token: ${{ secrets.GITHUB_TOKEN }}
56+
file: ./dist/*
57+
tag: ${{ github.ref }}
58+
overwrite: true
59+
file_glob: true
60+
61+
windows_releases:
62+
name: Release windows binaries
63+
runs-on: ubuntu-latest
64+
strategy:
65+
matrix:
66+
goarch: [amd64]
67+
steps:
68+
- name: Install dos2unix
69+
run: sudo apt-get install dos2unix
70+
71+
- name: Checkout code
72+
uses: actions/checkout@v4
73+
74+
- name: Install Go
75+
uses: actions/setup-go@v5
76+
with:
77+
go-version-file: .github/go-version
78+
79+
- name: Build
80+
env:
81+
GOARCH: ${{ matrix.goarch }}
82+
CGO_ENABLED: 0
83+
run: ./build_windows.sh -ldflags '-extldflags -static -X github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=${{ github.ref_name }}'
84+
85+
- name: COPY files
86+
run: cp README.md LICENSE bin/
87+
88+
- name: Change plugin file ownership
89+
working-directory: ./bin
90+
run: sudo chown -R root:root .
91+
92+
- name: Create dist directory
93+
run: mkdir dist
94+
95+
- name: Create archive file
96+
working-directory: ./bin
97+
run: tar cpfzv ../dist/cni-plugins-windows-${{ matrix.goarch }}-${{ github.ref_name }}.tgz .
98+
99+
- name: Create sha256 checksum
100+
working-directory: ./dist
101+
run: sha256sum cni-plugins-windows-${{ matrix.goarch }}-${{ github.ref_name }}.tgz | tee cni-plugins-windows-${{ matrix.goarch }}-${{ github.ref_name }}.tgz.sha256
102+
103+
- name: Create sha512 checksum
104+
working-directory: ./dist
105+
run: sha512sum cni-plugins-windows-${{ matrix.goarch }}-${{ github.ref_name }}.tgz | tee cni-plugins-windows-${{ matrix.goarch }}-${{ github.ref_name }}.tgz.sha512
106+
107+
- name: Upload binaries to release
108+
uses: svenstaro/upload-release-action@v2
109+
with:
110+
repo_token: ${{ secrets.GITHUB_TOKEN }}
111+
file: ./dist/*
112+
tag: ${{ github.ref }}
113+
overwrite: true
114+
file_glob: true

.github/workflows/test.yaml

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,53 @@
11
---
22
name: test
33

4-
on: ["push", "pull_request"]
4+
on:
5+
pull_request: {}
56

67
env:
7-
GO_VERSION: "1.22"
8-
LINUX_ARCHES: "amd64 386 arm arm64 s390x mips64le ppc64le"
8+
LINUX_ARCHES: "amd64 386 arm arm64 s390x mips64le ppc64le riscv64"
99

1010
jobs:
11+
lint:
12+
name: Lint
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: setup go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version-file: .github/go-version
20+
- uses: ibiqlik/action-yamllint@v3
21+
with:
22+
format: auto
23+
- uses: golangci/golangci-lint-action@v6
24+
with:
25+
version: v1.61.0
26+
args: -v
27+
verify-vendor:
28+
name: Verify vendor directory
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Install Go
33+
uses: actions/setup-go@v5
34+
with:
35+
go-version-file: .github/go-version
36+
- name: Check module vendoring
37+
run: |
38+
go mod tidy
39+
go mod vendor
40+
test -z "$(git status --porcelain)" || (echo "please run 'go mod tidy && go mod vendor', and submit your changes"; exit 1)
1141
build:
1242
name: Build all linux architectures
43+
needs: lint
1344
runs-on: ubuntu-latest
1445
steps:
46+
- uses: actions/checkout@v4
1547
- name: setup go
16-
uses: actions/setup-go@v2
48+
uses: actions/setup-go@v5
1749
with:
18-
go-version: ${{ env.GO_VERSION }}
19-
- uses: actions/checkout@v2
20-
50+
go-version-file: .github/go-version
2151
- name: Build on all supported architectures
2252
run: |
2353
set -e
@@ -26,9 +56,9 @@ jobs:
2656
GOARCH=$arch ./build_linux.sh
2757
rm bin/*
2858
done
29-
3059
test-linux:
3160
name: Run tests on Linux amd64
61+
needs: build
3262
runs-on: ubuntu-latest
3363
steps:
3464
- name: Install kernel module
@@ -37,22 +67,25 @@ jobs:
3767
sudo apt-get install linux-modules-extra-$(uname -r)
3868
- name: Install nftables
3969
run: sudo apt-get install nftables
40-
70+
- name: Install dnsmasq(dhcp server)
71+
run: |
72+
sudo apt-get install dnsmasq
73+
sudo systemctl disable --now dnsmasq
74+
- uses: actions/checkout@v4
4175
- name: setup go
42-
uses: actions/setup-go@v2
76+
uses: actions/setup-go@v5
4377
with:
44-
go-version: ${{ env.GO_VERSION }}
78+
go-version-file: .github/go-version
4579
- name: Set up Go for root
4680
run: |
4781
sudo ln -sf `which go` `sudo which go` || true
4882
sudo go version
49-
- uses: actions/checkout@v2
5083
5184
- name: Install test binaries
5285
run: |
53-
go install github.com/containernetworking/cni/cnitool@v1.2.2
54-
go install github.com/mattn/goveralls@v0.0.12
55-
go install github.com/modocache/gover@b58185e
86+
go install github.com/containernetworking/cni/cnitool@latest
87+
go install github.com/mattn/goveralls@latest
88+
go install github.com/modocache/gover@latest
5689
5790
- name: test
5891
run: PATH=$PATH:$(go env GOPATH)/bin COVERALLS=1 ./test_linux.sh
@@ -64,15 +97,15 @@ jobs:
6497
PATH=$PATH:$(go env GOPATH)/bin
6598
gover
6699
goveralls -coverprofile=gover.coverprofile -service=github
67-
68100
test-win:
69101
name: Build and run tests on Windows
102+
needs: build
70103
runs-on: windows-latest
71104
steps:
105+
- uses: actions/checkout@v4
72106
- name: setup go
73-
uses: actions/setup-go@v2
107+
uses: actions/setup-go@v5
74108
with:
75-
go-version: ${{ env.GO_VERSION }}
76-
- uses: actions/checkout@v2
109+
go-version-file: .github/go-version
77110
- name: test
78111
run: bash ./test_windows.sh

.golangci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
issues:
2+
exclude-rules:
3+
- linters:
4+
- revive
5+
text: "don't use ALL_CAPS in Go names; use CamelCase"
6+
- linters:
7+
- revive
8+
text: " and that stutters;"
9+
- path: '(.+)_test\.go'
10+
text: "dot-imports: should not use dot imports"
11+
12+
linters:
13+
disable:
14+
- errcheck
15+
enable:
16+
- contextcheck
17+
- durationcheck
18+
- gci
19+
- ginkgolinter
20+
- gocritic
21+
- gofumpt
22+
- gosimple
23+
- govet
24+
- ineffassign
25+
- misspell
26+
- nonamedreturns
27+
- predeclared
28+
- revive
29+
- staticcheck
30+
- unconvert
31+
- unparam
32+
- unused
33+
- wastedassign
34+
35+
linters-settings:
36+
gci:
37+
sections:
38+
- standard
39+
- default
40+
- prefix(github.com/containernetworking)
41+
42+
run:
43+
timeout: 5m
44+
modules-download-mode: vendor

.yamllint.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
extends: default
2+
3+
ignore: |
4+
vendor
5+
6+
rules:
7+
document-start: disable
8+
line-length: disable
9+
truthy:
10+
ignore: |
11+
.github/workflows/*.yml
12+
.github/workflows/*.yaml

0 commit comments

Comments
 (0)