-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
170 lines (127 loc) · 4.89 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS = -ecuo pipefail
.DEFAULT_GOAL := full
CONTROL_PLANE_SERVER_PATH=server/ControlPlane
DATA_PLANE_SERVER_PATH=server/DataPlane
DEVELOPER_CONFIG_JSON = $(shell scripts/get-config.sh --dev -o json | jq -c)
ifeq ($(TYGER_ENVIRONMENT_TYPE),)
include Makefile.cloud
else ifeq ($(TYGER_ENVIRONMENT_TYPE),cloud)
include Makefile.cloud
else ifeq ($(TYGER_ENVIRONMENT_TYPE),docker)
include Makefile.docker
endif
get-config:
echo '${ENVIRONMENT_CONFIG_JSON}' | yq -P
open-docker-window:
code /workspaces/tyger-docker
open-cloud-window:
code /workspaces/tyger
check-az-login:
scripts/check-az-login.sh
az-login-from-host:
scripts/az-login-from-host.sh
build-csharp:
find . -name *csproj | xargs -L 1 dotnet build
build-go:
cd cli
go build -v ./...
build: build-csharp build-go
run: set-localsettings
cd server/ControlPlane
dotnet run -v m --no-restore
unit-test:
find . -name *csproj | xargs -L 1 dotnet test --no-restore -v q
cd cli
go test ./... | { grep -v "\\[[no test files\\]" || true; }
_docker-build:
if [[ "$${DO_NOT_BUILD_IMAGES:-}" == "true" ]]; then
exit
fi
if [[ -z "${DOCKER_BUILD_TARGET}" ]]; then
echo "DOCKER_BUILD_TARGET not set"
exit 1
fi
target_arg="--${DOCKER_BUILD_TARGET}"
tag=$${EXPLICIT_IMAGE_TAG:-dev}
dev_config=$$(scripts/get-config.sh --dev -o json)
registry=$$(echo "$${dev_config}" | jq -r '.wipContainerRegistry.fqdn')
directory=$$(echo "$${dev_config}" | jq -r '.wipContainerRegistry.directory // ""')
scripts/build-images.sh $$target_arg ${DOCKER_BUILD_ARCH_FLAGS} ${DOCKER_BUILD_PUSH_FLAGS} --tag "$$tag" --registry "$${registry}" --registry-directory "$${directory}"
docker-build-test: login-wip-acr
$(MAKE) _docker-build DOCKER_BUILD_TARGET=test-connectivity
docker-build-tyger-server: login-wip-acr
$(MAKE) _docker-build DOCKER_BUILD_TARGET=tyger-server
docker-build-buffer-sidecar: login-wip-acr
$(MAKE) _docker-build DOCKER_BUILD_TARGET=buffer-sidecar
docker-build-worker-waiter: login-wip-acr
$(MAKE) _docker-build DOCKER_BUILD_TARGET=worker-waiter
docker-build-helm: login-wip-acr
$(MAKE) _docker-build DOCKER_BUILD_TARGET=helm
docker-build: docker-build-test docker-build-tyger-server docker-build-buffer-sidecar docker-build-worker-waiter
publish-official-images:
dev_config=$$(scripts/get-config.sh --dev -o json)
registry=$$(echo "$${dev_config}" | jq -r '.officialPushContainerRegistry.fqdn')
registry_name=$$(echo "$$registry" | cut -d'.' -f1)
az acr login --name "$${registry_name}"
registry_directory=$$(echo "$${dev_config}" | jq -r '.officialPushContainerRegistry.directory // ""')
tag=$$(git describe --tags)
scripts/build-images.sh --push --push-force --arch amd64 --arch arm64 --tyger-server --worker-waiter --buffer-sidecar --helm --tag "$${tag}" --registry "$${registry}" --registry-directory "$${registry_directory}"
prepare-wip-binaries:
tag="$$(git describe --tags)-$$(date +'%Y%m%d%H%M%S')"
export EXPLICIT_IMAGE_TAG=$${tag}
$(MAKE) DOCKER_BUILD_ARCH_FLAGS="--arch amd64 --arch arm64" docker-build docker-build-helm
$(MAKE) install-cli
integration-test-no-up-prereqs:
integration-test-no-up: integration-test-no-up-prereqs cli-ready
if [[ -n "$${EXPLICIT_IMAGE_TAG:-}" ]]; then
repo_fqdn=$$(scripts/get-config.sh --dev -e .wipContainerRegistry.fqdn)
export TEST_CONNECTIVITY_IMAGE="$${repo_fqdn}/testconnectivity:$${EXPLICIT_IMAGE_TAG}"
fi
pushd cli/integrationtest
go test -tags=integrationtest
integration-test: up integration-test-no-up-prereqs
$(MAKE) integration-test-no-up-prereqs integration-test-no-up
test: up unit-test integration-test
$(MAKE) variant-test
test-no-up: unit-test integration-test-no-up
$(MAKE) variant-test
full:
$(MAKE) test INSTALL_CLOUD=true
get-tyger-uri:
echo ${TYGER_URI}
install-cli:
dev_config=$$(scripts/get-config.sh --dev -o json)
container_registry=$$(echo "$${dev_config}" | jq -r '.wipContainerRegistry.fqdn')
container_registry_directory=$$(echo "$${dev_config}" | jq -r '.wipContainerRegistry.directory // ""')
cd cli
tag="$${EXPLICIT_IMAGE_TAG:-$$(git describe --tags 2> /dev/null || echo "0.0.0")}"
CGO_ENABLED=0 go install -buildvcs=false -ldflags="-s -w \
-X main.version=$${tag} \
-X github.com/microsoft/tyger/cli/internal/install.ContainerRegistry=$${container_registry} \
-X github.com/microsoft/tyger/cli/internal/install.ContainerRegistryDirectory=$${container_registry_directory} \
-X github.com/microsoft/tyger/cli/internal/install.ContainerImageTag=$${tag}" \
./cmd/tyger ./cmd/buffer-sidecar ./cmd/tyger-proxy
cli-ready: install-cli
if ! tyger login status &> /dev/null; then
$(MAKE) login
fi
restore:
cd cli
go mod download
cd ../server
dotnet restore
format:
cd server
dotnet format
verify-format:
cd server
dotnet build -p:EnforceCodeStyleInBuild=true
dotnet format --verify-no-changes
start-docs-website:
cd docs
npm install
npm run docs:dev