From ca3600dd307742a755e614e25ddaa8f1e0cd3633 Mon Sep 17 00:00:00 2001 From: Evan Baker Date: Mon, 13 Nov 2023 15:51:41 +0000 Subject: [PATCH] chore: update to go1.21 Signed-off-by: Evan Baker --- .devcontainer/Dockerfile | 28 +++---- .devcontainer/devcontainer.json | 83 +++++++++---------- .github/dependabot.yaml | 21 ----- .github/workflows/crdgen.yaml | 2 +- ...cyclonus-netpol-extended-nightly-test.yaml | 2 +- .github/workflows/cyclonus-netpol-test.yaml | 2 +- .github/workflows/golangci.yaml | 4 +- azure-ipam/go.mod | 2 +- build/tools/go.mod | 2 +- cns/linux.Dockerfile | 2 +- cns/windows.Dockerfile | 2 +- dropgz/build/cniTest_linux.Dockerfile | 6 +- dropgz/build/cniTest_windows.Dockerfile | 4 +- dropgz/build/linux.Dockerfile | 2 +- dropgz/build/windows.Dockerfile | 2 +- dropgz/go.mod | 2 +- go.mod | 2 +- hack/toolbox/Dockerfile.windows | 2 +- hack/toolbox/server/Dockerfile.heavy | 2 +- hack/toolbox/server/Dockerfile.lite | 2 +- npm/linux.Dockerfile | 2 +- npm/windows.Dockerfile | 2 +- tools/acncli/Dockerfile | 2 +- zapai/go.mod | 2 +- 24 files changed, 74 insertions(+), 108 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e510e02ae3..513ad62979 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,19 +1,11 @@ -# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.203.0/containers/go/.devcontainer/base.Dockerfile - -# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster -ARG VARIANT="1.20" +ARG VARIANT="1.21" FROM mcr.microsoft.com/vscode/devcontainers/go:${VARIANT} - -# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 -ARG NODE_VERSION="none" -RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi - -# [Optional] Uncomment this section to install additional OS packages. -RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ - && apt-get -y install --no-install-recommends podman buildah skopeo vim fzf ripgrep - -# [Optional] Uncomment the next line to use go get to install anything else you need -# RUN go get -x - -# [Optional] Uncomment this line to install global node packages. -# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 +RUN apt-get update && \ + export DEBIAN_FRONTEND=noninteractive && \ + apt-get -y install --no-install-recommends \ + podman \ + buildah \ + skopeo \ + vim \ + fzf \ + ripgrep diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6e354dd318..eee94e61c7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,11 +5,7 @@ "build": { "dockerfile": "Dockerfile", "args": { - // Update the VARIANT arg to pick a version of Go: 1, 1.16, 1.17 - // Append -bullseye or -buster to pin to an OS version. - // Use -bullseye variants on local arm64/Apple Silicon. - "VARIANT": "1.20-bullseye", - // Options + "VARIANT": "1.21-bullseye", "NODE_VERSION": "none" } }, @@ -19,47 +15,46 @@ "--security-opt", "seccomp=unconfined" ], - // Set *default* container specific settings.json values on container create. - "settings": { - "editor.formatOnSave": true, - "files.autoSave": "onFocusChange", - "files.insertFinalNewline": true, - "git.allowForcePush": true, - "git.alwaysSignOff": true, - "git.autoStash": true, - "git.autofetch": "all", - "git.branchSortOrder": "alphabetically", - "git.enableCommitSigning": true, - "git.fetchOnPull": true, - "git.pruneOnFetch": true, - "git.rebaseWhenSync": true, - "go.coverOnSave": true, - "go.coverOnSingleTest": true, - "go.coverOnSingleTestFile": true, - "go.formatTool": "gofumpt", - "go.gopath": "/go", - "go.goroot": "/usr/local/go", - "go.lintTool": "golangci-lint", - "go.testOnSave": true, - "go.toolsManagement.autoUpdate": true, - "go.toolsManagement.checkForUpdates": "local", - "go.useLanguageServer": true + "customizations": { + "codespaces": {}, + "vscode": { + "settings": { + "editor.formatOnSave": true, + "files.autoSave": "onFocusChange", + "files.insertFinalNewline": true, + "git.allowForcePush": true, + "git.alwaysSignOff": true, + "git.autoStash": true, + "git.autofetch": "all", + "git.branchSortOrder": "alphabetically", + "git.enableCommitSigning": true, + "git.fetchOnPull": true, + "git.pruneOnFetch": true, + "git.rebaseWhenSync": true, + "go.coverOnSave": true, + "go.coverOnSingleTest": true, + "go.coverOnSingleTestFile": true, + "go.formatTool": "gofumpt", + "go.gopath": "/go", + "go.goroot": "/usr/local/go", + "go.lintTool": "golangci-lint", + "go.testOnSave": true, + "go.toolsManagement.autoUpdate": true, + "go.toolsManagement.checkForUpdates": "local", + "go.useLanguageServer": true + }, + "extensions": [ + "bierner.github-markdown-preview", + "gitHub.codespaces", + "ms-vscode-remote.vscode-remote-extensionpack", + "golang.go", + "ms-vsliveshare.vsliveshare-pack", + "redhat.vscode-yaml", + "eamodio.gitlens" + ] + } }, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "bierner.github-markdown-preview", - "gitHub.codespaces", - "ms-vscode-remote.vscode-remote-extensionpack", - "golang.go", - "ms-vsliveshare.vsliveshare-pack", - "redhat.vscode-yaml", - "eamodio.gitlens" - ], - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "make setup", - // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", "features": { "docker-in-docker": "latest", diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index d4f3ade948..2c5df6e028 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -5,9 +5,6 @@ updates: directory: "/" schedule: interval: "daily" - assignees: - - "matmerr" - - "rbtr" reviewers: - "azure/azure-sdn-members" commit-message: @@ -17,9 +14,6 @@ updates: directory: "/" schedule: interval: "daily" - assignees: - - "matmerr" - - "rbtr" reviewers: - "azure/azure-sdn-members" commit-message: @@ -29,9 +23,6 @@ updates: directory: "/" schedule: interval: "daily" - assignees: - - "matmerr" - - "rbtr" reviewers: - "azure/azure-sdn-members" commit-message: @@ -40,9 +31,6 @@ updates: directory: "/azure-ipam" schedule: interval: "daily" - assignees: - - "matmerr" - - "rbtr" reviewers: - "azure/azure-sdn-members" commit-message: @@ -51,9 +39,6 @@ updates: directory: "/build/tools" schedule: interval: "daily" - assignees: - - "matmerr" - - "rbtr" reviewers: - "azure/azure-sdn-members" commit-message: @@ -62,17 +47,11 @@ updates: directory: "/dropgz" schedule: interval: "daily" - assignees: - - "matmerr" - - "rbtr" commit-message: prefix: "deps" - package-ecosystem: "gomod" directory: "/zapai" schedule: interval: "daily" - assignees: - - "matmerr" - - "rbtr" commit-message: prefix: "deps" diff --git a/.github/workflows/crdgen.yaml b/.github/workflows/crdgen.yaml index ab5bd33592..89444a038a 100644 --- a/.github/workflows/crdgen.yaml +++ b/.github/workflows/crdgen.yaml @@ -11,7 +11,7 @@ jobs: crdgen119: strategy: matrix: - go-version: ['1.20'] + go-version: ['1.20','1.21'] os: [ubuntu-latest] name: CRDs are Generated runs-on: ${{ matrix.os }} diff --git a/.github/workflows/cyclonus-netpol-extended-nightly-test.yaml b/.github/workflows/cyclonus-netpol-extended-nightly-test.yaml index b5cf07df74..0fe111c57d 100644 --- a/.github/workflows/cyclonus-netpol-extended-nightly-test.yaml +++ b/.github/workflows/cyclonus-netpol-extended-nightly-test.yaml @@ -26,7 +26,7 @@ jobs: - uses: actions/setup-go@v4 with: - go-version: "^1.20" + go-version: "^1.21" - name: Setup Kind uses: engineerd/setup-kind@v0.5.0 diff --git a/.github/workflows/cyclonus-netpol-test.yaml b/.github/workflows/cyclonus-netpol-test.yaml index 89b0fb7222..8679b9deab 100644 --- a/.github/workflows/cyclonus-netpol-test.yaml +++ b/.github/workflows/cyclonus-netpol-test.yaml @@ -32,7 +32,7 @@ jobs: - uses: actions/setup-go@v4 with: - go-version: '^1.20' + go-version: '^1.21' - name: Setup Kind uses: engineerd/setup-kind@v0.5.0 diff --git a/.github/workflows/golangci.yaml b/.github/workflows/golangci.yaml index 9397f19329..376aeea907 100644 --- a/.github/workflows/golangci.yaml +++ b/.github/workflows/golangci.yaml @@ -8,11 +8,11 @@ on: - synchronize - ready_for_review jobs: - golangci119: + golangci: strategy: fail-fast: false matrix: - go-version: ["1.20.x"] + go-version: ['1.20.x','1.21.x'] os: [ubuntu-latest, windows-latest] name: Lint runs-on: ${{ matrix.os }} diff --git a/azure-ipam/go.mod b/azure-ipam/go.mod index 800e75613e..5847b1c7e4 100644 --- a/azure-ipam/go.mod +++ b/azure-ipam/go.mod @@ -1,6 +1,6 @@ module github.com/Azure/azure-container-networking/azure-ipam -go 1.20 +go 1.21 require ( github.com/Azure/azure-container-networking v1.5.12-0.20230919193705-477200881d37 diff --git a/build/tools/go.mod b/build/tools/go.mod index 8cdf290afc..2c42ee1c3a 100644 --- a/build/tools/go.mod +++ b/build/tools/go.mod @@ -1,6 +1,6 @@ module github.com/Azure/azure-container-networking/build/tools -go 1.20 +go 1.21 require ( github.com/AlekSi/gocov-xml v1.1.0 diff --git a/cns/linux.Dockerfile b/cns/linux.Dockerfile index 88585339e5..6177bb58d0 100644 --- a/cns/linux.Dockerfile +++ b/cns/linux.Dockerfile @@ -1,7 +1,7 @@ FROM mcr.microsoft.com/cbl-mariner/base/core:1.0 AS certs RUN tdnf upgrade -y && tdnf install -y ca-certificates -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS builder +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS builder ARG VERSION ARG CNS_AI_PATH ARG CNS_AI_ID diff --git a/cns/windows.Dockerfile b/cns/windows.Dockerfile index 4ca5e82c2e..52bec2e7b6 100644 --- a/cns/windows.Dockerfile +++ b/cns/windows.Dockerfile @@ -1,5 +1,5 @@ ARG OS_VERSION -FROM --platform=linux/amd64 mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS builder +FROM --platform=linux/amd64 mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS builder ARG VERSION ARG CNS_AI_PATH ARG CNS_AI_ID diff --git a/dropgz/build/cniTest_linux.Dockerfile b/dropgz/build/cniTest_linux.Dockerfile index 89788fd7bb..b55f49ab7c 100644 --- a/dropgz/build/cniTest_linux.Dockerfile +++ b/dropgz/build/cniTest_linux.Dockerfile @@ -1,10 +1,10 @@ -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS azure-ipam +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS azure-ipam ARG VERSION WORKDIR /azure-ipam COPY ./azure-ipam . RUN CGO_ENABLED=0 go build -a -o bin/azure-ipam -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" . -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS azure-vnet +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS azure-vnet ARG VERSION WORKDIR /azure-container-networking COPY . . @@ -29,7 +29,7 @@ COPY --from=azure-vnet /azure-container-networking/telemetry/azure-vnet-telemetr RUN cd pkg/embed/fs/ && sha256sum * > sum.txt RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS dropgz +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS dropgz ARG VERSION WORKDIR /dropgz COPY --from=compressor /dropgz . diff --git a/dropgz/build/cniTest_windows.Dockerfile b/dropgz/build/cniTest_windows.Dockerfile index 874d46b95d..c869f07a7e 100644 --- a/dropgz/build/cniTest_windows.Dockerfile +++ b/dropgz/build/cniTest_windows.Dockerfile @@ -1,6 +1,6 @@ ARG ARCH ARG OS_VERSION -FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS azure-vnet +FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS azure-vnet ARG VERSION WORKDIR /azure-container-networking COPY . . @@ -19,7 +19,7 @@ COPY --from=azure-vnet /azure-container-networking/telemetry/azure-vnet-telemetr RUN cd pkg/embed/fs/ && sha256sum * > sum.txt RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done -FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS dropgz +FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS dropgz ARG VERSION WORKDIR /dropgz COPY --from=compressor /dropgz . diff --git a/dropgz/build/linux.Dockerfile b/dropgz/build/linux.Dockerfile index 98cb26e7a9..0b939efe0f 100644 --- a/dropgz/build/linux.Dockerfile +++ b/dropgz/build/linux.Dockerfile @@ -36,7 +36,7 @@ COPY --from=azure-vnet /azure-container-networking/azure-vnet-ipam pkg/embed/fs RUN cd pkg/embed/fs/ && sha256sum * > sum.txt RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS dropgz +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS dropgz ARG VERSION WORKDIR /dropgz COPY --from=compressor /dropgz . diff --git a/dropgz/build/windows.Dockerfile b/dropgz/build/windows.Dockerfile index 46239f204a..8dea9cac5a 100644 --- a/dropgz/build/windows.Dockerfile +++ b/dropgz/build/windows.Dockerfile @@ -27,7 +27,7 @@ COPY --from=azure-vnet /azure-container-networking/azure-vnet-telemetry.config p RUN cd pkg/embed/fs/ && sha256sum * > sum.txt RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done -FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS dropgz +FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS dropgz ARG VERSION WORKDIR /dropgz COPY --from=compressor /dropgz . diff --git a/dropgz/go.mod b/dropgz/go.mod index 499b264ff2..5bf5dd50d8 100644 --- a/dropgz/go.mod +++ b/dropgz/go.mod @@ -1,6 +1,6 @@ module github.com/Azure/azure-container-networking/dropgz -go 1.20 +go 1.21 require ( github.com/jsternberg/zap-logfmt v1.3.0 diff --git a/go.mod b/go.mod index 75f14a101f..1f7a551b0c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/Azure/azure-container-networking -go 1.20 +go 1.21 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.2 diff --git a/hack/toolbox/Dockerfile.windows b/hack/toolbox/Dockerfile.windows index 7bc881cefa..12c4867157 100644 --- a/hack/toolbox/Dockerfile.windows +++ b/hack/toolbox/Dockerfile.windows @@ -1,5 +1,5 @@ # Build cns -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS builder +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS builder # Build args ARG VERSION ARG CNS_AI_PATH diff --git a/hack/toolbox/server/Dockerfile.heavy b/hack/toolbox/server/Dockerfile.heavy index 6839f45794..fc0e7b160c 100644 --- a/hack/toolbox/server/Dockerfile.heavy +++ b/hack/toolbox/server/Dockerfile.heavy @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20 as build +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21 as build ADD ./ / WORKDIR / RUN CGO_ENABLED=0 GOOS=linux go build -o server . diff --git a/hack/toolbox/server/Dockerfile.lite b/hack/toolbox/server/Dockerfile.lite index 45b552be00..12bac27032 100644 --- a/hack/toolbox/server/Dockerfile.lite +++ b/hack/toolbox/server/Dockerfile.lite @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20 as build +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21 as build ADD ./server/server.go / WORKDIR / RUN CGO_ENABLED=0 GOOS=linux go build -o server . diff --git a/npm/linux.Dockerfile b/npm/linux.Dockerfile index 378c7218e3..48036e50b3 100644 --- a/npm/linux.Dockerfile +++ b/npm/linux.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS builder +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS builder ARG VERSION ARG NPM_AI_PATH ARG NPM_AI_ID diff --git a/npm/windows.Dockerfile b/npm/windows.Dockerfile index b2c1cc2696..bd8c9c87a9 100644 --- a/npm/windows.Dockerfile +++ b/npm/windows.Dockerfile @@ -1,5 +1,5 @@ ARG OS_VERSION -FROM --platform=linux/amd64 mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS builder +FROM --platform=linux/amd64 mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS builder ARG VERSION ARG NPM_AI_PATH ARG NPM_AI_ID diff --git a/tools/acncli/Dockerfile b/tools/acncli/Dockerfile index 4b6dcee5a4..49d523609e 100644 --- a/tools/acncli/Dockerfile +++ b/tools/acncli/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20 as build +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21 as build WORKDIR /go/src/github.com/Azure/azure-container-networking/ ARG VERSION ADD . . diff --git a/zapai/go.mod b/zapai/go.mod index e4f4fc0031..1237697097 100644 --- a/zapai/go.mod +++ b/zapai/go.mod @@ -1,6 +1,6 @@ module github.com/Azure/azure-container-networking/zapai -go 1.20 +go 1.21 require ( github.com/jsternberg/zap-logfmt v1.3.0