Commit fdf9784d authored by David Mendez's avatar David Mendez
Browse files

CI: add deployment to prod hh

parent 1bccaa63
......@@ -42,23 +42,6 @@ build:
- docker build --tag ${SERVER_IMAGE_TAG} .
- docker push ${SERVER_IMAGE_TAG}
# build-prod:
# image:
# name: docker/compose:1.25.5
# entrypoint: ["/bin/sh", "-c"]
# stage: build
# only:
# - master
# # - master
# variables:
# DOCKER_HOST: tcp://docker:2375
# script:
# - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
# - echo Building ${DOCKER_IMAGE}:${CI_COMMIT_SHORT_SHA}
# - docker-compose build production
# - echo Deploying ${DOCKER_IMAGE}:${CI_COMMIT_SHORT_SHA}
# - docker push ${DOCKER_IMAGE}:${CI_COMMIT_SHORT_SHA}
unit-tests:
stage: test
script:
......@@ -155,7 +138,7 @@ deploy-prod-hx:
- kubectl config use-context ${CHEMBL_NS_PROD}
- echo ${CHEMBL_NS_PROD} ${KUBE_URL_HX} ${KUBE_CLUS_NAME_HX} ${KUBE_USER_HX}
- kubectl get pods -n ${CHEMBL_NS_PROD}
- kubectl create secret generic ${RUN_CONFIG_SECRET_NAME_PROD_HX} --from-file=.env=${ENV_PROD_HX_FILE_PATH} -o yaml -n ${CHEMBL_NS_PROD} --dry-run=client | kubectl apply -f -
- kubectl create secret generic ${RUN_CONFIG_SECRET_NAME_PROD_HX} --from-file=.env=${ENV_PROD_HX_FILE_PATH} -o yaml -n ${CHEMBL_NS_PROD} --dry-run=client | kubectl replace -f -
- cat ${ENV_PROD_HX_FILE_PATH}
- echo ${CHEMBL_NS_PROD} ${KUBE_URL_HX} ${KUBE_CLUS_NAME_HX} ${KUBE_USER_HX}
- kubectl get pods -n ${CHEMBL_NS_PROD}
......@@ -169,28 +152,32 @@ deploy-prod-hx:
- cat ${INGRESS_PROD_HX_FILE_PATH}
- kubectl apply -n ${CHEMBL_NS_PROD} -f ${INGRESS_PROD_HX_FILE_PATH}
# deploy-prod-hh:
# image:
# name: lachlanevenson/k8s-kubectl:latest
# entrypoint: ["/bin/sh", "-c"]
# stage: deploy
# script:
# - echo $KUBE_URL_HH
# - echo "$KUBE_CA_PEM_HH" > "$(pwd)/kube.ca.pem"
# - kubectl config set-cluster ${KUBE_CLUS_NAME_HH} --server="${KUBE_URL_HH}" --certificate-authority="$(pwd)/kube.ca.pem"
# - kubectl config set-credentials ${KUBE_USER_HH} --token="${KUBE_TOKEN_HH}"
# - kubectl config set-context ${KUBE_NAMESPACE_PROD} --cluster=${KUBE_CLUS_NAME_HH} --user=${KUBE_USER_HH}
# - kubectl config use-context ${KUBE_NAMESPACE_PROD}
# - echo ${KUBE_NAMESPACE_DEV} ${KUBE_URL_HH} ${KUBE_CLUS_NAME_HH} ${KUBE_USER_HH}
# - kubectl get pods -n ${KUBE_NAMESPACE_PROD}
# - sed -i "s~<VERSION>~${CI_COMMIT_SHORT_SHA}~" k8s-deployment.yml
# - sed -i "s~<DOCKER_IMAGE>~${DOCKER_IMAGE}~" k8s-deployment.yml
# - kubectl apply -n ${KUBE_NAMESPACE_PROD} -f k8s-deployment.yml
# when: manual
# only:
# - master
# after_script:
# - echo "End of script"
deploy-prod-hh:
image:
name: lachlanevenson/k8s-kubectl:latest
entrypoint: ["/bin/sh", "-c"]
stage: deploy
only:
- master
script:
- set -x
- echo "$KUBE_CA_PEM_HH" > "$(pwd)/kube.ca.pem"
- kubectl config set-cluster ${KUBE_CLUS_NAME_HH} --server="${KUBE_URL_HH}" --certificate-authority="$(pwd)/kube.ca.pem"
- kubectl config set-credentials ${KUBE_USER_HH} --token="${KUBE_TOKEN_HH}"
- kubectl config set-context ${CHEMBL_NS_PROD} --cluster=${KUBE_CLUS_NAME_HH} --user=${KUBE_USER_HH}
- kubectl config use-context ${CHEMBL_NS_PROD}
- echo ${CHEMBL_NS_PROD} ${KUBE_URL_HH} ${KUBE_CLUS_NAME_HH} ${KUBE_USER_HH}
- kubectl get pods -n ${CHEMBL_NS_PROD}
- kubectl create secret generic ${RUN_CONFIG_SECRET_NAME_PROD_HH} --from-file=.env=${ENV_PROD_HH_FILE_PATH} -o yaml -n ${CHEMBL_NS_PROD} --dry-run=client | kubectl apply -f -
- cat ${ENV_PROD_HH_FILE_PATH}
- echo ${CHEMBL_NS_PROD} ${KUBE_URL_HH} ${KUBE_CLUS_NAME_HH} ${KUBE_USER_HH}
- kubectl get pods -n ${CHEMBL_NS_PROD}
- sed -i "s~<SERVER_IMAGE_TAG>~${SERVER_IMAGE_TAG}~" k8s-deployment.yml
- sed -i "s~<HTTP_PROXY>~${HTTP_PROXY_HH}~g" k8s-deployment.yml
- sed -i "s~<HTTPS_PROXY>~${HTTPS_PROXY_HH}~g" k8s-deployment.yml
- sed -i "s~<NO_PROXY>~${NO_PROXY_HH_DEFAULT}~g" k8s-deployment.yml
- sed -i "s~<ENV_SECRET_NAME>~${RUN_CONFIG_SECRET_NAME_PROD_HH}~g" k8s-deployment.yml
- cat k8s-deployment.yml
- kubectl apply -n ${CHEMBL_NS_PROD} -f k8s-deployment.yml
- cat ${INGRESS_PROD_HH_FILE_PATH}
- kubectl apply -n ${CHEMBL_NS_PROD} -f ${INGRESS_PROD_HH_FILE_PATH}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment