-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.gitlab-ci.yml
86 lines (79 loc) · 2.35 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
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
DOCKER_TAG: $CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:$DOCKER_TAG
DOCKER_PULL_SECRET: docker-registry-secret
DOCKER_AUTH_CONFIG: $DOCKER_CONFIG_JSON
stages:
- build
- deploy
build_docker_image:
image: docker:latest
services:
- docker:dind
stage: build
script:
- echo "$CI_DEPLOY_PASSWORD" | docker login $CI_REGISTRY -u $CI_DEPLOY_USER --password-stdin
- echo $DOCKER_IMAGE_NAME
- docker build -t $DOCKER_IMAGE_NAME .
- docker push $DOCKER_IMAGE_NAME
after_script:
- docker logout ${CI_REGISTRY}
deploy_dev:
variables:
NAMESPACE: biosamples-dev
HOST: wwwint.ebi.ac.uk
environment:
name: dev
url: https://wwwint.ebi.ac.uk/biosamples/biovalidator
when: manual
extends: .kube_deploy_script
deploy_test:
variables:
NAMESPACE: biosamples-test
HOST: wwwdev.ebi.ac.uk
environment:
name: test
url: https://wwwdev.ebi.ac.uk/biosamples/biovalidator
only:
- main
- dev
when: manual
extends: .kube_deploy_script
deploy_prod:
variables:
NAMESPACE: biosamples-prod
HOST: www.ebi.ac.uk
environment:
name: prod
url: https://www.ebi.ac.uk/biosamples/biovalidator
only:
- main
when: manual
extends: .kube_deploy_script
# todo discuss: do we need AIT biovalidator to share with others?
# todo discuss: what are the options to make biosamples internal only: remove ingress and make service=ClusterIP?
#deploy_prod_ait:
# variables:
# NAMESPACE: ait-prod
# HOST: www.ebi.ac.uk
# environment:
# name: prod-ait
# url: https://www.ebi.ac.uk/ait/biovalidator
# when: manual
# extends: .kube_deploy_script
.kube_deploy_script:
stage: deploy
image: dtzar/helm-kubectl
script:
- kubectl create namespace $NAMESPACE || true
- kubectl config set-context --current --namespace=${NAMESPACE}
- kubectl delete secret $DOCKER_PULL_SECRET || true
- kubectl create secret docker-registry $DOCKER_PULL_SECRET --docker-server=$CI_REGISTRY --docker-username=$CI_DEPLOY_USER --docker-password=$CI_DEPLOY_PASSWORD
- envsubst < deployment.yaml > kubernetes.yaml
- kubectl apply -f kubernetes.yaml
- envsubst < ingress_template.yaml > ingress.yaml
- cat ingress.yaml
- kubectl apply -f ingress.yaml
- kubectl rollout restart deployments biovalidator