-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
85 lines (67 loc) · 3.06 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
COMMIT = $(shell git rev-parse --short HEAD)$(shell [[ $$(git status --porcelain) = "" ]] || echo -dirty)
rp: generate
go build -ldflags "-X main.gitCommit=$(COMMIT)" ./cmd/rp
az:
cd python/az/aro && python ./setup.py bdist_egg
clean:
rm -rf python/az/aro/{aro.egg-info,build,dist} rp
find python -type f -name '*.pyc' -delete
find python -type d -name __pycache__ -delete
client: generate
rm -rf pkg/client python/client
mkdir pkg/client python/client
sha256sum swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2019-12-31-preview/redhatopenshift.json >.sha256sum
sudo docker run \
-v $(PWD)/pkg/client:/github.com/jim-minter/rp/pkg/client:z \
-v $(PWD)/swagger:/swagger:z \
azuresdk/autorest \
--go \
--namespace=redhatopenshift \
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2019-12-31-preview/redhatopenshift.json \
--output-folder=/github.com/jim-minter/rp/pkg/client/services/preview/redhatopenshift/mgmt/2019-12-31-preview/redhatopenshift
sudo docker run \
-v $(PWD)/python/client:/python/client:z \
-v $(PWD)/swagger:/swagger:z \
azuresdk/autorest \
--python \
--azure-arm \
--namespace=azure.mgmt.redhatopenshift.v2019_12_31_preview \
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2019-12-31-preview/redhatopenshift.json \
--output-folder=/python/client
sudo chown -R $(USER):$(USER) pkg/client python/client
rm -rf python/client/azure/mgmt/redhatopenshift/v2019_12_31_preview/aio
>python/client/__init__.py
go run ./vendor/golang.org/x/tools/cmd/goimports -w -local=github.com/jim-minter/rp pkg/client
generate:
go generate ./...
image: rp
docker build -t arosvc.azurecr.io/rp:$(COMMIT) .
pyenv${PYTHON_VERSION}:
virtualenv --python=/usr/bin/python${PYTHON_VERSION} pyenv${PYTHON_VERSION}
. pyenv${PYTHON_VERSION}/bin/activate && \
pip install azdev && \
azdev setup -r . && \
sed -i -e "s|^dev_sources = $(PWD)$$|dev_sources = $(PWD)/python|" ~/.azure/config
secrets:
rm -rf secrets
mkdir secrets
oc extract -n azure secret/aro-v4-dev --to=secrets
secrets-update:
oc create secret generic aro-v4-dev --from-file=secrets --dry-run -o yaml | oc apply -f -
test-go: generate
go build ./...
gofmt -s -w cmd hack pkg
go run ./vendor/golang.org/x/tools/cmd/goimports -w -local=github.com/jim-minter/rp cmd hack pkg
go run ./hack/validate-imports/validate-imports.go cmd hack pkg
@[ -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)
@sha256sum --quiet -c .sha256sum || (echo error: client library is stale, please run make client; exit 1)
go vet ./...
go test ./...
test-python: generate pyenv${PYTHON_VERSION}
. pyenv${PYTHON_VERSION}/bin/activate && \
$(MAKE) az && \
azdev linter && \
azdev style
.PHONY: rp az clean client generate image secrets secrets-update test-go test-python