Revise Maven-based tests/builds
- Rename jobs to match current naming scheme
- Allow jobs to be renamed so they can be used with both JDK 8 and 11
- Run tests and publish junit/cobertura if found
- Move repo jobs into the verify dir from the maven dir to match others
- Update tagcollision/versiontag to parse versions from pom.xml files
Change-Id: I5e9da20bbdcb0edc62bb35e171aa4e13f91c2ab1
diff --git a/jjb/maven.yaml b/jjb/maven.yaml
index 5287127..cc2bc62 100644
--- a/jjb/maven.yaml
+++ b/jjb/maven.yaml
@@ -2,8 +2,8 @@
# maven jobs for Java projects
- job-template:
- id: maven-install
- name: '{project}-gerrit'
+ id: maven-test
+ name: 'verify_{project}_maven-test{name-extension}'
description: |
<!-- Managed by Jenkins Job Builder -->
Created by {id} job-template from ci-management/jjb/maven.yaml
@@ -13,16 +13,6 @@
parameters:
- string:
- name: GERRIT_BRANCH
- default: 'master'
- description: 'Use default when using "Build Now"'
-
- - string:
- name: GERRIT_REFSPEC
- default: 'refs/heads/master'
- description: 'Use default when using "Build Now"'
-
- - string:
name: jdkDistro
default: '{jdk-distribution}'
description: 'Distribution of the JDK to use with update-java-alternatives'
@@ -41,24 +31,16 @@
artifact-num-to-keep: '{artifact-num-to-keep}'
scm:
- - git:
- url: '{gerrit-server-url}/{project}'
- branches:
- - '$GERRIT_BRANCH'
+ - lf-infra-gerrit-scm:
+ git-url: '$GIT_URL/$GERRIT_PROJECT'
refspec: '$GERRIT_REFSPEC'
- choosing-strategy: 'gerrit'
- shallow-clone: true
+ branch: '$GERRIT_BRANCH'
+ submodule-recursive: 'false'
+ choosing-strategy: gerrit
+ jenkins-ssh-credential: '{jenkins-ssh-credential}'
builders:
- # NOTE: this env var is only required to fix a bug in the "surefire" dependency:
- # https://issues.apache.org/jira/browse/SUREFIRE-1588
- # https://github.com/apache/maven-surefire/pull/197
- # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911925
- # should be removed as soon as this problem is resolved
- - inject:
- properties-content: |
- _JAVA_OPTIONS=-Djdk.net.URLClassPath.disableClassPathURLCheck=true
-
+ # Set JDK version
- shell: |
#!/usr/bin/env bash
set -eu -o pipefail
@@ -67,13 +49,32 @@
echo "Java Version:"
java -version
+ # run tests and install
- maven-target:
pom: pom.xml
- goals: 'clean install'
+ settings: onoscord-apps
+ settings-type: cfp
+ goals: 'clean test install'
+
+ publishers:
+ - junit:
+ results: "**/TEST-*.xml"
+ allow-empty-results: '{junit-allow-empty-results}'
+ - cobertura:
+ report-file: "**/*coverage.xml"
+ targets:
+ - files:
+ healthy: 80
+ unhealthy: 0
+ failing: 0
+ - method:
+ healthy: 50
+ unhealthy: 0
+ failing: 0
- job-template:
- id: maven-deploy
- name: '{project}-gerrit-deploy'
+ id: maven-publish
+ name: 'maven-publish{name-extension}_{project}'
description: |
<!-- Managed by Jenkins Job Builder -->
Created by {id} job-template from ci-management/jjb/maven.yaml
@@ -83,16 +84,6 @@
parameters:
- string:
- name: GERRIT_BRANCH
- default: 'master'
- description: 'Use default when using "Build Now"'
-
- - string:
- name: GERRIT_REFSPEC
- default: 'refs/heads/master'
- description: 'Use default when using "Build Now"'
-
- - string:
name: jdkDistro
default: '{jdk-distribution}'
description: 'Distribution of the JDK to use with update-java-alternatives'
@@ -111,19 +102,16 @@
artifact-num-to-keep: '{artifact-num-to-keep}'
scm:
- - git:
- url: '{gerrit-server-url}/{project}'
- branches:
- - '$GERRIT_BRANCH'
+ - lf-infra-gerrit-scm:
+ git-url: '$GIT_URL/$GERRIT_PROJECT'
refspec: '$GERRIT_REFSPEC'
- choosing-strategy: 'gerrit'
- shallow-clone: true
+ branch: '$GERRIT_BRANCH'
+ submodule-recursive: 'false'
+ choosing-strategy: gerrit
+ jenkins-ssh-credential: '{jenkins-ssh-credential}'
builders:
- - inject:
- properties-content: |
- _JAVA_OPTIONS=-Djdk.net.URLClassPath.disableClassPathURLCheck=true
-
+ # Set JDK version
- shell: |
#!/usr/bin/env bash
set -eu -o pipefail
@@ -137,70 +125,3 @@
settings: onoscord-apps
settings-type: cfp
goals: 'clean deploy'
-
-- job-template:
- id: maven-test
- name: 'verify_{project}_maven-test'
- description: |
- <!-- Managed by Jenkins Job Builder -->
- Created by {id} job-template from ci-management/jjb/maven.yaml
-
- parameters:
- - string:
- name: jdkDistro
- default: '{jdk-distribution}'
- description: 'Distribution of the JDK to use with update-java-alternatives'
-
- triggers:
- - cord-infra-gerrit-trigger-patchset:
- gerrit-server-name: '{gerrit-server-name}'
- project-regexp: '{project}'
- branch-regexp: '{branch-regexp}'
- file-include-regexp: '{all-files-regexp}'
- dependency-jobs: '{dependency-jobs}'
-
- properties:
- - cord-infra-properties:
- build-days-to-keep: '{build-days-to-keep}'
- artifact-num-to-keep: '{artifact-num-to-keep}'
-
-
- wrappers:
- - lf-infra-wrappers:
- build-timeout: 30
- jenkins-ssh-credential: '{jenkins-ssh-credential}'
-
- scm:
- - lf-infra-gerrit-scm:
- git-url: '$GIT_URL/$GERRIT_PROJECT'
- refspec: '$GERRIT_REFSPEC'
- branch: '$GERRIT_BRANCH'
- submodule-recursive: 'false'
- choosing-strategy: gerrit
- jenkins-ssh-credential: '{jenkins-ssh-credential}'
-
- node: 'ubuntu16.04-basebuild-1c-2g'
- project-type: maven
- concurrent: true
-
- builders:
- # NOTE: this env var is only required to fix a bug in the "surefire" dependency:
- # https://issues.apache.org/jira/browse/SUREFIRE-1588
- # https://github.com/apache/maven-surefire/pull/197
- # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911925
- # should be removed as soon as this problem is resolved
- - inject:
- properties-content: |
- _JAVA_OPTIONS=-Djdk.net.URLClassPath.disableClassPathURLCheck=true
-
- - shell: |
- #!/usr/bin/env bash
- set -eu -o pipefail
- echo "Setting JDK Distro to: $jdkDistro"
- sudo update-java-alternatives -s $jdkDistro
- echo "Java Version:"
- java -version
-
- - maven-target:
- pom: pom.xml
- goals: 'test'