-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
100 lines (78 loc) · 2.85 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
SCRIPTPATH=$(shell cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)
ifneq (,$(wildcard ./.env))
$(info found env file)
include .env
export
endif
ENVFILE=${SCRIPTPATH}/.env
IMAGE?=${REGISTRY}/pubsubtest
LOG_DIRECTORY?=/aci/logs/localrun_$(shell date -u +"%FT%H%M%S%Z")
ACI_CONTAINER_NAME?=tester
export
.PHONY: test-setup
test-setup:
scripts/test-setup.sh "${ENVFILE}"
.PHONY: test-env
test-env:
scripts/test-env.sh "${ENVFILE}"
.PHONY: cleanup-test-setup
cleanup-test-setup:
az group delete --name ${TEST_RESOURCE_GROUP} --subscription ${AZURE_SUBSCRIPTION_ID}
build-test-image:
echo "envfile : ${ENVFILE}"
echo "REGISTRY : ${REGISTRY}"
docker build -t ${IMAGE} .
push-test-image:
@docker login -u ${REGISTRY_USER} -p ${REGISTRY_PASSWORD} ${REGISTRY}
docker push ${IMAGE}
test-aci: clean-aci scripts/containergroup.yaml
containerId=$$(az container create --file scripts/containergroup.yaml \
--name "${ACI_CONTAINER_NAME}" \
--resource-group ${TEST_RESOURCE_GROUP} \
--subscription ${AZURE_SUBSCRIPTION_ID} \
--environment-variables SUITE=${SUITE} \
--verbose \
--query id -o tsv); \
./scripts/wait-aci.sh $${containerId}
shell-aci: clean-aci
az container create --file scripts/containergroup.yaml \
--resource-group ${TEST_RESOURCE_GROUP} \
--subscription ${AZURE_SUBSCRIPTION_ID} \
--command-line "/bin/bash"; \
az container attach --name "pubsubtester" --resource-group "${TEST_RESOURCE_GROUP}"
scripts/containergroup.yaml:
envsubst < scripts/containergroup.template.yaml > scripts/containergroup.yaml
clean-aci:
az container delete \
--resource-group ${TEST_RESOURCE_GROUP} \
--name ${ACI_CONTAINER_NAME} \
--subscription ${AZURE_SUBSCRIPTION_ID} \
--yes
integration: build-test-image push-test-image test-aci
integration-compose: build-test-image
@docker-compose --env-file "${ENVFILE}" up
integration-local:
LOG_DIRECTORY=. ./run-integration.sh TestConnectionString/TestCreate*
integration-pipeline: scripts/containergroup.yaml
SUITE=$$(echo "${SUITE}" | tr '[:upper:]' '[:lower:]') \
containerId=$$(az container create --file scripts/containergroup.yaml \
--name "bld${ACI_CONTAINER_NAME}-${SUITE}" \
--resource-group ${TEST_RESOURCE_GROUP} \
--subscription ${AZURE_SUBSCRIPTION_ID} \
--verbose \
--query id -o tsv); \
./scripts/wait-aci.sh $${containerId}
integration-clean-aci:
SUITE=$$(echo "${SUITE}" | tr '[:upper:]' '[:lower:]') \
az rest \
--method delete \
--uri "/subscriptions/{subscriptionId}/resourceGroups/${TEST_RESOURCE_GROUP}/providers/Microsoft.ContainerInstance/containerGroups/bld${ACI_CONTAINER_NAME}-${SUITE}?api-version=2019-12-01" \
--subscription 2b03bfb8-e885-4566-a62a-909a11d71692
download-junit:
az storage file download-batch \
--account-name ${STORAGE_ACCOUNT_NAME} \
--account-key ${STORAGE_ACCOUNT_KEY} \
--source "acilogs" \
--pattern "${LOG_DIRECTORY}/*.junit.xml" \
--dest . \
--output none