2 # Copyright (c) 2019 AT&T Intellectual Property.
3 # Copyright (c) 2019 Nokia.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Macros and templates for using Docker as the CI system.
18 # The merge template calls builders to build in docker,
19 # export files, then push to PackageCloud.
20 # The docker image is discarded, not pushed to a registry.
21 # Uses builders defined in, and mirrors the structure of,
22 # global-jjb resource jjb/lf-docker-jobs.yaml
25 name: oran-packagecloud-file-provider
27 - config-file-provider:
29 - file-id: ".packagecloud"
30 target: "$HOME/.packagecloud"
31 - config-file-provider:
33 - file-id: "packagecloud_api"
34 target: "$HOME/packagecloud_api"
36 # This shell script launches the container, which copies
37 # build products to a mounted volume. Script needs vars
38 # CONTAINER_PUSH_REGISTRY, DOCKER_NAME and DOCKER_IMAGE_TAG
39 # as set by lf-docker-get-container-tag and lf-docker-build.
41 name: oran-docker-build-export
43 - shell: !include-raw-escape:
44 - shell/export-packages.sh
47 # {packagecloud-account} is PackageCloud account ID; example: oran
48 # {packagecloud-repo} is PackageCloud repository; example: master, staging
49 # {debian-distribution-versions} is list of DEB package distro/version strings
50 # separated by space; example: ubuntu/bionic debian/stretch
51 # {rpm-distribution-versions} is list of RPM package distro/version strings
52 # separated by space; example: el/4 el/5
53 name: oran-packagecloud-push
57 PACKAGECLOUD_ACCOUNT={packagecloud-account}
58 PACKAGECLOUD_REPO={packagecloud-repo}
59 DEBIAN_DISTRIBUTION_VERSIONS={debian-distribution-versions}
60 RPM_DISTRIBUTION_VERSIONS={rpm-distribution-versions}
61 - shell: !include-raw-escape:
62 - shell/packagecloud-push.sh
64 # Different name, same content as lf_docker_common
65 - oran_docker_common: &oran_docker_common
66 name: oran-docker-ci-common
68 project-type: freestyle
71 ######################
72 # Default parameters #
73 ######################
78 submodule-disable: false
79 submodule-recursive: true
81 pre_docker_build_script: "# pre docker build script goes here"
82 post_docker_build_script: "# post docker build script goes here"
84 docker-root: "$WORKSPACE"
86 git-url: "$GIT_URL/$PROJECT"
87 # TODO: how to interpolate value of {docker-root} parameter?
88 container-tag-yaml-dir: ""
94 disabled: "{disable-job}"
97 - lf-infra-properties:
98 build-days-to-keep: "{build-days-to-keep}"
101 - lf-infra-parameters:
104 refspec: "refs/heads/{branch}"
109 build-timeout: "{build-timeout}"
110 jenkins-ssh-credential: "{jenkins-ssh-credential}"
115 - oran_docker_ci_pc_merge_common: &oran_docker_ci_pc_merge_common
116 name: oran-docker-ci-pc-merge-common
120 - lf-infra-gerrit-scm:
121 jenkins-ssh-credential: "{jenkins-ssh-credential}"
123 refspec: "$GERRIT_REFSPEC"
124 branch: "$GERRIT_BRANCH"
125 submodule-disable: "{submodule-disable}"
126 submodule-recursive: "{submodule-recursive}"
127 submodule-timeout: "{submodule-timeout}"
128 choosing-strategy: gerrit
130 gerrit_merge_triggers:
131 - change-merged-event
132 - comment-added-contains-event:
133 comment-contains-value: remerge$
135 gerrit_trigger_file_paths:
136 - compare-type: REG_EXP
141 - config-file-provider:
143 - file-id: ".packagecloud"
144 target: "$HOME/.packagecloud"
145 - lf-infra-docker-login:
146 global-settings-file: "global-settings"
147 settings-file: "{mvn-settings}"
148 - shell: "{pre_docker_build_script}"
149 - lf-docker-get-container-tag:
150 container-tag-method: "{container-tag-method}"
151 container-tag-yaml-dir: "{container-tag-yaml-dir}"
152 docker-root: "{docker-root}"
154 docker-build-args: "{docker-build-args}"
155 docker-name: "{docker-name}"
156 docker-root: "{docker-root}"
157 container-public-registry: "{container-public-registry}"
158 container-push-registry: "{container-push-registry}"
159 - shell: "{post_docker_build_script}"
160 - oran-docker-build-export
161 - oran-packagecloud-push:
162 packagecloud-account: "{packagecloud-account}"
163 packagecloud-repo: "{packagecloud-repo}"
164 debian-distribution-versions: "{debian-distribution-versions}"
165 rpm-distribution-versions: "{rpm-distribution-versions}"
166 - lf-provide-maven-settings-cleanup
169 name: "{project-name}-docker-ci-pc-merge-{stream}"
170 id: oran-gerrit-docker-ci-pc-merge
172 <<: *oran_docker_common
173 # yamllint disable-line rule:key-duplicates
174 <<: *oran_docker_ci_pc_merge_common
177 - timed: "{obj:cron}"
179 server-name: "{gerrit-server-name}"
180 trigger-on: "{obj:gerrit_merge_triggers}"
182 - project-compare-type: ANT
183 project-pattern: "{project}"
185 - branch-compare-type: ANT
186 branch-pattern: "**/{branch}"
187 file-paths: "{obj:gerrit_trigger_file_paths}"