Skip to content

Commit bf96fec

Browse files
committed
NO-ISSUE: bumping to to 1.25 in the backplane-2.7 branch
1 parent a3726f1 commit bf96fec

File tree

13 files changed

+99
-14
lines changed

13 files changed

+99
-14
lines changed

.golangci.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
version: "2"
2+
run:
3+
concurrency: 4
4+
timeout: 5m
5+
issues-exit-code: 1
6+
tests: true
7+
output:
8+
print-issued-lines: true
9+
print-linter-name: true
10+
linters:
11+
enable:
12+
- staticcheck
13+
- unused
14+
- govet
15+
- gocyclo
16+
- gosec
17+
- unconvert
18+
settings:
19+
govet:
20+
enable:
21+
- shadow
22+
settings:
23+
printf:
24+
funcs:
25+
- Infof
26+
- Warnf
27+
- Errorf
28+
- Fatalf
29+
gosec:
30+
excludes:
31+
- G107
32+
- G115
33+
- G401
34+
- G402
35+
- G501
36+
staticcheck:
37+
checks:
38+
- "all"
39+
- "-ST1001"
40+
- "-ST1003"
41+
- "-ST1005"
42+
- "-ST1008"
43+
- "-ST1016"
44+
- "-ST1019"
45+
- "-ST1023"
46+
- "-QF1001"
47+
- "-QF1003"
48+
- "-QF1011"
49+
exclusions:
50+
rules:
51+
- linters:
52+
- staticcheck
53+
text: 'QF1008: could remove embedded field'
54+
- linters:
55+
- gosec
56+
text: 'G306: Expect WriteFile permissions to be 0600 or less'
57+
generated: lax
58+
presets:
59+
- comments
60+
- common-false-positives
61+
- legacy
62+
- std-error-handling
63+
paths:
64+
- third_party$
65+
- builtin$
66+
- examples$
67+
issues:
68+
uniq-by-line: true
69+
formatters:
70+
enable:
71+
- gofmt
72+
- goimports
73+
exclusions:
74+
generated: lax
75+
paths:
76+
- third_party$
77+
- builtin$
78+
- examples$

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.24-openshift-4.21 as builder
1+
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.25-openshift-4.21 as builder
22
ARG TARGETOS
33
ARG TARGETARCH
44

Dockerfile.konflux

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.24 as builder
1+
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.25 as builder
22
ARG TARGETOS
33
ARG TARGETARCH
44

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ else
6060
GOBIN=$(shell go env GOBIN)
6161
endif
6262

63+
TEST ?= $(shell go list -f '{{if or .TestGoFiles .XTestGoFiles}}{{.ImportPath}}{{end}}' ./...)
64+
6365
# Setting SHELL to bash allows bash commands to be executed by recipes.
6466
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
6567
SHELL = /usr/bin/env bash -o pipefail
@@ -110,7 +112,7 @@ golangci-lint: ## Run golangci-lint against code.
110112

111113
.PHONY: test
112114
test: manifests generate fmt vet ## Run tests.
113-
go test ./... -coverprofile cover.out
115+
go test $(TEST) -coverprofile cover.out
114116

115117
.PHONY: deploy-integration-test
116118
deploy-integration-test:
@@ -181,7 +183,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
181183

182184
## Tool Versions
183185
KUSTOMIZE_VERSION ?= v5.4.3
184-
CONTROLLER_TOOLS_VERSION ?= v0.16.2
186+
CONTROLLER_TOOLS_VERSION ?= v0.17.0
185187

186188
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
187189
.PHONY: kustomize

cmd/manager/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"flag"
2121
"fmt"
2222
"net/http"
23-
_ "net/http/pprof"
23+
_ "net/http/pprof" //nolint:gosec // G108: pprof only enabled via --start-pprof and bound to localhost:6060
2424
"net/url"
2525
"os"
2626
"time"

cmd/server/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"path/filepath"
1010
"sync"
1111
"syscall"
12+
"time"
1213

1314
"github.com/kelseyhightower/envconfig"
1415
"github.com/openshift/image-based-install-operator/internal/imageserver"
@@ -44,7 +45,8 @@ func main() {
4445
}
4546
http.Handle("/images/", s)
4647
server := &http.Server{
47-
Addr: fmt.Sprintf(":%s", Options.Port),
48+
Addr: fmt.Sprintf(":%s", Options.Port),
49+
ReadHeaderTimeout: 5 * time.Second,
4850
}
4951

