blob: 00bb08efe1a3573835476114d38e88da4d6c3db3 [file] [log] [blame]
---
# maven jobs for Java projects
- job-template:
id: maven-test
name: 'verify_{project}_maven-test{name-extension}'
sandbox: true
description: |
<!-- Managed by Jenkins Job Builder -->
Created by {id} job-template from ci-management/jjb/maven.yaml
node: 'ubuntu18.04-basebuild-1c-2g'
project-type: freestyle
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}'
scm:
- lf-infra-gerrit-scm:
git-url: '$GIT_URL/$GERRIT_PROJECT'
refspec: '$GERRIT_REFSPEC'
branch: '$GERRIT_BRANCH'
submodule-disable: '{submodule-disable}'
submodule-recursive: 'false'
submodule-timeout: '{submodule-timeout}'
choosing-strategy: gerrit
jenkins-ssh-credential: '{jenkins-ssh-credential}'
builders:
# Set JDK version
- 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
# run tests and install
- maven-target:
pom: pom.xml
settings: 'cord-apps-maven-settings'
settings-type: cfp
goals: '-Pci-verify clean test install spotbugs:check'
maven-version: '{maven-version}'
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-publish
name: 'maven-publish{name-extension}_{project}'
sandbox: true
description: |
<!-- Managed by Jenkins Job Builder -->
Created by {id} job-template from ci-management/jjb/maven.yaml
node: 'ubuntu18.04-basebuild-1c-2g'
project-type: freestyle
parameters:
- string:
name: jdkDistro
default: '{jdk-distribution}'
description: 'Distribution of the JDK to use with update-java-alternatives'
triggers:
- cord-infra-gerrit-trigger-merge:
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}'
scm:
- lf-infra-gerrit-scm:
git-url: '$GIT_URL/$GERRIT_PROJECT'
refspec: '$GERRIT_REFSPEC'
branch: '$GERRIT_BRANCH'
submodule-disable: '{submodule-disable}'
submodule-recursive: 'false'
submodule-timeout: '{submodule-timeout}'
choosing-strategy: gerrit
jenkins-ssh-credential: '{jenkins-ssh-credential}'
wrappers:
- credentials-binding:
- file:
credential-id: 'gpg-creds-maven'
variable: 'GNUPG'
builders:
# Set JDK version
- 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
echo "Unpacking GPG Keys"
tar -xvf $GNUPG -C ~
- maven-target:
pom: pom.xml
settings: 'cord-apps-maven-settings'
settings-type: cfp
goals: '-Prelease clean deploy'
maven-version: '{maven-version}'