зеркало из https://github.com/Azure/ARO-RP.git
143 строки
5.3 KiB
Makefile
143 строки
5.3 KiB
Makefile
SHELL = /bin/bash
|
|
COMMIT = $(shell git rev-parse --short=7 HEAD)$(shell [[ $$(git status --porcelain) = "" ]] || echo -dirty)
|
|
ARO_IMAGE ?= ${RP_IMAGE_ACR}.azurecr.io/aro:$(COMMIT)
|
|
|
|
ifneq ($(shell uname -s),Darwin)
|
|
export CGO_CFLAGS=-Dgpgme_off_t=off_t
|
|
endif
|
|
|
|
aro: generate
|
|
go build -tags containers_image_openpgp -ldflags "-X github.com/Azure/ARO-RP/pkg/util/version.GitCommit=$(COMMIT)" ./cmd/aro
|
|
|
|
az: pyenv
|
|
. pyenv/bin/activate && \
|
|
cd python/az/aro && \
|
|
python ./setup.py bdist_egg && \
|
|
python ./setup.py bdist_wheel || true && \
|
|
rm -f ~/.azure/commandIndex.json # https://github.com/Azure/azure-cli/issues/1499
|
|
|
|
clean:
|
|
rm -rf python/az/aro/{aro.egg-info,build,dist} aro
|
|
find python -type f -name '*.pyc' -delete
|
|
find python -type d -name __pycache__ -delete
|
|
|
|
client: generate
|
|
hack/build-client.sh 2020-04-30 2021-01-31-preview
|
|
|
|
# TODO: hard coding dev-config.yaml is clunky; it is also probably convenient to
|
|
# override COMMIT.
|
|
deploy:
|
|
go run -ldflags "-X github.com/Azure/ARO-RP/pkg/util/version.GitCommit=$(COMMIT)" ./cmd/aro deploy dev-config.yaml ${LOCATION}
|
|
|
|
dev-config.yaml:
|
|
go run ./hack/gendevconfig >dev-config.yaml
|
|
|
|
discoverycache:
|
|
$(MAKE) admin.kubeconfig
|
|
KUBECONFIG=admin.kubeconfig go run ./hack/gendiscoverycache
|
|
$(MAKE) generate
|
|
|
|
generate:
|
|
go generate ./...
|
|
|
|
image-aro: aro e2e.test
|
|
docker pull registry.access.redhat.com/ubi8/ubi-minimal
|
|
docker build --no-cache -f Dockerfile.aro -t $(ARO_IMAGE) .
|
|
|
|
image-aro-multistage:
|
|
docker build --no-cache -f Dockerfile.aro-multistage -t $(ARO_IMAGE) .
|
|
|
|
image-fluentbit:
|
|
docker build --no-cache --build-arg VERSION=1.6.10-1 \
|
|
-f Dockerfile.fluentbit -t ${RP_IMAGE_ACR}.azurecr.io/fluentbit:1.6.10-1 .
|
|
|
|
image-proxy: proxy
|
|
docker pull registry.access.redhat.com/ubi8/ubi-minimal
|
|
docker build --no-cache -f Dockerfile.proxy -t ${RP_IMAGE_ACR}.azurecr.io/proxy:latest .
|
|
|
|
publish-image-aro: image-aro
|
|
docker push $(ARO_IMAGE)
|
|
ifeq ("${RP_IMAGE_ACR}-$(BRANCH)","arointsvc-master")
|
|
docker tag $(ARO_IMAGE) arointsvc.azurecr.io/aro:latest
|
|
docker push arointsvc.azurecr.io/aro:latest
|
|
endif
|
|
|
|
publish-image-aro-multistage: image-aro-multistage
|
|
docker push $(ARO_IMAGE)
|
|
ifeq ("${RP_IMAGE_ACR}-$(BRANCH)","arointsvc-master")
|
|
docker tag $(ARO_IMAGE) arointsvc.azurecr.io/aro:latest
|
|
docker push arointsvc.azurecr.io/aro:latest
|
|
endif
|
|
|
|
publish-image-fluentbit: image-fluentbit
|
|
docker push ${RP_IMAGE_ACR}.azurecr.io/fluentbit:1.6.10-1
|
|
|
|
publish-image-proxy: image-proxy
|
|
docker push ${RP_IMAGE_ACR}.azurecr.io/proxy:latest
|
|
|
|
proxy:
|
|
go build -ldflags "-X github.com/Azure/ARO-RP/pkg/util/version.GitCommit=$(COMMIT)" ./hack/proxy
|
|
|
|
pyenv:
|
|
virtualenv pyenv
|
|
. pyenv/bin/activate && \
|
|
pip install -U pip && \
|
|
pip install autopep8 azdev azure-mgmt-loganalytics==0.2.0 ruamel.yaml wheel && \
|
|
azdev setup -r . && \
|
|
sed -i -e "s|^dev_sources = $(PWD)$$|dev_sources = $(PWD)/python|" ~/.azure/config
|
|
|
|
secrets:
|
|
@[ "${SECRET_SA_ACCOUNT_NAME}" ] || ( echo ">> SECRET_SA_ACCOUNT_NAME is not set"; exit 1 )
|
|
rm -rf secrets
|
|
az storage blob download -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
|
|
|
|
secrets-update:
|
|
@[ "${SECRET_SA_ACCOUNT_NAME}" ] || ( echo ">> SECRET_SA_ACCOUNT_NAME is not set"; exit 1 )
|
|
tar -czf secrets.tar.gz secrets
|
|
az storage blob upload -n secrets.tar.gz -c secrets -f secrets.tar.gz --account-name ${SECRET_SA_ACCOUNT_NAME} >/dev/null
|
|
rm secrets.tar.gz
|
|
|
|
tunnel:
|
|
go run ./hack/tunnel $(shell az network public-ip show -g ${RESOURCEGROUP} -n rp-pip --query 'ipAddress')
|
|
|
|
e2e.test:
|
|
go test ./test/e2e -tags e2e -c -ldflags "-X github.com/Azure/ARO-RP/pkg/util/version.GitCommit=$(COMMIT)" -o e2e.test
|
|
|
|
test-e2e: e2e.test
|
|
./e2e.test -test.timeout 180m -test.v -ginkgo.v
|
|
|
|
test-go: generate
|
|
go build -tags containers_image_openpgp ./...
|
|
|
|
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
|
|
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 test -tags e2e -run ^$$ ./test/e2e/...
|
|
|
|
go vet ./...
|
|
set -o pipefail && go test -v ./... -coverprofile cover.out | tee uts.txt
|
|
|
|
lint-go:
|
|
go run ./vendor/github.com/golangci/golangci-lint/cmd/golangci-lint run
|
|
|
|
test-python: generate pyenv az
|
|
. pyenv/bin/activate && \
|
|
azdev linter && \
|
|
azdev style && \
|
|
hack/format-yaml/format-yaml.py .pipelines
|
|
|
|
admin.kubeconfig:
|
|
hack/get-admin-kubeconfig.sh /subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${RESOURCEGROUP}/providers/Microsoft.RedHatOpenShift/openShiftClusters/${CLUSTER} >admin.kubeconfig
|
|
|
|
vendor:
|
|
# https://groups.google.com/forum/#!topic/golang-nuts/51-D_YFC78k
|
|
hack/update-go-module-dependencies.sh
|
|
|
|
.PHONY: admin.kubeconfig aro az clean client deploy discoverycache generate image-aro image-aro-multistage image-fluentbit image-proxy lint-go proxy publish-image-aro publish-image-aro-multistage publish-image-fluentbit publish-image-proxy secrets secrets-update e2e.test tunnel test-e2e test-go test-python vendor
|