2020-01-31 17:28:34 +03:00
|
|
|
SHELL = /bin/bash
|
2019-11-30 16:51:47 +03:00
|
|
|
COMMIT = $(shell git rev-parse --short HEAD)$(shell [[ $$(git status --porcelain) = "" ]] || echo -dirty)
|
|
|
|
|
2019-12-22 20:47:29 +03:00
|
|
|
aro: generate
|
|
|
|
go build -ldflags "-X main.gitCommit=$(COMMIT)" ./cmd/aro
|
2019-11-18 09:24:26 +03:00
|
|
|
|
2019-12-13 21:09:53 +03:00
|
|
|
az:
|
|
|
|
cd python/az/aro && python ./setup.py bdist_egg
|
2020-02-26 17:41:47 +03:00
|
|
|
cd python/az/aro && python ./setup.py bdist_wheel || true
|
2019-12-13 21:09:53 +03:00
|
|
|
|
2019-11-18 09:24:26 +03:00
|
|
|
clean:
|
2019-12-22 20:47:29 +03:00
|
|
|
rm -rf python/az/aro/{aro.egg-info,build,dist} aro
|
2019-12-13 21:09:53 +03:00
|
|
|
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
|
2020-04-01 03:51:28 +03:00
|
|
|
sha256sum swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2020-04-30/redhatopenshift.json >.sha256sum
|
2019-12-06 21:47:03 +03:00
|
|
|
|
2019-11-30 22:02:04 +03:00
|
|
|
sudo docker run \
|
2020-01-07 00:52:51 +03:00
|
|
|
--rm \
|
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 \
|
2019-12-16 07:48:57 +03:00
|
|
|
--license-header=MICROSOFT_APACHE_NO_VERSION \
|
2019-11-30 22:02:04 +03:00
|
|
|
--namespace=redhatopenshift \
|
2020-04-01 03:51:28 +03:00
|
|
|
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2020-04-30/redhatopenshift.json \
|
|
|
|
--output-folder=/github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2020-04-30/redhatopenshift
|
2019-11-30 22:02:04 +03:00
|
|
|
|
2019-12-03 14:33:55 +03:00
|
|
|
sudo docker run \
|
2020-01-07 00:52:51 +03:00
|
|
|
--rm \
|
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 \
|
2019-12-16 07:48:57 +03:00
|
|
|
--license-header=MICROSOFT_APACHE_NO_VERSION \
|
2020-04-01 03:51:28 +03:00
|
|
|
--namespace=azure.mgmt.redhatopenshift.v2020_04_30 \
|
|
|
|
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2020-04-30/redhatopenshift.json \
|
2019-12-13 23:55:41 +03:00
|
|
|
--output-folder=/python/client
|
2019-12-06 21:47:03 +03:00
|
|
|
|
2020-01-28 05:46:35 +03:00
|
|
|
sudo chown -R $$(id -un):$$(id -gn) pkg/client python/client
|
2020-04-01 03:51:28 +03:00
|
|
|
sed -i -e 's|azure/aro-rp|Azure/ARO-RP|g' pkg/client/services/redhatopenshift/mgmt/2020-04-30/redhatopenshift/models.go pkg/client/services/redhatopenshift/mgmt/2020-04-30/redhatopenshift/redhatopenshiftapi/interfaces.go
|
|
|
|
rm -rf python/client/azure/mgmt/redhatopenshift/v2020_04_30/aio
|
2019-12-13 21:09:53 +03:00
|
|
|
>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-12-29 17:49:38 +03:00
|
|
|
image-aro: aro
|
2019-12-22 20:25:31 +03:00
|
|
|
docker pull registry.access.redhat.com/ubi8/ubi-minimal
|
2020-03-09 17:40:34 +03:00
|
|
|
docker build -f Dockerfile.aro -t ${RP_IMAGE_ACR}.azurecr.io/aro:$(COMMIT) .
|
2019-12-29 17:49:38 +03:00
|
|
|
|
2020-02-28 07:04:37 +03:00
|
|
|
image-fluentbit:
|
|
|
|
docker build --build-arg VERSION=1.3.9-1 \
|
2020-03-09 17:40:34 +03:00
|
|
|
-f Dockerfile.fluentbit -t ${RP_IMAGE_ACR}.azurecr.io/fluentbit:1.3.9-1 .
|
2020-02-28 07:04:37 +03:00
|
|
|
|
2020-06-02 00:39:29 +03:00
|
|
|
image-ifreload:
|
|
|
|
cd hack/ifreload && $(MAKE) clean ifreload.rhel8
|
|
|
|
|
2019-12-29 17:49:38 +03:00
|
|
|
image-proxy: proxy
|
|
|
|
docker pull registry.access.redhat.com/ubi8/ubi-minimal
|
2020-03-09 17:40:34 +03:00
|
|
|
docker build -f Dockerfile.proxy -t ${RP_IMAGE_ACR}.azurecr.io/proxy:latest .
|
|
|
|
|
2020-03-10 18:02:18 +03:00
|
|
|
publish-image-aro: image-aro
|
2020-03-09 17:40:34 +03:00
|
|
|
docker push ${RP_IMAGE_ACR}.azurecr.io/aro:$(COMMIT)
|
|
|
|
|
|
|
|
publish-image-fluentbit: image-fluentbit
|
|
|
|
docker push ${RP_IMAGE_ACR}.azurecr.io/fluentbit:1.3.9-1
|
|
|
|
|
2020-06-02 00:39:29 +03:00
|
|
|
publish-image-ifreload: image-ifreload
|
|
|
|
docker push ${RP_IMAGE_ACR}.azurecr.io/ifreload:$(COMMIT)
|
|
|
|
|
2020-03-09 17:40:34 +03:00
|
|
|
publish-image-proxy: image-proxy
|
|
|
|
docker push ${RP_IMAGE_ACR}.azurecr.io/proxy:latest
|
2019-12-29 17:49:38 +03:00
|
|
|
|
|
|
|
proxy:
|
|
|
|
go build -ldflags "-X main.gitCommit=$(COMMIT)" ./hack/proxy
|
2019-11-18 09:24:26 +03:00
|
|
|
|
2019-12-16 19:52:17 +03:00
|
|
|
pyenv${PYTHON_VERSION}:
|
2020-01-27 23:46:13 +03:00
|
|
|
virtualenv --python=/usr/bin/python${PYTHON_VERSION} pyenv${PYTHON_VERSION}
|
2019-12-16 19:52:17 +03:00
|
|
|
. pyenv${PYTHON_VERSION}/bin/activate && \
|
2020-04-14 20:01:24 +03:00
|
|
|
pip install autopep8 azdev azure-mgmt-loganalytics==0.2.0 ruamel.yaml && \
|
2019-12-16 19:52:17 +03:00
|
|
|
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:
|
2020-02-27 16:34:46 +03:00
|
|
|
@[ "${SECRET_SA_ACCOUNT_NAME}" ] || ( echo ">> SECRET_SA_ACCOUNT_NAME is not set"; exit 1 )
|
2019-12-04 16:17:27 +03:00
|
|
|
rm -rf secrets
|
2020-02-27 16:35:25 +03:00
|
|
|
az storage blob download --auth-mode login -n secrets.tar.gz -c secrets -f secrets.tar.gz --account-name ${SECRET_SA_ACCOUNT_NAME} >/dev/null
|
|
|
|
tar -xzf secrets.tar.gz
|
|
|
|
rm secrets.tar.gz
|
2019-12-04 16:17:27 +03:00
|
|
|
|
|
|
|
secrets-update:
|
2020-02-27 16:34:46 +03:00
|
|
|
@[ "${SECRET_SA_ACCOUNT_NAME}" ] || ( echo ">> SECRET_SA_ACCOUNT_NAME is not set"; exit 1 )
|
2020-02-27 16:35:25 +03:00
|
|
|
tar -czf secrets.tar.gz secrets
|
2020-02-27 16:34:46 +03:00
|
|
|
az storage blob upload --auth-mode login -n secrets.tar.gz -c secrets -f secrets.tar.gz --account-name ${SECRET_SA_ACCOUNT_NAME} >/dev/null
|
|
|
|
rm secrets.tar.gz
|
2019-12-04 16:17:27 +03:00
|
|
|
|
2020-01-23 09:25:27 +03:00
|
|
|
e2e:
|
2020-01-24 17:06:05 +03:00
|
|
|
go test ./test/e2e -timeout 60m -v -ginkgo.v -tags e2e
|
2020-01-23 09:25:27 +03:00
|
|
|
|
2019-12-13 21:09:53 +03:00
|
|
|
test-go: generate
|
2019-11-30 03:53:25 +03:00
|
|
|
go build ./...
|
|
|
|
|
2020-01-24 02:55:22 +03:00
|
|
|
gofmt -s -w cmd hack pkg test
|
|
|
|
go run ./vendor/golang.org/x/tools/cmd/goimports -w -local=github.com/Azure/ARO-RP cmd hack pkg test
|
|
|
|
go run ./hack/validate-imports cmd hack pkg test
|
2019-12-16 07:48:57 +03:00
|
|
|
go run ./hack/licenses
|
2019-11-30 03:53:25 +03:00
|
|
|
@[ -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)
|
2020-01-24 17:02:15 +03:00
|
|
|
go test -tags e2e -run ^$$ ./test/e2e/...
|
2019-11-30 03:53:25 +03:00
|
|
|
|
|
|
|
go vet ./...
|
2020-01-31 17:28:34 +03:00
|
|
|
set -o pipefail && go test -v ./... -coverprofile cover.out | tee uts.txt
|
2019-11-21 05:32:34 +03:00
|
|
|
|
2020-06-18 07:51:21 +03:00
|
|
|
lint-go: generate
|
|
|
|
golangci-lint run
|
|
|
|
|
2019-12-16 19:52:17 +03:00
|
|
|
test-python: generate pyenv${PYTHON_VERSION}
|
2019-12-13 21:09:53 +03:00
|
|
|
. pyenv${PYTHON_VERSION}/bin/activate && \
|
|
|
|
$(MAKE) az && \
|
|
|
|
azdev linter && \
|
2020-04-03 20:01:00 +03:00
|
|
|
azdev style && \
|
|
|
|
hack/format-yaml/format-yaml.py .pipelines
|
2019-12-13 21:09:53 +03:00
|
|
|
|
2020-03-12 05:45:32 +03:00
|
|
|
admin.kubeconfig:
|
|
|
|
hack/get-admin-kubeconfig.sh /subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${RESOURCEGROUP}/providers/Microsoft.RedHatOpenShift/openShiftClusters/${CLUSTER} >admin.kubeconfig
|
2020-03-11 01:22:20 +03:00
|
|
|
|
2020-06-02 00:39:29 +03:00
|
|
|
.PHONY: aro az clean client generate image-aro image-ifreload proxy secrets secrets-update test-go test-python image-fluentbit publish-image-proxy publish-image-aro publish-image-fluentbit publish-image-ifreload publish-image-proxy admin.kubeconfig
|