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-get-container-tag-script: "../shell/docker-get-container-tag.sh"
85 docker-root: "$WORKSPACE"
87 git-url: "$GIT_URL/$PROJECT"
88 # TODO: how to interpolate value of {docker-root} parameter?
89 container-tag-yaml-dir: ""
95 disabled: "{disable-job}"
98 - lf-infra-properties:
99 build-days-to-keep: "{build-days-to-keep}"
102 - lf-infra-parameters:
105 refspec: "refs/heads/{branch}"
110 build-timeout: "{build-timeout}"
111 jenkins-ssh-credential: "{jenkins-ssh-credential}"
116 - oran_docker_ci_pc_merge_common: &oran_docker_ci_pc_merge_common
117 name: oran-docker-ci-pc-merge-common
121 - lf-infra-gerrit-scm:
122 jenkins-ssh-credential: "{jenkins-ssh-credential}"
124 refspec: "$GERRIT_REFSPEC"
125 branch: "$GERRIT_BRANCH"
126 submodule-disable: "{submodule-disable}"
127 submodule-recursive: "{submodule-recursive}"
128 submodule-timeout: "{submodule-timeout}"
129 choosing-strategy: gerrit
131 gerrit_merge_triggers:
132 - change-merged-event
133 - comment-added-contains-event:
134 comment-contains-value: remerge$
136 gerrit_trigger_file_paths:
137 - compare-type: REG_EXP
142 - config-file-provider:
144 - file-id: ".packagecloud"
145 target: "$HOME/.packagecloud"
146 - lf-infra-docker-login:
147 global-settings-file: "global-settings"
148 settings-file: "{mvn-settings}"
149 - shell: "{pre_docker_build_script}"
150 - lf-docker-get-container-tag:
151 container-tag-method: "{container-tag-method}"
152 container-tag-yaml-dir: "{container-tag-yaml-dir}"
153 docker-root: "{docker-root}"
154 docker-get-container-tag-script: "{docker-get-container-tag-script}"
156 docker-build-args: "{docker-build-args}"
157 docker-name: "{docker-name}"
158 docker-root: "{docker-root}"
159 container-public-registry: "{container-public-registry}"
160 container-push-registry: "{container-push-registry}"
161 - shell: "{post_docker_build_script}"
162 - oran-docker-build-export
163 - oran-packagecloud-push:
164 packagecloud-account: "{packagecloud-account}"
165 packagecloud-repo: "{packagecloud-repo}"
166 debian-distribution-versions: "{debian-distribution-versions}"
167 rpm-distribution-versions: "{rpm-distribution-versions}"
168 - lf-provide-maven-settings-cleanup
171 name: "{project-name}-docker-ci-pc-merge-{stream}"
172 id: oran-gerrit-docker-ci-pc-merge
174 <<: *oran_docker_common
175 # yamllint disable-line rule:key-duplicates
176 <<: *oran_docker_ci_pc_merge_common
179 - timed: "{obj:cron}"
181 server-name: "{gerrit-server-name}"
182 trigger-on: "{obj:gerrit_merge_triggers}"
184 - project-compare-type: ANT
185 project-pattern: "{project}"
187 - branch-compare-type: ANT
188 branch-pattern: "**/{branch}"
189 file-paths: "{obj:gerrit_trigger_file_paths}"