5052
go func() {

config/crd/bases/extensions.hive.openshift.io_imageclusterinstalls.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.16.2
6+
controller-gen.kubebuilder.io/version: v0.17.0
77
name: imageclusterinstalls.extensions.hive.openshift.io
88
spec:
99
group: extensions.hive.openshift.io

controllers/imageclusterinstall_controller.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package controllers
1919
import (
2020
"bytes"
2121
"context"
22+
2223
// These are required for image parsing to work correctly with digest-based pull specs
2324
// See: https://github.com/opencontainers/go-digest/blob/v1.0.0/README.md#usage
2425
_ "crypto/sha256"
@@ -499,7 +500,7 @@ func (r *ImageClusterInstallReconciler) updateBMHProvisioningState(ctx context.C
499500
if bmh.Status.Provisioning.State != bmh_v1alpha1.StateAvailable && bmh.Status.Provisioning.State != bmh_v1alpha1.StateExternallyProvisioned {
500501
return nil
501502
}
502-
log.Infof("Updating BareMetalHost %s/%s provisioning state, current PoweredOn status is: %s", bmh.Namespace, bmh.Name, bmh.Status.PoweredOn)
503+
log.Infof("Updating BareMetalHost %s/%s provisioning state, current PoweredOn status is: %t", bmh.Namespace, bmh.Name, bmh.Status.PoweredOn)
503504
if bmh.Status.Provisioning.State == bmh_v1alpha1.StateAvailable {
504505
if !bmh.Spec.ExternallyProvisioned {
505506
log.Infof("Setting BareMetalHost (%s/%s) ExternallyProvisioned spec", bmh.Namespace, bmh.Name)
@@ -849,7 +850,7 @@ func (r *ImageClusterInstallReconciler) getClusterInfoFromFile(log logrus.FieldL
849850
clusterInfo := lca_api.SeedReconfiguration{}
850851
err = json.Unmarshal(data, &clusterInfo)
851852
if err != nil {
852-
log.Warnf("failed to marshal cluster info: %w", err)
853+
log.Warnf("failed to marshal cluster info: %s", err)
853854
return nil
854855
}
855856
return &clusterInfo

controllers/imageclusterinstall_controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ var _ = Describe("Reconcile", func() {
105105
clusterInstall *v1alpha1.ImageClusterInstall
106106
clusterDeployment *hivev1.ClusterDeployment
107107
pullSecret *corev1.Secret
108-
testPullSecretVal = `{"auths":{"cloud.openshift.com":{"auth":"dXNlcjpwYXNzd29yZAo=","email":"r@r.com"}}}`
108+
testPullSecretVal = `{"auths":{"cloud.openshift.com":{"auth":"dXNlcjpwYXNzd29yZAo=","email":"r@r.com"}}}` //nolint:gosec //fake credentials for testing
109109
)
110110

111111
BeforeEach(func() {
@@ -1493,7 +1493,7 @@ var _ = Describe("Reconcile with DataImageCoolDownPeriod set to 1 second", func(
14931493
clusterInstall *v1alpha1.ImageClusterInstall
14941494
clusterDeployment *hivev1.ClusterDeployment
14951495
pullSecret *corev1.Secret
1496-
testPullSecretVal = `{"auths":{"cloud.openshift.com":{"auth":"dXNlcjpwYXNzd29yZAo=","email":"r@r.com"}}}`
1496+
testPullSecretVal = `{"auths":{"cloud.openshift.com":{"auth":"dXNlcjpwYXNzd29yZAo=","email":"r@r.com"}}}` //nolint:gosec //fake credentials for testing
14971497
)
14981498

14991499
BeforeEach(func() {

controllers/imageclusterinstall_monitor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var _ = Describe("Monitor", func() {
3838
clusterDeployment *hivev1.ClusterDeployment
3939
bmh *bmh_v1alpha1.BareMetalHost
4040
pullSecret *corev1.Secret
41-
testPullSecretVal = `{"auths":{"cloud.openshift.com":{"auth":"dXNlcjpwYXNzd29yZAo=","email":"r@r.com"}}}`
41+
testPullSecretVal = `{"auths":{"cloud.openshift.com":{"auth":"dXNlcjpwYXNzd29yZAo=","email":"r@r.com"}}}` //nolint:gosec //fake credentials for testing
4242
)
4343

4444
BeforeEach(func() {

0 commit comments

Comments
 (0)