Merge "Always build requirements image in the pipeline"

This commit is contained in:
Zuul 2018-10-16 14:25:52 +00:00 committed by Gerrit Code Review
commit a45d25d181
11 changed files with 72 additions and 7 deletions

View File

@ -16,6 +16,7 @@
project: cinder
required-projects:
- openstack/loci
- openstack/requirements
- openstack/cinder
- job:

View File

@ -16,6 +16,7 @@
project: glance
required-projects:
- openstack/loci
- openstack/requirements
- openstack/glance
- job:

View File

@ -16,6 +16,7 @@
project: heat
required-projects:
- openstack/loci
- openstack/requirements
- openstack/heat
- job:

View File

@ -16,6 +16,7 @@
project: horizon
required-projects:
- openstack/loci
- openstack/requirements
- openstack/horizon
- job:

View File

@ -16,6 +16,7 @@
project: ironic
required-projects:
- openstack/loci
- openstack/requirements
- openstack/ironic
- job:

View File

@ -16,6 +16,7 @@
project: keystone
required-projects:
- openstack/loci
- openstack/requirements
- openstack/keystone
- job:

View File

@ -16,6 +16,7 @@
project: neutron
required-projects:
- openstack/loci
- openstack/requirements
- openstack/neutron
- job:

View File

@ -16,6 +16,7 @@
project: nova
required-projects:
- openstack/loci
- openstack/requirements
- openstack/nova
- job:

View File

@ -16,6 +16,7 @@
project: octavia
required-projects:
- openstack/loci
- openstack/requirements
- openstack/octavia
- job:

View File

@ -9,7 +9,13 @@
- "pydep.txt"
environment:
LC_ALL: C
# NOTE(evrardjp): While reuse_requirements is very nice and optimises
# checks and gating, there is a race condition here, because
# we are consuming prebuild wheels (see vars.yaml) by default:
# The jobs in zuul can be building a new "requirements" image, working
# And the new "nova" image would still build on previous "requirements"
# image that was last published. This could cause an issue. Instead
# in gating we should build directly what will be consumed.
# NOTE(SamYaple): This process is so we can take advantage of the infra
# DockerHub mirroring as configured through the Docker daemon. We do this
# instead of calling fetch_wheels initially. All-in-all this saves
@ -25,6 +31,7 @@
async: 1000
poll: 0
register: pull
- async_status:
jid: "{{ item.ansible_job_id }}"
with_items: "{{ pull.results }}"
@ -34,11 +41,14 @@
- pull_result.finished
retries: 1000
delay: 5
when: project != 'requirements'
when:
- reuse_requirements | bool
- project != 'requirements'
- name: Build base images
block:
- docker_image:
- name: "Build base image for {{ item.name }} asynchronously"
docker_image:
path: "{{ loci_src_dir }}/dockerfiles/{{ item.name }}"
name: base
tag: "{{ item.name }}"
@ -47,6 +57,7 @@
async: 1000
poll: 0
register: base
- async_status:
jid: "{{ item.ansible_job_id }}"
with_items: "{{ base.results }}"
@ -57,18 +68,49 @@
retries: 1000
delay: 5
- name: Build project images
- name: Build requirements image
block:
- docker_image:
- name: "Build requirements image for {{ item.name }}"
docker_image:
path: "{{ loci_src_dir }}"
name: loci/{{ project }}
name: loci/requirements
tag: "{{ branch }}-{{ item.name }}"
repository: 172.17.0.1:5000/loci/requirements
push: yes
pull: False
buildargs: "{{ item.buildargs.project }}"
buildargs: "{{ item.buildargs.requirements }}"
with_items: "{{ distros }}"
async: 1000
poll: 0
register: build
- async_status:
jid: "{{ item.ansible_job_id }}"
with_items: "{{ build.results }}"
register: build_result
until:
- build_result.finished is defined
- build_result.finished
retries: 1000
delay: 5
when:
- (not reuse_requirements) | bool
- project != 'requirements'
- name: Build project images
block:
- name: "Build {{ project }} image for {{ item.name }}"
docker_image:
path: "{{ loci_src_dir }}"
name: loci/{{ project }}
tag: "{{ branch }}-{{ item.name }}"
pull: False
buildargs: "{{ item.buildargs.project }}"
with_items: "{{ distros }}"
async: 1000
poll: 0
register: build
- async_status:
jid: "{{ item.ansible_job_id }}"
with_items: "{{ build.results }}"

View File

@ -7,6 +7,8 @@ docker_daemon:
insecure-registries:
- 172.17.0.1:5000
reuse_requirements: False
# NOTE(SamYaple): When running in the loci repo, the project is "loci", but
# when running as a post job for cinder, the project is "cinder". We statically
# declare the path rather than using zuul variables so thats not an issue
@ -26,6 +28,10 @@ distros:
PROJECT_REPO: http://172.17.0.1/git/openstack/{{ project }}
WHEELS: 172.17.0.1:5000/loci/requirements:{{ branch }}-centos
FROM: base:centos
requirements:
PROJECT: requirements
PROJECT_REPO: http://172.17.0.1/git/openstack/requirements
FROM: base:centos
- name: ubuntu
image: ubuntu:xenial
buildargs:
@ -41,6 +47,10 @@ distros:
PROJECT_REPO: http://172.17.0.1/git/openstack/{{ project }}
WHEELS: 172.17.0.1:5000/loci/requirements:{{ branch }}-ubuntu
FROM: base:ubuntu
requirements:
PROJECT: requirements
PROJECT_REPO: http://172.17.0.1/git/openstack/requirements
FROM: base:ubuntu
# - name: debian
# image: debian:stretch
# buildargs:
@ -57,3 +67,7 @@ distros:
# PROJECT_REPO: http://172.17.0.1/git/openstack/{{ project }}
# WHEELS: 172.17.0.1:5000/loci/requirements:master-debian
# FROM: base:debian
# requirements:
# PROJECT: requirements
# PROJECT_REPO: http://172.17.0.1/git/openstack/requirements
# FROM: base:debian