diff options
author | Paul Vaduva <Paul.Vaduva@enea.com> | 2019-07-05 17:31:18 +0200 |
---|---|---|
committer | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2019-09-06 01:10:03 +0200 |
commit | 866558d317feb1171c4a40d9ff63f9dc99cd4a6d (patch) | |
tree | b8bf05a0f6e35f0fd2fc8289d8100aa88eba792f /jjb | |
parent | 428d943347e054576fb801f4c57f1c50a3dd05ac (diff) |
Add multiplatform jobs for policy docker images
Add three global templates needed to build multiarch images:
- {project-name}-docker-manifest-{stream}: creates a docker
manifest list with images for multiple architectures by calling
docker_push_manifest.sh
- {project-name}-multiarch-docker-stage-{stream}: multijob that
uses the global-jjb template
{project-name}-maven-docker-stage-{stream} to produce staging
images for each supported arch and a manifest list for them
- {project-name}-multiarch-{stream}-merge-java: multijob that uses
the existing {project-name}-{stream}-merge-java template to
produce snapshot images for each suppported arch and a manifest
list for them
The policy/docker project jobs are modified to use the new multiarch
templates.
All images are now pushed to DockerHub instead of Nexus (as Nexus lacks
support for docker manifest list).
Cancel the triggers for child jobs, as they will be triggered by the
parent multiarch job.
For the jobs that build images, use registry registry-1.docker.io
as a workaround for [1].
Enable the multiarch jobs only for the master branch for now.
[1] https://github.com/fabric8io/docker-maven-plugin/issues/838
Issue-ID: CIMAN-217
Change-Id: Ibd00d24bb70ef51f761005016b7baea4ef66a0a5
Signed-off-by: Paul Vaduva <Paul.Vaduva@enea.com>
Signed-off-by: Cristina Pauna <cristina.pauna@enea.com>
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Diffstat (limited to 'jjb')
-rw-r--r-- | jjb/global-templates-docker.yaml | 133 | ||||
-rw-r--r-- | jjb/global-templates-java.yaml | 79 | ||||
-rw-r--r-- | jjb/policy/policy-docker-base-common.yaml | 61 |
3 files changed, 270 insertions, 3 deletions
diff --git a/jjb/global-templates-docker.yaml b/jjb/global-templates-docker.yaml index 1c8242f32..eecedd464 100644 --- a/jjb/global-templates-docker.yaml +++ b/jjb/global-templates-docker.yaml @@ -771,4 +771,137 @@ - '{parent_job}' result: 'success' +- job-template: + # Job template for creating a docker manifest list + # + # The purpose of this job template is to run: + # 1. docker_push_manifest.sh script (which needs to exist in the + # project implementation repo) + + name: '{project-name}-docker-manifest-{stream}' + <<: *docker_job_boiler_plate + node: '{build-node}' + build-timeout: 15 + + parameters: + - lf-infra-parameters: + project: '{project}' + stream: '{stream}' + branch: '{branch}' + - string: + name: PARENT_JOB_NAME + default: 'none' + + disabled: '{obj:disabled}' + + scm: + - lf-infra-gerrit-scm: + jenkins-ssh-credential: '{jenkins-ssh-credential}' + git-url: '$GIT_URL/$PROJECT' + refspec: '$GERRIT_REFSPEC' + branch: '$GERRIT_BRANCH' + submodule-recursive: true + submodule-disable: '{submodule-disable}' + submodule-timeout: '{submodule-timeout}' + choosing-strategy: default + + + builders: + - lf-infra-docker-login: + global-settings-file: 'global-settings' + settings-file: '{mvn-settings}' + - shell: | + #!/bin/bash -ex + export PARENT_JOB_NAME + ./docker_push_manifest.sh + +- job-template: + # Job template for staging jobs on multiple architectures + # + # The purpose of this job template is to: + # 1. Run parallel maven-docker-stage jobs for each supported architecure + # 2. Build and push a docker manifest list for the images created by + # the previous jobs + + name: '{project-name}-multiarch-docker-stage-{stream}' + node: '{build-node}' + project-type: multijob + disabled: '{obj:disabled}' + build-timeout: 15 + pattern: '**' + + parameters: + - lf-infra-parameters: + project: '{project}' + stream: '{stream}' + branch: '{branch}' + - string: + name: DOCKER_REGISTRY + default: 'none' + - string: + name: DOCKERHUB_REGISTRY + default: 'registry-1.docker.io' + + disabled: '{obj:disabled}' + + properties: + - throttle: + max-per-node: 1 + option: 'project' + - build-blocker: + use-build-blocker: true + blocking-jobs: + - '{project-name}-.*-docker-.*' + blocking-level: 'NODE' + + scm: + - lf-infra-gerrit-scm: + jenkins-ssh-credential: '{jenkins-ssh-credential}' + git-url: '$GIT_URL/$PROJECT' + refspec: '$GERRIT_REFSPEC' + branch: '$GERRIT_BRANCH' + submodule-recursive: true + submodule-timeout: 10 + submodule-disable: false + choosing-strategy: default + triggers: + - timed: '@daily' + - gerrit: + server-name: '{gerrit-server-name}' + trigger-on: + - comment-added-contains-event: + comment-contains-value: '^Patch Set\s+\d+:\s+stage-(docker-)?release\s*$' + + projects: + - project-compare-type: ANT + project-pattern: '{project}' + branches: + - branch-compare-type: ANT + branch-pattern: '**/{branch}' + file-paths: + - compare-type: ANT + pattern: "**" + + builders: + - multijob: + name: 'build docker images' + condition: ALWAYS + execution-type: PARALLEL + projects: + - name: '{project-name}-amd64-maven-docker-stage-{stream}' + kill-phase-on: FAILURE + current-parameters: true + - name: '{project-name}-arm64-maven-docker-stage-{stream}' + kill-phase-on: NEVER + current-parameters: true + - multijob: + name: 'publish docker manifest' + condition: SUCCESSFUL + execution-type: PARALLEL + projects: + - name: '{project-name}-docker-manifest-{stream}' + current-parameters: true + predefined-parameters: | + PARENT_JOB_NAME=$JOB_NAME + DOCKERHUB_REGISTRY=docker.io diff --git a/jjb/global-templates-java.yaml b/jjb/global-templates-java.yaml index c589fbae8..d6104d808 100644 --- a/jjb/global-templates-java.yaml +++ b/jjb/global-templates-java.yaml @@ -613,6 +613,9 @@ builders: - lf-infra-pre-build + - lf-infra-docker-login: + global-settings-file: 'global-settings' + settings-file: '{mvn-settings}' - provide-maven-settings: global-settings-file: 'global-settings' settings-file: '{mvn-settings}' @@ -1369,3 +1372,79 @@ # use default as mvn-profile if profile is not needed mvn-profile: '{mvn-profile}' mvn-params: '' + +- job-template: + # Job template for Java merge jobs on multiple architectures + # + # The purpose of this job template is to: + # 1. Run parallel {project-name}-{stream}-verify-java jobs for each supported architecture + # 2. Build and push a docker manifest list for the images created by + # the previous jobs + + name: '{project-name}-multiarch-{stream}-merge-java' + node: '{build-node}' + project-type: multijob + disabled: '{obj:disabled}' + pattern: '**' + + parameters: + - lf-infra-parameters: + project: '{project}' + stream: '{stream}' + branch: '{branch}' + - string: + name: DOCKER_REGISTRY + default: 'none' + - string: + name: DOCKERHUB_REGISTRY + default: 'registry-1.docker.io' + + properties: + - throttle: + max-per-node: 1 + option: 'project' + - build-blocker: + use-build-blocker: true + blocking-jobs: + - '{project-name}-.*-merge-.*' + blocking-level: 'NODE' + + scm: + - gerrit-trigger-scm: + refspec: '' + choosing-strategy: 'default' + submodule-recursive: '{submodule-recursive}' + + wrappers: + - infra-wrappers: + build-timeout: '{build-timeout}' + + triggers: + - gerrit-trigger-patch-merged: + server: '{server-name}' + project: '{project}' + branch: '{branch}' + files: '{pattern}' + + builders: + - multijob: + name: 'build docker images' + condition: ALWAYS + execution-type: PARALLEL + projects: + - name: '{project-name}-amd64-{stream}-merge-java' + kill-phase-on: FAILURE + current-parameters: true + - name: '{project-name}-arm64-{stream}-merge-java' + kill-phase-on: NEVER + current-parameters: true + - multijob: + name: 'publish docker manifest' + condition: SUCCESSFUL + execution-type: PARALLEL + projects: + - name: '{project-name}-docker-manifest-{stream}' + current-parameters: true + predefined-parameters: | + PARENT_JOB_NAME=$JOB_NAME + DOCKERHUB_REGISTRY=docker.io diff --git a/jjb/policy/policy-docker-base-common.yaml b/jjb/policy/policy-docker-base-common.yaml index 4551f15c8..42f7f6bef 100644 --- a/jjb/policy/policy-docker-base-common.yaml +++ b/jjb/policy/policy-docker-base-common.yaml @@ -1,6 +1,6 @@ --- - project: - name: policy-docker-base-common + name: policy-docker-base-common-elalto project-name: 'policy-docker' jobs: - '{project-name}-{stream}-verify-java' @@ -20,8 +20,6 @@ project: 'policy/docker' stream: - - 'master': - branch: 'master' - 'elalto': branch: 'elalto' mvn-settings: 'policy-docker-settings' @@ -30,6 +28,63 @@ build-node: ubuntu1604-builder-4c-4g - project: + name: policy-docker-base-common + project-name: 'policy-docker' + jobs: + - '{project-name}-{stream}-verify-java' + - '{project-name}-{stream}-merge-java': + project-name: 'policy-docker-amd64' + docker-pom: 'pom.xml' + mvn-profile: 'docker' + mvn-params: '-P docker -Ddocker.pull.registry=docker.io -Ddocker.push.registry=registry-1.docker.io' + build-node: ubuntu1604-docker-8c-8g + pattern: 'do_not_match_any_file' + - '{project-name}-{stream}-merge-java': + project-name: 'policy-docker-arm64' + docker-pom: 'pom.xml' + mvn-profile: 'docker' + mvn-params: '-P docker -Ddocker.pull.registry=docker.io -Ddocker.push.registry=registry-1.docker.io' + build-node: ubuntu1604-docker-arm64-4c-2g + pattern: 'do_not_match_any_file' + - '{project-name}-multiarch-{stream}-merge-java' + - gerrit-maven-docker-stage: + project-name: 'policy-docker-arm64' + build-node: ubuntu1604-docker-arm64-4c-2g + maven-versions-plugin: true + mvn-params: '-P docker -Dmaven.test.skip=true -Ddocker.pull.registry=docker.io -Ddocker.push.registry=registry-1.docker.io' + container-public-registry: 'docker.io' + container-staging-registry: 'docker.io' + cron: '' + gerrit_trigger_file_paths: + - compare-type: REG_EXP + pattern: 'do_not_match_any_file' + - gerrit-maven-docker-stage: + project-name: 'policy-docker-amd64' + build-node: ubuntu1604-docker-8c-8g + maven-versions-plugin: true + mvn-params: '-P docker -Dmaven.test.skip=true -Ddocker.pull.registry=docker.io -Ddocker.push.registry=registry-1.docker.io' + container-public-registry: 'docker.io' + container-staging-registry: 'docker.io' + cron: '' + gerrit_trigger_file_paths: + - compare-type: REG_EXP + pattern: 'do_not_match_any_file' + - '{project-name}-docker-manifest-{stream}': + build-node: ubuntu1604-docker-8c-8g + - '{project-name}-multiarch-docker-stage-{stream}' +# - '{project-name}-gerrit-release-jobs': +# build-node: centos7-builder-4c-4g + + project: 'policy/docker' + stream: + - 'master': + branch: 'master' + mvn-settings: 'policy-docker-settings' + files: '**' + archive-artifacts: '' + build-node: ubuntu1604-builder-4c-4g + +- project: name: policy-docker-sonar jobs: - gerrit-maven-sonar |