2020-01-31 17:28:34 +03:00
|
|
|
SHELL = /bin/bash
|
2021-04-15 20:53:44 +03:00
|
|
|
COMMIT = $(shell git rev-parse --short=7 HEAD)$(shell [[ $$(git status --porcelain) = "" ]] || echo -dirty)
|
2020-07-28 12:51:01 +03:00
|
|
|
ARO_IMAGE ?= ${RP_IMAGE_ACR}.azurecr.io/aro:$(COMMIT)
|
2019-11-30 16:51:47 +03:00
|
|
|
|
2020-11-12 21:45:31 +03:00
|
|
|
ifneq ($(shell uname -s),Darwin)
|
|
|
|
export CGO_CFLAGS=-Dgpgme_off_t=off_t
|
|
|
|
endif
|
2020-08-10 15:25:30 +03:00
|
|
|
|
2019-12-22 20:47:29 +03:00
|
|
|
aro: generate
|
2021-03-10 00:13:26 +03:00
|
|
|
go build -tags containers_image_openpgp -ldflags "-X github.com/Azure/ARO-RP/pkg/util/version.GitCommit=$(COMMIT)" ./cmd/aro
|
2019-11-18 09:24:26 +03:00
|
|
|
|
2020-10-08 03:20:20 +03:00
|
|
|
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
|
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
|
2020-12-02 21:08:45 +03:00
|
|
|
hack/build-client.sh 2020-04-30 2021-01-31-preview
|
2019-12-03 14:33:55 +03:00
|
|
|
|
2021-03-09 00:02:45 +03:00
|
|
|
# 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}
|
|
|
|
|
2021-03-11 02:42:48 +03:00
|
|
|
dev-config.yaml:
|
|
|
|
go run ./hack/gendevconfig >dev-config.yaml
|
|
|
|
|
2020-10-03 00:42:23 +03:00
|
|
|
discoverycache:
|
|
|
|
$(MAKE) admin.kubeconfig
|
|
|
|
KUBECONFIG=admin.kubeconfig go run ./hack/gendiscoverycache
|
|
|
|
$(MAKE) generate
|
|
|
|
|
2019-12-11 15:06:19 +03:00
|
|
|
generate:
|
|
|
|
go generate ./...
|
|
|
|
|
2020-07-07 15:19:55 +03:00
|
|
|
image-aro: aro e2e.test
|
2019-12-22 20:25:31 +03:00
|
|
|
docker pull registry.access.redhat.com/ubi8/ubi-minimal
|
2020-10-21 02:57:29 +03:00
|
|
|
docker build --no-cache -f Dockerfile.aro -t $(ARO_IMAGE) .
|
2019-12-29 17:49:38 +03:00
|
|
|
|
2021-03-10 00:13:26 +03:00
|
|
|
image-aro-multistage:
|
|
|
|
docker build --no-cache -f Dockerfile.aro-multistage -t $(ARO_IMAGE) .
|
|
|
|
|
2020-02-28 07:04:37 +03:00
|
|
|
image-fluentbit:
|
2021-02-09 17:23:44 +03:00
|
|
|
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 .
|
2020-02-28 07:04:37 +03:00
|
|
|
|
2019-12-29 17:49:38 +03:00
|
|
|
image-proxy: proxy
|
|
|
|
docker pull registry.access.redhat.com/ubi8/ubi-minimal
|
2020-10-21 02:57:29 +03:00
|
|
|
docker build --no-cache -f Dockerfile.proxy -t ${RP_IMAGE_ACR}.azurecr.io/proxy:latest .
|
2020-03-09 17:40:34 +03:00
|
|
|
|
2020-03-10 18:02:18 +03:00
|
|
|
publish-image-aro: image-aro
|
2020-07-28 12:51:01 +03:00
|
|
|
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
|
2020-03-09 17:40:34 +03:00
|
|
|
|
2021-03-10 00:13:26 +03:00
|
|
|
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
|
|
|
|
|
2020-03-09 17:40:34 +03:00
|
|
|
publish-image-fluentbit: image-fluentbit
|
2021-02-09 17:23:44 +03:00
|
|
|
docker push ${RP_IMAGE_ACR}.azurecr.io/fluentbit:1.6.10-1
|
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:
|
2020-06-25 07:38:08 +03:00
|
|
|
go build -ldflags "-X github.com/Azure/ARO-RP/pkg/util/version.GitCommit=$(COMMIT)" ./hack/proxy
|
2019-11-18 09:24:26 +03:00
|
|
|
|
2020-10-08 03:04:39 +03:00
|
|
|
pyenv:
|
|
|
|
virtualenv pyenv
|
|
|
|
. pyenv/bin/activate && \
|
2021-02-08 15:43:39 +03:00
|
|
|
pip install -U pip && \
|
2020-09-08 05:35:29 +03:00
|
|
|
pip install autopep8 azdev azure-mgmt-loganalytics==0.2.0 ruamel.yaml wheel && \
|
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-11-20 20:04:51 +03:00
|
|
|
az storage blob download -n secrets.tar.gz -c secrets -f secrets.tar.gz --account-name ${SECRET_SA_ACCOUNT_NAME} >/dev/null
|
2020-02-27 16:35:25 +03:00
|
|
|
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-08-10 15:25:30 +03:00
|
|
|
az storage blob upload -n secrets.tar.gz -c secrets -f secrets.tar.gz --account-name ${SECRET_SA_ACCOUNT_NAME} >/dev/null
|
2020-02-27 16:34:46 +03:00
|
|
|
rm secrets.tar.gz
|
2019-12-04 16:17:27 +03:00
|
|
|
|
2021-03-22 17:48:48 +03:00
|
|
|
tunnel:
|
|
|
|
go run ./hack/tunnel $(shell az network public-ip show -g ${RESOURCEGROUP} -n rp-pip --query 'ipAddress')
|
|
|
|
|
2020-07-07 15:19:55 +03:00
|
|
|
e2e.test:
|
2021-01-19 05:02:46 +03:00
|
|
|
go test ./test/e2e -tags e2e -c -ldflags "-X github.com/Azure/ARO-RP/pkg/util/version.GitCommit=$(COMMIT)" -o e2e.test
|
2020-07-07 15:19:55 +03:00
|
|
|
|
|
|
|
test-e2e: e2e.test
|
2020-09-09 21:10:59 +03:00
|
|
|
./e2e.test -test.timeout 180m -test.v -ginkgo.v
|
2020-01-23 09:25:27 +03:00
|
|
|
|
2019-12-13 21:09:53 +03:00
|
|
|
test-go: generate
|
2021-03-10 07:40:55 +03:00
|
|
|
go build -tags containers_image_openpgp ./...
|
2019-11-30 03:53:25 +03:00
|
|
|
|
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-11-14 03:07:17 +03:00
|
|
|
lint-go:
|
|
|
|
go run ./vendor/github.com/golangci/golangci-lint/cmd/golangci-lint run
|
2020-06-18 07:51:21 +03:00
|
|
|
|
2020-10-08 03:20:20 +03:00
|
|
|
test-python: generate pyenv az
|
2020-10-08 03:04:39 +03:00
|
|
|
. pyenv/bin/activate && \
|
2019-12-13 21:09:53 +03:00
|
|
|
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-10-31 21:05:27 +03:00
|
|
|
vendor:
|
2020-11-17 12:55:24 +03:00
|
|
|
# https://groups.google.com/forum/#!topic/golang-nuts/51-D_YFC78k
|
|
|
|
hack/update-go-module-dependencies.sh
|
2020-10-31 21:05:27 +03:00
|
|
|
|
2021-03-22 17:48:48 +03:00
|
|
|
.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
|