6523c800ad
We build iso image in two steps 1) We prepare cloud-init data using a krm function krm-functions/cloud-init which uses arishipctl capabilities to gather necessary data from the executor document bundle. Cloud-init data files are written into a directory mounted to the krm function container. 2) We build iso image using image-builder. While doing this we mount the directory with cloud-init data files and set necessary environment variables defined in the executor document. Relates-To: #440 Change-Id: Id0b34822e95f494d2e2f8fb407700b7f873e7c69
79 lines
1.8 KiB
Makefile
79 lines
1.8 KiB
Makefile
.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 ?= cloud-init
|
|
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
|