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

4
Jenkinsfile vendored
View File

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

View File

@ -10,7 +10,7 @@ EXTRA_BUILD_ARGS ?= ""
CERT_MANAGER_VERSION ?= v1.8.1
CONTROLLER_GEN_VERSION ?= v0.9.2
GOLANGCI_LINT_VERSION ?= v1.45.0
GOLANGCI_LINT_VERSION ?= v1.48.0
KIND_VERSION ?= v0.14.0
GOLICENSES_VERSION ?= v1.2.0
# 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.
## 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
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.
## 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
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.
## 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
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.
## 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
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.
## 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
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.
## 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
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.
## 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
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.
## 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
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.
## 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
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.
## 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
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.
## 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
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.
## 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
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.
## 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
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.
## 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
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.
## 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
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.
## 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
ARG DIR=/intel-device-plugins-for-kubernetes

View File

@ -5,5 +5,5 @@
##
## This is used on release branches before tagging a stable version.
## 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,14 +442,17 @@ func isPreferredAllocationRequestOk(rqt *pluginapi.PreferredAllocationRequest, s
}
// findAllocationPodCandidate tries to find the best allocation candidate pod, which must be:
// -pending for this node
// -using GPU resources in its spec
// -is found via grpc service with unallocated GPU devices
//
// -pending for this node
// -using GPU resources in its spec
// -is found via grpc service with unallocated GPU devices
//
// returns:
// -the candidate pod struct pointer and no error, or
// -errRetry if unsuccessful, but there is perhaps hope of trying again with better luck
// -errZeroPending if no pending pods exist anymore (which is fine)
// -any grpc communication errors
//
// -the candidate pod struct pointer and no error, or
// -errRetry if unsuccessful, but there is perhaps hope of trying again with better luck
// -errZeroPending if no pending pods exist anymore (which is fine)
// -any grpc communication errors
func (rm *resourceManager) findAllocationPodCandidate() (*podCandidate, error) {
// get map of pending pods for this node
pendingPods, err := rm.getNodePendingGPUPods()

View File

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

View File

@ -69,7 +69,7 @@ var qatDeviceDriver = map[string]string{
"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 {
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
}
//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 {
switch {
case !isFlagSet("allocation-policy"):

View File

@ -35,7 +35,7 @@ type testCase struct {
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) {
var ret []*gousb.Device

View File

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

View File

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

View File

@ -144,10 +144,10 @@ func (f *DflPort) CheckExtension() (int, error) {
// PortPR does Partial Reconfiguration based on Port ID and Buffer (Image)
// provided by caller.
// * Return: 0 on success, -errno on failure.
// * 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
// from the status of FME's fpga manager.
// - Return: 0 on success, -errno on failure.
// - 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
// from the status of FME's fpga manager.
func (f *DflFME) PortPR(port uint32, bitstream []byte) error {
var value DflFpgaFmePortPR

View File

@ -140,10 +140,10 @@ func (f *IntelFpgaPort) CheckExtension() (int, error) {
// PortPR does Partial Reconfiguration based on Port ID and Buffer (Image)
// provided by caller.
// * Return: 0 on success, -errno on failure.
// * 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
// from the status of FME's fpga manager.
// - Return: 0 on success, -errno on failure.
// - 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
// from the status of FME's fpga manager.
func (f *IntelFpgaFME) PortPR(port uint32, bitstream []byte) error {
var value IntelFpgaFmePortPR

View File

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