build: move to Go 1.19 and golangci-lint 1.48 because of that

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
This commit is contained in:
Mikko Ylinen 2022-08-09 11:19:29 +03:00
parent 8f2d10cd34
commit 642c4f7b59
29 changed files with 51 additions and 44 deletions

View File

@ -9,7 +9,7 @@ on:
- main - main
- 'release-*' - 'release-*'
env: env:
GO_VERSION: 1.18.3 GO_VERSION: 1.19
K8S_VERSION: 1.24.2 K8S_VERSION: 1.24.2
permissions: permissions:
contents: read contents: read
@ -50,6 +50,7 @@ jobs:
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
check-latest: true
- name: Install build dependencies needed for VPU plugin - name: Install build dependencies needed for VPU plugin
run: | run: |
sudo apt-get update sudo apt-get update
@ -57,7 +58,7 @@ jobs:
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v3 uses: golangci/golangci-lint-action@v3
with: with:
version: v1.46.2 version: v1.48.0
args: -v --timeout 5m args: -v --timeout 5m
build: build:
@ -68,6 +69,7 @@ jobs:
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
check-latest: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: | path: |
@ -158,6 +160,7 @@ jobs:
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
check-latest: true
- name: Test SGX & FPGA Admission Webhook, Deploy Operator - name: Test SGX & FPGA Admission Webhook, Deploy Operator
run: | run: |
make test-with-kind make test-with-kind

4
Jenkinsfile vendored
View File

@ -9,8 +9,8 @@ pipeline {
GO111MODULE="on" GO111MODULE="on"
REG="cloud-native-image-registry.westus.cloudapp.azure.com/" REG="cloud-native-image-registry.westus.cloudapp.azure.com/"
K8S_VERSION="1.24.2" K8S_VERSION="1.24.2"
GOLANGCI_LINT_VERSION="v1.46.2" GOLANGCI_LINT_VERSION="v1.48.0"
GO_VERSION="1.18.3" GO_VERSION="1.19"
GO_TAR="go${GO_VERSION}.linux-amd64.tar.gz" GO_TAR="go${GO_VERSION}.linux-amd64.tar.gz"
GOROOT="/usr/local/go" GOROOT="/usr/local/go"
GOPATH="/tmp/go" GOPATH="/tmp/go"

View File

@ -10,7 +10,7 @@ EXTRA_BUILD_ARGS ?= ""
CERT_MANAGER_VERSION ?= v1.8.1 CERT_MANAGER_VERSION ?= v1.8.1
CONTROLLER_GEN_VERSION ?= v0.9.2 CONTROLLER_GEN_VERSION ?= v0.9.2
GOLANGCI_LINT_VERSION ?= v1.45.0 GOLANGCI_LINT_VERSION ?= v1.48.0
KIND_VERSION ?= v0.14.0 KIND_VERSION ?= v0.14.0
GOLICENSES_VERSION ?= v1.2.0 GOLICENSES_VERSION ?= v1.2.0
# Current Operator version # Current Operator version

View File

@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -33,7 +33,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -33,7 +33,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -33,7 +33,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -33,7 +33,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -33,7 +33,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -33,7 +33,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi8-micro
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###
FROM ${GOLANG_BASE} as builder FROM ${GOLANG_BASE} as builder
ARG DIR=/intel-device-plugins-for-kubernetes ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -5,5 +5,5 @@
## ##
## This is used on release branches before tagging a stable version. ## This is used on release branches before tagging a stable version.
## The main branch defaults to using the latest Golang base image. ## The main branch defaults to using the latest Golang base image.
ARG GOLANG_BASE=golang:1.18-bullseye ARG GOLANG_BASE=golang:1.19-bullseye
### ###

View File

@ -442,10 +442,13 @@ func isPreferredAllocationRequestOk(rqt *pluginapi.PreferredAllocationRequest, s
} }
// findAllocationPodCandidate tries to find the best allocation candidate pod, which must be: // findAllocationPodCandidate tries to find the best allocation candidate pod, which must be:
//
// -pending for this node // -pending for this node
// -using GPU resources in its spec // -using GPU resources in its spec
// -is found via grpc service with unallocated GPU devices // -is found via grpc service with unallocated GPU devices
//
// returns: // returns:
//
// -the candidate pod struct pointer and no error, or // -the candidate pod struct pointer and no error, or
// -errRetry if unsuccessful, but there is perhaps hope of trying again with better luck // -errRetry if unsuccessful, but there is perhaps hope of trying again with better luck
// -errZeroPending if no pending pods exist anymore (which is fine) // -errZeroPending if no pending pods exist anymore (which is fine)

View File

