Skip to content

Commit

Permalink
Sync common Makefile
Browse files Browse the repository at this point in the history
Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
  • Loading branch information
dhaiducek committed Feb 5, 2024
1 parent 3da5031 commit 47c5e5b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
32 changes: 24 additions & 8 deletions build/common/Makefile.common.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# Copyright (c) 2022 Red Hat, Inc.
# Copyright Contributors to the Open Cluster Management project

## CLI versions (with links to the latest releases)
# https://github.com/kubernetes-sigs/controller-tools/releases/latest
CONTROLLER_GEN_VERSION := v0.6.1
# https://github.com/kubernetes-sigs/kustomize/releases/latest
KUSTOMIZE_VERSION := v5.3.0
# https://github.com/golangci/golangci-lint/releases/latest
GOLANGCI_VERSION := v1.52.2
# https://github.com/mvdan/gofumpt/releases/latest
GOFUMPT_VERSION := v0.6.0
# https://github.com/daixiang0/gci/releases/latest
GCI_VERSION := v0.12.1
# https://github.com/securego/gosec/releases/latest
GOSEC_VERSION := v2.18.2
# https://github.com/kubernetes-sigs/kubebuilder/releases/latest
KBVERSION := 3.12.0
# https://github.com/kubernetes/kubernetes/releases/latest
ENVTEST_K8S_VERSION := 1.26.x

LOCAL_BIN ?= $(error LOCAL_BIN is not set.)
ifneq ($(findstring $(LOCAL_BIN), $(PATH)), $(LOCAL_BIN))
$(error LOCAL_BIN is not in PATH.)
Expand Down Expand Up @@ -35,11 +53,11 @@ KUSTOMIZE = $(LOCAL_BIN)/kustomize

.PHONY: controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.1)
$(call go-get-tool,sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION))

.PHONY: kustomize
kustomize: ## Download kustomize locally if necessary.
$(call go-get-tool,sigs.k8s.io/kustomize/kustomize/v5@v5.0.1)
$(call go-get-tool,sigs.k8s.io/kustomize/kustomize/v5@$(KUSTOMIZE_VERSION))

############################################################
# Lint
Expand All @@ -53,7 +71,7 @@ lint: lint-dependencies lint-yaml lint-go

.PHONY: lint-dependencies
lint-dependencies:
$(call go-get-tool,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2)
$(call go-get-tool,github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_VERSION))

.PHONY: lint-yaml
lint-yaml:
Expand All @@ -67,8 +85,8 @@ lint-go:

.PHONY: fmt-dependencies
fmt-dependencies:
$(call go-get-tool,github.com/daixiang0/gci@v0.10.1)
$(call go-get-tool,mvdan.cc/gofumpt@v0.5.0)
$(call go-get-tool,github.com/daixiang0/gci@$(GCI_VERSION))
$(call go-get-tool,mvdan.cc/gofumpt@$(GOFUMPT_VERSION))

.PHONY: fmt
fmt: fmt-dependencies
Expand All @@ -82,8 +100,6 @@ fmt: fmt-dependencies
GOSEC = $(LOCAL_BIN)/gosec
KUBEBUILDER = $(LOCAL_BIN)/kubebuilder
ENVTEST = $(LOCAL_BIN)/setup-envtest
KBVERSION = 3.12.0
ENVTEST_K8S_VERSION = 1.26.x

.PHONY: kubebuilder
kubebuilder:
Expand All @@ -99,7 +115,7 @@ envtest:

.PHONY: gosec
gosec:
$(call go-get-tool,github.com/securego/gosec/v2/cmd/gosec@v2.15.0)
$(call go-get-tool,github.com/securego/gosec/v2/cmd/gosec@$(GOSEC_VERSION))

.PHONY: gosec-scan
gosec-scan: gosec
Expand Down
4 changes: 1 addition & 3 deletions controllers/configurationpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,6 @@ func (r *ConfigurationPolicyReconciler) handleObjectTemplates(plc policyv1.Confi
var err error

encryptionConfig, usedKeyCache, err = r.getEncryptionConfig(plc, false)

if err != nil {
addTemplateErrorViolation("", err.Error())

Expand Down Expand Up @@ -1013,8 +1012,8 @@ func (r *ConfigurationPolicyReconciler) handleObjectTemplates(plc policyv1.Confi
"the encryption key cache and try the decryption again",
)
var encryptionConfig templates.EncryptionConfig
encryptionConfig, usedKeyCache, err = r.getEncryptionConfig(plc, true)

encryptionConfig, usedKeyCache, err = r.getEncryptionConfig(plc, true)
if err != nil {
addTemplateErrorViolation("", err.Error())

Expand Down Expand Up @@ -1907,7 +1906,6 @@ func (r *ConfigurationPolicyReconciler) getMapping(
r.lock.RUnlock()

mapping, err = mapper.RESTMapping(gvk.GroupKind(), gvk.Version)

if err != nil {
// if the restmapper fails to find a mapping to a resource, generate a violation
prefix := "no matches for kind \""
Expand Down

0 comments on commit 47c5e5b

Please sign in to comment.