Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 41 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ ratify-config:
cp -r ./test/bats/tests/schemas/ ${INSTALL_DIR}

.PHONY: test
test:
go test -v -coverprofile=coverage.txt -covermode=atomic ./...
test: setup-envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v -coverprofile=coverage.txt -covermode=atomic ./...

.PHONY: clean
clean:
Expand Down Expand Up @@ -709,12 +709,8 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen conversion-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. Also generate conversions between structs of different API versions.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
$(CONVERSION_GEN) \
--go-header-file "./hack/boilerplate.go.txt" \
--output-file "zz_generated.conversion.go" \
./api/v1beta1 ./api/v1alpha1
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="assets/boilerplate.go.txt" paths="./..."


.PHONY: fmt
Expand Down Expand Up @@ -762,22 +758,55 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
CONVERSION_GEN ?= $(LOCALBIN)/conversion-gen

## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7
CONTROLLER_TOOLS_VERSION ?= v0.15.0
KUSTOMIZE_VERSION ?= v5.6.0
CONTROLLER_TOOLS_VERSION ?= v0.18.0
CONVERSION_TOOLS_VERSION ?= v0.30.2
#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
$(KUSTOMIZE): $(LOCALBIN)
test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION))

.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))

.PHONY: setup-envtest
setup-envtest: envtest ## Download the binaries required for ENVTEST in the local bin directory.
@echo "Setting up envtest binaries for Kubernetes version $(ENVTEST_K8S_VERSION)..."
@$(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path || { \
echo "Error: Failed to set up envtest binaries for version $(ENVTEST_K8S_VERSION)."; \
exit 1; \
}

.PHONY: envtest
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
$(ENVTEST): $(LOCALBIN)
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION))

.PHONY: conversion-gen
conversion-gen: $(CONVERSION_GEN) ## Download conversion-gen locally if necessary.
$(CONVERSION_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/conversion-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/conversion-gen@$(CONVERSION_TOOLS_VERSION)

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
# $2 - package url which can be installed
# $3 - specific version of package
define go-install-tool
@[ -f "$(1)-$(3)" ] || { \
set -e; \
package=$(2)@$(3) ;\
echo "Downloading $${package}" ;\
rm -f $(1) || true ;\
GOBIN=$(LOCALBIN) go install $${package} ;\
mv $(1) $(1)-$(3) ;\
} ;\
ln -sf $(1)-$(3) $(1)
endef
112 changes: 9 additions & 103 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -2,114 +2,20 @@
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: ratify.deislabs.io
cliVersion: 4.6.0
domain: ratify.dev
layout:
- go.kubebuilder.io/v3
projectName: ratify
repo: github.com/deislabs/ratify
- go.kubebuilder.io/v4
projectName: crd
repo: github.com/notaryproject/ratify/v2
resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ratify.deislabs.io
domain: ratify.dev
group: config
kind: Verifier
path: github.com/deislabs/ratify/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ratify.deislabs.io
group: config
kind: Store
path: github.com/deislabs/ratify/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ratify.deislabs.io
group: config
kind: CertificateStore
path: github.com/deislabs/ratify/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ratify.deislabs.io
group: config
kind: Policy
path: github.com/deislabs/ratify/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ratify.deislabs.io
group: config
kind: Verifier
path: github.com/deislabs/ratify/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ratify.deislabs.io
group: config
kind: Store
path: github.com/deislabs/ratify/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ratify.deislabs.io
group: config
kind: CertificateStore
path: github.com/deislabs/ratify/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ratify.deislabs.io
group: config
kind: KeyManagementProvider
path: github.com/deislabs/ratify/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
domain: ratify.deislabs.io
group: config
kind: NamespacedPolicy
path: github.com/deislabs/ratify/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
domain: ratify.deislabs.io
group: config
kind: NamespacedStore
path: github.com/deislabs/ratify/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
domain: ratify.deislabs.io
group: config
kind: NamespacedKeyManagementProvider
path: github.com/deislabs/ratify/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
domain: ratify.deislabs.io
group: config
kind: NamespacedVerifier
path: github.com/deislabs/ratify/api/v1beta1
version: v1beta1
kind: Executor
path: github.com/notaryproject/ratify/v2/api/v2alpha1
version: v2alpha1
version: "3"
16 changes: 0 additions & 16 deletions api/group.go

This file was deleted.

70 changes: 0 additions & 70 deletions api/unversioned/certificatestore_types.go

This file was deleted.

31 changes: 0 additions & 31 deletions api/unversioned/common.go

This file was deleted.

19 changes: 0 additions & 19 deletions api/unversioned/doc.go

This file was deleted.

Loading
Loading