Per reports on the mailing list Sonar jobs are broken in OpenDaylight.
This is because Sonar release a new plugin which only works with newer
versions of Sonar so until we can upgrade we need to allow flexibility
to configure the Sonar job to override the default sonar:sonar goal.
With this patch it is now possible to override the Sonar goal in JJB
and force an older version of the Sonar plugin to run using a JJB
defaults config or projects variable like this:
sonar-mvn-goal: org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar
Unfortunately due to the defaults priority of JJB since we are
defining the sonar-mvn-goal parameter inside of the job template it
can only be overrided via a project section.
Reports:
https://lists.opendaylight.org/pipermail/release/2017-December/013119.html
https://lists.opendaylight.org/pipermail/release/2017-December/013223.html
Change-Id: I04512613f39e7c328e0f2f18d9c4729667e86909
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
<name>STAGING_PROFILE_ID</name>
<description>Nexus staging profile ID.
</description>
- <defaultValue>uuddlrlrba</defaultValue>
+ <defaultValue/>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>ARCHIVE_ARTIFACTS</name>
<description>Artifacts to archive to the logs server.</description>
<defaultValue/>
</hudson.model.StringParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>SONAR_MAVEN_GOAL</name>
+ <description>Maven goals to pass to the Sonar call. Typically sonar:sonar
+however to use a specific version of the sonar-maven-plugin we
+can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar".
+</description>
+ <defaultValue>sonar:sonar</defaultValue>
+ </hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
</hudson.tasks.Shell>
<EnvInjectBuilder>
<info>
- <propertiesContent>SONAR_HOST_URL=$SONAR_URL
-SONAR_MAVEN_GOAL=sonar:sonar
-</propertiesContent>
+ <propertiesContent>SONAR_HOST_URL=$SONAR_URL</propertiesContent>
</info>
</EnvInjectBuilder>
<org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
<name>STAGING_PROFILE_ID</name>
<description>Nexus staging profile ID.
</description>
- <defaultValue>uuddlrlrba</defaultValue>
+ <defaultValue/>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>ARCHIVE_ARTIFACTS</name>
<description>Artifacts to archive to the logs server.</description>
<defaultValue/>
</hudson.model.StringParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>SONAR_MAVEN_GOAL</name>
+ <description>Maven goals to pass to the Sonar call. Typically sonar:sonar
+however to use a specific version of the sonar-maven-plugin we
+can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar".
+</description>
+ <defaultValue>sonar:sonar</defaultValue>
+ </hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
</hudson.tasks.Shell>
<EnvInjectBuilder>
<info>
- <propertiesContent>SONAR_HOST_URL=$SONAR_URL
-SONAR_MAVEN_GOAL=sonar:sonar
-</propertiesContent>
+ <propertiesContent>SONAR_HOST_URL=$SONAR_URL</propertiesContent>
</info>
</EnvInjectBuilder>
<org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
mvn-opts: ''
mvn-params: ''
mvn-version: mvn33
+ sonar-mvn-goal: 'sonar:sonar'
staging-profile-id: '' # Unused in this job
stream: master
submodule-recursive: true
# Job Configuration #
#####################
+ parameters:
+ - lf-infra-parameters:
+ project: '{project}'
+ branch: '{branch}'
+ stream: '{stream}'
+ lftools-version: '{lftools-version}'
+ - lf-infra-maven-parameters:
+ mvn-opts: '{mvn-opts}'
+ mvn-params: '{mvn-params}'
+ mvn-version: '{mvn-version}'
+ # Staging repos do not make sense for Sonar jobs so set it blank.
+ staging-profile-id: ''
+ - string:
+ name: ARCHIVE_ARTIFACTS
+ default: '{archive-artifacts}'
+ description: Artifacts to archive to the logs server.
+ - string:
+ name: SONAR_MAVEN_GOAL
+ default: '{sonar-mvn-goal}'
+ description: |
+ Maven goals to pass to the Sonar call. Typically sonar:sonar
+ however to use a specific version of the sonar-maven-plugin we
+ can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar".
+
triggers:
- timed: 'H H * * 6'
- gerrit:
mvn-version: '{mvn-version}'
- inject:
# Switch this to the sonar wrapper when JJB 2.0 is available
- properties-content: |
- SONAR_HOST_URL=$SONAR_URL
- SONAR_MAVEN_GOAL=sonar:sonar
+ properties-content: SONAR_HOST_URL=$SONAR_URL
- lf-provide-maven-settings:
global-settings-file: global-settings
settings-file: '{mvn-settings}'