1 # JJB macros specific to Integration/Distribution ODL project
4 name: distribution-check-wipe
5 # Step zero: Wipe file repositories up front.
8 echo "wipe r: the local Maven repository"
10 echo "wipe n: the fake remote (Nexus) repository"
12 echo "wipe t: the transient repository used in some manipulations"
14 echo "create n: multithreaded execution might fail at creating it."
16 echo "detecting distribution allowed projects"
17 # Some allowed projects cannot be detected in distribution because they do not produce features.
18 ALLOW_PROJECTS=(yangtools mdsal openflowjava)
19 ALLOW_PROJECTS+=(`grep '<groupId>org.opendaylight.' -Rh distribution \
20 | sed -e 's%^[ \t]*<groupId>org.opendaylight.%%' \
21 | sed -e 's%</groupId>%%' | sort -u`)
22 echo "Allowed projects are ${ALLOW_PROJECTS[@]}"
23 echo "ALLOW_PROJECTS=${ALLOW_PROJECTS[@]}" > allowed_projects.txt
26 name: distribution-check-build-project
27 # Step one: Online build of the project, using local repository /tmp/r/ and deploying artifacts to /tmp/n/.
28 # Ordinary SingleFeatureTest failures are detected in the verify job, so we can use "q" profile here.
30 # pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
33 maven-version: '{mvn-version}'
37 dependency:tree -DoutputFile=dependency_tree.txt
38 -Pq -Pmanaged -Punmanaged
39 -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
42 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
43 settings: 'integration-settings'
45 global-settings: 'global-settings'
46 global-settings-type: cfp
49 name: distribution-check-verify-groupid
50 # Step two: Verify all deployed artifacts belong to the project's groupId.
51 # This is done by moving the allowed directories out of /tmp/n and checking no files remained there.
52 # The correct directory is derived from $GERRIT_PROJECT.
53 # TODO: Verify all deployed artifacts are snapshots.
55 # gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
58 echo "These are allowed projects: $ALLOW_PROJECTS"
59 echo "These are distribution pulled projects:"
61 for PROJECT in `ls /tmp/r/org/opendaylight`; do
62 echo "checking $PROJECT"
63 if [[ "$ALLOW_PROJECTS" != *"$PROJECT"* ]]; then
64 echo "ERROR: Not allowed project $PROJECT pulled"
69 echo "verify project groupId"
70 mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
71 mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
72 test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
77 name: distribution-check-download-deps
78 # Step three: Online build of integration distribution.
79 # This step is mainly used for downloading other project artifacts.
80 # Running SingleFeaturesTest here does not seem to be required, so -Pq is used again.
82 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
85 maven-version: '{mvn-version}'
89 dependency:tree -DoutputFile=dependency_tree.txt
90 -Pq -Pmanaged -Punmanaged
93 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
94 settings: 'integration-settings'
96 global-settings: 'global-settings'
97 global-settings-type: cfp
100 name: distribution-check-delete-snapshots
101 # Step four: Delete snapshot artifacts from the local repository.
102 # This is critical to detect orphaned artifacts or missing project-internal dependency declarations.
103 # Also other files related to maven repository resolution are removed,
104 # and then empty directories are removed, in order to simplify debugging.
106 - shell: !include-raw-escape: distribution-delete-snaphot-artifacts.sh
109 name: distribution-check-configure-remotes
110 # Now the ugly part. It seems that the only way to tell Maven 2+
111 # which remote repositories to use is via settings.xml file.
112 # So we create such a file here, but it needs most of odlparent:settings.xml
116 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
117 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
118 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
119 https://maven.apache.org/xsd/settings-1.0.0.xsd">
122 <id>opendaylight-release</id>
125 <id>opendaylight-mirror</id>
126 <name>opendaylight</name>
127 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
128 <releases><updatePolicy>never</updatePolicy></releases>
129 <snapshots><enabled>false</enabled></snapshots>
134 <id>opendaylight-plugin-mirror</id>
135 <name>opendaylight-plugin</name>
136 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
137 <releases><updatePolicy>never</updatePolicy></releases>
138 <snapshots><enabled>false</enabled></snapshots>
140 </pluginRepositories>
143 <id>file-snapshots</id>
146 <id>file-snapshots</id>
148 <url>file:///tmp/n/</url>
149 <releases><enabled>false</enabled></releases>
154 <id>file-plugin-snapshots</id>
155 <name>file-plugin</name>
156 <url>file:///tmp/n/</url>
157 <releases><enabled>false</enabled></releases>
159 </pluginRepositories>
163 <activeProfile>file-snapshots</activeProfile>
164 <activeProfile>opendaylight-release</activeProfile>
168 # Notes: The settings are minimal in order to detect breakage scenarios,
169 # while allowing for the following quirks:
170 # * Some plugins seem to have hardcoded repos, for example check-license looks at repository.apache.org
171 # * Some plugin artifacts (related to surefire) are not downloaded when tests are skipped.
172 # * populate-local-repo looks at oss.sonatype.org and does not store things (like guava) to /tmp/r
175 name: distribution-check-repeat-project-build
176 # Step five: Repeat the project build but with the new settings.
177 # Here, only the project snapshot artifacts deployed to /tmp/n are available,
178 # which faithfully reproduces conditions in later verify-like job runs.
179 # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode".
180 # SingleFeatureTest is still skipped, as we expect the same results as in the verify job.
181 # Current content of /tmp/r is restored afterwards to not affect the next step.
182 # TODO: Could there be missing dependencies which would only affect SFT here?
184 # pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
189 maven-version: '{mvn-version}'
193 dependency:tree -DoutputFile=dependency_tree.txt
195 -Pq -Pmanaged -Punmanaged
198 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
204 name: distribution-check-repeat-distro-build
205 # Step six: Repeat the distribution build but with the new settings.
206 # Here, only the project snapshot artifacts deployed to /tmp/n are available,
207 # which faithfully reproduces conditions in later verify-like job runs.
208 # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode".
209 # This is where SingleFeatureTest is not skipped.
210 # TODO: Lower -Dsft.heap.max to 3g or lower when Bug 9218 is fixed.
212 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
215 maven-version: '{mvn-version}'
219 dependency:tree -DoutputFile=dependency_tree.txt
221 -Pq -Pmananaged -Punmanaged
226 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
229 name: distribution-check-warn-9191
230 # Detect ODL bundles referenced cross-project from features, store them to a file to be archived.
231 # Do not fail the build, this is just to inform interested contributors.
232 # TODO: Improve integration archiving macro so that it finds bug_9191 log without us crating it in $WORKSPACE/.
235 # No failure in this macro should affect the job result.
237 rm -f "$WORKSPACE/bug_9191.log"
238 pushd "$WORKSPACE/distribution/$KARAF_ARTIFACT/target/assembly/system/org/opendaylight"
239 for folder in `ls`; do
240 find "$folder" -name \*features.xml | xargs fgrep -n '<bundle>' > bug_9191.0.log
241 fgrep org.opendaylight bug_9191.0.log | fgrep -v "org.opendaylight.$folder" >> "$WORKSPACE/bug_9191.log"
247 name: distribution-check-warn-9192
248 # Detect ODL bundles referenced from multiple features within a project, store them to a file to be archived.
249 # Current implementation will also include Bug 9191 violations,
250 # presenting an unified diff with lines marked to be removed, among unmarked lines to compare to.
251 # Do not fail the build, this is just to inform interested contributors.
252 # TODO: Improve integration archiving macro so that it finds bug_9192 log without us crating it in $WORKSPACE/.
255 # No failure in this macro should affect the job result.
257 pushd "$WORKSPACE/distribution/$KARAF_ARTIFACT/target/assembly/system/org/opendaylight"
258 find . -name \*features.xml | xargs fgrep -n '<bundle>' > "$WORKSPACE/bug_9192.0.log"
260 fgrep org.opendaylight bug_9192.0.log > "$WORKSPACE/bug_9192.1.log"
261 sort -s -t '<' -k 2 "$WORKSPACE/bug_9192.1.log" > "$WORKSPACE/bug_9192.2.log"
262 sort -u -s -t '<' -k 2 "$WORKSPACE/bug_9192.1.log" > "$WORKSPACE/bug_9192.3.log"
263 diff -U 999 -b -t -d "$WORKSPACE/bug_9192.2.log" "$WORKSPACE/bug_9192.3.log" > "$WORKSPACE/bug_9192.diff.log"
264 rm -f "$WORKSPACE"/bug_9192.?.log
267 name: distribution-check-bootup
268 # Operation: Locally deploy ODL with all fetures, check it is not broken.
269 # Required bash variables:
270 # KARAF_VERSION: 'karaf4' or 'karaf3'.
271 # Use distribution-karaf-version macro to customize.
273 - shell: !include-raw: distribution-check-bootup.sh