blob: 3d44a9eb1ece2158a5445c7ec34b3dc59e19e6a4 [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:
Charles Chanc501ef72020-11-17 17:00:11 -080062 - jacoco
Zack Williams5d2123b2020-06-25 17:10:02 -070063
64- job-template:
65 id: maven-publish
66 name: 'maven-publish{name-extension}_{project}'
67 description: |
68 <!-- Managed by Jenkins Job Builder -->
69 Created by {id} job-template from ci-management/jjb/maven.yaml
70
71 node: 'ubuntu16.04-basebuild-1c-2g'
72 project-type: freestyle
73
74 parameters:
75 - string:
76 name: jdkDistro
77 default: '{jdk-distribution}'
78 description: 'Distribution of the JDK to use with update-java-alternatives'
79
80 triggers:
81 - onf-infra-gerrit-trigger-merge:
82 gerrit-server-name: '{gerrit-server-name}'
83 project-regexp: '{project}'
84 branch-regexp: '{branch-regexp}'
85 file-include-regexp: '{all-files-regexp}'
86 dependency-jobs: '{dependency-jobs}'
87
88 properties:
89 - onf-infra-properties:
90 build-days-to-keep: '{build-days-to-keep}'
91 artifact-num-to-keep: '{artifact-num-to-keep}'
92
93 scm:
94 - lf-infra-gerrit-scm:
95 git-url: '$GIT_URL/$GERRIT_PROJECT'
96 refspec: '$GERRIT_REFSPEC'
97 branch: '$GERRIT_BRANCH'
98 submodule-disable: '{submodule-disable}'
99 submodule-recursive: 'false'
100 submodule-timeout: '{submodule-timeout}'
101 choosing-strategy: gerrit
102 jenkins-ssh-credential: '{jenkins-ssh-credential}'
103
104 builders:
105 # Provide GPG key file
106 - config-file-provider:
107 files:
108 - file-id: 'gpg-key'
109 target: 'jenkins.key'
110 variable: 'GPG_KEY_FILE'
111
112 # Set JDK version
113 - shell: |
114 #!/usr/bin/env bash
115 set -eu -o pipefail
116 echo "Setting JDK Distro to: $jdkDistro"
117 sudo update-java-alternatives -s $jdkDistro
118 echo "Java Version:"
119 java -version
120 echo "Import GPG key"
121 gpg --import jenkins.key
122
123 # make build release and deploy
124 - maven-target:
125 pom: pom.xml
126 settings: 'release-build-maven-settings'
127 settings-type: cfp
128 goals: '-Prelease clean deploy'