Merge "Remove tox verify job for bgpcep"
[releng/builder.git] / jjb / integration / distribution / distribution-macros.yaml
1 # JJB macros specific to Integration/Distribution ODL project
2 ---
3
4 - builder:
5     name: distribution-check-wipe
6     # Step zero: Wipe file repositories up front.
7     builders:
8       - shell: |
9           echo "wipe r: the local Maven repository"
10           rm -rfv /tmp/r
11           echo "wipe n: the fake remote (Nexus) repository"
12           rm -rfv /tmp/n
13           echo "wipe t: the transient repository used in some manipulations"
14           rm -rfv /tmp/t
15
16 - builder:
17     name: distribution-check-build-project
18     # Step one: Online build of the project, using local repository /tmp/r/ and deploying artifacts to /tmp/n/.
19     # Ordinary SingleFeatureTest failures are detected in the verify job, so we can use "q" profile here.
20     # Arguments:
21     #   pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
22     builders:
23       - maven-target:
24           maven-version: 'mvn33'
25           pom: '{pom}'
26           goals: |
27               clean deploy
28               dependency:tree -DoutputFile=dependency_tree.txt
29               -Pq
30               -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
31               {mvn-opts}
32           java-opts:
33             - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
34           settings: 'integration-settings'
35           settings-type: cfp
36           global-settings: 'global-settings'
37           global-settings-type: cfp
38
39 - builder:
40     name: distribution-check-verify-groupid
41     # Step two: Verify all deployed artifacts belong to the project's groupId.
42     # This is done by moving the allowed directories out of /tmp/n and checking no files remained there.
43     # The correct directory is derived from $GERRIT_PROJECT.
44     # TODO: Verify all deployed artifacts are snapshots.
45     # Arguments:
46     #   gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
47     builders:
48       - shell: |
49           mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
50           mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
51           test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
52           rm -rf /tmp/n
53           mv /tmp/t /tmp/n
54
55 - builder:
56     name: distribution-check-download-deps
57     # Step three: Online build of integration distribution.
58     # This step is mainly used for downloading other project artifacts.
59     # Running SingleFeaturesTest here does not seem to be required, so -Pq is used again.
60     # Arguments:
61     #   dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
62     builders:
63       - maven-target:
64           maven-version: 'mvn33'
65           pom: '{dist-pom}'
66           goals: |
67               clean install
68               dependency:tree -DoutputFile=dependency_tree.txt
69               -Pq
70               {mvn-opts}
71           java-opts:
72             - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
73           settings: 'integration-settings'
74           settings-type: cfp
75           global-settings: 'global-settings'
76           global-settings-type: cfp
77
78 - builder:
79     name: distribution-check-delete-snapshots
80     # Step four: Delete snapshot artifacts from the local repository.
81     # This is critical to detect orphaned artifacts or missing project-internal dependency declarations.
82     # Also other files related to maven repository resolution are removed,
83     # and then empty directories are removed, in order to simplify debugging.
84     builders:
85       - shell: !include-raw-escape: distribution-delete-snaphot-artifacts.sh
86
87 - builder:
88     name: distribution-check-configure-remotes
89     # Now the ugly part. It seems that the only way to tell Maven 2+
90     # which remote repositories to use is via settings.xml file.
91     # So we create such a file here, but it needs most of odlparent:settings.xml
92     builders:
93       - shell: |
94           echo '
95           <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
96             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
97             xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
98             https://maven.apache.org/xsd/settings-1.0.0.xsd">
99             <profiles>
100               <profile>
101                 <id>opendaylight-release</id>
102                 <repositories>
103                   <repository>
104                     <id>opendaylight-mirror</id>
105                     <name>opendaylight</name>
106                     <url>https://nexus.opendaylight.org/content/repositories/public/</url>
107                     <releases><updatePolicy>never</updatePolicy></releases>
108                     <snapshots><enabled>false</enabled></snapshots>
109                   </repository>
110                 </repositories>
111                 <pluginRepositories>
112                   <pluginRepository>
113                     <id>opendaylight-plugin-mirror</id>
114                     <name>opendaylight-plugin</name>
115                     <url>https://nexus.opendaylight.org/content/repositories/public/</url>
116                     <releases><updatePolicy>never</updatePolicy></releases>
117                     <snapshots><enabled>false</enabled></snapshots>
118                   </pluginRepository>
119                 </pluginRepositories>
120               </profile>
121               <profile>
122                 <id>file-snapshots</id>
123                 <repositories>
124                   <repository>
125                     <id>file-snapshots</id>
126                     <name>file</name>
127                     <url>file:///tmp/n/</url>
128                     <releases><enabled>false</enabled></releases>
129                   </repository>
130                 </repositories>
131                 <pluginRepositories>
132                   <pluginRepository>
133                     <id>file-plugin-snapshots</id>
134                     <name>file-plugin</name>
135                     <url>file:///tmp/n/</url>
136                     <releases><enabled>false</enabled></releases>
137                   </pluginRepository>
138                 </pluginRepositories>
139               </profile>
140             </profiles>
141             <activeProfiles>
142               <activeProfile>file-snapshots</activeProfile>
143               <activeProfile>opendaylight-release</activeProfile>
144             </activeProfiles>
145           </settings>
146           ' > fake_remotes.xml
147           # Notes: The settings are minimal in order to detect breakage scenarios,
148           # while allowing for the following quirks:
149           # * Some plugins seem to have hardcoded repos, for example check-license looks at repository.apache.org
150           # * Some plugin artifacts (related to surefire) are not downloaded when tests are skipped.
151           # * populate-local-repo looks at oss.sonatype.org and does not store things (like guava) to /tmp/r
152
153 - builder:
154     name: distribution-check-repeat-project-build
155     # Step five: Repeat the project build but with the new settings.
156     # Here, only the project snapshot artifacts deployed to /tmp/n are available,
157     # which faithfully reproduces conditions in later verify-like job runs.
158     # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode".
159     # SingleFeatureTest is still skipped, as we expect the same results as in the verify job.
160     # Current content of /tmp/r is restored afterwards to not affect the next step.
161     # TODO: Could there be missing dependencies which would only affect SFT here?
162     # Arguments:
163     #   pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
164     builders:
165       - shell: |
166           cp -r /tmp/r /tmp/t
167       - maven-target:
168           maven-version: 'mvn33'
169           pom: '{pom}'
170           goals: |
171               clean install
172               dependency:tree -DoutputFile=dependency_tree.txt
173               -s fake_remotes.xml
174               -Pq
175               {mvn-opts}
176           java-opts:
177             - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
178       - shell: |
179           rm -rf /tmp/r
180           mv /tmp/t /tmp/r
181
182 - builder:
183     name: distribution-check-repeat-distro-build
184     # Step six: Repeat the distribution build but with the new settings.
185     # Here, only the project snapshot artifacts deployed to /tmp/n are available,
186     # which faithfully reproduces conditions in later verify-like job runs.
187     # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode".
188     # This is where SingleFeatureTest is not skipped.
189     # TODO: Lower -Dsft.heap.max to 3g or lower when Bug 9218 is fixed.
190     # Arguments:
191     #   dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
192     builders:
193       - maven-target:
194           maven-version: 'mvn33'
195           pom: '{dist-pom}'
196           goals: |
197               clean install
198               dependency:tree -DoutputFile=dependency_tree.txt
199               -s fake_remotes.xml
200               -Pq
201               -Dsft.heap.max=4g
202               -DskipTests=false
203               {mvn-opts}
204           java-opts:
205             - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'