.gitlab-ci.yml 7.39 KB
Newer Older
Alicja Reniewicz's avatar
Alicja Reniewicz committed
1
2
3
# Gitlab CI/CD script for the Morphemic Preprocessor project

variables:
4
  MAVEN_IMAGE: "maven:3.8.1-jdk-11"
5
  MAVEN_IMAGE_JDK_8: "maven:3.5.2-jdk-8"
Alicja Reniewicz's avatar
Alicja Reniewicz committed
6
7
  LOCAL_REPO: "127.0.0.1:5000"

8
9
10
11
12
  DOCKER_REPO: "gitlab.ow2.org:4567"
  DOCKER_DIND_IMAGE: "docker:19.03.1"
  DOCKER_DIND_SERVICE: "$DOCKER_DIND_IMAGE-dind"
  DOCKER_DRIVER: overlay
  DOCKER_TLS_CERTDIR: "/certs"
13

mriedl's avatar
mriedl committed
14
  DOCKER_CLI: "docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v $CI_PROJECT_DIR/maven_repo:/root/.m2 -w /usr/src/mymaven -v $CI_PROJECT_DIR:/usr/src/mymaven $MAVEN_IMAGE"
15
  SCHEDULING_ABSTRACTION_LAYER_CLI: "mvn --batch-mode -f scheduling-abstraction-layer/pom.xml"
16
  AMQ_MESSAGE_JAVA_LIBRARY_CLI: "mvn --batch-mode -f amq-message-java-library/pom.xml"
17
  SLO_SEVERITY_CALCULATOR_CLI: "mvn --batch-mode -f morphemic-slo-severity-calculator/pom.xml"
mriedl's avatar
mriedl committed
18
  PREDICTON_ORCHESTRATOR_CLI: "mvn --batch-mode -N -f prediction_orchestrator/pom.xml"
Alicja Reniewicz's avatar
Alicja Reniewicz committed
19
20
21
22
23
24
25

cache:
  paths:
    - maven_repo/

before_script:
  - echo '=========================================================================='
26
  - echo $MORPHEMIC_PREPROCESSOR_LAYER_CLI
Alicja Reniewicz's avatar
Alicja Reniewicz committed
27
28
29
30
31
32
33
34
  - echo '=========================================================================='
  - mkdir -p $HOME/.m2
  - echo '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
    https://maven.apache.org/xsd/settings-1.0.0.xsd">
    <localRepository>'$CI_PROJECT_DIR'/maven_repo</localRepository>
    </settings>' > $HOME/.m2/settings.xml
35

Alicja Reniewicz's avatar
Alicja Reniewicz committed
36
stages:
mriedl's avatar
mriedl committed
37
  - deployLibrary
Alicja Reniewicz's avatar
Alicja Reniewicz committed
38
39
40
  - build
  - deploy

41
build:scheduling-abstraction-layer:
Alicja Reniewicz's avatar
Alicja Reniewicz committed
42
  stage: build
43
  image: $MAVEN_IMAGE_JDK_8
Alicja Reniewicz's avatar
Alicja Reniewicz committed
44
45
46
47
48
  script:
    - $SCHEDULING_ABSTRACTION_LAYER_CLI clean install
  artifacts:
    paths:
      - /builds/melodic/morphemic-preprocessor/maven_repo/org/activeeon/scheduling-abstraction-layer/
49

mriedl's avatar
mriedl committed
50
51
build:amq-message-java-library:
  stage: deployLibrary
52
  image: $MAVEN_IMAGE
53
54
55
  only:
    - master
    - morphemic-rc1.5
Jan Marchel's avatar
Jan Marchel committed
56
    - openstack-nc
57
  script:
mriedl's avatar
mriedl committed
58
    - $AMQ_MESSAGE_JAVA_LIBRARY_CLI clean install
59
60
  artifacts:
    paths:
mriedl's avatar
mriedl committed
61
      - /builds/melodic/morphemic-preprocessor/maven_repo/gr/ntua/imu/morphemic/amq-message-java-library/
62

mriedl's avatar
mriedl committed
63
build:prediction_orchestrator:
64
  stage: build
65
  image: $MAVEN_IMAGE
66
67
68
  only:
    - master
    - morphemic-rc1.5
