-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy path.gitlab-ci.yml
109 lines (100 loc) · 3.29 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
stages:
- deploy
.deploy_steps: &deploy_steps
script:
- kubectl config use-context RNAcentral/rnacentral-webcode:$AGENT
- kubectl config set-context --current --namespace=$NAMESPACE
- cd kubernetes/helm
- helm uninstall full-$NAMESPACE --namespace $NAMESPACE
- sleep 10
- |
if [ "$COLLECTSTATIC" == "yes" ]; then
kubectl apply -f ../static-volume-cleanup.yaml
until [[ $(kubectl get pod static-volume-cleanup-pod -o jsonpath='{.status.phase}' 2>/dev/null) == "Succeeded" ]]; do
echo "Waiting for static-volume-cleanup-pod to complete..."
sleep 10
done
kubectl delete -f ../static-volume-cleanup.yaml
fi
- helm upgrade --install full-$NAMESPACE --namespace $NAMESPACE --values=$VALUES_FILE --set proxy=$PROXY,database=$DATABASE,searchIndex=$SEARCH_INDEX,rnacentralBranch=$RNACENTRAL_BRANCH,rnacentralReplicas=1 .
- |
if [ "$RNACENTRAL_REPLICAS" -gt 1 ]; then
if [ "$COLLECTSTATIC" == "yes" ]; then
sleep 120
fi
kubectl scale deploy rnacentral --replicas=$RNACENTRAL_REPLICAS
fi
.variables_prod: &variables_prod
variables:
AGENT: "agent-hh"
NAMESPACE: "prod"
VALUES_FILE: "values.yaml"
PROXY: "proxy-hh"
DATABASE: "db-hh"
SEARCH_INDEX: "search-index-prod"
RNACENTRAL_BRANCH: "$CI_COMMIT_REF_NAME" # use the branch that triggered the pipeline
RNACENTRAL_REPLICAS: "12"
.variables_fallback: &variables_fallback
variables:
AGENT: "agent-hx"
NAMESPACE: "prod"
VALUES_FILE: "values.fallback.yaml"
PROXY: "proxy-hx"
DATABASE: "db-fb"
SEARCH_INDEX: "search-index-prod"
RNACENTRAL_BRANCH: "master"
RNACENTRAL_REPLICAS: "6"
.variables_test: &variables_test
variables:
AGENT: "agent-hh"
NAMESPACE: "dev"
VALUES_FILE: "values.dev.yaml"
PROXY: "proxy-hh"
DATABASE: "db-pro"
SEARCH_INDEX: "search-index-dev"
RNACENTRAL_BRANCH: "$CI_COMMIT_REF_NAME" # use the branch that triggered the pipeline
RNACENTRAL_REPLICAS: "1"
# Automatic deployment to the fallback website when the master branch is updated
fallback_prod_website:
stage: deploy
image:
name: rnacentral/rnacentral-ci-cd
<<: [*deploy_steps, *variables_fallback]
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
changes:
- rnacentral/**/*
# Automatic deployment to the testing website when any branch is updated
test_website:
stage: deploy
image:
name: rnacentral/rnacentral-ci-cd
<<: [*deploy_steps, *variables_test]
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
changes:
- rnacentral/**/*
manual_deployment_to_production:
stage: deploy
image:
name: rnacentral/rnacentral-ci-cd
<<: [*deploy_steps, *variables_prod]
rules:
- if: '$CI_PIPELINE_SOURCE == "web" && $DEPLOY == "prod"'
when: manual
manual_deployment_to_fallback:
stage: deploy
image:
name: rnacentral/rnacentral-ci-cd
<<: [*deploy_steps, *variables_fallback]
rules:
- if: '$CI_PIPELINE_SOURCE == "web" && $DEPLOY == "fallback"'
when: manual
manual_deployment_to_test:
stage: deploy
image:
name: rnacentral/rnacentral-ci-cd
<<: [*deploy_steps, *variables_test]
rules:
- if: '$CI_PIPELINE_SOURCE == "web" && $DEPLOY == "test"'
when: manual