-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
175 lines (162 loc) · 5.67 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
image: 'registry.gitlab.com/nsitbim/satellites/dsplus/cli:latest'
workflow:
rules:
- if: $CI_PIPELINE_TRIGGERED
when: always
- if: $CI_COMMIT_TAG
when: always
- if: $CI_MERGE_REQUEST_ID
when: never
- if: $CI_COMMIT_MESSAGEE =~ /wip/
when: never
- if: $CI_COMMIT_MESSAGE =~ /ci/ && $CI_COMMIT_MESSAGE =~ /force/
when: always
- if: $CI_COMMIT_MESSAGE =~ /ci/
when: never
- if: $CI_COMMIT_MESSAGE =~ /fix/ || $CI_COMMIT_MESSAGE =~ /evol/
when: always
- if: $CI_COMMIT_BRANCH == "master" && $CI_COMMIT_MESSAGE =~ /into 'master'/
when: always
- when: never
variables:
Mode: FULL
stages:
- checks
- publish
- package
- deploy_tst
- tests
- deploy
code_quality:
stage: checks
allow_failure: true
script:
- dsplus version
- '[ "$CI_COMMIT_BRANCH" != "master" ] && scope="$( git diff $(git describe --abbrev=0 --tags) --name-only --diff-filter="AM" -- "*.isx" )" || scope="$(git ls-files -- "*.isx" )" '
- '[ -n "$CI_COMMIT_TAG" ] && scope="$(git ls-files -- "*.isx" )" '
- '[ -z "$scope" ] && scope="$(git ls-files -- "*.isx" )" '
- echo "scope=$scope"
- dsplus quality --external $(for f in $scope ; do dirname $f ; done) --query "select rule,severity,count(*) as num from ? group by rule,severity" --format table
- criticity=$(dsplus quality --external $(for f in $scope ; do dirname $f ; done) --query '$sum(criticity)' --format json )
- echo "criticity=$criticity"
- '[ ${criticity} -ge ${MAX_CRITICITY} ] && echo "Quality tests failed" && exit 1'
- DSP_CODECLIMATE=true dsplus quality --external $(for f in $(git ls-files -- "*.isx" ) ; do dirname $f ; done) --format json > gl-code-quality-report.json
- dsplus quality --external $(for f in $scope ; do dirname $f ; done) --format html --project "${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}" > issues.html
artifacts:
#expire_in: 10 days
expose_as: 'quality issues'
paths:
- issues.html
reports:
codequality: gl-code-quality-report.json
rules:
- if: $CI_COMMIT_TAG == null
metrics:
stage: checks
allow_failure: true
script:
- '[ "$CI_COMMIT_BRANCH" != "master" ] && scope="$( git diff $(git describe --abbrev=0 --tags) --name-only --diff-filter="AM" -- "*.isx" )" || scope="$(git ls-files -- "*.isx" )" '
- '[ -n "$CI_COMMIT_TAG" ] && scope="$(git ls-files -- "*.isx" )" '
- '[ -z "$scope" ] && scope="$(git ls-files -- "*.isx" )" '
- DSP_METRICS=true dsplus quality --external $(for f in $(git ls-files -- "*.isx" ) ; do dirname $f ; done) --query "metrics" --format csv --delim " " > metrics.txt
- DSP_METRICS=true dsplus quality --external $(for f in $scope ; do dirname $f ; done) --format html --project "${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}" > index.html
- DSP_METRICS=true dsplus quality --external $(for f in $scope ; do dirname $f ; done) --format json --project "${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}" > metrics.json
artifacts:
#expire_in: 10 days
expose_as: 'overview'
paths:
- index.html
- metrics.json
reports:
metrics: metrics.txt
pages:
variables:
GIT_STRATEGY: none
stage: publish
dependencies:
- metrics
- code_quality
script:
- mkdir public
- mv *.html public/
- mv metrics.json public/
artifacts:
paths:
- public
expire_in: 30 days
rules:
- if: $CI_COMMIT_TAG
package:
stage: package
script:
- dsplus package --version ${CI_COMMIT_REF_NAME} --pack dsTNR.${CI_BUILD_REF_SLUG}.isx
- ls -lrt *.isx
artifacts:
untracked: true
expire_in: 1 hour
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH != "master"
deploy:rct:
variables:
GIT_STRATEGY: none
DSP_PROJECT: $CI_ENVIRONMENT_NAME
stage: deploy_tst
environment:
name: dstage1
dependencies:
- package
script:
- 'ls -lrt *.isx'
- 'dsplus deploy --pack dsTNR.${CI_BUILD_REF_SLUG}.isx'
#- 'dsplus check --pack dsTNR.${CI_BUILD_REF_SLUG}.isx'
tags:
- datastage
rules:
- if: $CI_COMMIT_TAG
allow_failure: true
- if: $CI_COMMIT_BRANCH != "master"
allow_failure: true
tests:
variables:
DSP_PROJECT: $CI_ENVIRONMENT_NAME
stage: tests
environment:
name: dstage1
dependencies:
- package
script:
- 'chmod -R a+x ./tests'
- dsplus run:test
- sleep 30
- dsplus coverage --format table --pack dsTNR.${CI_BUILD_REF_SLUG}.isx
- dsplus coverage --format junit --pack dsTNR.${CI_BUILD_REF_SLUG}.isx > tests.xml
coverage: /Ok\s+.*\s+'(\d+.?\d+)%'\s+/
artifacts:
paths: [tests.xml]
reports:
junit: tests.xml
tags:
- datastage
rules:
- if: $CI_COMMIT_BRANCH != "master" && $CI_COMMIT_TAG == null
release:
stage: deploy
tags:
- datastage
dependencies:
- metrics
- code_quality
variables:
GITLAB_TOKEN: $CI_API_TOKEN
GIT_STRATEGY: clone
script:
- git status
- git tag
- dsplus package --pack dsTNR.isx
- dsplus package --mode DELTA --version $(git describe --abbrev=0 --tags) master --pack dsTNR.delta.isx
- dsplus coverage --format table --project dstage1 --pack dsTNR.isx
- dsplus release
coverage: /Ok\s+.*\s+'(\d+.?\d+)%'\s+/
rules:
- if: $CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null