69
  script:
mriedl's avatar
mriedl committed
70
    - $PREDICTON_ORCHESTRATOR_CLI -Pwithout-docker clean install
71
72
  artifacts:
    paths:
mriedl's avatar
mriedl committed
73
      - /builds/melodic/morphemic-preprocessor/maven_repo/eu/morphemic/prediction_orchestrator/
74

75
76
build:slo-severity-calculator:
  stage: build
77
  image: $MAVEN_IMAGE
78
79
80
  only:
    - master
    - morphemic-rc1.5
81
  script:
82
    - $SLO_SEVERITY_CALCULATOR_CLI -Dtest=!UnboundedMonitoringAttributeTests clean install
83
84
85
86
  artifacts:
    paths:
      - /builds/melodic/morphemic-preprocessor/maven_repo/gr/ntua/imu/morphemic/SLOSeverityCalculator/

87
88
89
90
91
92
93
94
95
deploy:performance-model:
  stage: deploy
  image: $DOCKER_DIND_IMAGE
  only:
    - master
    - morphemic-rc1.5
  services:
    - $DOCKER_DIND_SERVICE
  script:
96
97
    - cd morphemic-performance-model/ml_code/
    - docker build -t performance_model -f ./deployment/Dockerfile .
98
99
    - docker image ls
    - echo "$K8S_SECRET_DOCKER_PASSWORD" | docker login $CI_REGISTRY -u $K8S_SECRET_DOCKER_USER --password-stdin
100
    - docker tag performance_model:latest $CI_REGISTRY_IMAGE/performance_model:$CI_COMMIT_BRANCH
101
102
    - docker push $CI_REGISTRY_IMAGE/performance_model:$CI_COMMIT_BRANCH

103
104
105
106
107
108
109
110
111
deploy:persistent-storage-database:
  stage: deploy
  image: $DOCKER_DIND_IMAGE
  only:
    - master
    - morphemic-rc1.5
  services:
    - $DOCKER_DIND_SERVICE
  script:
112
113
    - cd morphemic-persistent-storage/database
    - docker build -t persistent_storage_database -f ./Dockerfile .
114
115
116
117
118
119
120
121
122
123
124
125
126
127
    - docker image ls
    - echo "$K8S_SECRET_DOCKER_PASSWORD" | docker login $CI_REGISTRY -u $K8S_SECRET_DOCKER_USER --password-stdin
    - docker tag persistent_storage_database:latest $CI_REGISTRY_IMAGE/persistent_storage_database:$CI_COMMIT_BRANCH
    - docker push $CI_REGISTRY_IMAGE/persistent_storage_database:$CI_COMMIT_BRANCH

deploy:persistent-storage-activemq:
  stage: deploy
  image: $DOCKER_DIND_IMAGE
  only:
    - master
    - morphemic-rc1.5
  services:
    - $DOCKER_DIND_SERVICE
  script:
128
129
    - cd morphemic-persistent-storage/example
    - docker build -t persistent_storage_activemq -f ./Dockerfile .
130
131
132
133
134
    - docker image ls
    - echo "$K8S_SECRET_DOCKER_PASSWORD" | docker login $CI_REGISTRY -u $K8S_SECRET_DOCKER_USER --password-stdin
    - docker tag persistent_storage_activemq:latest $CI_REGISTRY_IMAGE/persistent_storage_activemq:$CI_COMMIT_BRANCH
    - docker push $CI_REGISTRY_IMAGE/persistent_storage_activemq:$CI_COMMIT_BRANCH

135
deploy:scheduling-abstraction-layer:
Alicja Reniewicz's avatar
Alicja Reniewicz committed
136
  stage: deploy
137
  image: $MAVEN_IMAGE_JDK_8
Alicja Reniewicz's avatar
Alicja Reniewicz committed
138
139
140
  only:
    - master
    - morphemic-rc1.5
141
    - proactive-dev
Jan Marchel's avatar
Jan Marchel committed
142
    - OpenStack-nc
143
144
  dependencies:
    - build:scheduling-abstraction-layer
Alicja Reniewicz's avatar
Alicja Reniewicz committed
145
  script:
146
    - $SCHEDULING_ABSTRACTION_LAYER_CLI deploy
147
148
149

