-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
99 lines (90 loc) · 2.38 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
variables:
URL_DEPLOY_SH: "https://gitlab.ebi.ac.uk/api/v4/projects/3377/repository/files/helm-deploy.sh/raw?ref=master&private_token=${GITLAB_USER_API_TOKEN}"
UPSTREAM_CI_COMMIT_BRANCH: $CI_COMMIT_BRANCH
stages:
- test
- build
- build_docker_image
- deploy
- integration_test
.mvn:
image: maven:3.8.2-openjdk-17-slim
before_script:
- java --version
- mvn --version
test:
extends: .mvn
stage: test
script:
- mkdir -p /data
- mvn clean verify
build:
only:
refs:
- main
- dev
extends: .mvn
stage: build
script:
- mvn -DskipTests clean package
- mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
artifacts:
expire_in: 2 days
paths:
- target/dependency
build_docker_image:
only:
refs:
- main
- dev
stage: build_docker_image
image: docker:latest
tags:
- dind
services:
- docker:dind
script:
- docker --version
- echo "$CI_REGISTRY_PASSWORD" | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
- CONTAINER_IMAGE=${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}
- echo "image name will be ${CONTAINER_IMAGE}"
- docker build -t ${CONTAINER_IMAGE} --no-cache -f deploy/Dockerfile .
- docker image ls
- docker push ${CONTAINER_IMAGE}
- docker rmi ${CONTAINER_IMAGE}
- docker logout "$CI_REGISTRY"
.kubectl:
image: dockerhub.ebi.ac.uk/uniprot/deployment/containers/helm
before_script:
- wget -O deploy.sh "${URL_DEPLOY_SH}"
- echo "--no-cache --no-cookies was not used by wget"
- if [ ! -f deploy.sh ]; then echo "k8s deployment script is missing"; exit 1; fi
- chmod +x deploy.sh
dev-deploy:
only:
refs:
- dev
stage: deploy
extends: .kubectl
script:
- ./deploy.sh ENV=DV APP_NAME=protvar-be K8S_NAMESPACE=protvar-dev imageTag="${CI_COMMIT_SHORT_SHA}"
prod-deploy:
only:
refs:
- main
stage: deploy
extends: .kubectl
script:
- ./deploy.sh ENV=FB APP_NAME=protvar-be K8S_NAMESPACE=protvar imageTag="${CI_COMMIT_SHORT_SHA}"
- ./deploy.sh ENV=PD APP_NAME=protvar-be K8S_NAMESPACE=protvar imageTag="${CI_COMMIT_SHORT_SHA}"
trigger_integration_tests:
only:
refs:
- main
- dev
stage: integration_test
trigger:
project: uniprot/framework/protvar-integration-tests
inherit: # only allow propagating the declared vars
variables:
- UPSTREAM_CI_COMMIT_BRANCH