Skip to content

Commit 5902eb1

Browse files
Merge pull request #58 from bharath-b-rh/eso-185
ESO-185: Adds e2e tag and new make target for govulncheck tool
2 parents 3f97c27 + 5403657 commit 5902eb1

File tree

136 files changed

+22778
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+22778
-10
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ go.work.sum
2424

2525
# env file
2626
.env
27-
bin/
27+
28+
# dirs to ignore
29+
bin
30+
_output

Makefile

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,20 @@ update-operand-manifests: helm yq
135135
.PHONY: update-operand-manifests
136136

137137
# Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
138+
E2E_TIMEOUT ?= 1h
139+
# E2E_GINKGO_LABEL_FILTER is ginkgo label query for selecting tests. See
140+
# https://onsi.github.io/ginkgo/#spec-labels. The default is to run tests on the AWS platform.
141+
E2E_GINKGO_LABEL_FILTER ?= "Platform: isSubsetOf {AWS}"
138142
.PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up.
139143
test-e2e:
140-
go test ./test/e2e/ -v -ginkgo.v
144+
go test \
145+
-timeout $(E2E_TIMEOUT) \
146+
-count 1 \
147+
-v \
148+
-p 1 \
149+
-tags e2e \
150+
./test/e2e \
151+
-ginkgo.label-filter=$(E2E_GINKGO_LABEL_FILTER)
141152

142153
.PHONY: lint
143154
lint: golangci-lint ## Run golangci-lint linter
@@ -224,6 +235,11 @@ LOCALBIN ?= $(shell pwd)/bin
224235
$(LOCALBIN):
225236
mkdir -p $(LOCALBIN)
226237

238+
## Location to story temp outputs
239+
OUTPUTS_PATH ?= $(shell pwd)/_output
240+
$(OUTPUTS_PATH):
241+
mkdir -p $(OUTPUTS_PATH)
242+
227243
## Tool Binaries
228244
KUBECTL ?= kubectl
229245
KUSTOMIZE ?= $(LOCALBIN)/kustomize
@@ -233,6 +249,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
233249
YQ = $(LOCALBIN)/yq
234250
HELM ?= $(LOCALBIN)/helm
235251
REFERENCE_DOC_GENERATOR ?= $(LOCALBIN)/crd-ref-docs
252+
GOVULNCHECK ?= $(LOCALBIN)/govulncheck
236253

237254
## Tool Versions
238255
YQ_VERSION = v4.45.2
@@ -262,6 +279,10 @@ $(GOLANGCI_LINT): $(LOCALBIN)
262279
crd-ref-docs: $(LOCALBIN) ## Download crd-ref-docs locally if necessary.
263280
$(call go-install-tool,$(REFERENCE_DOC_GENERATOR),github.com/elastic/crd-ref-docs)
264281

282+
.PHONY: govulncheck
283+
govulncheck: $(LOCALBIN) ## Download govulncheck locally if necessary.
284+
$(call go-install-tool,$(GOVULNCHECK),golang.org/x/vuln/cmd/govulncheck)
285+
265286
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
266287
# $1 - target path with name of binary
267288
# $2 - package url which can be installed
@@ -370,7 +391,7 @@ catalog-push: ## Push a catalog image.
370391

371392
## verify the changes are working as expected.
372393
.PHONY: verify
373-
verify: vet fmt golangci-lint verify-bindata verify-bindata-assets verify-generated
394+
verify: vet fmt golangci-lint verify-bindata verify-bindata-assets verify-generated govulnscan
374395

