Fix maven-release job choosing strategy
[releng/global-jjb.git] / jjb / lf-maven-jobs.yaml
1 ---
2 # This file contains job templates for Maven projects.
3
4 - job-group:
5     name: '{project-name}-maven-jobs'
6
7     # This job group contains all the recommended jobs that should be deployed
8     # for any project ci.
9
10     jobs:
11       - gerrit-maven-release
12
13 - job-group:
14     name: '{project-name}-github-maven-jobs'
15
16     # This job group contains all the recommended jobs that should be deployed
17     # for any project ci that is using github.
18
19     jobs:
20       - github-maven-release
21
22 ####################
23 # Anchors & Macros #
24 ####################
25 - lf_maven_release: &lf_maven_release
26     name: lf-maven-release
27
28     # Produces a release candidate by creating a staging repo in Nexus.
29     #
30     # Runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
31     # directory can then be reused later to deploy to Nexus.
32     #
33     # Required parameters:
34     #     build-node:    The node to run build on.
35     #     jenkins-ssh-credential: Credential to use for SSH. (Generally should
36     #                             be configured in defaults.yaml)
37     #     settings-file: The name of settings file containing credentials for
38     #                    the project.
39     #     global-settings-file: The name of the Maven global settings to use for
40     #                           Maven configuration.
41     #     staging-profile-id: Profile ID of the project's Nexus staging profile.
42
43     project-type: freestyle
44     node: '{build-node}'
45     jdk: '{java-version}'
46
47     ######################
48     # Default parameters #
49     ######################
50
51     branch: master
52     build-timeout: 30
53     git-url: '$GIT_URL/$PROJECT'
54     global-settings-file: global-settings
55     java-version: openjdk8
56     mvn-opts: ''
57     mvn-params: ''
58     mvn-version: mvn33
59     submodule-recursive: true
60
61     #####################
62     # Job Configuration #
63     #####################
64
65     properties:
66       - lf-infra-properties:
67           # Keep around for 30 days in case a release takes long to get approved.
68           build-days-to-keep: 30
69
70     parameters:
71       - lf-infra-parameters:
72           project: '{project}'
73           branch: '{branch}'
74       - lf-infra-maven-parameters:
75           mvn-opts: '{mvn-opts}'
76           mvn-params: '{mvn-params}'
77           mvn-version: '{mvn-version}'
78           staging-profile-id: '{staging-profile-id}'
79
80     wrappers:
81       - lf-infra-wrappers:
82           build-timeout: '{build-timeout}'
83           jenkins-ssh-credential: '{jenkins-ssh-credential}'
84
85     builders:
86       - lf-jacoco-nojava-workaround
87       - lf-maven-install:
88           mvn-version: '{mvn-version}'
89       - lf-provide-maven-settings:
90           global-settings-file: '{global-settings-file}'
91           settings-file: '{settings-file}'
92       - lf-infra-create-netrc:
93           server-id: opendaylight-staging
94       - shell: !include-raw-escape:
95           - ../shell/lftools-install.sh
96           - ../shell/common-variables.sh
97           - ../shell/maven-patch-release.sh
98           - ../shell/maven-build.sh
99           - ../shell/maven-stage.sh
100       - lf-provide-maven-settings-cleanup
101
102     publishers:
103       # TODO: Make email notification work.
104       # - lf-infra-email-notify:
105       #     email-recipients: '{email-recipients}'
106       #     email-prefix: '[releng]'
107       - lf-infra-publish
108
109
110 #################
111 # Job Templates #
112 #################
113
114 - job-template:
115     name: '{project-name}-maven-release-{stream}'
116     id: gerrit-maven-release
117     <<: *lf_maven_release
118
119     scm:
120       - lf-infra-gerrit-scm:
121           jenkins-ssh-credential: '{jenkins-ssh-credential}'
122           git-url: '{git-url}'
123           refspec: '$GERRIT_REFSPEC'
124           branch: '$GERRIT_BRANCH'
125           submodule-recursive: '{submodule-recursive}'
126           choosing-strategy: default
127
128 - job-template:
129     name: '{project-name}-maven-release-{stream}'
130     id: github-maven-release
131     <<: *lf_maven_release
132
133     properties:
134       - github:
135           url: '{git-url}/{github-org}/{project}'
136
137     scm:
138       - lf-infra-github-scm:
139           url: '{git-clone-url}{github-org}/{project}'
140           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
141           branch: '{branch}'
142           submodule-recursive: '{submodule-recursive}'
143           choosing-strategy: default
144           jenkins-ssh-credential: '{jenkins-ssh-credential}'