-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
174 lines (164 loc) · 3.87 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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
default:
image: docker.io/zazukoians/node-java-jena:v5
stages:
- github
- fetch
- process
- store
# Push `main` branch to GitHub
github:
stage: github
image:
name: docker.io/bitnami/git:2
script:
# Some SSH configuration
- mkdir -p /root/.ssh
- ssh-keyscan -H github.com >> /root/.ssh/known_hosts
- cp "${GITHUB_REPO_PRIVATE_KEY}" /root/.ssh/id_ed25519
- chmod 400 /root/.ssh/id_ed25519
# Create the main branch locally out of the detached HEAD
- git checkout -b main
# Inspect the current Git state
- git branch --list
- git log --oneline
# Add the remote GitHub repository, and push the current branch to it
- git remote add github "${GITHUB_REPO}"
- git push --follow-tags --force github main
only:
- main
# fetch the latest full import from the S3 bucket
fetch-test:
stage: fetch
interruptible: true
image:
name: docker.io/bitnami/minio-client:latest
artifacts:
expire_in: 1 day
paths:
- input/*.json
script:
- mc alias set bucket "${S3_ENDPOINT}" "${S3_ACCESS_KEY}" "${S3_SECRET_KEY}"
- mkdir -p input
- mc ls "bucket/${S3_BUCKET}/${S3_PATH}/"
- ./scripts/fetch_input.sh
except:
- main
fetch-prod:
stage: fetch
interruptible: true
image:
name: docker.io/bitnami/minio-client:latest
artifacts:
expire_in: 1 day
paths:
- input/*.json
script:
- mc alias set bucket "${S3_ENDPOINT}" "${S3_ACCESS_KEY}" "${S3_SECRET_KEY}"
- mkdir -p input
- mc ls "bucket/${S3_BUCKET}/${S3_PATH}/"
- ./scripts/fetch_input.sh
environment:
name: prod
only:
- main
# Install npm dependencies
npm-deps:
stage: fetch
timeout: 5 minutes
image: docker.io/library/node:22
retry: 2
artifacts:
expire_in: 1 day
paths:
- node_modules/
script:
- npm ci
# generate metadata as ntriples
metadata:
stage: process
artifacts:
expire_in: 1 week
paths:
- output/metadata.nt
script:
- mkdir -p output
# ignore the exit code (as warnings are making the command fail)
- riot --output=ntriples metadata/*.ttl > output/metadata.nt || true
# check the existance of the file
- "[ -f output/metadata.nt ]"
# make sure it has more than one line
- '[ "$(wc -l output/metadata.nt | awk ''{ print $1 }'')" -gt 1 ]'
# run the pipeline on each splitted part that are generated within this step
process-test:
stage: process
interruptible: true
dependencies:
- npm-deps
- fetch-test
artifacts:
expire_in: 1 week
paths:
- output/*.nt
services:
- name: ghcr.io/zazuko/carml-service:v0.0.5
alias: carml-service
variables:
CARML_SERVICE: "http://carml-service:8080/"
script:
- ./scripts/splitter.sh
- ./scripts/generate_triples.sh
except:
- main
process-prod:
stage: process
interruptible: true
dependencies:
- npm-deps
- fetch-prod
artifacts:
expire_in: 1 week
paths:
- output/*.nt
services:
- name: ghcr.io/zazuko/carml-service:v0.0.5
alias: carml-service
variables:
CARML_SERVICE: "http://carml-service:8080/"
script:
- ./scripts/splitter.sh
- ./scripts/generate_triples.sh
environment:
name: prod
only:
- main
# store triples in the triplestore
store-test:
stage: store
resource_group: store-test
interruptible: true
dependencies:
- metadata
- process-test
script:
# display the list of all files that we will upload in the triplestore
- ls -alh output
# upload them to the triplestore
- ./scripts/upload.sh
only:
- develop
store-prod:
stage: store
resource_group: store-prod
interruptible: true
dependencies:
- metadata
- process-prod
script:
# display the list of all files that we will upload in the triplestore
- ls -alh output
# upload them to the triplestore
- ./scripts/upload.sh
environment:
name: prod
only:
- main