deploy:amq-message-java-library:
  stage: deploy
150
  image: $MAVEN_IMAGE
151
152
153
154
155
156
157
  only:
    - master
    - morphemic-rc1.5
  dependencies:
    - build:amq-message-java-library
  script:
    - $AMQ_MESSAGE_JAVA_LIBRARY_CLI deploy
158
159
160

deploy:prediction_orchestrator:
  stage: deploy
161
  image: $DOCKER_DIND_IMAGE
162
163
164
  only:
    - master
    - morphemic-rc1.5
165
166
  services:
    - $DOCKER_DIND_SERVICE
167
168
169
  dependencies:
    - build:prediction_orchestrator
  script:
mriedl's avatar
mriedl committed
170
    - $DOCKER_CLI $PREDICTON_ORCHESTRATOR_CLI deploy
mriedl's avatar
mriedl committed
171
    - echo "$K8S_SECRET_DOCKER_PASSWORD" | docker login $CI_REGISTRY -u $K8S_SECRET_DOCKER_USER --password-stdin
mriedl's avatar
mriedl committed
172
173
    - docker tag $LOCAL_REPO/morphemic/prediction-orchestrator:latest $CI_REGISTRY_IMAGE/prediction-orchestrator:$CI_COMMIT_BRANCH
    - docker push $CI_REGISTRY_IMAGE/prediction-orchestrator:$CI_COMMIT_BRANCH
174

175
176
deploy:slo-severity-calculator:
  stage: deploy
177
  image: $DOCKER_DIND_IMAGE
178
179
180
181
182
  only:
    - master
    - morphemic-rc1.5
  dependencies:
    - build:slo-severity-calculator
183
184
  services:
    - $DOCKER_DIND_SERVICE
185
  script:
186
    - cd morphemic-slo-severity-calculator
187
188
    - mkdir -p target/
    - cp /builds/melodic/morphemic-preprocessor/maven_repo/gr/ntua/imu/morphemic/SLOSeverityCalculator/1.0-SNAPSHOT/SLOSeverityCalculator-1.0-SNAPSHOT.jar target/
189
190
191
192
193
    - docker build -t slo_severity_calculator -f ./Dockerfile .
    - docker image ls
    - echo "$K8S_SECRET_DOCKER_PASSWORD" | docker login $CI_REGISTRY -u $K8S_SECRET_DOCKER_USER --password-stdin
    - docker tag slo_severity_calculator:latest $CI_REGISTRY_IMAGE/slo_severity_calculator:$CI_COMMIT_BRANCH
    - docker push $CI_REGISTRY_IMAGE/slo_severity_calculator:$CI_COMMIT_BRANCH
194
195
196
197
198
199
200
201
202
203

deploy:nbeats:
  stage: deploy
  image: $DOCKER_DIND_IMAGE
  only:
    - master
    - morphemic-rc1.5
  services:
    - $DOCKER_DIND_SERVICE
  script:
204
    - docker build -t nbeats -f ./deployment/nbeats/Dockerfile .
205
206
207
208
209
210
211
212
213
214
215
216
217
218
    - docker image ls
    - echo "$K8S_SECRET_DOCKER_PASSWORD" | docker login $CI_REGISTRY -u $K8S_SECRET_DOCKER_USER --password-stdin
    - docker tag nbeats:latest $CI_REGISTRY_IMAGE/nbeats:$CI_COMMIT_BRANCH
    - docker push $CI_REGISTRY_IMAGE/nbeats:$CI_COMMIT_BRANCH

deploy:tft:
  stage: deploy
  image: $DOCKER_DIND_IMAGE
  only:
    - master
    - morphemic-rc1.5
  services:
    - $DOCKER_DIND_SERVICE
  script:
219
    - docker build -t tft -f ./deployment/tft/Dockerfile .
220
221
222
223
    - docker image ls
    - echo "$K8S_SECRET_DOCKER_PASSWORD" | docker login $CI_REGISTRY -u $K8S_SECRET_DOCKER_USER --password-stdin
    - docker tag tft:latest $CI_REGISTRY_IMAGE/tft:$CI_COMMIT_BRANCH
    - docker push $CI_REGISTRY_IMAGE/tft:$CI_COMMIT_BRANCH