Continuous Integration with Hudson and Jenkins#
Download the latest Lattix Hudson / Jenkins plug-in here: https://www.lattix.com/dl/release/hudsonjenkins/lattix-070118.hpi.
The earliest versions that the plug-in has been tested an confirmed to work with is Hudson 2.2.1 and Jenkins 1.474. The plug-in allows you to integrate Lattix command line commands with Hudson and Jenkins.
Installing Hudson / Jenkins plug-in#
The procedure for installing the plug-in is nearly identical in both Hudson and Jenkins
In web browser, go to Jenkins
Click on “Manage Jenkins” in left hand navigation panel
Click on “Manage Jenkins” in center panel
Click on “Advanced” tab
Under “Upload Plugin” section,
click “Chose File”
select the plugin that you download (hpi file)
Click “Upload”
Navigate to the “Installed” tab and click “Restart Once No Jobs Are Running”
Configuring Hudson / Jenkins#
After installing the plug-in and restarting Jenkins
In web browser, go to Jenkins
Click on “Manage Jenkins” in left hand navigation panel
Click on “Configure System” in center panel
Scroll down until “Lattix” section is visible
Click “Add Lattix” button
Enter name for lattix install
Enter path for currently installed lattix
Scroll down until “Lattix Web” section is visible
Click “Add Lattix Web” button
Enter name for repository
Enter values for host/port/appname/user/password for Lattix Repository
Click “Save” at bottom of page
Adding Lattix Support to Jobs#
Once you have installed and configured the plug-in, you can add Lattix commands to your Jobs.
In web browser, go to Jenkins
Click on name of job to which you will add a Lattix build step
Click on “Configure” in left nav panel
Scroll down to “build” section
Click “Add Build Step” drop down
select “Lattix LDM”
fill in the fields
repeat “Add Build Step” to add multiple commands
Jenkins pipline support#
This is an example pipeline that will force the stage to fail if new violations are detected after a project update using ldcupdate#
the -deltaviolations
argument will create the given file if there is a change in the architecture violations.
This example assumes you have set up Lattix in the Global tool configuration in Jenkins
pipeline {
agent any
stages {
stage("No New Violations"){
steps{
dir("."){
withEnv(["LATTIX_HOME=${ tool 'Lattix' }"]) {
sh """
"$LATTIX_HOME/bin/ldcupdate.sh" project.ldz -module:clang buildspec.xml -deltaviolations:delta.txt
if [ -f delta.txt ]; then
count=`grep -ci "No New Rule Violations Found" delta.txt`
if [ "\$count" -ne "1" ]; then
echo "New rule violations found"
exit 1
fi
fi
"""
}
}
}
}
}
}