Merge "Define CMake + Package Cloud stage job"
[ci-management.git] / jjb / oran-templates / oran-c-cpp-jobs.yaml
1 #   Copyright (c) 2020 AT&T Intellectual Property.
2 #
3 #   Licensed under the Apache License, Version 2.0 (the 'License');
4 #   you may not use this file except in compliance with the License.
5 #   You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #   Unless required by applicable law or agreed to in writing, software
10 #   distributed under the License is distributed on an 'AS IS' BASIS,
11 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #   See the License for the specific language governing permissions and
13 #   limitations under the License.
14 ---
15
16 # This file is structured with a cmake alias/anchor, an alias/anchor,
17 # and a job-template to simplify the task of lifting it to global-jjb.
18
19 ####################
20 # COMMON FUNCTIONS #
21 ####################
22
23 # Clone of lf_cmake_common which isn't visible here
24 - oran_cmake_common: &oran_cmake_common
25     name: oran-cmake-common
26
27     #####################
28     # Job Configuration #
29     #####################
30
31     project-type: freestyle
32     node: "{build-node}"
33     disabled: "{disable-job}"
34
35     properties:
36       - lf-infra-properties:
37           build-days-to-keep: "{build-days-to-keep}"
38
39     parameters:
40       - lf-infra-parameters:
41           project: "{project}"
42           branch: "{branch}"
43           stream: "{stream}"
44       - lf-cmake-parameters:
45           build-dir: "{build-dir}"
46           cmake-opts: "{cmake-opts}"
47           install-prefix: "{install-prefix}"
48           make-opts: "{make-opts}"
49
50     wrappers:
51       - lf-infra-wrappers:
52           build-timeout: "{build-timeout}"
53           jenkins-ssh-credential: "{jenkins-ssh-credential}"
54
55     publishers:
56       - lf-infra-publish
57
58 ##################
59 # CMAKE+PC STAGE #
60 ##################
61
62 - oran_cmake_pc_stage: &oran_cmake_pc_stage
63     name: oran-cmake-pc-stage
64
65     ######################
66     # Default parameters #
67     ######################
68
69     branch: master
70     build-days-to-keep: 7
71     build-dir: "$WORKSPACE/target"
72     build-timeout: 15
73     cmake-opts: ""
74     cron: "" # avoid for PackageCloud which rejects duplicates
75     disable-job: false
76     git-url: "$GIT_URL/$PROJECT"
77     github-url: "https://github.com"
78     install-prefix: "$BUILD_DIR/output"
79     make-opts: ""
80     pre-build: ""
81     stream: master
82     submodule-recursive: true
83     submodule-timeout: 10
84     submodule-disable: false
85
86     gerrit_trigger_file_paths:
87       - compare-type: REG_EXP
88         pattern: ".*"
89
90     # github_included_regions MUST match gerrit_trigger_file_paths
91     github_included_regions:
92       - ".*"
93
94     builders:
95       - config-file-provider:
96           files:
97             - file-id: ".packagecloud"
98               target: "$HOME/.packagecloud"
99       - shell: "{pre-build}"
100       - shell: !include-raw-escape: ../../global-jjb/shell/cmake-build.sh
101       - oran-packagecloud-push:
102           packagecloud-account: "{packagecloud-account}"
103           packagecloud-repo: "{packagecloud-repo}"
104           debian-distribution-versions: "{debian-distribution-versions}"
105           rpm-distribution-versions: "{rpm-distribution-versions}"
106
107 - job-template:
108     # build with cmake and publish to PackageCloud on command
109     name: "{project-name}-cmake-pc-stage-{stream}"
110     id: oran-gerrit-cmake-pc-stage
111     <<: *oran_cmake_common
112     <<: *oran_cmake_pc_stage
113
114     ######################
115     # Default parameters #
116     ######################
117
118     gerrit_stage_triggers:
119       - comment-added-contains-event:
120           comment-contains-value: '^Patch Set\s+\d+:\s+stage-release\s*$'
121
122     #####################
123     # Job Configuration #
124     #####################
125
126     scm:
127       - lf-infra-gerrit-scm:
128           jenkins-ssh-credential: "{jenkins-ssh-credential}"
129           git-url: "{git-url}"
130           refspec: "$GERRIT_REFSPEC"
131           branch: "$GERRIT_BRANCH"
132           submodule-recursive: "{submodule-recursive}"
133           submodule-timeout: "{submodule-timeout}"
134           submodule-disable: "{submodule-disable}"
135           # stage jobs always build from tip
136           choosing-strategy: default
137
138     triggers:
139       - timed: "{obj:cron}"
140       - gerrit:
141           server-name: "{gerrit-server-name}"
142           trigger-on: "{obj:gerrit_stage_triggers}"
143           projects:
144             - project-compare-type: ANT
145               project-pattern: "{project}"
146               branches:
147                 - branch-compare-type: ANT
148                   branch-pattern: "**/{branch}"
149               file-paths: "{obj:gerrit_trigger_file_paths}"