From eac44cd9010068addb80c5d90548ed15adc832d2 Mon Sep 17 00:00:00 2001 From: Ruslan Aliev Date: Tue, 5 Oct 2021 12:58:06 -0500 Subject: [PATCH] Remove Makefiles in krm functions These Makefiles actually are not used in image build process, all the appropriate logic contained in the main Makefile. Change-Id: Ic915b320997d055ba224f03b308b672fcf115038 Signed-off-by: Ruslan Aliev --- krm-functions/clusterctl/Makefile | 78 ---------------- krm-functions/kubeval-validator/Makefile | 78 ---------------- krm-functions/toolbox-virsh/Makefile | 109 ----------------------- 3 files changed, 265 deletions(-) delete mode 100644 krm-functions/clusterctl/Makefile delete mode 100644 krm-functions/kubeval-validator/Makefile delete mode 100644 krm-functions/toolbox-virsh/Makefile diff --git a/krm-functions/clusterctl/Makefile b/krm-functions/clusterctl/Makefile deleted file mode 100644 index 017c06ba4..000000000 --- a/krm-functions/clusterctl/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -.PHONY: generate license fix vet fmt test build tidy image - -SHELL := /bin/bash -GOBIN := $(shell go env GOPATH)/bin - -# docker image options -DOCKER_REGISTRY ?= quay.io -DOCKER_IMAGE_NAME ?= clusterctl -DOCKER_IMAGE_PREFIX ?= airshipit -DOCKER_IMAGE_TAG ?= latest -DOCKER_IMAGE ?= $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) -PUBLISH ?= false -DOCKER_FORCE_CLEAN ?= true - -# proxy options -PROXY ?= http://proxy.foo.com:8000 -NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local -USE_PROXY ?= false - -.PHONY: build -build: - (cd image && go build -v -o $(GOBIN)/config-function .) - -.PHONY: all -all: generate license build fix vet fmt test lint tidy - -.PHONY: fix -fix: - (cd image && go fix ./...) - -.PHONY: fmt -fmt: - (cd image && go fmt ./...) - -.PHONY: generate -generate: - (which $(GOBIN)/mdtogo || go get sigs.k8s.io/kustomize/cmd/mdtogo) - (cd image && GOBIN=$(GOBIN) go generate ./...) - -.PHONY: tidy -tidy: - (cd image && go mod tidy) - -.PHONY: fix -lint: - (which $(GOBIN)/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1) - (cd image && $(GOBIN)/golangci-lint run ./...) - -.PHONY: test -test: - (cd image && go test -cover ./...) - -.PHONY: vet -vet: - (cd image && go vet ./...) - -.PHONY: image -image: -ifeq ($(USE_PROXY), true) - cd image && \ - docker build . --network=host \ - --build-arg http_proxy=$(PROXY) \ - --build-arg https_proxy=$(PROXY) \ - --build-arg HTTP_PROXY=$(PROXY) \ - --build-arg HTTPS_PROXY=$(PROXY) \ - --build-arg no_proxy=$(NO_PROXY) \ - --build-arg NO_PROXY=$(NO_PROXY) \ - --tag $(DOCKER_IMAGE) \ - --force-rm=$(DOCKER_FORCE_CLEAN) -else - cd image && \ - docker build . --network=host \ - --tag $(DOCKER_IMAGE) \ - --force-rm=$(DOCKER_FORCE_CLEAN) -endif -ifeq ($(PUBLISH), true) - @docker push $(DOCKER_IMAGE) -endif diff --git a/krm-functions/kubeval-validator/Makefile b/krm-functions/kubeval-validator/Makefile deleted file mode 100644 index 0e87cee24..000000000 --- a/krm-functions/kubeval-validator/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -.PHONY: generate license fix vet fmt test build tidy image - -SHELL := /bin/bash -GOBIN := $(shell go env GOPATH)/bin - -# docker image options -DOCKER_REGISTRY ?= quay.io -DOCKER_IMAGE_NAME ?= kubeval-validator -DOCKER_IMAGE_PREFIX ?= airshipit -DOCKER_IMAGE_TAG ?= latest -DOCKER_IMAGE ?= $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) -PUBLISH ?= false -DOCKER_FORCE_CLEAN ?= true - -# proxy options -PROXY ?= http://proxy.foo.com:8000 -NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local -USE_PROXY ?= false - -.PHONY: build -build: - (cd image && go build -v -o $(GOBIN)/config-function .) - -.PHONY: all -all: generate license build fix vet fmt test lint tidy - -.PHONY: fix -fix: - (cd image && go fix ./...) - -.PHONY: fmt -fmt: - (cd image && go fmt ./...) - -.PHONY: generate -generate: - (which $(GOBIN)/mdtogo || go get sigs.k8s.io/kustomize/cmd/mdtogo) - (cd image && GOBIN=$(GOBIN) go generate ./...) - -.PHONY: tidy -tidy: - (cd image && go mod tidy) - -.PHONY: fix -lint: - (which $(GOBIN)/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1) - (cd image && $(GOBIN)/golangci-lint run ./...) - -.PHONY: test -test: - (cd image && go test -cover ./...) - -.PHONY: vet -vet: - (cd image && go vet ./...) - -.PHONY: image -image: -ifeq ($(USE_PROXY), true) - cd image && \ - docker build . --network=host \ - --build-arg http_proxy=$(PROXY) \ - --build-arg https_proxy=$(PROXY) \ - --build-arg HTTP_PROXY=$(PROXY) \ - --build-arg HTTPS_PROXY=$(PROXY) \ - --build-arg no_proxy=$(NO_PROXY) \ - --build-arg NO_PROXY=$(NO_PROXY) \ - --tag $(DOCKER_IMAGE) \ - --force-rm=$(DOCKER_FORCE_CLEAN) -else - cd image && \ - docker build . --network=host \ - --tag $(DOCKER_IMAGE) \ - --force-rm=$(DOCKER_FORCE_CLEAN) -endif -ifeq ($(PUBLISH), true) - @docker push $(DOCKER_IMAGE) -endif diff --git a/krm-functions/toolbox-virsh/Makefile b/krm-functions/toolbox-virsh/Makefile deleted file mode 100644 index 41f72e967..000000000 --- a/krm-functions/toolbox-virsh/Makefile +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright 2018 AT&T Intellectual Property. All other rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -SHELL := /bin/bash -BUILD_DIR ?= build -PUSH_IMAGE ?= false -IMAGE_ID ?= none -COMMIT ?= $(shell git rev-parse HEAD) -LABEL ?= org.airshipit.build=community -IMAGE_NAME ?= toolbox-virsh -DOCKER_REGISTRY ?= quay.io -IMAGE_PREFIX ?= airshipit -IMAGE_TAG ?= latest -IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG} -SH_TO_CHECK := $(wildcard files/*.sh ) -PROXY ?= http://proxy.foo.com:8000 -NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local -USE_PROXY ?= false - -all: lint images - -check-docker: - @if [ -z $$(which docker) ]; then \ - echo "Missing \`docker\` client which is required for development"; \ - exit 2; \ - fi - -images: check-docker build_image - -docs: clean build_docs - -build_docs: - echo TODO - -build_image: - mkdir -p $(BUILD_DIR) -ifeq ($(IMAGE_ID), none) -ifeq ($(USE_PROXY), true) - docker build . \ - --iidfile $(BUILD_DIR)/image_id \ - --tag $(IMAGE) \ - --label $(LABEL) \ - --label "org.opencontainers.image.revision=$(COMMIT)" \ - --label "org.opencontainers.image.created=\ - $(shell date --rfc-3339=seconds --utc)" \ - --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ - --build-arg http_proxy=$(PROXY) \ - --build-arg https_proxy=$(PROXY) \ - --build-arg HTTP_PROXY=$(PROXY) \ - --build-arg HTTPS_PROXY=$(PROXY) \ - --build-arg no_proxy=$(NO_PROXY) \ - --build-arg NO_PROXY=$(NO_PROXY) \ - --build-arg GIT_COMMIT=$(COMMIT) -else - docker build . \ - --iidfile $(BUILD_DIR)/image_id \ - --tag $(IMAGE) \ - --label $(LABEL) \ - --label "org.opencontainers.image.revision=$(COMMIT)" \ - --label "org.opencontainers.image.created=\ - $(shell date --rfc-3339=seconds --utc)" \ - --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ - --build-arg GIT_COMMIT=$(COMMIT) -endif -else - echo $(IMAGE_ID) > $(BUILD_DIR)/image_id -endif -ifeq ($(PUSH_IMAGE), true) - docker push $(IMAGE) -endif - -clean: -ifeq ($(IMAGE_ID), none) - if [[ -s $(BUILD_DIR)/image_id ]]; \ - then \ - docker rmi $$(cat $(BUILD_DIR)/image_id); \ - fi -endif - rm -rf $(BUILD_DIR) - -# style checks -lint: test-shellcheck - echo "TODO" - -tests: lint unit_tests - -test-shellcheck: $(SH_TO_CHECK) - -unit_tests: - echo TODO - -$(SH_TO_CHECK): - docker run --rm -v $(shell pwd):/mnt \ - nlknguyen/alpine-shellcheck -x /mnt/$(@) - -.PHONY: test clean $(SH_TO_CHECK) test-shellcheck tests lint build_image \ - all build_docs docs check-docker images -