375396
## update the relevant data based on new changes.
376397
.PHONY: update
@@ -385,3 +406,12 @@ check-git-diff: update
385406
.PHONY: docs
386407
docs: crd-ref-docs
387408
$(REFERENCE_DOC_GENERATOR) --source-path=api/v1alpha1/ --renderer=markdown --config=hack/docs/config.yaml --output-path=docs/api_reference.md
409+
410+
## perform vulnerabilities scan using govulncheck.
411+
.PHONY: govulnscan
412+
#GO-2025-3547 and GO-2025-3521 containing code is not directly used in the operator, hence will be ignored.
413+
KNOWN_VULNERABILITIES:="GO-2025-3547|GO-2025-3521"
414+
govulnscan: govulncheck $(OUTPUTS_PATH) ## Run govulncheck
415+
- $(GOVULNCHECK) ./... > $(OUTPUTS_PATH)/govulcheck.results 2>&1
416+
$(eval reported_vulnerabilities = $(strip $(shell grep "pkg.go.dev" $(OUTPUTS_PATH)/govulcheck.results | ([ -n $KNOWN_VULNERABILITIES ] && grep -Ev $(KNOWN_VULNERABILITIES) || cat) | wc -l)))
417+
@(if [ $(reported_vulnerabilities) -ne 0 ]; then echo -e "\n-- ERROR -- $(reported_vulnerabilities) new vulnerabilities reported, please check\n"; exit 1; fi)

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ require (
1515
github.com/openshift/build-machinery-go v0.0.0-20250806130835-622c0378eb0d
1616
github.com/stretchr/testify v1.10.0
1717
go.uber.org/zap v1.27.0
18+
golang.org/x/vuln v1.1.4
1819
k8s.io/api v0.32.3
1920
k8s.io/apiextensions-apiserver v0.32.3
2021
k8s.io/apimachinery v0.32.3
2122
k8s.io/client-go v0.32.3
2223
k8s.io/klog/v2 v2.130.1
23-
k8s.io/kubernetes v1.32.3
24+
k8s.io/kubernetes v1.32.6
2425
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
2526
sigs.k8s.io/controller-runtime v0.20.4
2627
sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20250308055145-5fe7bb3edc86
@@ -276,6 +277,7 @@ require (
276277
golang.org/x/oauth2 v0.30.0 // indirect
277278
golang.org/x/sync v0.16.0 // indirect
278279
golang.org/x/sys v0.34.0 // indirect
280+
golang.org/x/telemetry v0.0.0-20250710130107-8d8967aff50b // indirect
279281
golang.org/x/term v0.33.0 // indirect
280282
golang.org/x/text v0.27.0 // indirect
281283
golang.org/x/time v0.12.0 // indirect

go.sum

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ github.com/google/cel-go v0.22.1 h1:AfVXx3chM2qwoSbM7Da8g8hX8OVSkBFwX+rz2+PcK40=
233233
github.com/google/cel-go v0.22.1/go.mod h1:BuznPXXfQDpXKWQ9sPW3TzlAJN5zzFe+i9tIs0yC4s8=
234234
github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo=
235235
github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ=
236+
github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786 h1:rcv+Ippz6RAtvaGgKxc+8FQIpxHgsF+HBzPyYL2cyVU=
237+
github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786/go.mod h1:apVn/GCasLZUVpAJ6oWAuyP7Ne7CEsQbTnc0plM3m+o=
236238
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
237239
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
238240
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
@@ -246,6 +248,8 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
246248
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
247249
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5 h1:xhMrHhTJ6zxu3gA4enFM9MLn9AY7613teCdFnlUVbSQ=
248250
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5/go.mod h1:5hDyRhoBCxViHszMt12TnOpEI4VVi+U8Gm9iphldiMA=
251+
github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA=
252+
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
249253
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
250254
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
251255
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
@@ -718,6 +722,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
718722
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
719723
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
720724
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
725+
golang.org/x/telemetry v0.0.0-20250710130107-8d8967aff50b h1:DU+gwOBXU+6bO0sEyO7o/NeMlxZxCZEvI7v+J4a1zRQ=
726+
golang.org/x/telemetry v0.0.0-20250710130107-8d8967aff50b/go.mod h1:4ZwOYna0/zsOKwuR5X/m0QFOJpSZvAxFfkQT+Erd9D4=
721727
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
722728
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
723729
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
@@ -768,6 +774,8 @@ golang.org/x/tools/go/expect v0.1.0-deprecated h1:jY2C5HGYR5lqex3gEniOQL0r7Dq5+V
768774
golang.org/x/tools/go/expect v0.1.0-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY=
769775
golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM=
770776
golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8=
777+
golang.org/x/vuln v1.1.4 h1:Ju8QsuyhX3Hk8ma3CesTbO8vfJD9EvUBgHvkxHBzj0I=
778+
golang.org/x/vuln v1.1.4/go.mod h1:F+45wmU18ym/ca5PLTPLsSzr2KppzswxPP603ldA67s=
771779
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
772780
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
773781
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -835,8 +843,8 @@ k8s.io/kube-openapi v0.0.0-20250701173324-9bd5c66d9911 h1:gAXU86Fmbr/ktY17lkHwSj
835843
k8s.io/kube-openapi v0.0.0-20250701173324-9bd5c66d9911/go.mod h1:GLOk5B+hDbRROvt0X2+hqX64v/zO3vXN7J78OUmBSKw=
836844
k8s.io/kubelet v0.32.1 h1:bB91GvMsZb+LfzBxnjPEr1Fal/sdxZtYphlfwAaRJGw=
837845
k8s.io/kubelet v0.32.1/go.mod h1:4sAEZ6PlewD0GroV3zscY7llym6kmNNTVmUI/Qshm6w=
838-
k8s.io/kubernetes v1.32.3 h1:2A58BlNME8NwsMawmnM6InYo3Jf35Nw5G79q46kXwoA=
839-
k8s.io/kubernetes v1.32.3/go.mod h1:GvhiBeolvSRzBpFlgM0z/Bbu3Oxs9w3P6XfEgYaMi8k=
846+
k8s.io/kubernetes v1.32.6 h1:tp1gRjOqZjaoFBek5PN6eSmODdS1QRrH5UKiFP8ZByg=
847+
k8s.io/kubernetes v1.32.6/go.mod h1:REY0Gok66BTTrbGyZaFMNKO9JhxvgBDW9B7aksWRFoY=
840848
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8tmbZBHi4zVsl1Y=
841849
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
842850
mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU=

test/e2e/e2e_suite_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build e2e
2+
// +build e2e
3+
14
/*
25
Copyright 2025.
36

test/e2e/e2e_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build e2e
2+
// +build e2e
3+
14
/*
25
Copyright 2025.
36
Licensed under the Apache License, Version 2.0 (the "License");

test/utils/conditions.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
//go:build e2e
2+
// +build e2e
3+
4+
/*
5+
Copyright 2025.
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
119
package utils
220

321
import (

test/utils/dynamic_resources.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
1+
//go:build e2e
2+
// +build e2e
3+
4+
/*
5+
Copyright 2025.
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
119
package utils
220

321
import (
422
"bytes"
523
"context"
24+
"testing"
25+
626
"github.com/stretchr/testify/require"
727
k8serrors "k8s.io/apimachinery/pkg/api/errors"
828
"k8s.io/apimachinery/pkg/api/meta"
@@ -14,7 +34,6 @@ import (
1434
"k8s.io/client-go/dynamic"
1535
"k8s.io/client-go/kubernetes"
1636
"k8s.io/client-go/restmapper"
17-
"testing"
1837
)
1938

2039
type DynamicResourceLoader struct {

test/utils/external_secrets.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
//go:build e2e
2+
// +build e2e
3+
14
/*
25
Copyright 2025.
3-
46
Licensed under the Apache License, Version 2.0 (the "License");
57
you may not use this file except in compliance with the License.
68
You may obtain a copy of the License at
79
8-
http://www.apache.org/licenses/LICENSE-2.0
10+
http://www.apache.org/licenses/LICENSE-2.0
911
1012
Unless required by applicable law or agreed to in writing, software
1113
distributed under the License is distributed on an "AS IS" BASIS,

test/utils/kube_client.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
//go:build e2e
2+
// +build e2e
3+
4+
/*
5+
Copyright 2025.
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
119
package utils
220

321
import (

0 commit comments

Comments
 (0)