[GLOBAL] Move to Gitlab
[oom.git] / .gitlab-ci.yml
1 ---
2 # Copyright © 2021 Orange
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 stages:
16   - linting
17   - build
18   - test
19
20 cla_authors:
21   stage: linting
22   image: bitnami/git:2
23   script:
24     - . .ci/common.sh
25     - title "Running cla authors retrieval..."
26     - exit_code=0
27     - RESULT=$(.ci/check-cla-for-multiple-commits.sh 2>&1) || exit_code=$?
28     - handle_test_result $exit_code "$RESULT"
29     - exit $exit_code
30   needs: []
31   rules:
32     - if: $CI_MERGE_REQUEST_ID
33
34
35 pylint:
36   stage: linting
37   image: cytopia/pylint
38   script:
39     - . .ci/common.sh
40     - title "Running pylint check..."
41     - exit_code=0
42     - RESULT=$(find kubernetes/ TOSCA/ docs/ -name '*.py' -print0 | xargs -0 pylint 2>&1) || exit_code=$?
43     - handle_test_result $exit_code "$RESULT"
44     - exit $exit_code
45   needs: []
46   rules:
47     - if: $CI_MERGE_REQUEST_ID
48       changes:
49         - .ci/*
50         - .gitlab-ci.yml
51         - '**/*.py'
52
53 commit-message:
54   stage: linting
55   image: jorisroovers/gitlint:0.16.0
56   script:
57     - . .ci/common.sh
58     - title "*** Running gitlint..."
59     - exit_code=0
60     - RESULT=$(gitlint 2>&1) || exit_code=$?
61     - handle_test_result $exit_code "$RESULT"
62     - exit $exit_code
63   needs: []
64   rules:
65     - if: $CI_MERGE_REQUEST_ID
66
67
68 trailing-whitespaces:
69   stage: linting
70   image: alpine/git:v2.24.1
71   script:
72     - . .ci/common.sh
73     - title "Running trailing whitespaces check..."
74     - exit_code=0
75     - RESULT=$(.ci/find-trailing-whitespaces.sh 2>&1) || exit_code=$?
76     - handle_test_result $exit_code "$RESULT"
77     - exit $exit_code
78   needs: []
79   rules:
80     - if: $CI_MERGE_REQUEST_ID
81
82 tabs:
83   stage: linting
84   image: alpine/git:v2.24.1
85   script:
86     - . .ci/common.sh
87     - title "Running tabs check..."
88     - exit_code=0
89     - RESULT=$(.ci/find-tabs.sh 2>&1) || exit_code=$?
90     - handle_test_result $exit_code "$RESULT"
91     - exit $exit_code
92   needs: []
93   rules:
94     - if: $CI_MERGE_REQUEST_ID
95
96 documentation:doc8:
97   stage: linting
98   image: testthedocs/ttd-doc8
99   script:
100     - . .ci/common.sh
101     - title "Running doc8 check..."
102     - exit_code=0
103     - RESULT=$(doc8 docs 2>&1) || exit_code=$?
104     - handle_test_result $exit_code "$RESULT"
105     - exit $exit_code
106   rules:
107     - if: $CI_MERGE_REQUEST_ID
108       changes:
109         - .ci/*
110         - .gitlab-ci.yml
111         - docs/**/*
112   needs: []
113
114 documentation:link-check:
115   stage: linting
116   image: python:3.7
117   script:
118     - . .ci/common.sh
119     - pip install -r requirements.txt
120       -chttps://git.onap.org/doc/plain/etc/upper-constraints.os.txt
121       -chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt
122     - title "Running documentation links check..."
123     - exit_code=0
124     - RESULT=$(sphinx-build -W -b linkcheck -d /tmp/doctrees ./docs/ ./docs/_build/linkcheck 2>&1) || exit_code=$?
125     - handle_test_result $exit_code "$RESULT"
126     - exit $exit_code
127   rules:
128     - if: $CI_MERGE_REQUEST_ID
129       changes:
130         - .ci/*
131         - .gitlab-ci.yml
132         - docs/**/*
133   needs: []
134
135 documentation:spelling:
136   stage: linting
137   image: python:3.7
138   script:
139     - . .ci/common.sh
140     - apt-get update
141     - apt-get install -qq --yes curl libenchant-2-2
142     - curl -LO https://git.onap.org/doc/plain/docs/spelling_wordlist.txt
143     - pip install -r requirements.txt
144       -chttps://git.onap.org/doc/plain/etc/upper-constraints.os.txt
145       -chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt
146     - title "Running documentation spelling check..."
147     - exit_code=0
148     - RESULT=$(sphinx-build -b spelling -d /tmp/doctrees ./docs/ ./docs/_build/spelling 2>&1) || exit_code=$?
149     - handle_test_result $exit_code "$RESULT"
150     - exit $exit_code
151   rules:
152     - if: $CI_MERGE_REQUEST_ID
153       changes:
154         - .ci/*
155         - .gitlab-ci.yml
156         - docs/**/*
157   needs: []
158
159 bashisms:
160   stage: linting
161   image: manabu/checkbashisms-docker
162   script:
163     - . .ci/common.sh
164     - title "Running bashisms check..."
165     - exit_code=0
166     - RESULT=$(.ci/check-bashisms 2>&1) || exit_code=$?
167     - handle_test_result $exit_code "$RESULT"
168     - exit $exit_code
169   rules:
170     - if: $CI_MERGE_REQUEST_ID
171   needs: []
172
173 helm:fast:
174   stage: linting
175   services:
176     - name: bitnami/chartmuseum:latest
177       alias: chartmuseum
178   image: alpine/helm:3.6.3
179   variables:
180     SKIP_LINT: "TRUE"
181   script:
182     - . .ci/common.sh
183     - apk add --no-cache make
184     - helm repo add local http://chartmuseum:8080/
185     - helm plugin install --version v0.9.0 https://github.com/chartmuseum/helm-push.git
186     - title "Running helm fast check..."
187     - cd kubernetes
188     - exit_code=0
189     - make all || exit_code=$?
190     - handle_test_result $exit_code ""
191     - exit $exit_code
192   needs: []
193   rules:
194     - if: $CI_MERGE_REQUEST_ID
195       changes:
196         - .ci/*
197         - .gitlab-ci.yml
198         - kubernetes/**/*
199
200 helm:full:
201   stage: build
202   services:
203     - name: bitnami/chartmuseum:latest
204       alias: chartmuseum
205   image: alpine/helm:3.6.3
206   script:
207     - . .ci/common.sh
208     - apk add --no-cache make
209     - helm repo add local http://chartmuseum:8080/
210     - helm plugin install --version v0.9.0 https://github.com/chartmuseum/helm-push.git
211     - title "Running full helm check..."
212     - cd kubernetes
213     - exit_code=0
214     - make all || exit_code=$?
215     - handle_test_result $exit_code ""
216     - exit $exit_code
217   needs:
218     - helm:fast
219   timeout: 6h
220   rules:
221     - if: $CI_MERGE_REQUEST_ID
222       changes:
223         - .ci/*
224         - .gitlab-ci.yml
225         - kubernetes/**/*
226
227 documentation:
228   stage: build
229   image: python:3.7
230   script:
231     - . .ci/common.sh
232     - apt-get update
233     - apt-get install --yes graphviz plantuml
234     - pip install -r requirements.txt
235       -chttps://git.onap.org/doc/plain/etc/upper-constraints.os.txt
236       -chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt
237     - title "Running documentation build..."
238     - exit_code=0
239     - RESULT=$(sphinx-build -q -W -b html -d /tmp/doctrees ./docs/ ./docs/_build/html 2>&1) || exit_code=$?
240     - handle_test_result $exit_code "$RESULT"
241     - exit $exit_code
242   rules:
243     - if: $CI_MERGE_REQUEST_ID
244       changes:
245         - .ci/*
246         - .gitlab-ci.yml
247         - docs/*
248   needs:
249     - documentation:spelling
250     - documentation:link-check
251     - documentation:doc8
252
253 gating:launch:
254   stage: test
255   image: busybox
256   script:
257     - . .ci/common.sh
258     - title "Launching request for a gate"
259   needs:
260     - bashisms
261     - helm:fast
262     - tabs
263     - trailing-whitespaces
264   rules:
265     - if: $CI_MERGE_REQUEST_ID
266       changes:
267         - .ci/*
268         - .gitlab-ci.yml
269         - kubernetes/**/*