-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
250 lines (230 loc) · 9.56 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#GitLab CI File for REDHAWK Integration Asset
#Tutuorial on using GitLab CI: https://docs.gitlab.com/ce/ci/quick_start/README.html
#Docs on format of CI file: https://docs.gitlab.com/ce/ci/yaml/README.html
stages:
- build
- test
- test-jacorb
- deploy
variables:
redhawk_version: '2.1.2'
enterprise_version: '2.1.2'
maven_command: bash -c "mvn -P CFDependencies clean install -B -U && mvn clean install site -P localIT -DfailIfNoTests=false -DdomainHost=redhawk_${dist}_${arch}_${CI_JOB_ID} -DtestProps=`pwd`/docker_test.properties"
.skip: &skip
#Skip on tag of following format
except:
- /^(\d+\.)?(\d+)?(\.\d+)$/
- master
.common: &common
image: ${docker_registry}redbus/maven:3-jdk-8
stage: build
tags:
- mvn-cache
before_script:
- mvn -P CFDependencies clean install -B -U
after_script:
- mkdir -p output
- mkdir -p site/images
- cp docs/target/asciidoc/html/index.html site/index.html #Docs artifacts
- cp -r docs/target/asciidoc/html/images/* site/images/ #Make sure images are available for site
- tar zcvf site.tar.gz site; cp site.tar.gz output/
- cp docs/target/asciidoc/pdf/index.pdf output/REDHAWK_Enterprise_v$enterprise_version.pdf
- cp docs/target/rpm/redhawk-enterprise-integration-docs/RPMS/noarch/*.rpm output/ #RPM for installing REDHAWK Java Tools Docs in KARAF
- cp dists/karaf/target/redhawk-enterprise-integration-karaf.tar.gz output/ #Tar of karaf distribution
- cp dists/karaf/target/rpm/redhawk-enterprise-integration-dist-karaf/RPMS/noarch/*.rpm output/ #RPM for karaf distribution
- cp dists/jetty/target/redhawk-enterprise-integration-jetty.tar.gz output/ #Tar of jetty distribution
- cp dists/jetty/target/rpm/redhawk-enterprise-integration-dist-jetty/RPMS/noarch/*.rpm output/ #RPM for jetty distribution
- cp dists/shell/target/redhawk-enterprise-integration-shell.tar.gz output/ #Tar of shell distribution
- cp dists/shell/target/rpm/redhawk-enterprise-integration-dist-shell/RPMS/noarch/*.rpm output/ #RPM for shell distribution
- cp demos/demo-dist/target/rpm/redhawk-enterprise-integration-demo-dist/RPMS/noarch/*.rpm output/ #RPM for deploying demos
- cp demos/demo-dist/target/redhawk-enterprise-integration-demo-dist.tar.gz output/ #tar for deploying demos
- tar zcvf output.tar.gz output/
artifacts:
name: $CI_JOB_NAME
paths:
- output/site.tar.gz
- output/*.pdf
- output/*.rpm
- output.tar.gz
expire_in: 3 days
<<: *skip
deploy:
image: centos:7
stage: deploy
dependencies: []
tags:
- jenkins
before_script:
- echo "Deploying to $jenkins_url/job/$CI_PROJECT_NAMESPACE/job/$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME"
script:
- if [ -n "$jenkins_url" ]; then
curl --insecure -X POST $jenkins_url/job/$CI_PROJECT_NAMESPACE/job/$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME/buildWithParameters?pipeline_id=$CI_PIPELINE_ID --user $jenkins_user:$jenkins_api_token;
fi
<<: *skip
#Common commands for the compose jobs
#https://gitlab.com/gitlab-org/gitlab-ce/issues/19677 ayufan comment did the trick.
.compose-test-common: &compose-test-common |
docker-compose pull
docker-compose --project-name ${dist}_${arch}_${CI_JOB_ID} up --force-recreate -d redhawk
docker-compose --project-name ${dist}_${arch}_${CI_JOB_ID} exec -T redhawk yum install -y rh.FmRdsSimulator #TODO: This line shouldn't be necessary
docker cp redhawk-driver/src/test/resources/node/SimulatorNode redhawk_${dist}_${arch}_${CI_JOB_ID}:/var/redhawk/sdr/dev/nodes/ # Deploy devMgr
docker-compose --project-name ${dist}_${arch}_${CI_JOB_ID} exec redhawk nodeBooter -d /var/redhawk/sdr/dev/nodes/SimulatorNode/DeviceManager.dcd.xml 2>&1 & #Start DevMgr
docker-compose --project-name ${dist}_${arch}_${CI_JOB_ID} exec -T redhawk mkdir -p /usr/local/redhawk/workspace #Make dir for deploying components
docker cp demos/camel-event-channel/src/main/resources/EventSpitter redhawk_${dist}_${arch}_${CI_JOB_ID}:/usr/local/redhawk/workspace #Copy Event Spitter component into workspace
docker cp redhawk-driver/src/test/resources/components/MessageProducer redhawk_${dist}_${arch}_${CI_JOB_ID}:/usr/local/redhawk/workspace #Copy Message Producer component into workspace
docker cp redhawk-driver/src/test/resources/components/AllPropsComponent redhawk_${dist}_${arch}_${CI_JOB_ID}:/usr/local/redhawk/workspace #Copy AllProps Component into workspace
docker-compose --project-name ${dist}_${arch}_${CI_JOB_ID} exec -T redhawk bash -c "cd /usr/local/redhawk/workspace/EventSpitter; ./build.sh install" #Install EventSpitter component
docker-compose --project-name ${dist}_${arch}_${CI_JOB_ID} exec -T redhawk bash -c "java -version" #Debug
docker-compose --project-name ${dist}_${arch}_${CI_JOB_ID} exec -T redhawk bash -c "cd /usr/local/redhawk/workspace/MessageProducer; ./build.sh install" #Install MessageProducer component
docker-compose --project-name ${dist}_${arch}_${CI_JOB_ID} exec -T redhawk bash -c "cd /usr/local/redhawk/workspace/AllPropsComponent; ./build.sh install" #Install EventSpitter component
docker-compose --project-name ${dist}_${arch}_${CI_JOB_ID} exec -T redhawk bash -c "nameclt list REDHAWK_DEV" #Debug
docker-compose --project-name ${dist}_${arch}_${CI_JOB_ID} up --exit-code-from rei
.cleanup-compose: &cleanup-compose |
docker-compose --project-name ${dist}_${arch}_${CI_JOB_ID} down
#TODO: You'll always need to do this make this common...
.failsafe-reports: &failsafe-reports |
find */target/failsafe-reports -name 'TEST*.xml' | tar cvf $CI_PROJECT_DIR/output.tar --files-from -
.site-report: &site-report |
find */target -name "*.exec" | tar -cvf jacoco-exec.tar.gz --files-from -
find */target/classes | tar -cvf jacoco-classes.tar --files-from -
find redhawk-*/src/main/java | tar -cvf jacoco-sources.tar --files-from -
tar -C docs/target -czvf site.tar.gz site
.compose-test-artifacts: &compose-test-artifacts
artifacts:
name: $CI_JOB_NAME
paths:
- output.tar
- jacoco-exec.tar.gz
- jacoco-classes.tar
- jacoco-sources.tar
- site.tar.gz
expire_in: 3 days
<<: *skip
#General command for running the integration tests
#.general-it-command: &general-it-command
# variables:
# - maven_command: bash -c "mvn -P CFDependencies clean install -B -U && mvn clean install site -P localIT -DfailIfNoTests=false -DdomainHost=redhawk_${dist}_${arch}_${CI_JOB_ID} -DtestProps=`pwd`/docker_test.properties"
build:
<<: *common
script:
- mvn -Djava.io.tmpdir=./ clean install -P docs,jaxb-generation,default -B -U -Drelease=0.$CI_PIPELINE_ID
only:
- branches
build-release:
<<: *common
script:
- mvn -Djava.io.tmpdir=./ clean install -P docs,jaxb-generation,default -B -U
only:
- tags
<<: *skip
test-install:
image: centos:7
stage: test
script:
- yum install -y `find output -name '*.rpm'`
<<: *skip
test-el7-x86_64:
<<: *compose-test-artifacts
script:
- *compose-test-common
- *failsafe-reports
- *site-report
after_script:
- *cleanup-compose
image: ${docker_registry}utils/docker-compose:latest
stage: test
tags:
- mvn-cache
dependencies: []
variables:
dist: el7
arch: x86_64
test-el6-x86_64:
<<: *compose-test-artifacts
script:
- *compose-test-common
- *failsafe-reports
- *site-report
after_script:
- *cleanup-compose
image: ${docker_registry}utils/docker-compose:latest
stage: test
tags:
- mvn-cache
dependencies: []
variables:
dist: el6
arch: x86_64
test-el6-i386:
<<: *compose-test-artifacts
script:
- *compose-test-common
- *failsafe-reports
- *site-report
after_script:
- *cleanup-compose
image: ${docker_registry}utils/docker-compose:latest
stage: test
tags:
- mvn-cache
dependencies: []
variables:
dist: el6
arch: i686
#Test Driver Against Jacorb
test-jacorb-el7_x86_64:
script:
- *compose-test-common
image: ${docker_registry}utils/docker-compose:latest
stage: test-jacorb
tags:
- mvn-cache
after_script:
- *cleanup-compose
dependencies: []
variables:
dist: el7
arch: x86_64
maven_command: bash -c "mvn -P CFDependencies clean install -B -U && mvn -pl redhawk-driver clean install site -P localIT -Djacorb=true -DfailIfNoTests=false -DdomainHost=redhawk_${dist}_${arch}_${CI_JOB_ID} -DtestProps=`pwd`/docker_test.properties"
<<: *skip
test-jacorb-el6_x86_64:
script:
- *compose-test-common
image: ${docker_registry}utils/docker-compose:latest
stage: test-jacorb
tags:
- mvn-cache
after_script:
- *cleanup-compose
dependencies: []
variables:
dist: el6
arch: x86_64
maven_command: bash -c "mvn -P CFDependencies clean install -B -U && mvn -pl redhawk-driver clean install site -P localIT -Djacorb=true -DfailIfNoTests=false -DdomainHost=redhawk_${dist}_${arch}_${CI_JOB_ID} -DtestProps=`pwd`/docker_test.properties"
<<: *skip
test-jacorb-el6_i386:
script:
- *compose-test-common
image: ${docker_registry}utils/docker-compose:latest
stage: test-jacorb
tags:
- mvn-cache
after_script:
- *cleanup-compose
dependencies: []
variables:
dist: el6
arch: i686
maven_command: bash -c "mvn -P CFDependencies clean install -B -U && mvn -pl redhawk-driver clean install site -P localIT -Djacorb=true -DfailIfNoTests=false -DdomainHost=redhawk_${dist}_${arch}_${CI_JOB_ID} -DtestProps=`pwd`/docker_test.properties"
<<: *skip
pages:
stage: deploy
script:
- mkdir .public
- if [ -f output/site.tar.gz ]; then echo "Found site.tar.gz"; cp output/site.tar.gz .; tar -xvf site.tar.gz; mv site/* .public; fi
- rm -rf site
- mv .public public
artifacts:
paths:
- public
<<: *skip