Skip to content

Commit

Permalink
chore: update to go1.24
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Baker <[email protected]>
  • Loading branch information
rbtr authored Mar 3, 2025
1 parent 965cd1f commit 612c3b4
Show file tree
Hide file tree
Showing 48 changed files with 694 additions and 1,778 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG VARIANT="1.23"
ARG VARIANT="dev-1.24"
FROM mcr.microsoft.com/vscode/devcontainers/go:${VARIANT}
RUN apt-get update && \
export DEBIAN_FRONTEND=noninteractive && \
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "1.23-bullseye",
"VARIANT": "dev-1.24",
"NODE_VERSION": "none"
}
},
Expand Down
10 changes: 0 additions & 10 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ updates:
prefix: "deps"
labels: [ "dependencies", "azure-ipam" ]
open-pull-requests-limit: 10
- package-ecosystem: "gomod"
directory: "/build/tools"
schedule:
interval: "daily"
reviewers:
- "azure/azure-sdn-members"
commit-message:
prefix: "deps"
labels: [ "dependencies" ]
open-pull-requests-limit: 10
- package-ecosystem: "gomod"
directory: "/dropgz"
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: "1.23"
go-version: stable
check-latest: true
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/crdgen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,15 @@ on:
- checks_requested
jobs:
crdgen:
strategy:
matrix:
go-version: ['1.22', '1.23']
os: [ubuntu-latest]
name: CRDs are Generated
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
go-version: stable
- name: Regenerate NodeNetworkConfig CRD
run: make -C crd/nodenetworkconfig
- name: Regenerate MultitenantNetworkContainer CRD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: "^1.23"
go-version: stable

- name: Setup Kind
uses: helm/kind-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cyclonus-netpol-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: '^1.23'
go-version: stable

- name: Setup Kind
uses: helm/kind-action@v1
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: ['1.22.x', '1.23.x']
os: [ubuntu-latest, windows-latest]
name: Lint
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
go-version: stable
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61
version: latest
args: --new-from-rev=origin/master --config=.golangci.yml --timeout=25m
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ ipam-*.xml
*.test

controller-gen
build/tools/bin
npm/debug/http

go.work*
Expand Down
3 changes: 1 addition & 2 deletions .pipelines/templates/run-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ stages:
name: "$(BUILD_POOL_NAME_DEFAULT)"
steps:
- script: |
make tools
# run test, echo exit status code to fd 3, pipe output from test to tee, which splits output to stdout and go-junit-report (which converts test output to report.xml), stdout from tee is redirected to fd 4. Take output written to fd 3 (which is the exit code of test), redirect to stdout, pipe to read from stdout then exit with that status code. Read all output from fd 4 (output from tee) and write to top stdout
{ { { {
sudo -E env "PATH=$PATH" make test-all;
echo $? >&3;
} | tee >(build/tools/bin/go-junit-report > report.xml) >&4;
} | tee >(go tool go-junit-report > report.xml) >&4;
} 3>&1;
} | { read xs; exit $xs; }
} 4>&1
Expand Down
3 changes: 1 addition & 2 deletions .pipelines/templates/unit-tests.stages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ stages:

