This repository has been archived by the owner on Dec 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
88 lines (66 loc) · 2.95 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
79
80
81
82
83
84
85
86
87
88
# SPDX-FileCopyrightText: 2022 SAP SE or an SAP affiliate company and Gardener contributors.
#
# SPDX-License-Identifier: Apache-2.0
VERSION?=0.0.0-dev.0
BOOTSTRAP_RELEASE_VERSION?=v0.1.0
DEV_VERSION?=0.0.0-$(shell git rev-parse --abbrev-ref HEAD)-$(shell git rev-parse --short HEAD)-$(shell date +%s)
GO_TEST_ARGS ?= -race
TAG ?= latest
UNAME ?= $(shell uname|tr '[:upper:]' '[:lower:]')
# podinfo component
PODINFO_VERSION ?= v1.0.0
PODINFO_GITHUB_REPOSITORY ?= ghcr.io/open-component-model/mpas
# gitea e2e test
GITEA_TOKEN?=
MPAS_MANAGEMENT_REPO_OWNER?=mpas-management
MPAS_MANAGEMENT_REPO_HOSTNAME?=http://127.0.0.1:3000
# Bootstrap component
MPAS_GITHUB_REPOSITORY?=ghcr.io/open-component-model/mpas-bootstrap-component
GITHUB_USERNAME?=mpas
## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
#Verbose Tests
GOTESTSUM ?= $(LOCALBIN)/gotestsum
build:
# omit debug info wih -s -w
go build -ldflags="-s -w -X main.Version=$(VERSION)" -o ./bin/mpas ./cmd/mpas
build-dev:
# omit debug info wih -s -w
go build -ldflags="-s -w -X main.Version=$(DEV_VERSION)" -o ./bin/mpas ./cmd/mpas
.PHONY: build-release-bootstrap-component
build-release-bootstrap-component:
# omit debug info wih -s -w
go build -v -ldflags="-s -w -X github.com/open-component-model/mpas/cmd/release-bootstrap-component/version.Tag=$(BOOTSTRAP_RELEASE_VERSION)" \
-o ./bin/mpas-rel ./cmd/release-bootstrap-component
.PHONY: e2e
e2e: prime-test-cluster test-summary-tool
$(GOTESTSUM) --format testname -- -count=1 -timeout=30m -tags=e2e ./e2e
.PHONY: test-summary-tool
test-summary-tool: ## Download gotestsum locally if necessary.
GOBIN=$(LOCALBIN) go install gotest.tools/gotestsum@${TAG}
.PHONY: e2e-verbose
e2e-verbose: prime-test-cluster test-summary-tool ## Runs e2e tests in verbose.
$(GOTESTSUM) --format standard-verbose -- -count=1 -timeout=30m -tags=e2e ./e2e
e2e-cli:
GITEA_TOKEN=$(GITEA_TOKEN) MPAS_MANAGEMENT_REPO_OWNER=$(MPAS_MANAGEMENT_REPO_OWNER) \
MPAS_MANAGEMENT_REPO_HOSTNAME=$(MPAS_MANAGEMENT_REPO_HOSTNAME) go test ./e2e-cli --tags=e2e -v -count=1 -run TestBootstrap_gitea
release-bootstrap-component:
./bin/mpas-rel --repository-url $(MPAS_GITHUB_REPOSITORY) --username $(GITHUB_USERNAME)
test:
go test -v ./internal/... $(GO_TEST_ARGS) -coverprofile cover.out
.PHONY: prime-test-cluster
prime-test-cluster: mkcert ## Runs prime-test-cluster in the ocm-controller project. It expects the project to exist.
./hack/prime_test_cluster.sh
MKCERT ?= $(LOCALBIN)/mkcert
MKCERT_VERSION ?= v1.4.4
.PHONY: mkcert
mkcert: $(MKCERT)
$(MKCERT): $(LOCALBIN)
curl -L "https://github.com/FiloSottile/mkcert/releases/download/$(MKCERT_VERSION)/mkcert-$(MKCERT_VERSION)-$(UNAME)-amd64" -o $(LOCALBIN)/mkcert
chmod +x $(LOCALBIN)/mkcert
podinfo:
ocm add componentversion --create --version $(PODINFO_VERSION) --scheme v3alpha1 ./podinfo_component/componentfile.yaml
push-podinfo:
ocm transfer component -f ./transport-archive $(PODINFO_GITHUB_REPOSITORY)