ARO-RP/Makefile

90 строки
3.4 KiB
Makefile

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/Azure/ARO-RP/pkg/client:z \
-v $(PWD)/swagger:/swagger:z \
azuresdk/autorest \
--go \
--license-header=MICROSOFT_APACHE_NO_VERSION \
--namespace=redhatopenshift \
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2019-12-31-preview/redhatopenshift.json \
--output-folder=/github.com/Azure/ARO-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 \
--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 \
--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
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
go run ./vendor/golang.org/x/tools/cmd/goimports -w -local=github.com/Azure/ARO-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/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)
@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