Extend sonatype-clm.sh goals 46/16346/4
authorJessica Wagantall <jwagantall@linuxfoundation.org>
Sat, 27 Jul 2019 02:08:16 +0000 (19:08 -0700)
committerJessica Wagantall <jwagantall@linuxfoundation.org>
Mon, 29 Jul 2019 18:17:38 +0000 (11:17 -0700)
Allow to configure maven goals in
lf-maven-clm to allow running test in
some projects.

Issue: RELENG-2236
Change-Id: I83c0efb8b3749483554bf4c1db04ea77c2d17cd7
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
docs/jjb/lf-maven-jobs.rst
jjb/lf-maven-jobs.yaml
releasenotes/notes/configure-maven-clm-goals-f91df18f5b2a8d74.yaml [new file with mode: 0644]
shell/sonatype-clm.sh

index fd0b890..bdee524 100644 (file)
@@ -96,6 +96,16 @@ Setup Java alternatives for the Distro.
     :java-version: Version of Java to set as the default Java.
         Eg. openjdk8
 
+lf-infra-sonatype-clm
+---------------------
+
+Runs a Sonatype CLM scan against a Maven project and pushes results to
+Nexus IQ server.
+
+:Optional parameters:
+    :mvn-goals: The maven goals to perform for the build.
+        (default: clean install)
+
 Job Templates
 =============
 
@@ -128,6 +138,8 @@ Produces a CLM scan of the code into Nexus IQ Server.
     :java-version: Version of Java to use for the build. (default: openjdk8)
     :mvn-global-settings: The name of the Maven global settings to use for
         Maven configuration. (default: global-settings)
+    :mvn-goals: The maven goals to perform for the build.
+        (default: clean install)
     :mvn-opts: Sets MAVEN_OPTS. (default: '')
     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
     :mvn-version: Version of maven to use. (default: mvn35)
index a012691..a01af95 100644 (file)
     github-url: "https://github.com"
     java-version: openjdk8
     mvn-global-settings: global-settings
+    mvn-goals: clean install
     mvn-opts: ""
     mvn-params: ""
     mvn-version: mvn35
       - lf-provide-maven-settings:
           global-settings-file: "{mvn-global-settings}"
           settings-file: "{mvn-settings}"
-      - shell: !include-raw-escape:
-          - ../shell/common-variables.sh
-          - ../shell/sonatype-clm.sh
+      - lf-infra-sonatype-clm:
+          mvn-goals: "{mvn-goals}"
       - lf-provide-maven-settings-cleanup
       - shell: 'find . -regex ".*karaf/target" | xargs rm -rf'
       - nexus-iq-policy-evaluator:
           scan-patterns: "{obj:nexus_iq_scan_patterns}"
           fail-build-network-error: true
 
+- builder:
+    name: lf-infra-sonatype-clm
+    # Run a CLM scan build with Maven
+    builders:
+      - inject:
+          properties-content: |
+            MAVEN_GOALS={mvn-goals}
+      - shell: !include-raw-escape:
+          - ../shell/common-variables.sh
+          - ../shell/sonatype-clm.sh
+
 - job-template:
     name: "{project-name}-maven-clm-{stream}"
     id: gerrit-maven-clm
diff --git a/releasenotes/notes/configure-maven-clm-goals-f91df18f5b2a8d74.yaml b/releasenotes/notes/configure-maven-clm-goals-f91df18f5b2a8d74.yaml
new file mode 100644 (file)
index 0000000..0f2178b
--- /dev/null
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Allow maven goals to be configured in sonatype-clm.sh.
+    Set to "clean install" by default.
index 3642d51..2071974 100644 (file)
@@ -21,7 +21,7 @@ export MAVEN_OPTS
 
 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
 # shellcheck disable=SC2086
-$MVN clean install dependency:tree com.sonatype.clm:clm-maven-plugin:index \
+$MVN $MAVEN_GOALS dependency:tree com.sonatype.clm:clm-maven-plugin:index \
     --global-settings "$GLOBAL_SETTINGS_FILE" \
     --settings "$SETTINGS_FILE" \
     -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \