Newer
Older
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
variables:
DOCKER_HOST: $DOCKER_HOST_BIO
PROJECT_NAME: "gateway"
cache:
untracked: true
key: "$CI_COMMIT_MESSAGE"
paths:
- .gradle
- build
stages:
- analyse
- build
- verification
- publish
- deploy
# ===========================================================================
# Stage: analyse
# ===========================================================================
include:
- template: Code-Quality.gitlab-ci.yml
code_quality:
stage: analyse
services: [] # Shut off Docker-in-Docker
variables:
REPORT_FORMAT: html
artifacts:
paths: [gl-code-quality-report.html]
# second job has to be run to create both artefacts
code_quality_json:
extends: code_quality
variables:
REPORT_FORMAT: json
artifacts:
paths: [gl-code-quality-report.json]
# ===========================================================================
# Stage: build
# ===========================================================================
gradlew-bootJar:
stage: build
image: eclipse-temurin:17-jdk-alpine
script:
- ./gradlew bootJar
docker-build-latest:
stage: build
image: docker:git
only:
refs:
- main
- 1-extrahovat-gateway-z-projketu-dna-analyser
except:
variables:
- $CI_COMMIT_TAG
script:
- docker build -t $DOCKER_NAMESPACE/$PROJECT_NAME:latest .
- docker save -o build/image.tar $DOCKER_NAMESPACE/$PROJECT_NAME:latest
docker-build-tag:
stage: build
image: docker:git
only:
variables:
- $CI_COMMIT_TAG
script:
- docker build -t $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG .
- docker save -o build/image.tar $DOCKER_NAMESPACE/gateway:$CI_COMMIT_TAG
# ===========================================================================
# Stage: test
# ===========================================================================
verification-unit:
stage: verification
image: eclipse-temurin:17-jdk-alpine
allow_failure: true
script:
- ./gradlew test
artifacts:
when: always
reports:
junit: build/test-results/test/**/TEST-*.xml
# ===========================================================================
# Stage: publish
# ===========================================================================
docker-push-latest:
stage: publish
image: docker
only:
- main
- 1-extrahovat-gateway-z-projketu-dna-analyser
before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
script:
- docker load -i build/image.tar
- docker push $DOCKER_NAMESPACE/$PROJECT_NAME:latest
docker-push-tag:
stage: publish
image: docker
only:
variables:
- $CI_COMMIT_TAG
before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
script:
- docker load -i build/image.tar
- docker push $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG
# ===========================================================================
# Stage: deploy
# ===========================================================================
deploy-bioinformatika.pef.mendelu.cz:
stage: deploy
only:
- main
- 1-extrahovat-gateway-z-projketu-dna-analyser
script:
- cp .env /home/bioinformatics/
- cd /home/bioinformatics/
- docker-compose config > docker-swarm.yml
# - docker stack deploy -c docker-compose.yml test_stack
# after_script:
# - docker system prune -f
deploy-bioinformatics.ibp.cz:
stage: deploy
only:
variables:
- $CI_COMMIT_TAG
script:
- scp .env root@bioinformatics.ibp.cz:/opt/
- scp docker-compose.yml root@bioinformatics.ibp.cz:/opt/
- ssh root@bioinformatics.ibp.cz "cd /opt && export $(xargs < .env) && docker stack deploy dna-analyser -c docker-compose.yml"