-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
127 lines (112 loc) · 3.91 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:latest
services:
- docker:dind
stages:
- sandbox-build-migration
- prod-build
- docker-build
- docker-build-release
- deploy-sandbox-migration
- deploy-production
- deploy-fallback
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
CI_REGISTRY_IMAGE: ebispot/gwas-curation-ui
CURATION_UI_SERVICE_NAME: gwas-curation-ui
sandbox-build-migration:
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node:14.15.5
stage: sandbox-build-migration
script:
- npm -v
- node -v
- rm -rf node_modules
- npm install
- CI=false npm run build -- --base-href=/gwas/depo-curation/ --configuration sandbox-migration
artifacts:
paths:
- dist/gwas-curation-ui/*
only:
- develop
prod-build:
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node:14.15.5
stage: prod-build
script:
- npm -v
- node -v
- rm -rf node_modules
- npm install
- CI=false npm run build -- --base-href=/gwas/depo-curation/ --configuration production
artifacts:
paths:
- dist/gwas-curation-ui/*
except:
- tags
- develop
- curation-477-sandbox-migration
docker-build:
stage: docker-build
script:
- echo "$DOCKER_HUB_PASSWORD" > dhpw.txt
- docker login -u "${DOCKER_HUB_USER}" --password-stdin < dhpw.txt
- docker build --force-rm=true -t $CURATION_UI_SERVICE_NAME:latest .
- docker tag $CURATION_UI_SERVICE_NAME:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
except:
- tags
docker-build-release:
variables:
GIT_STRATEGY: none
stage: docker-build-release
script:
- echo "$DOCKER_HUB_PASSWORD" > dhpw.txt
- docker login -u "${DOCKER_HUB_USER}" --password-stdin < dhpw.txt
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
- docker push $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
only:
- tags
deploy-sandbox-migration:
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/dtzar/helm-kubectl:2.13.1
stage: deploy-sandbox-migration
script:
- echo "Deploy to sandbox server"
- mkdir -p /root/.kube
- echo ${PLIVE_KUBECONFIG} | base64 -d > /root/.kube/config
- helm init --stable-repo-url https://charts.helm.sh/stable
- helm delete --purge gwas-curation-ui-dev || true
- helm install --name gwas-curation-ui-dev --set k8Namespace=gwas-dev,service.name=gwas-curation-ui-dev,ingress.name=curation-ui-ingress-dev,image.repository=$CI_REGISTRY_IMAGE,image.tag=$CI_COMMIT_SHA ./k8chart/ --wait
environment:
name: sandbox-migration
only:
- develop
deploy-fallback:
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/dtzar/helm-kubectl:2.13.1
stage: deploy-fallback
script:
- echo "Deploy to Production fallback server"
- mkdir -p /root/.kube
- echo ${PFALLBACK_KUBECONFIG} | base64 -d > /root/.kube/config
- helm init --stable-repo-url https://charts.helm.sh/stable
- helm delete --purge gwas-curation-ui || true
- helm install --name gwas-curation-ui --set k8Namespace=gwas,replicaCount=1,image.repository=$CI_REGISTRY_IMAGE,image.tag=$CI_COMMIT_TAG ./k8chart/ --wait
environment:
name: production
only:
- tags
deploy-production:
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/dtzar/helm-kubectl:2.13.1
stage: deploy-production
script:
- echo "Deploy to Production server"
- mkdir -p /root/.kube
- echo ${PLIVE_KUBECONFIG} | base64 -d > /root/.kube/config
- helm init --stable-repo-url https://charts.helm.sh/stable
- helm delete --purge gwas-curation-ui || true
- helm install --name gwas-curation-ui --set k8Namespace=gwas,replicaCount=1,image.repository=$CI_REGISTRY_IMAGE,image.tag=$CI_COMMIT_TAG ./k8chart/ --wait
environment:
name: production
only:
- tags