From 78d4f1142eb4e71c41c39c51b6093e0f0c120429 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Mon, 20 Aug 2018 17:45:43 +0200 Subject: [PATCH] [fuel] Add Docker build jobs JIRA: FUEL-383 Change-Id: I80049726c256d2891ae1cfbacbc54781d3d81c70 Signed-off-by: Alexandru Avadanii --- jjb/fuel/fuel-docker-jobs.yaml | 200 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 jjb/fuel/fuel-docker-jobs.yaml diff --git a/jjb/fuel/fuel-docker-jobs.yaml b/jjb/fuel/fuel-docker-jobs.yaml new file mode 100644 index 000000000..98ed66da7 --- /dev/null +++ b/jjb/fuel/fuel-docker-jobs.yaml @@ -0,0 +1,200 @@ +--- +############################################## +# job configuration for docker build and push +############################################## +- project: + + name: fuel-docker + + project: fuel + + stream: + - master: + branch: '{stream}' + disabled: false + - gambia: + branch: 'stable/{stream}' + disabled: true + + arch_tag: + - 'amd64': + slave_label: 'opnfv-build-ubuntu' + - 'arm64': + slave_label: 'opnfv-build-ubuntu-arm' + + # settings for jobs run in multijob phases + build-job-settings: &build-job-settings + current-parameters: false + git-revision: true + node-parameters: false + predefined-parameters: | + PUSH_IMAGE=$PUSH_IMAGE + COMMIT_ID=$COMMIT_ID + GERRIT_REFNAME=$GERRIT_REFNAME + kill-phase-on: FAILURE + abort-all-jobs: false + + manifest-job-settings: &manifest-job-settings + current-parameters: false + git-revision: true + node-parameters: false + predefined-parameters: + GERRIT_REFNAME=$GERRIT_REFNAME + kill-phase-on: FAILURE + abort-all-jobs: false + + jobs: + - "fuel-docker-{stream}" + - "fuel-docker-build-{arch_tag}-{stream}" + - "fuel-docker-manifest-{stream}" + +######################## +# job templates +######################## +- job-template: + name: 'fuel-docker-{stream}' + + project-type: multijob + + disabled: '{obj:disabled}' + + parameters: + - fuel-job-parameters: + project: '{project}' + branch: '{branch}' + slave_label: 'opnfv-build-ubuntu' + arch_tag: 'amd64' + + properties: + - throttle: + max-per-node: 1 + option: 'project' + + scm: + - git-scm + + triggers: + - pollscm: + cron: "*/25 * * * *" + - gerrit-trigger-tag-created: + project: '{project}' + + builders: + - multijob: + name: 'build fuel images' + execution-type: PARALLEL + projects: + - name: 'fuel-docker-build-amd64-{stream}' + <<: *build-job-settings + - name: 'fuel-docker-build-arm64-{stream}' + <<: *build-job-settings + - multijob: + name: 'publish fuel manifests' + condition: SUCCESSFUL + execution-type: PARALLEL + projects: + - name: 'fuel-docker-manifest-{stream}' + <<: *manifest-job-settings + + publishers: + - email-fuel-ptl + +- job-template: + name: 'fuel-docker-build-{arch_tag}-{stream}' + disabled: '{obj:disabled}' + parameters: + - fuel-job-parameters: + project: '{project}' + branch: '{branch}' + slave_label: '{slave_label}' + arch_tag: '{arch_tag}' + scm: + - git-scm + builders: + - shell: | + #!/bin/bash -ex + case "{stream}" in + "master") + tag="latest" ;; + *) + tag="{stream}" ;; + esac + sudo ./ci/build.sh $tag + +- job-template: + name: 'fuel-docker-manifest-{stream}' + + parameters: + - project-parameter: + project: '{project}' + branch: '{branch}' + - label: + name: SLAVE_LABEL + default: 'opnfv-build-ubuntu' + description: 'Slave label on Jenkins' + - string: + name: PROJECT + default: "{project}" + description: "Project name used to enable job conditions" + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' + - string: + name: REPO + default: "opnfv" + description: "Repository name for fuel-docker images" + + + disabled: '{obj:disabled}' + + builders: + - shell: | + #!/bin/bash -ex + case "{stream}" in + "master") + tag="latest" ;; + *) + tag="{stream}" ;; + esac + sudo manifest-tool push from-args \ + --platforms linux/amd64,linux/arm64 \ + --template $REPO/fuel:saltmaster-reclass-ARCH-$tag \ + --target $REPO/fuel:saltmaster-reclass-$tag + exit $? + +# parameter macro +- parameter: + name: fuel-job-parameters + parameters: + - project-parameter: + project: '{project}' + branch: '{branch}' + - label: + name: SLAVE_LABEL + default: '{slave_label}' + description: 'Slave label on Jenkins' + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' + - string: + name: PUSH_IMAGE + default: "true" + description: "To enable/disable pushing the image to Dockerhub." + - string: + name: COMMIT_ID + default: "" + description: "commit id to make a snapshot docker image" + - string: + name: GERRIT_REFNAME + default: "" + description: "Docker tag to be built, e.g. refs/tags/5.0.0, refs/tags/opnfv-5.0.0, refs/tags/5.0.RC1" + - string: + name: PROJECT + default: "{project}" + description: "Project name used to enable job conditions" + - string: + name: REPO + default: "opnfv" + description: "Repository name for fuel-docker images" -- 2.16.6