The following information is for a standard Jenkins setup for running Continuous Integration (CI)/Continuous Delivery (CD) for HERE platform.
Tools
The following tools are used in the CI/CD implementation. The source code for the example application and configuration in the Maven POM files can be viewed in the platform-examples-<release>.zip in the HERE Artifactory, https://repo.platform.here.com/artifactory.
Maven
JUnit
Jenkins
Git
Gerrit
Maven Plugins
The following Maven plugins are used for the CI server build.
Maven Plugin
Description
sonar-maven-plugin
SonarQube™ is an open source platform for Continuous Inspection of code quality. The Maven Plugin triggers the code analyzers.
jacoco-maven-plugin
The JaCoCo Maven plug-in provides the JaCoCo runtime agent for your tests and allows basic report creation.
maven-surefire-plugin
The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application.
maven-failsafe-plugin
The Failsafe Plugin is designed to run integration tests while the Surefire Plugin is designed to run unit tests.
Jenkins Plugins
The following Maven plugins are used for the CD server.
Note
The Pipeline plugin installs several dependent plugins.
To add your user credentials to Maven, follow the steps below.
From the main Jenkins dashboard, select Manage Jenkins.
Select Credentials from the left-hand side menu to display the System sub-menu.
Select the System sub-menu.
Select Global credentials > Add Credentials.
Figure 1. Add Credentials
Import the Maven settings.xml file
To import your Maven settings file, follow the steps below.
From the main Jenkins dashboard, select Manage Jenkins.
Select the Managed files plugin. This opens the Config File Management dashboard.
Select Add a new Config.
Select Maven settings.xml and click Submit.
Select Server Credentials Add.
Enter HERE_PLATFORM_REPO for ServerId. This matches the <server><id> section from your settings.xml file.
Enter the username and password pair from the downloaded settings.xml file in the Credentials field.
Remove the username and password pair from the downloaded settings.xml file and copy the resulting file into the Content field.
Figure 2. Import Maven Settings
Add OLP CLI Access Credentials in Jenkins
The sharing groups created for each environment must be added to Jenkins in order to gain permission to run OLP CLI commands.
Perform the following steps for each sharing group.
From the main Jenkins dashboard, select Manage Jenkins.
Select Credentials from the left-hand side menu. A System sub-menu opens under Credentials.
Select the System sub-menu.
Select Global credentials > Add Credentials.
Set the input parameters as indicated in the table below.
Label
Value
Kind
Secret file
Scope
Global
File
~/.here/credentials.properties
ID
Add Proxy Access Credentials in Jenkins (optional)
To add proxy access credentials, follow the steps below.
From the main Jenkins dashboard, select Manage Jenkins.
Select Credentials from the left-hand side menu. A System sub-menu opens under Credentials.
Select the System sub-menu.
Select Global credentials > Add Credentials.
Set the input parameters as indicated in the table below.
Label
Value
Kind
Username with password
Scope
Global
Username
<proxy username>
Password
<proxy password>
ID
proxy
Bind Proxy Credentials
To bind the proxy credentials, define the following pipeline DSL, which accesses the 'proxy' credentials created above and assigns "Username" to "USERNAME" and "Password" to "PASSWORD".
DSL Shared Libraries should be defined in a separate source control repository and configured in your Jenkins settings. The OLP CLI Helper Groovy class is part of HERE platform Shared Libraries.
Directory Structure
(root)
+- src # Groovy source files| +- org
| +- foo
| +- Bar.groovy # for org.foo.Bar class
+- vars
| +- foo.groovy # for global 'foo' variable| +- foo.txt # help for 'foo' variable
+- resources # resource files (external libraries only)| +- org
| +- foo
| +- bar.json # static helper data for org.foo.Bar
Configure Jenkins to Define Global Shared Libraries
From the main Jenkins dashboard, select Manage Jenkins.
Select Configure System.
Select Global Pipeline Libraries > Add.
Set up Jenkins to Run the Job Based on Jenkinsfile
Create a new Jenkins job.
Figure 3. New item
Enter an arbitrary unique job name and select Pipeline.
Inside the job configuration Pipeline area, select Pipeline script from SCM.
In SCM, configure your repository type, repository URL, credentials, and other values.
In the Script Path field, enter the relative location to your Jenkinsfile in your project repo.
If you want to trigger the build on Gerrit events, you need to set up Build Triggers » Gerrit events.
For additional information, refer to the following links.