...
The following file hierarchy of the repository (ci-management) is similar to the following :
jenkins-scripts
jjb
???--- ci-management
? | ??? --- ci-management-macros.yaml
? | ??? --- ci-management.yaml
? | ??? --- raw-include-packer-validate.sh
???--- global-defaults.yaml
???--- global-macros.yaml
???--- global-templates-java.yaml
???--- global-templates-python.yaml
???--- include-raw-deploy-archives.sh
???--- mso
| ??? --- mso-libs.yaml
| ??? --- mso.yaml
packer
scripts
The main and most interesting part is the jjb folder where the whole Jenkins Job Builder configuration lies.
...
The configuration differs a bit if you use solely maven3 or mix it with maven2.
For maven3 it's quite simple, you have to add the plugin to you <build>
section :
If you need a maven2 / maven3 mix or more information, refer to this page
The behavior when the plugin is added will be as follows :
...
<!-- If the maven profile "docker" is specified the parameter -Dmso.git.url=<MsoGitRepo> must be provided
i.e: mvn clean install -P docker -Dmso.git.url=https://gerrit.onap.org/r-->
<mso.git.url>${env.GIT_NO_PROJECT}</mso.git.url>
+ <mso.project.version>${project.version}</mso.project.version>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>
+ println project.properties['mso.project.version'];
+ def versionArray;
+ if ( project.properties['mso.project.version'] != null ) {
+ versionArray = project.properties['mso.project.version'].split('\\.');
+ }
+
+ if ( project.properties['mso.project.version'].endsWith("-SNAPSHOT") ) {
+ project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-SNAPSHOT-latest";
+ } else {
+ project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+ }
+
+ println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
@@ -111,6 +141,7 @@
<build>
<tags>
<tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
</tags>
<cleanup>try</cleanup>
<dockerFileDir>docker-files</dockerFileDir>
SONAR
Sonar instance is available at https://sonar.onap.org/
Sonar push is typically done on the daily release job and is included in templates such as '{project-name}-{stream}-release-version-java-daily'.
Here is the specific step that does the sonar scan in this profile, in case you need to add it to a new profile :
In your pom.xml, add this plugin configuration (for more information on plugin parameters, please refer to http://docs.sonarqube.org/):
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.2</version>
</plugin>
JavaDoc
This explains how to configure your project to upload the javadoc to the Linux Foundation Nexus.
Step-by-step guide
Project configuration
To allow javadoc generation, add the maven-javadoc-plugin to your project pom.xml :
<
reporting
>
<
plugins
>
<
plugin
>
<
groupId
>org.apache.maven.plugins</
groupId
>
<
artifactId
>maven-javadoc-plugin</
artifactId
>
<
version
>2.10.4</
version
>
<
configuration
>
<
failOnError
>false</
failOnError
>
<
doclet
>org.umlgraph.doclet.UmlGraphDoc</
doclet
>
<
docletArtifact
>
<
groupId
>org.umlgraph</
groupId
>
<
artifactId
>umlgraph</
artifactId
>
<
version
>5.6</
version
>
</
docletArtifact
>
<
additionalparam
>-views</
additionalparam
>
<
useStandardDocletOptions
>true</
useStandardDocletOptions
>
</
configuration
>
</
plugin
>
</
plugins
>
</
reporting
>
Add the maven-site plugin :
<
plugin
>
<
groupId
>org.apache.maven.plugins</
groupId
>
<
artifactId
>maven-site-plugin</
artifactId
>
<
version
>3.6</
version
>
<
dependencies
>
<
dependency
>
<
groupId
>org.apache.maven.wagon</
groupId
>
<
artifactId
>wagon-webdav-jackrabbit</
artifactId
>
<
version
>2.10</
version
>
</
dependency
>
</
dependencies
>
</
plugin
>
Distribution management setup :
<
properties
>
...
<
nexusproxy
>https://nexus.onap.org</
nexusproxy
>
<
sitePath
>/content/sites/site/org/onap/mso/${project.version}</
sitePath
>
...
</
properties
>
<
distributionManagement
>
<
site
>
<
id
>ecomp-site</
id
>
<
url
>dav:${nexusproxy}${sitePath}</
url
>
</
site
>
</
distributionManagement
>
Be sure to use ecomp-site as id for your site, so that it matches the server credentials provided by the Linux Foundation.
Jenkins job configuration
Add the following lines to your projects yaml definition :
project.yaml
|
The added job(s) will be triggered when trigger-job ends successfully. This allow to publish the staging version documentation only when the staging release build succeeds and avoid overwriting the current documentation. The template {project-name}-{stream}-stage-site-java actually invokes mvn site:site and mvn site:stage-deploy on your project using the pom.xml specified as site-pom.