ARO-RP/Makefile

90 строки
3.4 KiB
Makefile
Исходник Обычный вид История

2019-11-30 16:51:47 +03:00
COMMIT = $(shell git rev-parse --short HEAD)$(shell [[ $$(git status --porcelain) = "" ]] || echo -dirty)
2019-12-11 15:06:19 +03:00
rp: generate
2019-11-30 16:51:47 +03:00
go build -ldflags "-X main.gitCommit=$(COMMIT)" ./cmd/rp
2019-11-18 09:24:26 +03:00
az:
cd python/az/aro && python ./setup.py bdist_egg
2019-11-18 09:24:26 +03:00
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
2019-11-18 09:24:26 +03:00
2019-12-11 15:06:19 +03:00
client: generate
2019-12-13 21:05:24 +03:00
rm -rf pkg/client python/client
mkdir pkg/client python/client
2019-12-02 14:04:46 +03:00
sha256sum swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2019-12-31-preview/redhatopenshift.json >.sha256sum
2019-11-30 22:02:04 +03:00
sudo docker run \
2019-12-17 04:26:21 +03:00
-v $(PWD)/pkg/client:/github.com/Azure/ARO-RP/pkg/client:z \
2019-12-16 10:04:13 +03:00
-v $(PWD)/swagger:/swagger:z \
2019-11-30 22:02:04 +03:00
azuresdk/autorest \
--go \
--license-header=MICROSOFT_APACHE_NO_VERSION \
2019-11-30 22:02:04 +03:00
--namespace=redhatopenshift \
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2019-12-31-preview/redhatopenshift.json \
2019-12-17 04:26:21 +03:00
--output-folder=/github.com/Azure/ARO-RP/pkg/client/services/preview/redhatopenshift/mgmt/2019-12-31-preview/redhatopenshift
2019-11-30 22:02:04 +03:00
2019-12-03 14:33:55 +03:00
sudo docker run \
2019-12-16 10:04:13 +03:00
-v $(PWD)/python/client:/python/client:z \
-v $(PWD)/swagger:/swagger:z \
2019-12-03 14:33:55 +03:00
azuresdk/autorest \
--use=@microsoft.azure/autorest.python@4.0.70 \
--python \
--azure-arm \
--license-header=MICROSOFT_APACHE_NO_VERSION \
--namespace=azure.mgmt.redhatopenshift.v2019_12_31_preview \
2019-12-03 14:33:55 +03:00
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2019-12-31-preview/redhatopenshift.json \
--output-folder=/python/client
2019-12-13 21:05:24 +03:00
sudo chown -R $(USER):$(USER) pkg/client python/client
2019-12-20 22:30:13 +03:00
sed -i -e 's|azure/aro-rp|Azure/ARO-RP|g' pkg/client/services/preview/redhatopenshift/mgmt/2019-12-31-preview/redhatopenshift/models.go pkg/client/services/preview/redhatopenshift/mgmt/2019-12-31-preview/redhatopenshift/redhatopenshiftapi/interfaces.go
rm -rf python/client/azure/mgmt/redhatopenshift/v2019_12_31_preview/aio
>python/client/__init__.py
2019-12-03 14:33:55 +03:00
2019-12-17 04:26:21 +03:00
go run ./vendor/golang.org/x/tools/cmd/goimports -w -local=github.com/Azure/ARO-RP pkg/client
2019-12-03 14:33:55 +03:00
2019-12-11 15:06:19 +03:00
generate:
go generate ./...
2019-11-30 16:51:47 +03:00
image: rp
docker build -t arosvc.azurecr.io/rp:$(COMMIT) .
2019-11-18 09:24:26 +03:00
2019-12-16 19:52:17 +03:00
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
2019-12-04 16:17:27 +03:00
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
2019-12-17 04:26:21 +03:00
go run ./vendor/golang.org/x/tools/cmd/goimports -w -local=github.com/Azure/ARO-RP cmd hack pkg
go run ./hack/validate-imports cmd hack pkg
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)
2019-12-02 14:04:46 +03:00
@sha256sum --quiet -c .sha256sum || (echo error: client library is stale, please run make client; exit 1)
go vet ./...
2019-11-21 05:32:34 +03:00
go test ./...
2019-12-16 19:52:17 +03:00
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