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

CI: start to create step to deploy to prod hx

parent c670e931
......@@ -27,7 +27,7 @@ stages:
- deploy_to_staging
- test_staging
- prepare_config_hx
# - deploy_to_prod_hx
- deploy_to_prod_hx
# - test_prod_hx
# - prepare_config_hh
# - deploy_to_prod_hh
......@@ -182,48 +182,46 @@ prepare_config_prod_hx:
paths:
- ${CONFIG_PROD_HX_FILE_PATH}
- ${CONFIG_GUNICORN_PROD_HX_FILE_PATH}
#
#deploy_to_prod_hx:
# stage: deploy_to_prod_hx
# image:
# name: lachlanevenson/k8s-kubectl:latest
# entrypoint: ["/bin/sh", "-c"]
# only:
# - master
# except:
# - schedules
# environment:
# name: prod_hx
# script:
# - set -x
# - echo "$KUBE_CA_PEM_HX" > "$(pwd)/kube.ca.pem"
# - kubectl config set-cluster ${KUBE_CLUS_NAME_HX} --server="${KUBE_URL_HX}" --certificate-authority="$(pwd)/kube.ca.pem"
# - kubectl config set-credentials ${KUBE_USER_HX} --token="${KUBE_TOKEN_HX}"
# - kubectl config set-context ${CHEMBL_NS_PROD} --cluster=${KUBE_CLUS_NAME_HX} --user=${KUBE_USER_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 ${ID_RSA_SECRET_NAME_PROD_HX} --from-file=ID_RSA_LSF=${ID_RSA_LSF_HX} -o yaml -n ${CHEMBL_NS_PROD} --dry-run | kubectl replace -f -
# - kubectl create secret generic ${RUN_CONFIG_SECRET_NAME_PROD_HX} --from-file=RUN_CONFIG.yml=${CONFIG_PROD_HX_FILE_PATH} -o yaml -n ${CHEMBL_NS_PROD} --dry-run | kubectl replace -f -
# - kubectl create secret generic ${GUNICORN_CONFIG_SECRET_NAME_PROD_HX} --from-file=GUNICORN_CONFIG.py=${CONFIG_GUNICORN_PROD_HX_FILE_PATH} -o yaml -n ${CHEMBL_NS_PROD} --dry-run | kubectl replace -f -
# - cat ${CONFIG_PROD_HX_FILE_PATH}
# - cat ${CONFIG_GUNICORN_PROD_HX_FILE_PATH}
# - sed -i "s~<NAMESPACE>~${CHEMBL_NS_PROD}~" k8s-deployment.yaml
# - sed -i "s~<NUM_REPLICAS>~${NUM_REPLICAS_PROD_HX}~" k8s-deployment.yaml
# - sed -i "s~<UID>~${CBL_ADM_UID}~" k8s-deployment.yaml
# - sed -i "s~<GID>~${CBL_PUB_GID}~" k8s-deployment.yaml
# - sed -i "s~<SERVER_IMAGE_TAG>~${SERVER_IMAGE_TAG}~" k8s-deployment.yaml
# - sed -i "s~<STATUS_DAEMON_IMAGE_TAG>~${STATUS_DAEMON_IMAGE_TAG}~" k8s-deployment.yaml
# - sed -i "s~<NFS_MOUNT_PATH>~${NFS_MOUNT_PATH_PROD_HX}~" k8s-deployment.yaml
# - sed -i "s~<NFS_FQDN>~${NFS_FQDN_HX}~" k8s-deployment.yaml
# - sed -i "s~<NFS_PATH>~${NFS_PATH_HX}~" k8s-deployment.yaml
# - sed -i "s~<ID_RSA_SECRET_NAME>~${ID_RSA_SECRET_NAME_PROD_HX}~" k8s-deployment.yaml
# - sed -i "s~<RUN_CONFIG_SECRET_NAME>~${RUN_CONFIG_SECRET_NAME_PROD_HX}~" k8s-deployment.yaml
# - sed -i "s~<GUNICORN_CONFIG_SECRET_NAME>~${GUNICORN_CONFIG_SECRET_NAME_PROD_HX}~" k8s-deployment.yaml
# - cat k8s-deployment.yaml
# - kubectl apply -n ${CHEMBL_NS_PROD} -f k8s-deployment.yaml
# - kubectl get pods -n ${CHEMBL_NS_PROD}
#
deploy_to_prod_hx:
stage: deploy_to_prod_hx
image:
name: lachlanevenson/k8s-kubectl:latest
entrypoint: ["/bin/sh", "-c"]
only:
- master
environment:
name: prod_hx
script:
- set -x
- echo "$KUBE_CA_PEM_HX" > "$(pwd)/kube.ca.pem"
- kubectl config set-cluster ${KUBE_CLUS_NAME_HX} --server="${KUBE_URL_HX}" --certificate-authority="$(pwd)/kube.ca.pem"
- kubectl config set-credentials ${KUBE_USER_HX} --token="${KUBE_TOKEN_HX}"
- kubectl config set-context ${CHEMBL_NS_PROD} --cluster=${KUBE_CLUS_NAME_HX} --user=${KUBE_USER_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=RUN_CONFIG.yml=${CONFIG_PROD_HX_FILE_PATH} -o yaml -n ${CHEMBL_NS_PROD} --dry-run | kubectl apply -f -
- exit 0
- kubectl create secret generic ${GUNICORN_CONFIG_SECRET_NAME_PROD_HX} --from-file=GUNICORN_CONFIG.py=${CONFIG_GUNICORN_PROD_HX_FILE_PATH} -o yaml -n ${CHEMBL_NS_PROD} --dry-run | kubectl replace -f -
- cat ${CONFIG_PROD_HX_FILE_PATH}
- cat ${CONFIG_GUNICORN_PROD_HX_FILE_PATH}
- sed -i "s~<NAMESPACE>~${CHEMBL_NS_PROD}~" k8s-deployment.yaml
- sed -i "s~<NUM_REPLICAS>~${NUM_REPLICAS_PROD_HX}~" k8s-deployment.yaml
- sed -i "s~<UID>~${CBL_ADM_UID}~" k8s-deployment.yaml
- sed -i "s~<GID>~${CBL_PUB_GID}~" k8s-deployment.yaml
- sed -i "s~<SERVER_IMAGE_TAG>~${SERVER_IMAGE_TAG}~" k8s-deployment.yaml
- sed -i "s~<STATUS_DAEMON_IMAGE_TAG>~${STATUS_DAEMON_IMAGE_TAG}~" k8s-deployment.yaml
- sed -i "s~<NFS_MOUNT_PATH>~${NFS_MOUNT_PATH_PROD_HX}~" k8s-deployment.yaml
- sed -i "s~<NFS_FQDN>~${NFS_FQDN_HX}~" k8s-deployment.yaml
- sed -i "s~<NFS_PATH>~${NFS_PATH_HX}~" k8s-deployment.yaml
- sed -i "s~<ID_RSA_SECRET_NAME>~${ID_RSA_SECRET_NAME_PROD_HX}~" k8s-deployment.yaml
- sed -i "s~<RUN_CONFIG_SECRET_NAME>~${RUN_CONFIG_SECRET_NAME_PROD_HX}~" k8s-deployment.yaml
- sed -i "s~<GUNICORN_CONFIG_SECRET_NAME>~${GUNICORN_CONFIG_SECRET_NAME_PROD_HX}~" k8s-deployment.yaml
- cat k8s-deployment.yaml
- kubectl apply -n ${CHEMBL_NS_PROD} -f k8s-deployment.yaml
- kubectl get pods -n ${CHEMBL_NS_PROD}
#functional_tests_prod_hx:
# stage: test_prod_hx
# image:
......
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