- script: |
cd azure-container-networking
make tools
# run test, echo exit status code to fd 3, pipe output from test to tee, which splits output to stdout and go-junit-report (which converts test output to report.xml), stdout from tee is redirected to fd 4. Take output written to fd 3 (which is the exit code of test), redirect to stdout, pipe to read from stdout then exit with that status code. Read all output from fd 4 (output from tee) and write to top stdout
{ { { {
sudo -E env "PATH=$PATH" make test-all;
echo $? >&3;
} | tee >(build/tools/bin/go-junit-report > report.xml) >&4;
} | tee >(go tool go-junit-report > report.xml) >&4;
} 3>&1;
} | { read xs; exit $xs; }
} 4>&1
Expand Down
70 changes: 5 additions & 65 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ CNI_BAREMETAL_BUILD_DIR = $(BUILD_DIR)/cni-baremetal
CNI_DUALSTACK_BUILD_DIR = $(BUILD_DIR)/cni-dualstack
CNS_BUILD_DIR = $(BUILD_DIR)/cns
NPM_BUILD_DIR = $(BUILD_DIR)/npm
TOOLS_DIR = $(REPO_ROOT)/build/tools
TOOLS_BIN_DIR = $(TOOLS_DIR)/bin
CNI_AI_ID = 5515a1eb-b2bc-406a-98eb-ba462e6f0411
CNS_AI_ID = ce672799-8f08-4235-8c12-08563dc2acef
NPM_AI_ID = 014c22bd-4107-459e-8475-67909e96edcb
Expand All @@ -79,15 +77,6 @@ CNI_AI_PATH=$(ACN_PACKAGE_PATH)/telemetry.aiMetadata
CNS_AI_PATH=$(ACN_PACKAGE_PATH)/cns/logger.aiMetadata
NPM_AI_PATH=$(ACN_PACKAGE_PATH)/npm.aiMetadata

# Tool paths
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen
GOCOV := $(TOOLS_BIN_DIR)/gocov
GOCOV_XML := $(TOOLS_BIN_DIR)/gocov-xml
GOFUMPT := $(TOOLS_BIN_DIR)/gofumpt
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
GO_JUNIT_REPORT := $(TOOLS_BIN_DIR)/go-junit-report
MOCKGEN := $(TOOLS_BIN_DIR)/mockgen

# Archive file names.
ACNCLI_ARCHIVE_NAME = acncli-$(GOOS)-$(GOARCH)-$(ACN_VERSION).$(ARCHIVE_EXT)
CNI_ARCHIVE_NAME = azure-vnet-cni-$(GOOS)-$(GOARCH)-$(CNI_VERSION).$(ARCHIVE_EXT)
Expand Down Expand Up @@ -722,16 +711,17 @@ endif

clean: ## Clean build artifacts.
$(RMDIR) $(OUTPUT_DIR)
$(RMDIR) $(TOOLS_BIN_DIR)
$(RMDIR) go.work*


LINT_PKG ?= .

lint: $(GOLANGCI_LINT) ## Fast lint vs default branch showing only new issues.
GOLANGCI_LINT = go tool golangci-lint

lint: ## Fast lint vs default branch showing only new issues.
GOGC=20 $(GOLANGCI_LINT) run --timeout 25m -v $(LINT_PKG)/...

lint-all: $(GOLANGCI_LINT) ## Lint the current branch in entirety.
lint-all: ## Lint the current branch in entirety.
GOGC=20 $(GOLANGCI_LINT) run -v $(LINT_PKG)/...


Expand All @@ -745,7 +735,6 @@ workspace: ## Set up the Go workspace.
go work init
go work use .
go work use ./azure-ipam
go work use ./build/tools
go work use ./dropgz
go work use ./zapai

Expand Down Expand Up @@ -821,56 +810,7 @@ gitconfig: ## configure the local git repository
@git config core.fsmonitor true
@git config core.untrackedcache true

setup: tools install-hooks gitconfig ## performs common required repo setup


##@ Tools

$(TOOLS_DIR)/go.mod:
cd $(TOOLS_DIR); go mod init && go mod tidy

$(CONTROLLER_GEN): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR); go mod download; go build -o bin/controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen

controller-gen: $(CONTROLLER_GEN) ## Build controller-gen

protoc:
source ${REPO_ROOT}/scripts/install-protoc.sh

$(GOCOV): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR); go mod download; go build -o bin/gocov github.com/axw/gocov/gocov

gocov: $(GOCOV) ## Build gocov

$(GOCOV_XML): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR); go mod download; go build -o bin/gocov-xml github.com/AlekSi/gocov-xml

gocov-xml: $(GOCOV_XML) ## Build gocov-xml

$(GOFUMPT): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR); go mod download; go build -o bin/gofumpt mvdan.cc/gofumpt

gofumpt: $(GOFUMPT) ## Build gofumpt

$(GOLANGCI_LINT): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR); go mod download; go build -o bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint

golangci-lint: $(GOLANGCI_LINT) ## Build golangci-lint

$(GO_JUNIT_REPORT): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR); go mod download; go build -o bin/go-junit-report github.com/jstemmer/go-junit-report

go-junit-report: $(GO_JUNIT_REPORT) ## Build go-junit-report

$(MOCKGEN): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR); go mod download; go build -o bin/mockgen github.com/golang/mock/mockgen

mockgen: $(MOCKGEN) ## Build mockgen

clean-tools:
rm -r build/tools/bin

tools: acncli gocov gocov-xml go-junit-report golangci-lint gofumpt protoc ## Build bins for build tools
setup: install-hooks gitconfig ## performs common required repo setup


##@ Help
Expand Down
4 changes: 2 additions & 2 deletions azure-ipam/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ ARG DROPGZ_VERSION=v0.0.12
ARG OS_VERSION
ARG OS

# skopeo inspect docker://mcr.microsoft.com/oss/go/microsoft/golang:1.23.2-cbl-mariner2.0 --format "{{.Name}}@{{.Digest}}"
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:f8613198423d5cb702961f1547f9cb061f8da1c6ca9ce8da4824eb47db663cd7 AS go
# skopeo inspect docker://mcr.microsoft.com/oss/go/microsoft/golang:1.24-cbl-mariner2.0 --format "{{.Name}}@{{.Digest}}"
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:15c9b9b8449f55446243ce20c5d3808cc18625d0b358d70aaad402fb73c0766f AS go

# skopeo inspect docker://mcr.microsoft.com/cbl-mariner/base/core:2.0 --format "{{.Name}}@{{.Digest}}"
FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core@sha256:a490e0b0869dc570ae29782c2bc17643aaaad1be102aca83ce0b96e0d0d2d328 AS mariner-core
Expand Down
4 changes: 1 addition & 3 deletions azure-ipam/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/Azure/azure-container-networking/azure-ipam

go 1.23

toolchain go1.23.2
go 1.24

require (
github.com/Azure/azure-container-networking v1.6.21
Expand Down
4 changes: 1 addition & 3 deletions bpf-prog/ipv6-hp-bpf/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/Azure/azure-container-networking/bpf-prog/ipv6-hp-bpf

go 1.23

toolchain go1.23.2
go 1.24

require (
github.com/cilium/ebpf v0.15.0
Expand Down
12 changes: 6 additions & 6 deletions bpf-prog/ipv6-hp-bpf/linux.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# skopeo inspect docker://mcr.microsoft.com/oss/go/microsoft/golang:1.23.2 --format "{{.Name}}@{{.Digest}}"
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:86c5b00bbed2a6e7157052d78bf4b45c0bf26545ed6e8fd7dbad51ac9415f534 AS builder
# skopeo inspect docker://mcr.microsoft.com/oss/go/microsoft/golang:1.24-cbl-mariner2.0 --format "{{.Name}}@{{.Digest}}"
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:15c9b9b8449f55446243ce20c5d3808cc18625d0b358d70aaad402fb73c0766f AS go
ARG VERSION
ARG DEBUG
ARG OS
Expand Down Expand Up @@ -39,8 +39,8 @@ RUN GOOS=$OS CGO_ENABLED=0 go generate ./...
RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/ipv6-hp-bpf -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" .

FROM mcr.microsoft.com/cbl-mariner/distroless/minimal:2.0 AS linux
COPY --from=builder /go/bin/ipv6-hp-bpf /ipv6-hp-bpf
COPY --from=builder /usr/sbin/nft /usr/sbin/nft
COPY --from=builder /sbin/ip /sbin/ip
COPY --from=builder /tmp/lib/* /lib
COPY --from=go /go/bin/ipv6-hp-bpf /ipv6-hp-bpf
COPY --from=go /usr/sbin/nft /usr/sbin/nft
COPY --from=go /sbin/ip /sbin/ip
COPY --from=go /tmp/lib/* /lib
CMD ["/ipv6-hp-bpf"]
Loading

0 comments on commit 612c3b4

Please sign in to comment.