-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.gitlab-ci.yml
92 lines (82 loc) · 2.11 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
stages:
- build
- deploy
variables:
DOCKER_IMAGE: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}
DOCKER_TLS_CERTDIR: ""
PUBLIC_PATH: /api/docs
.build:
stage: build
image: docker
services:
- docker:dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker build -t ${DOCKER_IMAGE} --build-arg PUBLIC_PATH=${PUBLIC_PATH} --no-cache .
- docker push ${DOCKER_IMAGE}
- docker rmi ${DOCKER_IMAGE}
- docker logout $CI_REGISTRY
.deploy:
stage: deploy
image: dockerhub.ebi.ac.uk/ensembl-web/deploy-tools:latest
before_script:
- kubectl config use-context ${AGENT}
- kubectl config set-context --current --namespace=${NS}
script:
- git clone https://gitlab.ebi.ac.uk/ensembl-web/ensembl-k8s-manifests.git
- git -C ensembl-k8s-manifests/ checkout k8s123-migration
- cd ensembl-k8s-manifests/help-and-docs
- kustomize edit set image DOCKER_IMAGE=${DOCKER_IMAGE}
- kubectl apply -k ./
.deploy-template: &deploy-rules
rules:
- if: '$CI_DEPLOY_FREEZE == null && $CI_COMMIT_BRANCH == "main"'
when: always
build:
extends: .build
# Live (production) deployment: beta.ensembl.org
Live:
extends: .deploy
<<: *deploy-rules
environment:
name: production
variables:
AGENT: ${PROD_AGENT}
NS: ${PROD_NS}
# Fallback deployment for the live (production) deployment: beta.ensembl.org (Hinxton)
LiveFallback:
extends: .deploy
<<: *deploy-rules
environment:
name: fallback
variables:
AGENT: ${FALLBACK_AGENT}
NS: ${FALLBACK_NS}
# Staging deployment: staging-2020.ensembl.org
Staging:
extends: .deploy
<<: *deploy-rules
environment:
name: staging
variables:
AGENT: ${STAGING_AGENT}
NS: ${STAGING_NS}
# Internal deployment: internal-2020.ensembl.org
Internal:
extends: .deploy
<<: *deploy-rules
environment:
name: internal
variables:
AGENT: ${INTERNAL_AGENT}
NS: ${INTERNAL_NS}
# Development deployment: dev-2020.ensembl.org
Dev:
extends: .deploy
<<: *deploy-rules
environment:
name: development
variables:
AGENT: ${DEV_AGENT}
NS: ${DEV_NS}