|
|
@ -14,12 +14,14 @@ GOBIN = $(shell pwd)/build/bin |
|
|
|
GO ?= latest |
|
|
|
|
|
|
|
# variables
|
|
|
|
NAME_DEV=develop |
|
|
|
NAME_TEST=test |
|
|
|
NAME_STAGING=staging |
|
|
|
NAME_MASTER=master |
|
|
|
|
|
|
|
RD_SUFFIX=rd |
|
|
|
|
|
|
|
BRANCH_DEV=$(NAME_DEV)-$(RD_SUFFIX) |
|
|
|
BRANCH_TEST=$(NAME_TEST)-$(RD_SUFFIX) |
|
|
|
BRANCH_STAGING=$(NAME_STAGING)-$(RD_SUFFIX) |
|
|
|
BRANCH_MASTER=$(NAME_MASTER)-$(RD_SUFFIX) |
|
|
@ -38,6 +40,8 @@ K8S_DEPLOY_PARAM_RESOURCE_SUFFIX=$(GIT_BRANCH) |
|
|
|
K8S_DEPLOY_PARAM_ARC_PREFIX=$(ACR_PREFIX) |
|
|
|
|
|
|
|
TMP_FILE_DEPLOY=.tmp.deploy.txt |
|
|
|
TMP_DATA_DIR=tmpData |
|
|
|
CONFIGFILES_PROJECT_NAME=configfiles |
|
|
|
|
|
|
|
#GIT_BRANCH=master-rd
|
|
|
|
|
|
|
@ -85,7 +89,7 @@ docker: clean buildquick |
|
|
|
@echo ACR_PREFIX=$(ACR_PREFIX); |
|
|
|
@echo CURR_MODEL_NAME=$(CURR_MODEL_NAME); |
|
|
|
@echo GIT_BRANCH=$(GIT_BRANCH); |
|
|
|
@if [ $(GIT_BRANCH) = $(BRANCH_TEST) ] || [ $(GIT_BRANCH) = $(BRANCH_STAGING) ] || [ $(GIT_BRANCH) = $(BRANCH_MASTER) ]; then\
|
|
|
|
@if [[ $(GIT_BRANCH) = $(BRANCH_DEV) || $(GIT_BRANCH) = $(BRANCH_TEST) || $(GIT_BRANCH) = $(BRANCH_STAGING) || $(GIT_BRANCH) = $(BRANCH_MASTER) ]]; then\
|
|
|
|
cd pack;\
|
|
|
|
docker build -t $(CURR_MODEL_NAME):$(K8S_DEPLOY_PARAM_IMAGE_TAG) .;\
|
|
|
|
docker tag $(CURR_MODEL_NAME):$(K8S_DEPLOY_PARAM_IMAGE_TAG) $(ACR_PREFIX)/$(CURR_MODEL_NAME):$(K8S_DEPLOY_PARAM_IMAGE_TAG); \
|
|
|
@ -98,13 +102,33 @@ deployK8s: docker |
|
|
|
@echo ==deploy to K8s== |
|
|
|
@echo $(SHELL_EXPORT); |
|
|
|
|
|
|
|
@if [ $(GIT_BRANCH) = $(BRANCH_TEST) ] || [ $(GIT_BRANCH) = $(BRANCH_STAGING) ] || [ $(GIT_BRANCH) = $(BRANCH_MASTER) ]; then\
|
|
|
|
@if [[ $(GIT_BRANCH) = $(BRANCH_DEV) || $(GIT_BRANCH) = $(BRANCH_TEST) || $(GIT_BRANCH) = $(BRANCH_STAGING) || $(GIT_BRANCH) = $(BRANCH_MASTER) ]]; then\
|
|
|
|
$(SHELL_EXPORT) envsubst < deployK8s.yaml > $(TMP_FILE_DEPLOY) ; kubectl apply -f $(TMP_FILE_DEPLOY) ; \
|
|
|
|
kubectl replace -f $(TMP_FILE_DEPLOY) --force; \
|
|
|
|
else \
|
|
|
|
echo !!!!! no docker building in branch $(GIT_BRANCH) !!!!!!; \
|
|
|
|
fi |
|
|
|
|
|
|
|
configfiles: |
|
|
|
@echo ==get configfiles== |
|
|
|
@echo $(GIT_BRANCH) |
|
|
|
@if [[ $(GIT_BRANCH) = $(BRANCH_MASTER) ]]; then\
|
|
|
|
mkdir -p $(TMP_DATA_DIR); \
|
|
|
|
cd $(TMP_DATA_DIR); \
|
|
|
|
git clone https://git.pandaminer.com/ox/$(CONFIGFILES_PROJECT_NAME); \
|
|
|
|
cd $(CONFIGFILES_PROJECT_NAME); \
|
|
|
|
echo currDir:; \
|
|
|
|
pwd; \
|
|
|
|
git fetch; \
|
|
|
|
git checkout $(GIT_BRANCH); \
|
|
|
|
git reset --hard origin/$(GIT_BRANCH); \
|
|
|
|
cd ../..; \
|
|
|
|
echo currDir:; \
|
|
|
|
pwd; \
|
|
|
|
cp ./$(TMP_DATA_DIR)/$(CONFIGFILES_PROJECT_NAME)/$(CURR_MODEL_NAME)/pack/.service.config.yaml ./pack/.service.config.yaml; \
|
|
|
|
else \
|
|
|
|
echo !!!!! no configfiles process in branch $(GIT_BRANCH) !!!!!!; \
|
|
|
|
fi |
|
|
|
|
|
|
|
build: buildquick |
|
|
|
|
|
|
|