Expose stream as a env variable
[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     stream: master
60     submodule-recursive: true
61
62     #####################
63     # Job Configuration #
64     #####################
65
66     properties:
67       - lf-infra-properties:
68           # Keep around for 30 days in case a release takes long to get approved.
69           build-days-to-keep: 30
70
71     parameters:
72       - lf-infra-parameters:
73           project: '{project}'
74           branch: '{branch}'
75           stream: '{stream}'
76       - lf-infra-maven-parameters:
77           mvn-opts: '{mvn-opts}'
78           mvn-params: '{mvn-params}'
79           mvn-version: '{mvn-version}'
80           staging-profile-id: '{staging-profile-id}'
81
82     wrappers:
83       - lf-infra-wrappers:
84           build-timeout: '{build-timeout}'
85           jenkins-ssh-credential: '{jenkins-ssh-credential}'
86
87     builders:
88       - lf-jacoco-nojava-workaround
89       - lf-maven-install:
90           mvn-version: '{mvn-version}'
91       - lf-provide-maven-settings:
92           global-settings-file: '{global-settings-file}'
93           settings-file: '{settings-file}'
94       - lf-infra-create-netrc:
95           server-id: opendaylight-staging
96       - shell: !include-raw-escape:
97           - ../shell/lftools-install.sh
98           - ../shell/common-variables.sh
99           - ../shell/maven-patch-release.sh
100           - ../shell/maven-build.sh
101           - ../shell/maven-stage.sh
102       - lf-provide-maven-settings-cleanup
103
104     publishers:
105       # TODO: Make email notification work.
106       # - lf-infra-email-notify:
107       #     email-recipients: '{email-recipients}'
108       #     email-prefix: '[releng]'
109       - lf-infra-publish
110
111
112 #################
113 # Job Templates #
114 #################
115
116 - job-template:
117     name: '{project-name}-maven-release-{stream}'
118     id: gerrit-maven-release
119     <<: *lf_maven_release
120
121     scm:
122       - lf-infra-gerrit-scm:
123           jenkins-ssh-credential: '{jenkins-ssh-credential}'
124           git-url: '{git-url}'
125           refspec: '$GERRIT_REFSPEC'
126           branch: '$GERRIT_BRANCH'
127           submodule-recursive: '{submodule-recursive}'
128           choosing-strategy: default
129
130 - job-template:
131     name: '{project-name}-maven-release-{stream}'
132     id: github-maven-release
133     <<: *lf_maven_release
134
135     properties:
136       - github:
137           url: '{git-url}/{github-org}/{project}'
138
139     scm:
140       - lf-infra-github-scm:
141           url: '{git-clone-url}{github-org}/{project}'
142           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
143           branch: '{branch}'
144           submodule-recursive: '{submodule-recursive}'
145           choosing-strategy: default
146           jenkins-ssh-credential: '{jenkins-ssh-credential}'