@ -47,7 +47,7 @@ var (
setupLog = ctrl.Log.WithName("setup") setupLog = ctrl.Log.WithName("setup")
) )
// nolint:wsl //nolint:wsl
func init() { func init() {
// Add schemes for DaemonSets, Pods etc... // Add schemes for DaemonSets, Pods etc...
_ = clientgoscheme.AddToScheme(scheme) _ = clientgoscheme.AddToScheme(scheme)

View File

@ -69,7 +69,7 @@ var qatDeviceDriver = map[string]string{
"6f55": "d15xxvf", "6f55": "d15xxvf",
} }
// swapBDF returns ["C1:B1:A1", "C2:B2:A2"], when the given parameter is ["A1:B1:C1", "A2:B2:C2"``]. // swapBDF returns ["C1:B1:A1", "C2:B2:A2"], when the given parameter is ["A1:B1:C1", "A2:B2:C2"].
func swapBDF(devstrings []string) []string { func swapBDF(devstrings []string) []string {
result := make([]string, len(devstrings)) result := make([]string, len(devstrings))
@ -145,7 +145,7 @@ func NewDevicePlugin(maxDevices int, kernelVfDrivers string, dpdkDriver string,
return newDevicePlugin(pciDriverDirectory, pciDeviceDirectory, maxDevices, kernelDrivers, dpdkDriver, allocationPolicyFunc), nil return newDevicePlugin(pciDriverDirectory, pciDeviceDirectory, maxDevices, kernelDrivers, dpdkDriver, allocationPolicyFunc), nil
} }
//getAllocationPolicy returns a func that fits the policy given as a parameter. It returns nonePolicy when the flag is not set, and it returns nil when the policy is not valid value. // getAllocationPolicy returns a func that fits the policy given as a parameter. It returns nonePolicy when the flag is not set, and it returns nil when the policy is not valid value.
func getAllocationPolicy(preferredAllocationPolicy string) preferredAllocationPolicyFunc { func getAllocationPolicy(preferredAllocationPolicy string) preferredAllocationPolicyFunc {
switch { switch {
case !isFlagSet("allocation-policy"): case !isFlagSet("allocation-policy"):

View File

@ -35,7 +35,7 @@ type testCase struct {
vendorID int vendorID int
} }
//OpenDevices tries to inject gousb compatible fake device info. // OpenDevices tries to inject gousb compatible fake device info.
func (t *testCase) OpenDevices(opener func(desc *gousb.DeviceDesc) bool) ([]*gousb.Device, error) { func (t *testCase) OpenDevices(opener func(desc *gousb.DeviceDesc) bool) ([]*gousb.Device, error) {
var ret []*gousb.Device var ret []*gousb.Device

View File

@ -44,7 +44,7 @@ func init() {
bKeeper.pluginCounter = make(map[string]int) bKeeper.pluginCounter = make(map[string]int)
} }
//nolint: govet //nolint:govet
type bookKeeper struct { type bookKeeper struct {
sync.Mutex sync.Mutex
pluginCounter map[string]int pluginCounter map[string]int

View File

@ -48,7 +48,7 @@ const (
resourceName = namespace + "/testdevicetype" resourceName = namespace + "/testdevicetype"
) )
//nolint: govet //nolint:govet
type kubeletStub struct { type kubeletStub struct {
sync.Mutex sync.Mutex
server *grpc.Server server *grpc.Server

View File

@ -144,8 +144,8 @@ func (f *DflPort) CheckExtension() (int, error) {
// PortPR does Partial Reconfiguration based on Port ID and Buffer (Image) // PortPR does Partial Reconfiguration based on Port ID and Buffer (Image)
// provided by caller. // provided by caller.
// * Return: 0 on success, -errno on failure. // - Return: 0 on success, -errno on failure.
// * If DFL_FPGA_FME_PORT_PR returns -EIO, that indicates the HW has detected // - If DFL_FPGA_FME_PORT_PR returns -EIO, that indicates the HW has detected
// some errors during PR, under this case, the user can fetch HW error info // some errors during PR, under this case, the user can fetch HW error info
// from the status of FME's fpga manager. // from the status of FME's fpga manager.
func (f *DflFME) PortPR(port uint32, bitstream []byte) error { func (f *DflFME) PortPR(port uint32, bitstream []byte) error {

View File

@ -140,8 +140,8 @@ func (f *IntelFpgaPort) CheckExtension() (int, error) {
// PortPR does Partial Reconfiguration based on Port ID and Buffer (Image) // PortPR does Partial Reconfiguration based on Port ID and Buffer (Image)
// provided by caller. // provided by caller.
// * Return: 0 on success, -errno on failure. // - Return: 0 on success, -errno on failure.
// * If IntelFpga_FPGA_FME_PORT_PR returns -EIO, that indicates the HW has detected // - If IntelFpga_FPGA_FME_PORT_PR returns -EIO, that indicates the HW has detected
// some errors during PR, under this case, the user can fetch HW error info // some errors during PR, under this case, the user can fetch HW error info
// from the status of FME's fpga manager. // from the status of FME's fpga manager.
func (f *IntelFpgaFME) PortPR(port uint32, bitstream []byte) error { func (f *IntelFpgaFME) PortPR(port uint32, bitstream []byte) error {

View File

@ -71,7 +71,8 @@ var (
) )
// Patcher stores FPGA controller's state. // Patcher stores FPGA controller's state.
//nolint: govet //
//nolint:govet
type Patcher struct { type Patcher struct {
sync.Mutex sync.Mutex