Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ChEMBL
C
ChEMBL
Delayed Jobs
Delayed Jobs API
Commits
073bed41
Commit
073bed41
authored
Oct 13, 2020
by
David Mendez
Browse files
Try a DAG for the CI
parent
30c0764f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
87 deletions
+96
-87
.gitlab-ci.yml
.gitlab-ci.yml
+96
-87
No files found.
.gitlab-ci.yml
View file @
073bed41
...
...
@@ -35,15 +35,18 @@ stages:
-
build
-
prepare_config_tests
-
test_and_qa
-
prepare_config_staging
-
deploy_to_staging
-
test_staging
-
deploy_to_prod_hx
# - prepare_config_staging
# - deploy_to_staging
# - test_staging
# - prepare_config_hx
# - deploy_to_prod_hx
# - test_prod_hx
-
prepare_config_hh
# - prepare_config_hh
# - deploy_to_prod_hh
# - test_prod_hh
-
deploy_to_prod_hh
-
test_prod_hh
-
functional_tests_prod_public
-
schedules
...
...
@@ -135,7 +138,7 @@ unit_tests:
# Deployment to staging
# ----------------------------------------------------------------------------------------------------------------------
prepare_config_staging
:
stage
:
prepare_config
_staging
stage
:
deploy_to
_staging
image
:
name
:
alpine/git
entrypoint
:
[
"
/bin/sh"
,
"
-c"
]
...
...
@@ -157,6 +160,7 @@ prepare_config_staging:
deploy_to_staging
:
stage
:
deploy_to_staging
needs
:
[
'
prepare_config_staging'
]
image
:
name
:
lachlanevenson/k8s-kubectl:latest
entrypoint
:
[
"
/bin/sh"
,
"
-c"
]
...
...
@@ -208,7 +212,8 @@ deploy_to_staging:
# Test staging
# ----------------------------------------------------------------------------------------------------------------------
functional_tests
:
stage
:
test_staging
stage
:
deploy_to_staging
needs
:
[
'
deploy_to_staging'
]
image
:
name
:
$SERVER_IMAGE_TAG
entrypoint
:
[
"
"
]
...
...
@@ -227,87 +232,89 @@ functional_tests:
# ----------------------------------------------------------------------------------------------------------------------
# Deployment to prod hx
# ----------------------------------------------------------------------------------------------------------------------
#prepare_config_prod_hx:
# stage: prepare_config_hx
# image:
# name: alpine/git
# entrypoint: ["/bin/sh", "-c"]
# only:
# - master
# except:
# - schedules
# script:
# - rm -rf ${CONFIGS_FOLDER} || true
# - mkdir -p ${CONFIGS_FOLDER}
# - git clone https://${CONFIG_DEPLOY_GITLAB_USERNAME}:${CONFIG_DEPLOY_GITLAB_TOKEN}@${CONFIGURATIONS_REPO} ${CONFIGS_FOLDER}
# artifacts:
# paths:
# - ${CONFIG_PROD_HX_FILE_PATH}
# - ${CONFIG_GUNICORN_PROD_HX_FILE_PATH}
# - ${INGRESS_PROD_HX_FILE_PATH}
# - ${AUTOSCALER_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~<CPU_LIMIT>~${CPU_LIMIT_PROD_HX}~" k8s-deployment.yaml
# - sed -i "s~<CPU_REQUESTED>~${CPU_REQUESTED_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}
# - cat ${INGRESS_PROD_HX_FILE_PATH}
# - kubectl apply -n ${CHEMBL_NS_PROD} -f ${INGRESS_PROD_HX_FILE_PATH}
# - kubectl describe ingress -n ${CHEMBL_NS_PROD}
# - cat ${AUTOSCALER_PROD_HX_FILE_PATH}
# - kubectl apply -n ${CHEMBL_NS_PROD} -f ${AUTOSCALER_PROD_HX_FILE_PATH}
#
#functional_tests_prod_hx:
# stage: test_prod_hx
# image:
# name: $SERVER_IMAGE_TAG
# entrypoint: [""]
# only:
# - master
# except:
# - schedules
# script:
# - set -x
# - sleep 30 # Give some time for the deployment to take effect.
# - functional_tests/run_functional_tests.py ${SERVER_URL_PROD_HX} ${DJ_SERVER_ADMIN_USERNAME_PROD_HX} ${DJ_SERVER_ADMIN_PASSWORD_PROD_HX}
prepare_config_prod_hx
:
stage
:
deploy_to_prod_hx
image
:
name
:
alpine/git
entrypoint
:
[
"
/bin/sh"
,
"
-c"
]
only
:
-
master
except
:
-
schedules
script
:
-
rm -rf ${CONFIGS_FOLDER} ||
true
-
mkdir -p ${CONFIGS_FOLDER}
-
git clone https://${CONFIG_DEPLOY_GITLAB_USERNAME}:${CONFIG_DEPLOY_GITLAB_TOKEN}@${CONFIGURATIONS_REPO} ${CONFIGS_FOLDER}
artifacts
:
paths
:
-
${CONFIG_PROD_HX_FILE_PATH}
-
${CONFIG_GUNICORN_PROD_HX_FILE_PATH}
-
${INGRESS_PROD_HX_FILE_PATH}
-
${AUTOSCALER_PROD_HX_FILE_PATH}
deploy_to_prod_hx
:
stage
:
deploy_to_prod_hx
needs
:
[
'
prepare_config_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~<CPU_LIMIT>~${CPU_LIMIT_PROD_HX}~" k8s-deployment.yaml
-
sed -i "s~<CPU_REQUESTED>~${CPU_REQUESTED_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}
-
cat ${INGRESS_PROD_HX_FILE_PATH}
-
kubectl apply -n ${CHEMBL_NS_PROD} -f ${INGRESS_PROD_HX_FILE_PATH}
-
kubectl describe ingress -n ${CHEMBL_NS_PROD}
-
cat ${AUTOSCALER_PROD_HX_FILE_PATH}
-
kubectl apply -n ${CHEMBL_NS_PROD} -f ${AUTOSCALER_PROD_HX_FILE_PATH}
functional_tests_prod_hx
:
stage
:
deploy_to_prod_hx
needs
:
[
'
deploy_to_prod_hx'
]
image
:
name
:
$SERVER_IMAGE_TAG
entrypoint
:
[
"
"
]
only
:
-
master
except
:
-
schedules
script
:
-
set -x
-
sleep
30
# Give some time for the deployment to take effect.
-
functional_tests/run_functional_tests.py ${SERVER_URL_PROD_HX} ${DJ_SERVER_ADMIN_USERNAME_PROD_HX} ${DJ_SERVER_ADMIN_PASSWORD_PROD_HX}
# ----------------------------------------------------------------------------------------------------------------------
# Deployment to prod hh
...
...
@@ -334,6 +341,7 @@ prepare_config_prod_hh:
deploy_to_prod_hh
:
stage
:
deploy_to_prod_hh
needs
:
[
'
prepare_config_prod_hh'
]
image
:
name
:
lachlanevenson/k8s-kubectl:latest
entrypoint
:
[
"
/bin/sh"
,
"
-c"
]
...
...
@@ -382,6 +390,7 @@ deploy_to_prod_hh:
functional_tests_prod_hh
:
stage
:
test_prod_hh
needs
:
[
'
deploy_to_prod_hh'
]
image
:
name
:
$SERVER_IMAGE_TAG
entrypoint
:
[
"
"
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment