-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
95 lines (87 loc) · 3.43 KB
/
.gitlab-ci.yml
File metadata and controls
95 lines (87 loc) · 3.43 KB
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
image: docker:latest
services:
- docker:dind
stages:
- build
- docker
- docker-release
- deploy-sandbox
- deploy-fallback
- deploy-live
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
AUDIT_REGISTRY_IMAGE: ebispot/gwas-deposition-audit
AUDIT_SERVICE_NAME: gwas-deposition-audit
maven-build:
image: maven:3-jdk-8
stage: build
script:
- echo ${MAVEN_SETTINGS} | base64 -d > settings.xml
- mvn -s settings.xml clean install -B -Dspring.profiles.active=test -DskipTests=true -Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true
artifacts:
paths:
- target/*.jar
build-audit-container:
stage: docker
script:
- echo "$DOCKER_HUB_PASSWORD" > dhpw.txt
- docker login -u "${DOCKER_HUB_USER}" --password-stdin < dhpw.txt
- docker build --cache-from $AUDIT_REGISTRY_IMAGE:latest -t $AUDIT_REGISTRY_IMAGE:$CI_COMMIT_SHA .
- docker push $AUDIT_REGISTRY_IMAGE:$CI_COMMIT_SHA
build-audit-release:
variables:
GIT_STRATEGY: none
stage: docker-release
script:
- echo "$DOCKER_HUB_PASSWORD" > dhpw.txt
- docker login -u "${DOCKER_HUB_USER}" --password-stdin < dhpw.txt
- docker pull $AUDIT_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $AUDIT_REGISTRY_IMAGE:$CI_COMMIT_SHA $AUDIT_REGISTRY_IMAGE:latest
- docker tag $AUDIT_REGISTRY_IMAGE:$CI_COMMIT_SHA $AUDIT_REGISTRY_IMAGE:$CI_COMMIT_TAG
- docker push $AUDIT_REGISTRY_IMAGE:latest
- docker push $AUDIT_REGISTRY_IMAGE:$CI_COMMIT_TAG
only:
- tags
deploy-audit-sandbox:
image: dtzar/helm-kubectl:2.13.1
stage: deploy-sandbox
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-audit-service-dev || true
- helm install --name gwas-audit-service-dev --set k8Namespace=gwas-dev,service.name=gwas-audit-service-dev,ingress.name=audit-ingress-dev,image.volume.claimName=gwas-dev-depo-logs,image.repository=$AUDIT_REGISTRY_IMAGE,image.tag=$CI_COMMIT_SHA,image.env.dbUser=gwasdepo,image.env.secretsName=sandbox-secrets,image.env.secretsKey=db-backend ./k8chart/ --wait
environment:
name: sandbox
only:
- develop
deploy-fallback:
image: 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-audit-service || true
- helm install --name gwas-audit-service --set k8Namespace=gwas,image.env.envName=prod,image.repository=$AUDIT_REGISTRY_IMAGE,image.tag=$CI_COMMIT_SHA,image.env.dbUser=gwasdepo,image.env.secretsName=prod-secrets,image.env.secretsKey=db-backend ./k8chart/ --wait
environment:
name: prod
only:
- tags
deploy-live:
image: dtzar/helm-kubectl:2.13.1
stage: deploy-live
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-audit-service || true
- helm install --name gwas-audit-service --set k8Namespace=gwas,image.env.envName=prod,image.repository=$AUDIT_REGISTRY_IMAGE,image.tag=$CI_COMMIT_SHA,image.env.dbUser=gwasdepo,image.env.secretsName=prod-secrets,image.env.secretsKey=db-backend ./k8chart/ --wait
environment:
name: prod
only:
- tags