-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
111 lines (103 loc) · 3.55 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
image: docker:stable
services:
- docker:stable-dind
variables:
DOCKER_DRIVER: overlay
DOCKER_TLS_CERTDIR: ""
stages:
- package
- deploy
docker-build-dev:
stage: package
only:
- /^dev-.*$/
except:
- branches
- triggers
script:
- docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --build-arg configuration=dev --build-arg basePath=/ena/dev/submit/webin/ .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
tags:
- ena-dcap-gitlab-runner
docker-build-test:
stage: package
only:
- /^test-.*$/
except:
- triggers
script:
- docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --build-arg configuration=test --build-arg basePath=/ena/submit/webin/ .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
tags:
- ena-dcap-gitlab-runner
docker-build-prod:
stage: package
only:
- /^(\d+\.)?(\d+\.)?(\*|\d+)$/
except:
- branches
- triggers
script:
- docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --build-arg configuration=production --build-arg basePath=/ena/submit/webin/ .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
tags:
- ena-dcap-gitlab-runner
k8s-deploy-dev:
image: dtzar/helm-kubectl:3.11.0
stage: deploy
only:
- /^dev-.*$/
except:
- branches
- triggers
script:
- sed -i s#%DOCKER_IMAGE%#$CI_REGISTRY_IMAGE\:$CI_COMMIT_TAG#g Kubernetes-dev-deploy.yaml
- kubectl config set-cluster ena-cluster --server="${K8_HX_SERVER}"
- kubectl config set clusters.ena-cluster.certificate-authority-data ${K8_HX_CERTIFICATE_AUTHORITY_DATA}
- kubectl config set-credentials ena-user --token="${K8_HX_CREDENTIALS}"
- kubectl config set-context ena-context --cluster=ena-cluster --user=ena-user
- kubectl config use-context ena-context
- kubectl apply -f Kubernetes-dev-deploy.yaml --namespace=ena-dev
tags:
- ena-dcap-gitlab-runner
when: manual
k8s-deploy-test:
image: dtzar/helm-kubectl:3.11.0
stage: deploy
only:
- /^test-.*$/
except:
- triggers
script:
- sed -i s#%DOCKER_IMAGE%#$CI_REGISTRY_IMAGE\:$CI_COMMIT_TAG#g Kubernetes-test-deploy.yaml
- kubectl config set-cluster ena-cluster --server="${K8_HX_SERVER}"
- kubectl config set clusters.ena-cluster.certificate-authority-data ${K8_HX_CERTIFICATE_AUTHORITY_DATA}
- kubectl config set-credentials ena-user --token="${K8_HX_CREDENTIALS}"
- kubectl config set-context ena-context --cluster=ena-cluster --user=ena-user
- kubectl config use-context ena-context
- kubectl apply -f Kubernetes-test-deploy.yaml --namespace=ena-test
tags:
- ena-dcap-gitlab-runner
when: manual
k8s-deploy-prod:
image: dtzar/helm-kubectl:3.11.0
stage: deploy
only:
- /^(\d+\.)?(\d+\.)?(\*|\d+)$/
except:
- branches
- triggers
script:
- sed -i s#%DOCKER_IMAGE%#$CI_REGISTRY_IMAGE\:$CI_COMMIT_TAG#g Kubernetes-prod-deploy.yaml
- kubectl config set-cluster ena-cluster --server="${K8_HX_SERVER}"
- kubectl config set clusters.ena-cluster.certificate-authority-data ${K8_HX_CERTIFICATE_AUTHORITY_DATA}
- kubectl config set-credentials ena-user --token="${K8_HX_CREDENTIALS}"
- kubectl config set-context ena-context --cluster=ena-cluster --user=ena-user
- kubectl config use-context ena-context
- kubectl apply -f Kubernetes-prod-deploy.yaml --namespace=ena-prod
tags:
- ena-dcap-gitlab-runner
when: manual