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.
19 # The merge template calls builders to build in docker,
20 # export files, then push to PackageCloud.
21 # The docker image is discarded, not pushed to a registry.
22 # Uses builders defined in, and mirrors the structure of,
23 # global-jjb resource jjb/lf-docker-jobs.yaml
25 # This shell script launches the container, which copies
26 # build products to a mounted volume. Script needs vars
27 # CONTAINER_PUSH_REGISTRY, DOCKER_NAME and DOCKER_IMAGE_TAG
28 # as set by lf-docker-get-container-tag and lf-docker-build.
30 name: oran-docker-build-export
32 - shell: !include-raw-escape:
33 - ../shell/export-packages.sh
35 # Different name, same content as lf_docker_common
36 - oran_docker_common: &oran_docker_common
37 name: oran-docker-ci-common
39 project-type: freestyle
42 ######################
43 # Default parameters #
44 ######################
47 build-days-to-keep: 30
49 submodule-disable: false
50 submodule-recursive: true
52 pre_docker_build_script: "# pre docker build script goes here"
53 post_docker_build_script: "# post docker build script goes here"
55 docker-get-container-tag-script: "../shell/docker-get-container-tag.sh"
56 docker-root: "$WORKSPACE"
58 git-url: "$GIT_URL/$PROJECT"
59 # TODO: how to interpolate value of {docker-root} parameter?
60 container-tag-yaml-dir: ""
66 disabled: "{disable-job}"
69 - lf-infra-properties:
70 build-days-to-keep: "{build-days-to-keep}"
73 - lf-infra-parameters:
76 refspec: "refs/heads/{branch}"
81 build-timeout: "{build-timeout}"
82 jenkins-ssh-credential: "{jenkins-ssh-credential}"
87 - oran_docker_ci_pc_merge_common: &oran_docker_ci_pc_merge_common
88 name: oran-docker-ci-pc-merge-common
92 - lf-infra-gerrit-scm:
93 jenkins-ssh-credential: "{jenkins-ssh-credential}"
95 refspec: "$GERRIT_REFSPEC"
96 branch: "$GERRIT_BRANCH"
97 submodule-disable: "{submodule-disable}"
98 submodule-recursive: "{submodule-recursive}"
99 submodule-timeout: "{submodule-timeout}"
100 choosing-strategy: gerrit
102 gerrit_merge_triggers:
103 - change-merged-event
104 - comment-added-contains-event:
105 comment-contains-value: remerge$
107 gerrit_trigger_file_paths:
108 - compare-type: REG_EXP
113 - config-file-provider:
115 - file-id: ".packagecloud"
116 target: "$HOME/.packagecloud"
117 - lf-infra-docker-login:
118 global-settings-file: "global-settings"
119 settings-file: "{mvn-settings}"
120 - shell: "{pre_docker_build_script}"
121 - lf-docker-get-container-tag:
122 container-tag-method: "{container-tag-method}"
123 container-tag-yaml-dir: "{container-tag-yaml-dir}"
124 docker-root: "{docker-root}"
125 docker-get-container-tag-script: "{docker-get-container-tag-script}"
127 docker-build-args: "{docker-build-args}"
128 docker-name: "{docker-name}"
129 docker-root: "{docker-root}"
130 container-public-registry: "{container-public-registry}"
131 container-push-registry: "{container-push-registry}"
132 - shell: "{post_docker_build_script}"
133 - oran-docker-build-export
134 - oran-packagecloud-push:
135 build-dir: export-packages # directory with deb/rpm files
136 packagecloud-account: "{packagecloud-account}"
137 packagecloud-repo: "{packagecloud-repo}"
138 debian-distribution-versions: "{debian-distribution-versions}"
139 rpm-distribution-versions: "{rpm-distribution-versions}"
140 - lf-provide-maven-settings-cleanup
143 name: "{project-name}-docker-ci-pc-merge-{stream}"
144 id: oran-gerrit-docker-ci-pc-merge
146 <<: *oran_docker_common
147 # yamllint disable-line rule:key-duplicates
148 <<: *oran_docker_ci_pc_merge_common
151 - timed: "{obj:cron}"
153 server-name: "{gerrit-server-name}"
154 trigger-on: "{obj:gerrit_merge_triggers}"
156 - project-compare-type: ANT
157 project-pattern: "{project}"
159 - branch-compare-type: ANT
160 branch-pattern: "**/{branch}"
161 file-paths: "{obj:gerrit_trigger_file_paths}"