mirror of
https://github.com/kubevirt/containerized-data-importer.git
synced 2025-06-03 06:30:22 +00:00
Use new 1.23.6 builder (#3652)
* Use new 1.23.6 builder Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com> * Bump linter to 1.60.3 for go 1.23 support Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com> * Disable linter failures over G115 Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com> * Fix lint issues related to error format formatting Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com> * Address remaining lint failures len is enough/sprintf not really used Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com> --------- Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
This commit is contained in:
parent
67d1f3d4d0
commit
1927d7d13e
@ -49,3 +49,8 @@ linters-settings:
|
||||
forbid-focus-container: true
|
||||
nakedret:
|
||||
max-func-lines: 0
|
||||
gosec:
|
||||
excludes:
|
||||
# This is changing things up quite a bit and requires evaluation
|
||||
# per conversion
|
||||
- G115
|
||||
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
||||
module kubevirt.io/containerized-data-importer
|
||||
|
||||
go 1.22.0
|
||||
go 1.23.0
|
||||
|
||||
require (
|
||||
cloud.google.com/go/storage v1.38.0
|
||||
|
@ -29,7 +29,7 @@ FUNC_TEST_PROXY="cdi-func-test-proxy"
|
||||
FUNC_TEST_POPULATOR="cdi-func-test-sample-populator"
|
||||
|
||||
# update this whenever new builder tag is created
|
||||
BUILDER_IMAGE=${BUILDER_IMAGE:-quay.io/kubevirt/kubevirt-cdi-bazel-builder:2409021308-e6939c6c2}
|
||||
BUILDER_IMAGE=${BUILDER_IMAGE:-quay.io/kubevirt/kubevirt-cdi-bazel-builder:2503021312-67d1f3d4d}
|
||||
|
||||
BINARIES="cmd/${OPERATOR} cmd/${CONTROLLER} cmd/${IMPORTER} cmd/${CLONER} cmd/${APISERVER} cmd/${UPLOADPROXY} cmd/${UPLOADSERVER} cmd/${OPERATOR} tools/${FUNC_TEST_INIT} tools/${FUNC_TEST_REGISTRY_INIT} tools/${FUNC_TEST_BAD_WEBSERVER} tools/${FUNC_TEST_PROXY} tools/${FUNC_TEST_POPULATOR}"
|
||||
CDI_PKGS="cmd/ pkg/ test/"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
GOLANGCI_VERSION="${GOLANGCI_VERSION:-v1.58.0}"
|
||||
GOLANGCI_VERSION="${GOLANGCI_VERSION:-v1.60.3}"
|
||||
MONITORING_LINTER_VERSION="${MONITORING_LINTER_VERSION:-e2be790}"
|
||||
|
||||
go install "github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_VERSION}"
|
||||
|
@ -34,7 +34,7 @@ import (
|
||||
sdkapi "kubevirt.io/controller-lifecycle-operator-sdk/api"
|
||||
)
|
||||
|
||||
const uninstallErrorMsg = "Rejecting the uninstall request, since there are still DataVolumes present. Either delete all DataVolumes or change the uninstall strategy before uninstalling CDI."
|
||||
const uninstallErrorMsg = "rejecting the uninstall request, since there are still %d DataVolumes present. Either delete all DataVolumes or change the uninstall strategy before uninstalling CDI"
|
||||
|
||||
type cdiValidatingWebhook struct {
|
||||
client cdiclient.Interface
|
||||
@ -69,8 +69,8 @@ func (wh *cdiValidatingWebhook) Admit(ar admissionv1.AdmissionReview) *admission
|
||||
return toAdmissionResponseError(err)
|
||||
}
|
||||
|
||||
if len(dvs.Items) > 0 {
|
||||
return toAdmissionResponseError(fmt.Errorf(uninstallErrorMsg))
|
||||
if numDvs := len(dvs.Items); numDvs > 0 {
|
||||
return toAdmissionResponseError(fmt.Errorf(uninstallErrorMsg, numDvs))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ var _ = Describe("CDI Delete Webhook", func() {
|
||||
|
||||
resp := validateCDIs(ar, newDataVolumeWithName("foo"))
|
||||
Expect(resp.Allowed).To(BeFalse())
|
||||
Expect(resp.Result.Message).To(ContainSubstring("Rejecting the uninstall request, since there are still DataVolumes present."))
|
||||
Expect(resp.Result.Message).To(ContainSubstring("rejecting the uninstall request, since there are still 1 DataVolumes present."))
|
||||
})
|
||||
|
||||
It("should reject with DataVolumes present and oldobject not populated", func() {
|
||||
@ -187,7 +187,7 @@ var _ = Describe("CDI Delete Webhook", func() {
|
||||
|
||||
resp := validateCDIs(ar, cdi, newDataVolumeWithName("foo"))
|
||||
Expect(resp.Allowed).To(BeFalse())
|
||||
Expect(resp.Result.Message).To(ContainSubstring("Rejecting the uninstall request, since there are still DataVolumes present."))
|
||||
Expect(resp.Result.Message).To(ContainSubstring("rejecting the uninstall request, since there are still 1 DataVolumes present."))
|
||||
})
|
||||
|
||||
It("should allow error CDI to be deleted with DataVolumes present", func() {
|
||||
|
@ -716,7 +716,7 @@ func (r *ReconcilerBase) validatePVC(dv *cdiv1.DataVolume, pvc *corev1.Persisten
|
||||
if pvc.DeletionTimestamp != nil {
|
||||
msg := fmt.Sprintf(MessageResourceMarkedForDeletion, pvc.Name)
|
||||
r.recorder.Event(dv, corev1.EventTypeWarning, ErrResourceMarkedForDeletion, msg)
|
||||
return errors.Errorf(msg)
|
||||
return errors.New(msg)
|
||||
}
|
||||
// If the PVC is not controlled by this DataVolume resource, we should log
|
||||
// a warning to the event recorder and return
|
||||
@ -732,7 +732,7 @@ func (r *ReconcilerBase) validatePVC(dv *cdiv1.DataVolume, pvc *corev1.Persisten
|
||||
} else {
|
||||
msg := fmt.Sprintf(MessageResourceExists, pvc.Name)
|
||||
r.recorder.Event(dv, corev1.EventTypeWarning, ErrResourceExists, msg)
|
||||
return errors.Errorf(msg)
|
||||
return errors.New(msg)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
@ -321,7 +321,7 @@ func (r *ForkliftPopulatorReconciler) reconcileTargetPVC(pvc, pvcPrime *corev1.P
|
||||
return reconcile.Result{}, nil
|
||||
}
|
||||
|
||||
if pod.Status.ContainerStatuses == nil || len(pod.Status.ContainerStatuses) == 0 {
|
||||
if len(pod.Status.ContainerStatuses) == 0 {
|
||||
return reconcile.Result{RequeueAfter: 2 * time.Second}, nil
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ func (o *qemuOperations) Info(url *url.URL) (*ImgInfo, error) {
|
||||
if nbdkitLog, err := os.ReadFile(common.NbdkitLogPath); err == nil {
|
||||
errorMsg += " " + string(nbdkitLog)
|
||||
}
|
||||
return nil, errors.Errorf(errorMsg)
|
||||
return nil, errors.New(errorMsg)
|
||||
}
|
||||
return checkOutputQemuImgInfo(output, url.String())
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package importer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
@ -56,7 +55,7 @@ func NewGCSDataSource(endpoint, keyFile string) (*GCSDataSource, error) {
|
||||
ep, err := ParseEndpoint(endpoint)
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, fmt.Sprintf("GCS Importer: unable to parse endpoint %q", endpoint))
|
||||
return nil, errors.Wrapf(err, "GCS Importer: unable to parse endpoint %q", endpoint)
|
||||
}
|
||||
|
||||
// Getting Context
|
||||
|
@ -89,7 +89,7 @@ var createNbdkitCurl = image.NewNbdkitCurl
|
||||
func NewHTTPDataSource(endpoint, accessKey, secKey, certDir string, contentType cdiv1.DataVolumeContentType) (*HTTPDataSource, error) {
|
||||
ep, err := ParseEndpoint(endpoint)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, fmt.Sprintf("unable to parse endpoint %q", endpoint))
|
||||
return nil, errors.Wrapf(err, "unable to parse endpoint %q", endpoint)
|
||||
}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package importer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
@ -56,7 +55,7 @@ type S3DataSource struct {
|
||||
func NewS3DataSource(endpoint, accessKey, secKey string, certDir string) (*S3DataSource, error) {
|
||||
ep, err := ParseEndpoint(endpoint)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, fmt.Sprintf("unable to parse endpoint %q", endpoint))
|
||||
return nil, errors.Wrapf(err, "unable to parse endpoint %q", endpoint)
|
||||
}
|
||||
s3Reader, err := createS3Reader(ep, accessKey, secKey, certDir)
|
||||
if err != nil {
|
||||
|
@ -1,6 +1,6 @@
|
||||
module kubevirt.io/containerized-data-importer-api
|
||||
|
||||
go 1.22.0
|
||||
go 1.23.0
|
||||
|
||||
require (
|
||||
k8s.io/api v0.30.2
|
||||
|
@ -56,7 +56,7 @@ var _ = Describe("[rfe_id:1347][crit:high][vendor:cnv-qe@redhat.com][level:compo
|
||||
|
||||
Context("cdi-sa RBAC rules are correct", func() {
|
||||
It("[test_id:1353]rules should match expectation", func() {
|
||||
sa := fmt.Sprintf("system:serviceaccount:" + f.CdiInstallNs + ":cdi-sa")
|
||||
sa := fmt.Sprintf("system:serviceaccount:%s:cdi-sa", f.CdiInstallNs)
|
||||
|
||||
eventExpectedResult := make(map[string]string)
|
||||
eventExpectedResult["get"] = "no"
|
||||
|
@ -477,7 +477,7 @@ var _ = Describe("ALL Operator tests", func() {
|
||||
By("Cannot delete CDI")
|
||||
err = f.CdiClient.CdiV1beta1().CDIs().Delete(context.TODO(), cr.Name, metav1.DeleteOptions{DryRun: []string{"All"}})
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err.Error()).To(ContainSubstring("there are still DataVolumes present"))
|
||||
Expect(err.Error()).To(ContainSubstring("there are still 1 DataVolumes present"))
|
||||
|
||||
By("Delete the unlabeled datavolume")
|
||||
err = f.CdiClient.CdiV1beta1().DataVolumes(f.Namespace.Name).Delete(context.TODO(), "delete-me", metav1.DeleteOptions{})
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -1584,7 +1584,7 @@ k8s.io/utils/ptr
|
||||
k8s.io/utils/strings/slices
|
||||
k8s.io/utils/trace
|
||||
# kubevirt.io/containerized-data-importer-api v0.0.0 => ./staging/src/kubevirt.io/containerized-data-importer-api
|
||||
## explicit; go 1.22.0
|
||||
## explicit; go 1.23.0
|
||||
kubevirt.io/containerized-data-importer-api/pkg/apis/core
|
||||
kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1
|
||||
kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1
|
||||
|
Loading…
Reference in New Issue
Block a user