forked from openshift/installer-aro-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (61 loc) · 3.16 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
SHELL = /bin/bash
TAG ?= $(shell git describe --exact-match 2>/dev/null)
COMMIT = $(shell git rev-parse --short=7 HEAD)$(shell [[ $$(git status --porcelain) = "" ]] || echo -dirty)
ARO_IMAGE_BASE = $(RP_IMAGE_ACR).azurecr.io/aroinstaller
ifneq ($(shell uname -s),Darwin)
export CGO_CFLAGS=-Dgpgme_off_t=off_t
endif
ifeq ($(TAG),)
VERSION = $(COMMIT)
else
VERSION = $(TAG)
endif
# default to registry.access.redhat.com for build images on local builds and CI builds without $RP_IMAGE_ACR set.
ifeq ($(RP_IMAGE_ACR),arointsvc)
REGISTRY = arointsvc.azurecr.io
else ifeq ($(RP_IMAGE_ACR),arosvc)
REGISTRY = arosvc.azurecr.io
else
REGISTRY = registry.access.redhat.com
endif
ARO_IMAGE ?= $(ARO_IMAGE_BASE):$(VERSION)
build-all:
go build -tags aro,containers_image_openpgp ./...
aro: generate
go build -tags aro,containers_image_openpgp,codec.safe -ldflags "-X github.com/openshift/installer-aro-wrapper/pkg/util/version.GitCommit=$(VERSION)" ./cmd/aro
clean:
rm -rf aro
find -type d -name 'gomock_reflect_[0-9]*' -exec rm -rf {} \+ 2>/dev/null
generate:
go generate ./...
image-aro:
docker pull $(REGISTRY)/ubi8/ubi-minimal
docker build --network=host --no-cache -f Dockerfile.aro -t $(ARO_IMAGE) --build-arg REGISTRY=$(REGISTRY) .
publish-image-aro: image-aro
docker push $(ARO_IMAGE)
ifeq ("${RP_IMAGE_ACR}-$(BRANCH)","arointsvc-master")
docker tag $(ARO_IMAGE) arointsvc.azurecr.io/aroinstaller:latest
docker push arointsvc.azurecr.io/aroinstaller:latest
endif
test-go: generate build-all validate-go lint-go unit-test-go
validate-go:
gofmt -s -w cmd hack pkg test
go run ./vendor/golang.org/x/tools/cmd/goimports -w -local=github.com/openshift/installer-aro-wrapper cmd hack pkg test
go run ./hack/validate-imports cmd hack pkg test
go run ./hack/licenses
@[ -z "$$(ls pkg/util/*.go 2>/dev/null)" ] || (echo error: go files are not allowed in pkg/util, use a subpackage; exit 1)
@[ -z "$$(find -name "*:*")" ] || (echo error: filenames with colons are not allowed on Windows, please rename; exit 1)
go vet -tags containers_image_openpgp ./...
validate-go-action:
go run ./hack/licenses -validate -ignored-go vendor,pkg/client,.git -ignored-python python/client,vendor,.git
go run ./hack/validate-imports cmd hack pkg test
@[ -z "$$(ls pkg/util/*.go 2>/dev/null)" ] || (echo error: go files are not allowed in pkg/util, use a subpackage; exit 1)
@[ -z "$$(find -name "*:*")" ] || (echo error: filenames with colons are not allowed on Windows, please rename; exit 1)
unit-test-go:
go run ./vendor/gotest.tools/gotestsum/main.go --format pkgname --junitfile report.xml -- -tags=aro,containers_image_openpgp -coverprofile=cover.out ./...
lint-go:
hack/lint-go.sh
vendor:
# See comments in the script for background on why we need it
hack/update-go-module-dependencies.sh
.PHONY: admin.kubeconfig aks.kubeconfig aro az clean client deploy dev-config.yaml discoverycache generate image-aro image-aro-multistage image-fluentbit image-proxy lint-go runlocal-rp proxy publish-image-aro publish-image-aro-multistage publish-image-fluentbit publish-image-proxy secrets secrets-update e2e.test tunnel test-e2e test-go test-python vendor build-all validate-go unit-test-go coverage-go validate-fips