| --- |
| # maven jobs for Java projects |
| |
| - job-template: |
| 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 |
| |
| node: 'ubuntu16.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: |
| - onf-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: |
| - onf-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: 'release-build-maven-settings' |
| settings-type: cfp |
| goals: '-Pci-verify clean test install' |
| |
| publishers: |
| - jacoco |
| |
| - job-template: |
| 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 |
| |
| node: 'ubuntu16.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: |
| - onf-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: |
| - onf-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: |
| # Provide GPG key file |
| - config-file-provider: |
| files: |
| - file-id: 'gpg-key' |
| target: 'jenkins.key' |
| variable: 'GPG_KEY_FILE' |
| |
| # 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 "Import GPG key" |
| gpg --import jenkins.key |
| |
| # make build release and deploy |
| - maven-target: |
| pom: pom.xml |
| settings: 'release-build-maven-settings' |
| settings-type: cfp |
| goals: '-Prelease clean deploy' |