blob: 7d8788a525a1ccb16eae3c0cab68eea2d4eb8c7a [file] [log] [blame]
Zack Williams5d2123b2020-06-25 17:10:02 -07001---
2# maven jobs for Java projects
3
4- job-template:
5 id: maven-test
6 name: 'verify_{project}_maven-test{name-extension}'
7 description: |
8 <!-- Managed by Jenkins Job Builder -->
9 Created by {id} job-template from ci-management/jjb/maven.yaml
10
11 node: 'ubuntu16.04-basebuild-1c-2g'
12 project-type: freestyle
13
14 parameters:
15 - string:
16 name: jdkDistro
17 default: '{jdk-distribution}'
18 description: 'Distribution of the JDK to use with update-java-alternatives'
19
20 triggers:
21 - onf-infra-gerrit-trigger-patchset:
22 gerrit-server-name: '{gerrit-server-name}'
23 project-regexp: '{project}'
24 branch-regexp: '{branch-regexp}'
25 file-include-regexp: '{all-files-regexp}'
26 dependency-jobs: '{dependency-jobs}'
27
28 properties:
29 - onf-infra-properties:
30 build-days-to-keep: '{build-days-to-keep}'
31 artifact-num-to-keep: '{artifact-num-to-keep}'
32
33 scm:
34 - lf-infra-gerrit-scm:
35 git-url: '$GIT_URL/$GERRIT_PROJECT'
36 refspec: '$GERRIT_REFSPEC'
37 branch: '$GERRIT_BRANCH'
38 submodule-disable: '{submodule-disable}'
39 submodule-recursive: 'false'
40 submodule-timeout: '{submodule-timeout}'
41 choosing-strategy: gerrit
42 jenkins-ssh-credential: '{jenkins-ssh-credential}'
43
44 builders:
45 # Set JDK version
46 - shell: |
47 #!/usr/bin/env bash
48 set -eu -o pipefail
49 echo "Setting JDK Distro to: $jdkDistro"
50 sudo update-java-alternatives -s $jdkDistro
51 echo "Java Version:"
52 java -version
53
54 # run tests and install
55 - maven-target:
56 pom: pom.xml
57 settings: 'release-build-maven-settings'
58 settings-type: cfp
59 goals: '-Pci-verify clean test install'
60
61 publishers:
62 - junit:
63 results: "**/TEST-*.xml"
64 allow-empty-results: '{junit-allow-empty-results}'
65 - cobertura:
66 report-file: "**/*coverage.xml"
67 targets:
68 - files:
69 healthy: 80
70 unhealthy: 0
71 failing: 0
72 - method:
73 healthy: 50
74 unhealthy: 0
75 failing: 0
76
77- job-template:
78 id: maven-publish
79 name: 'maven-publish{name-extension}_{project}'
80 description: |
81 <!-- Managed by Jenkins Job Builder -->
82 Created by {id} job-template from ci-management/jjb/maven.yaml
83
84 node: 'ubuntu16.04-basebuild-1c-2g'
85 project-type: freestyle
86
87 parameters:
88 - string:
89 name: jdkDistro
90 default: '{jdk-distribution}'
91 description: 'Distribution of the JDK to use with update-java-alternatives'
92
93 triggers:
94 - onf-infra-gerrit-trigger-merge:
95 gerrit-server-name: '{gerrit-server-name}'
96 project-regexp: '{project}'
97 branch-regexp: '{branch-regexp}'
98 file-include-regexp: '{all-files-regexp}'
99 dependency-jobs: '{dependency-jobs}'
100
101 properties:
102 - onf-infra-properties:
103 build-days-to-keep: '{build-days-to-keep}'
104 artifact-num-to-keep: '{artifact-num-to-keep}'
105
106 scm:
107 - lf-infra-gerrit-scm:
108 git-url: '$GIT_URL/$GERRIT_PROJECT'
109 refspec: '$GERRIT_REFSPEC'
110 branch: '$GERRIT_BRANCH'
111 submodule-disable: '{submodule-disable}'
112 submodule-recursive: 'false'
113 submodule-timeout: '{submodule-timeout}'
114 choosing-strategy: gerrit
115 jenkins-ssh-credential: '{jenkins-ssh-credential}'
116
117 builders:
118 # Provide GPG key file
119 - config-file-provider:
120 files:
121 - file-id: 'gpg-key'
122 target: 'jenkins.key'
123 variable: 'GPG_KEY_FILE'
124
125 # Set JDK version
126 - shell: |
127 #!/usr/bin/env bash
128 set -eu -o pipefail
129 echo "Setting JDK Distro to: $jdkDistro"
130 sudo update-java-alternatives -s $jdkDistro
131 echo "Java Version:"
132 java -version
133 echo "Import GPG key"
134 gpg --import jenkins.key
135
136 # make build release and deploy
137 - maven-target:
138 pom: pom.xml
139 settings: 'release-build-maven-settings'
140 settings-type: cfp
141 goals: '-Prelease clean deploy'