diff --git a/Makefile b/Makefile index a7c8ab458..fc299fd3a 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL) # # For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both # openstack.org/nova-operator-bundle:$VERSION and openstack.org/nova-operator-catalog:$VERSION. -IMAGE_TAG_BASE ?= openstack.org/nova-operator +IMAGE_TAG_BASE ?= quay.io/$(USER)/nova-operator # BUNDLE_IMG defines the image:tag used for the bundle. # You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=/:) @@ -117,11 +117,11 @@ run: manifests generate fmt vet ## Run a controller from your host. .PHONY: docker-build docker-build: test ## Build docker image with the manager. - docker build -t ${IMG} . + podman build -t ${IMG} . .PHONY: docker-push docker-push: ## Push docker image with the manager. - docker push ${IMG} + podman push ${IMG} ##@ Deployment @@ -187,7 +187,7 @@ bundle: manifests kustomize ## Generate bundle manifests and metadata, then vali .PHONY: bundle-build bundle-build: ## Build the bundle image. - docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . + podman build -f bundle.Dockerfile -t $(BUNDLE_IMG) . .PHONY: bundle-push bundle-push: ## Push the bundle image. @@ -215,7 +215,7 @@ endif BUNDLE_IMGS ?= $(BUNDLE_IMG) # The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0). -CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:v$(VERSION) +CATALOG_IMG ?= $(IMAGE_TAG_BASE)-index:v$(VERSION) # Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image. ifneq ($(origin CATALOG_BASE_IMG), undefined) @@ -227,9 +227,43 @@ endif # https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator .PHONY: catalog-build catalog-build: opm ## Build a catalog image. - $(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) + $(OPM) index add --container-tool podman --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) # Push the catalog image. .PHONY: catalog-push catalog-push: ## Push a catalog image. $(MAKE) docker-push IMG=$(CATALOG_IMG) + +# CI tools repo for running tests +CI_TOOLS_REPO := https://github.com/openstack-k8s-operators/openstack-k8s-operators-ci +CI_TOOLS_REPO_DIR = $(shell pwd)/CI_TOOLS_REPO +.PHONY: get-ci-tools +get-ci-tools: + if [ -d "$(CI_TOOLS_REPO_DIR)" ]; then \ + echo "Ci tools exists"; \ + pushd "$(CI_TOOLS_REPO_DIR)"; \ + git pull --rebase; \ + popd; \ + else \ + git clone $(CI_TOOLS_REPO) "$(CI_TOOLS_REPO_DIR)"; \ + fi + +# Run go fmt against code +gofmt: get-ci-tools + $(CI_TOOLS_REPO_DIR)/test-runner/gofmt.sh + +# Run go vet against code +govet: get-ci-tools + $(CI_TOOLS_REPO_DIR)/test-runner/govet.sh + +# Run go test against code +gotest: get-ci-tools + $(CI_TOOLS_REPO_DIR)/test-runner/gotest.sh + +# Run golangci-lint test against code +golangci: get-ci-tools + $(CI_TOOLS_REPO_DIR)/test-runner/golangci.sh + +# Run go lint against code +golint: get-ci-tools + PATH=$(GOBIN):$(PATH); $(CI_TOOLS_REPO_DIR)/test-runner/golint.sh