-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Gerd Oberlechner <[email protected]>
- Loading branch information
Showing
9 changed files
with
89 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,56 @@ | ||
SHELL = /bin/bash | ||
DEPLOY_ENV ?= personal-dev | ||
$(shell ../templatize.sh $(DEPLOY_ENV) config.tmpl.mk config.mk) | ||
include config.mk | ||
include Makefile.deploy | ||
SHELLFLAGS = -eu -o pipefail -c | ||
include ../setup-env.mk | ||
|
||
COMMIT ?= $(shell git rev-parse --short=7 HEAD) | ||
ARO_HCP_BASE_IMAGE ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io | ||
ARO_HCP_BACKEND_IMAGE ?= $(ARO_HCP_BASE_IMAGE)/arohcpbackend:$(COMMIT) | ||
|
||
backend: | ||
go build -o aro-hcp-backend . | ||
.PHONY: backend | ||
|
||
run: | ||
./aro-hcp-backend --location ${LOCATION} \ | ||
--clusters-service-url http://localhost:8000 | ||
.PHONY: run | ||
|
||
clean: | ||
rm -f aro-hcp-backend | ||
.PHONY: clean | ||
|
||
image: | ||
pushd .. && git archive --output backend/archive.tar.gz HEAD && popd | ||
docker build -f "./Dockerfile" -t ${ARO_HCP_BACKEND_IMAGE} . | ||
rm -f archive.tar.gz | ||
.PHONY: image | ||
|
||
push: image | ||
az acr login --name ${ARO_HCP_IMAGE_ACR} | ||
docker push ${ARO_HCP_BACKEND_IMAGE} | ||
.PHONY: push | ||
|
||
deploy: | ||
BACKEND_MI_CLIENT_ID=$$(az identity show \ | ||
-g ${RESOURCEGROUP} \ | ||
-n backend \ | ||
--query clientId);\ | ||
ISTO_VERSION=$$(az aks show -n ${AKS_NAME} -g ${RESOURCEGROUP} --query serviceMeshProfile.istio.revisions[-1] -o tsv) && \ | ||
DB_URL=$$(az cosmosdb show -n ${DB_NAME} -g ${RESOURCEGROUP} --query documentEndpoint -o tsv) && \ | ||
kubectl create namespace aro-hcp --dry-run=client -o json | kubectl apply -f - && \ | ||
kubectl label namespace aro-hcp "istio.io/rev=$${ISTO_VERSION}" --overwrite=true && \ | ||
helm upgrade --install aro-hcp-backend-dev \ | ||
deploy/helm/backend/ \ | ||
--set configMap.databaseName=${DB_NAME} \ | ||
--set configMap.databaseUrl="$${DB_URL}" \ | ||
--set configMap.backendMiClientId="$${BACKEND_MI_CLIENT_ID}" \ | ||
--set serviceAccount.workloadIdentityClientId="$${BACKEND_MI_CLIENT_ID}" \ | ||
--set configMap.currentVersion=${ARO_HCP_BACKEND_IMAGE} \ | ||
--set configMap.location=${LOCATION} \ | ||
--set deployment.imageName=${ARO_HCP_BACKEND_IMAGE} \ | ||
--namespace aro-hcp | ||
.PHONY: deploy | ||
|
||
undeploy: | ||
helm uninstall aro-hcp-backend-dev --namespace aro-hcp | ||
|
||
.PHONY: backend run clean image push undeploy | ||
.PHONY: undeploy |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
PROJECT_ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
|
||
DEPLOY_ENV ?= personal-dev | ||
PIPELINE ?= pipeline.yaml | ||
PIPELINE_STEP ?= deploy | ||
HASH = $(shell echo -n "$(DEPLOY_ENV)$(PIPELINE)$(PIPELINE_STEP)" | md5) | ||
ENV_VARS_FILE ?= /tmp/deploy.${HASH}.cfg | ||
|
||
# Target to generate the environment variables file | ||
$(ENV_VARS_FILE): ${PROJECT_ROOT_DIR}/config/config.yaml ${PIPELINE} ${PROJECT_ROOT_DIR}/templatize.sh ${MAKEFILE_LIST} | ||
@echo "generate env vars" | ||
@${PROJECT_ROOT_DIR}/templatize.sh ${DEPLOY_ENV} \ | ||
-p ${PIPELINE} \ | ||
-s ${PIPELINE_STEP} > $@ | ||
|
||
# Include the environment variables file if it exists | ||
ifndef EV2 | ||
-include ${ENV_VARS_FILE} | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.