Jessica Wagantall | d9c235c | 2018-03-21 13:03:59 -0700 | [diff] [blame] | 1 | --- |
| 2 | ########### |
| 3 | # ANCHORS # |
| 4 | ########### |
| 5 | - docker_job_boiler_plate: &docker_job_boiler_plate |
| 6 | name: docker_job_boiler_plate |
| 7 | |
| 8 | project-type: freestyle |
| 9 | node: '{build-node}' |
| 10 | |
| 11 | ###################### |
| 12 | # Default parameters # |
| 13 | ###################### |
| 14 | |
| 15 | branch: master |
| 16 | submodule-recursive: true |
| 17 | |
| 18 | # default params for docker jobs |
| 19 | pre_build_script: '' |
| 20 | post_build_script: '' |
| 21 | docker_root: '$WORKSPACE' |
| 22 | docker_build_args: '' |
| 23 | docker_name: 'unnamed' |
| 24 | # Default to LF standard 'snapshots' docker registry |
| 25 | docker_registry: '$DOCKER_REGISTRY:10003' |
| 26 | docker_tag: 'latest' |
| 27 | |
| 28 | ##################### |
| 29 | # Job Configuration # |
| 30 | ##################### |
| 31 | |
| 32 | properties: |
| 33 | - lf-infra-properties: |
| 34 | build-days-to-keep: '{build-days-to-keep}' |
| 35 | |
| 36 | parameters: |
| 37 | - lf-infra-parameters: |
| 38 | branch: '{branch}' |
| 39 | project: '{project}' |
| 40 | stream: '{stream}' |
| 41 | lftools-version: '{lftools-version}' |
| 42 | |
| 43 | wrappers: |
| 44 | - lf-infra-wrappers: |
| 45 | build-timeout: '{build-timeout}' |
| 46 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 47 | |
| 48 | publishers: |
| 49 | - lf-infra-publish |
| 50 | |
| 51 | - docker_verify_boiler_plate: &docker_verify_boiler_plate |
| 52 | name: docker_verify_boiler_plate |
| 53 | |
| 54 | concurrent: true |
| 55 | |
| 56 | scm: |
| 57 | - gerrit-trigger-scm: |
| 58 | refspec: '$GERRIT_REFSPEC' |
| 59 | choosing-strategy: 'default' |
| 60 | submodule-recursive: '{submodule-recursive}' |
| 61 | |
| 62 | triggers: |
| 63 | - gerrit-trigger-patch-submitted: |
| 64 | status-context: '{project}-Docker-Verify' |
| 65 | server: '{server-name}' |
| 66 | project: '{project}' |
| 67 | branch: '{branch}' |
Jessica Wagantall | 86d80f7 | 2018-04-03 13:34:08 -0700 | [diff] [blame] | 68 | files: '{files}' |
Jessica Wagantall | d9c235c | 2018-03-21 13:03:59 -0700 | [diff] [blame] | 69 | |
| 70 | - docker_merge_boiler_plate: &docker_merge_boiler_plate |
| 71 | name: docker_merge_boiler_plate |
| 72 | |
| 73 | scm: |
| 74 | - gerrit-trigger-scm: |
| 75 | refspec: '$GERRIT_REFSPEC' |
| 76 | choosing-strategy: 'default' |
| 77 | submodule-recursive: '{submodule-recursive}' |
| 78 | |
| 79 | triggers: |
| 80 | - gerrit-trigger-patch-merged: |
| 81 | server: '{server-name}' |
| 82 | project: '{project}' |
| 83 | branch: '{branch}' |
Jessica Wagantall | 86d80f7 | 2018-04-03 13:34:08 -0700 | [diff] [blame] | 84 | files: '{files}' |
Jessica Wagantall | d9c235c | 2018-03-21 13:03:59 -0700 | [diff] [blame] | 85 | - pollscm: |
| 86 | cron: '' |
| 87 | |
| 88 | ################# |
| 89 | # JOB TEMPLATES # |
| 90 | ################# |
| 91 | - job-template: |
| 92 | name: '{project-name}-{stream}-merge-docker' |
| 93 | # Job template for Docker merge jobs |
| 94 | # |
| 95 | # The purpose of this job template is to run a docker build, and potentially |
| 96 | # test validation of the docker image |
| 97 | |
| 98 | <<: *docker_job_boiler_plate |
| 99 | # yamllint disable-line rule:key-duplicates |
| 100 | <<: *docker_merge_boiler_plate |
| 101 | |
| 102 | builders: |
| 103 | - lf-infra-docker-login: |
| 104 | global-settings-file: 'global-settings' |
| 105 | settings-file: '{mvn-settings}' |
| 106 | - shell: '{pre_build_script}' |
| 107 | - inject: |
| 108 | # Docker registry is purposely not using an '_' so as to not conflict |
| 109 | # with the Jenkins global env var |
| 110 | properties-content: | |
| 111 | DOCKER_ARGS={docker_build_args} |
| 112 | DOCKER_NAME={docker_name} |
| 113 | DOCKER_ROOT={docker_root} |
| 114 | DOCKER_TAG={docker_tag} |
| 115 | DOCKERREGISTRY={docker_registry} |
| 116 | # Do the docker build |
| 117 | - shell: !include-raw: ../shell/docker-build.sh |
| 118 | - inject: |
| 119 | # Import the docker image information from the build step |
| 120 | properties-file: 'env_inject.txt' |
| 121 | # Execute any post build clean-up or testing |
| 122 | - shell: '{post_build_script}' |
| 123 | # Provided all steps have already passed, push the docker image |
| 124 | - shell: !include-raw: ../shell/docker-push.sh |
| 125 | |
| 126 | - job-template: |
| 127 | name: '{project-name}-{stream}-verify-docker' |
| 128 | # Job template for Docker verify jobs |
| 129 | # |
| 130 | # The purpose of this job template is to run a docker build, and potentially |
| 131 | # test validation of the docker image |
| 132 | |
| 133 | ###################### |
| 134 | # Default parameters # |
| 135 | ###################### |
| 136 | |
| 137 | <<: *docker_job_boiler_plate |
| 138 | # yamllint disable-line rule:key-duplicates |
| 139 | <<: *docker_verify_boiler_plate |
| 140 | |
| 141 | builders: |
| 142 | - lf-infra-docker-login: |
| 143 | global-settings-file: 'global-settings' |
| 144 | settings-file: '{mvn-settings}' |
| 145 | - shell: '{pre_build_script}' |
| 146 | - inject: |
| 147 | # Docker registry is purposely not using an '_' so as to not conflict |
| 148 | # with the Jenkins global env var |
| 149 | properties-content: | |
| 150 | DOCKER_ARGS={docker_build_args} |
| 151 | DOCKER_NAME={docker_name} |
| 152 | DOCKER_ROOT={docker_root} |
| 153 | DOCKER_TAG={docker_tag} |
| 154 | DOCKERREGISTRY={docker_registry} |
| 155 | # Do the docker build |
| 156 | - shell: !include-raw: ../shell/docker-build.sh |
| 157 | - inject: |
| 158 | # Import the docker image information from the build step |
| 159 | properties-file: 'env_inject.txt' |
| 160 | # Execute any post build clean-up or testing |
| 161 | - shell: '{post_build_script}' |
| 162 | |
| 163 | - job-template: |
| 164 | name: '{project-name}-{stream}-release-version-docker-daily-no-sonar' |
| 165 | # Job template for Docker daily release jobs |
| 166 | # |
| 167 | # The purpose of this job template is to run "docker build and docker push" |
| 168 | # for projects using this template. |
| 169 | # |
| 170 | # Required Variables: |
| 171 | # branch: git branch (eg. stable/lithium or master) |
| 172 | <<: *docker_job_boiler_plate |
| 173 | |
| 174 | docker_registry: '$DOCKER_REGISTRY:10004' |
| 175 | |
| 176 | scm: |
| 177 | - lf-infra-gerrit-scm: |
| 178 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 179 | git-url: '$GIT_URL/$PROJECT' |
| 180 | refspec: '$GERRIT_REFSPEC' |
| 181 | branch: '$GERRIT_BRANCH' |
| 182 | submodule-recursive: true |
| 183 | choosing-strategy: default |
| 184 | |
| 185 | builders: |
| 186 | - lf-infra-docker-login: |
| 187 | global-settings-file: 'global-settings' |
| 188 | settings-file: '{mvn-settings}' |
| 189 | - shell: '{pre_build_script}' |
| 190 | - inject: |
| 191 | # Docker registry is purposely not using an '_' so as to not conflict |
| 192 | # with the Jenkins global env var |
| 193 | properties-content: | |
| 194 | DOCKER_ARGS={docker_build_args} |
| 195 | DOCKER_NAME={docker_name} |
| 196 | DOCKER_ROOT={docker_root} |
| 197 | DOCKER_TAG={docker_tag} |
| 198 | DOCKERREGISTRY={docker_registry} |
| 199 | |
| 200 | # Do the docker build |
| 201 | - shell: !include-raw: ../shell/snapshot-strip.sh |
| 202 | - shell: !include-raw: ../shell/docker-build.sh |
| 203 | - inject: |
| 204 | # Import the docker image information from the build step |
| 205 | properties-file: 'env_inject.txt' |
| 206 | # Execute any post build clean-up or testing |
| 207 | - shell: '{post_build_script}' |
| 208 | # Provided all steps have already passed, push the docker image |
| 209 | - shell: !include-raw: ../shell/docker-push.sh |
| 210 | |
| 211 | triggers: |
| 212 | # 11 AM UTC |
| 213 | - timed: 'H 11 * * *' |
| 214 | - gerrit-trigger-release-manually: |
| 215 | server: '{server-name}' |
| 216 | project: '{project}' |
| 217 | branch: '{branch}' |
| 218 | |
| 219 | - job-template: |
| 220 | name: '{project-name}-{subproject}-{stream}-merge-docker' |
| 221 | # Job template for Docker merge jobs |
| 222 | # |
| 223 | # The purpose of this job template is to run a docker build, and potentially |
| 224 | # test validation of the docker image |
| 225 | |
| 226 | <<: *docker_job_boiler_plate |
| 227 | # yamllint disable-line rule:key-duplicates |
| 228 | <<: *docker_merge_boiler_plate |
| 229 | |
| 230 | builders: |
| 231 | - lf-infra-docker-login: |
| 232 | global-settings-file: 'global-settings' |
| 233 | settings-file: '{mvn-settings}' |
| 234 | - shell: '{pre_build_script}' |
| 235 | - inject: |
| 236 | # Docker registry is purposely not using an '_' so as to not conflict |
| 237 | # with the Jenkins global env var |
| 238 | properties-content: | |
| 239 | DOCKER_ARGS={docker_build_args} |
| 240 | DOCKER_NAME={docker_name} |
| 241 | DOCKER_ROOT={docker_root} |
| 242 | DOCKER_TAG={docker_tag} |
| 243 | DOCKERREGISTRY={docker_registry} |
| 244 | # Do the docker build |
| 245 | - shell: !include-raw: ../shell/docker-build.sh |
| 246 | - inject: |
| 247 | # Import the docker image information from the build step |
| 248 | properties-file: 'env_inject.txt' |
| 249 | # Execute any post build clean-up or testing |
| 250 | - shell: '{post_build_script}' |
| 251 | # Provided all steps have already passed, push the docker image |
| 252 | - shell: !include-raw: ../shell/docker-push.sh |
| 253 | |
| 254 | - job-template: |
| 255 | name: '{project-name}-{subproject}-{stream}-verify-docker' |
| 256 | # Job template for Docker verify jobs |
| 257 | # |
| 258 | # The purpose of this job template is to run a docker build, and potentially |
| 259 | # test validation of the docker image |
| 260 | |
| 261 | ###################### |
| 262 | # Default parameters # |
| 263 | ###################### |
| 264 | |
| 265 | <<: *docker_job_boiler_plate |
| 266 | # yamllint disable-line rule:key-duplicates |
| 267 | <<: *docker_verify_boiler_plate |
| 268 | |
| 269 | builders: |
| 270 | - lf-infra-docker-login: |
| 271 | global-settings-file: 'global-settings' |
| 272 | settings-file: '{mvn-settings}' |
| 273 | - shell: '{pre_build_script}' |
| 274 | - inject: |
| 275 | # Docker registry is purposely not using an '_' so as to not conflict |
| 276 | # with the Jenkins global env var |
| 277 | properties-content: | |
| 278 | DOCKER_ARGS={docker_build_args} |
| 279 | DOCKER_NAME={docker_name} |
| 280 | DOCKER_ROOT={docker_root} |
| 281 | DOCKER_TAG={docker_tag} |
| 282 | DOCKERREGISTRY={docker_registry} |
| 283 | # Do the docker build |
| 284 | - shell: !include-raw: ../shell/docker-build.sh |
| 285 | - inject: |
| 286 | # Import the docker image information from the build step |
| 287 | properties-file: 'env_inject.txt' |
| 288 | # Execute any post build clean-up or testing |
| 289 | - shell: '{post_build_script}' |
| 290 | |
| 291 | - job-template: |
| 292 | name: '{project-name}-{subproject}-{stream}-release-version-docker-daily-no-sonar' |
| 293 | # Job template for Docker daily release jobs |
| 294 | # |
| 295 | # The purpose of this job template is to run "docker build and docker push" |
| 296 | # for projects using this template. |
| 297 | # |
| 298 | # Required Variables: |
| 299 | # branch: git branch (eg. stable/lithium or master) |
| 300 | <<: *docker_job_boiler_plate |
| 301 | |
| 302 | docker_registry: '$DOCKER_REGISTRY:10004' |
| 303 | |
| 304 | scm: |
| 305 | - lf-infra-gerrit-scm: |
| 306 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 307 | git-url: '$GIT_URL/$PROJECT' |
| 308 | refspec: '$GERRIT_REFSPEC' |
| 309 | branch: '$GERRIT_BRANCH' |
| 310 | submodule-recursive: true |
| 311 | choosing-strategy: default |
| 312 | |
| 313 | builders: |
| 314 | - lf-infra-docker-login: |
| 315 | global-settings-file: 'global-settings' |
| 316 | settings-file: '{mvn-settings}' |
| 317 | - shell: '{pre_build_script}' |
| 318 | - inject: |
| 319 | # Docker registry is purposely not using an '_' so as to not conflict |
| 320 | # with the Jenkins global env var |
| 321 | properties-content: | |
| 322 | DOCKER_ARGS={docker_build_args} |
| 323 | DOCKER_NAME={docker_name} |
| 324 | DOCKER_ROOT={docker_root} |
| 325 | DOCKER_TAG={docker_tag} |
| 326 | DOCKERREGISTRY={docker_registry} |
| 327 | |
| 328 | # Do the docker build |
| 329 | - shell: !include-raw: ../shell/snapshot-strip.sh |
| 330 | - shell: !include-raw: ../shell/docker-build.sh |
| 331 | - inject: |
| 332 | # Import the docker image information from the build step |
| 333 | properties-file: 'env_inject.txt' |
| 334 | # Execute any post build clean-up or testing |
| 335 | - shell: '{post_build_script}' |
| 336 | # Provided all steps have already passed, push the docker image |
| 337 | - shell: !include-raw: ../shell/docker-push.sh |
| 338 | |
| 339 | triggers: |
| 340 | # 11 AM UTC |
| 341 | - timed: 'H 11 * * *' |
| 342 | - gerrit-trigger-release-manually: |
| 343 | server: '{server-name}' |
| 344 | project: '{project}' |
| 345 | branch: '{branch}' |