From 5115bca5e5e576aef547e3bff524a39894169c43 Mon Sep 17 00:00:00 2001 From: Dmitrii Kabanov Date: Thu, 23 Apr 2020 15:34:21 -0700 Subject: [PATCH] Add base image for Openstack images The PS adds base image for Openstack/loci images. Also the PS adds a possibility to provide ceph repository link and key during the build. Change-Id: I2ca54ccfeb99bcd58a0d8736a9106d07b9455fc5 --- zuul.d/openstack-loci.yaml | 106 +++++++++++++++++++++++-------- zuul.d/playbooks/Dockerfile_base | 24 +++++++ zuul.d/playbooks/build-loci.yml | 9 ++- 3 files changed, 111 insertions(+), 28 deletions(-) create mode 100644 zuul.d/playbooks/Dockerfile_base diff --git a/zuul.d/openstack-loci.yaml b/zuul.d/openstack-loci.yaml index e5570583..b236d35b 100644 --- a/zuul.d/openstack-loci.yaml +++ b/zuul.d/openstack-loci.yaml @@ -95,12 +95,24 @@ wheels_location: "http://172.17.0.1:8080/wheels.tar.gz" # the macros named *_project apply project wide. Be careful # if editing those. + base_repository: "base" + ceph_repo: "" + ceph_key: "" + base_docker_image: + - &base_image + context: "zuul.d/playbooks/" + dockerfile: "Dockerfile_base" + repository: '{{ base_repository }}' + build_args: + - "FROM='{{ from }}'" + - "CEPH_REPO='{{ ceph_repo }}'" + - "CEPH_KEY='{{ ceph_key }}'" prep_docker_images: - &requirements_project context: "." repository: openstackhelm/requirements build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='requirements'" - "PROJECT_REF={{ branchname }}" @@ -109,7 +121,7 @@ context: "." repository: openstackhelm/keystone build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='keystone'" - "PROJECT_REF={{ branchname }}" @@ -123,7 +135,7 @@ context: "." repository: openstackhelm/heat build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='heat'" - "PROJECT_REF={{ branchname }}" @@ -135,7 +147,7 @@ context: "." repository: openstackhelm/barbican build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='barbican'" - "PROJECT_REF={{ branchname }}" @@ -146,7 +158,7 @@ context: "." repository: openstackhelm/glance build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='glance'" - "PROJECT_REF={{ branchname }}" @@ -158,7 +170,7 @@ context: "." repository: openstackhelm/cinder build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='cinder'" - "PROJECT_REF={{ branchname }}" @@ -170,7 +182,7 @@ context: "." repository: openstackhelm/neutron build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='neutron'" - "PROJECT_REF={{ branchname }}" @@ -196,7 +208,7 @@ context: "." repository: openstackhelm/nova build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='nova'" - "PROJECT_REF={{ branchname }}" @@ -207,7 +219,7 @@ context: "." repository: openstackhelm/horizon build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='horizon'" - "PROJECT_REF={{ branchname }}" @@ -218,7 +230,7 @@ context: "." repository: openstackhelm/senlin build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='senlin'" - "PROJECT_REF={{ branchname }}" @@ -229,7 +241,7 @@ context: "." repository: openstackhelm/congress build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='congress'" - "PROJECT_REF={{ branchname }}" @@ -241,7 +253,7 @@ context: "." repository: openstackhelm/magnum build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='magnum'" - "PROJECT_REF={{ branchname }}" @@ -252,7 +264,7 @@ context: "." repository: openstackhelm/ironic build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='ironic'" - "PROJECT_REF={{ branchname }}" @@ -264,7 +276,7 @@ context: "." repository: openstackhelm/placement build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='placement'" - "PROJECT_REF={{ branchname }}" @@ -316,6 +328,11 @@ python3: "yes" #172.17.0.1 is default docker0 ip. wheels_location: "http://172.17.0.1:8080/wheels.tar.gz" + base_repository: "base" + ceph_repo: "deb https://mirror.mirantis.com/testing/ceph-nautilus/bionic/ bionic main" + ceph_key: "https://mirror.mirantis.com/testing/ceph-nautilus/bionic/archive-ceph-nautilus.key" + base_docker_image: + - <<: *base_image prep_docker_images: - <<: *requirements_project docker_images: @@ -359,6 +376,11 @@ from: "docker.io/ubuntu:18.04" python3: "yes" wheels_location: "http://172.17.0.1:8080/wheels.tar.gz" + base_repository: "base" + ceph_repo: "deb https://mirror.mirantis.com/testing/ceph-nautilus/bionic/ bionic main" + ceph_key: "https://mirror.mirantis.com/testing/ceph-nautilus/bionic/archive-ceph-nautilus.key" + base_docker_image: + - <<: *base_image prep_docker_images: - <<: *requirements_project docker_images: @@ -400,6 +422,11 @@ from: "docker.io/ubuntu:18.04" python3: "yes" wheels_location: "http://172.17.0.1:8080/wheels.tar.gz" + base_repository: "base" + ceph_repo: "deb https://mirror.mirantis.com/testing/ceph-nautilus/bionic/ bionic main" + ceph_key: "https://mirror.mirantis.com/testing/ceph-nautilus/bionic/archive-ceph-nautilus.key" + base_docker_image: + - <<: *base_image prep_docker_images: - <<: *requirements_project docker_images: @@ -443,6 +470,11 @@ from: "docker.io/ubuntu:18.04" python3: "yes" wheels_location: "http://172.17.0.1:8080/wheels.tar.gz" + base_repository: "base" + ceph_repo: "deb https://mirror.mirantis.com/testing/ceph-nautilus/bionic/ bionic main" + ceph_key: "https://mirror.mirantis.com/testing/ceph-nautilus/bionic/archive-ceph-nautilus.key" + base_docker_image: + - <<: *base_image prep_docker_images: - <<: *requirements_project docker_images: @@ -480,6 +512,11 @@ from: "gcr.io/google_containers/ubuntu-slim:0.14" python3: "no" wheels_location: "http://172.17.0.1:8080/wheels.tar.gz" + base_repository: "base" + ceph_repo: "deb https://mirror.mirantis.com/testing/ceph-mimic/xenial/ xenial main" + ceph_key: "https://mirror.mirantis.com/testing/ceph-mimic/xenial/archive-ceph-mimic.key" + base_docker_image: + - <<: *base_image prep_docker_images: - <<: *requirements_project docker_images: @@ -573,6 +610,11 @@ from: "gcr.io/google_containers/ubuntu-slim:0.14" python3: "no" wheels_location: "http://172.17.0.1:8080/wheels.tar.gz" + base_repository: "base" + ceph_repo: "deb https://mirror.mirantis.com/testing/ceph-mimic/xenial/ xenial main" + ceph_key: "https://mirror.mirantis.com/testing/ceph-mimic/xenial/archive-ceph-mimic.key" + base_docker_image: + - <<: *base_image prep_docker_images: - <<: *requirements_project docker_images: @@ -613,6 +655,11 @@ from: "gcr.io/google_containers/ubuntu-slim:0.14" python3: "no" wheels_location: "http://172.17.0.1:8080/wheels.tar.gz" + base_repository: "base" + ceph_repo: "deb https://mirror.mirantis.com/testing/ceph-mimic/xenial/ xenial main" + ceph_key: "https://mirror.mirantis.com/testing/ceph-mimic/xenial/archive-ceph-mimic.key" + base_docker_image: + - <<: *base_image prep_docker_images: - <<: *requirements_project docker_images: @@ -654,11 +701,16 @@ python3: "no" wheels_location: "http://172.17.0.1:8080/wheels.tar.gz" from: "gcr.io/google_containers/ubuntu-slim:0.14" + base_repository: "base" + ceph_repo: "deb https://mirror.mirantis.com/testing/ceph-mimic/xenial/ xenial main" + ceph_key: "https://mirror.mirantis.com/testing/ceph-mimic/xenial/archive-ceph-mimic.key" + base_docker_image: + - <<: *base_image prep_docker_images: - context: "." repository: openstackhelm/requirements build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='requirements'" - "PROJECT_REF={{ branchname }}" @@ -666,7 +718,7 @@ - context: "." repository: openstackhelm/keystone build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='keystone'" - "PROJECT_REF={{ branchname }}" @@ -677,7 +729,7 @@ - context: "." repository: openstackhelm/heat build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='heat'" - "PROJECT_REF={{ branchname }}" @@ -689,7 +741,7 @@ - context: "." repository: openstackhelm/barbican build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='barbican'" - "PROJECT_REF={{ branchname }}" @@ -700,7 +752,7 @@ - context: "." repository: openstackhelm/glance build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='glance'" - "PROJECT_REF={{ branchname }}" @@ -711,7 +763,7 @@ - context: "." repository: openstackhelm/cinder build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='cinder'" - "PROJECT_REF={{ branchname }}" @@ -722,7 +774,7 @@ - context: "." repository: openstackhelm/neutron build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='neutron'" - "PROJECT_REF={{ branchname }}" @@ -748,7 +800,7 @@ - context: "." repository: openstackhelm/nova build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='nova'" - "PROJECT_REF={{ branchname }}" @@ -759,7 +811,7 @@ - context: "." repository: openstackhelm/horizon build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='horizon'" - "PROJECT_REF={{ branchname }}" @@ -770,7 +822,7 @@ - context: "." repository: openstackhelm/senlin build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='senlin'" - "PROJECT_REF={{ branchname }}" @@ -781,7 +833,7 @@ - context: "." repository: openstackhelm/congress build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='congress'" - "PROJECT_REF={{ branchname }}" @@ -792,7 +844,7 @@ - context: "." repository: openstackhelm/magnum build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='magnum'" - "PROJECT_REF={{ branchname }}" @@ -803,7 +855,7 @@ - context: "." repository: openstackhelm/ironic build_args: - - "FROM='{{ from }}'" + - "FROM='{{ base_repository }}'" - "PYTHON3={{ python3 }}" - "PROJECT='ironic'" - "PROJECT_REF={{ branchname }}" diff --git a/zuul.d/playbooks/Dockerfile_base b/zuul.d/playbooks/Dockerfile_base new file mode 100644 index 00000000..5969ecad --- /dev/null +++ b/zuul.d/playbooks/Dockerfile_base @@ -0,0 +1,24 @@ +ARG FROM=ubuntu:bionic +FROM ${FROM} + +ARG CEPH_REPO="deb https://download.ceph.com/debian-nautilus/ bionic main" +ARG CEPH_KEY="https://download.ceph.com/keys/release.asc" +ARG ALLOW_UNAUTHENTICATED=false + +RUN echo "APT::Get::AllowUnauthenticated \"${ALLOW_UNAUTHENTICATED}\";\n\ +Acquire::AllowInsecureRepositories \"${ALLOW_UNAUTHENTICATED}\";\n\ +Acquire::AllowDowngradeToInsecureRepositories \"${ALLOW_UNAUTHENTICATED}\";" \ + >> /etc/apt/apt.conf.d/allow-unathenticated + +RUN export DEBIAN_FRONTEND=noninteractive ;\ + apt-get update ;\ + apt-get install -y --no-install-recommends \ + apt-transport-https \ + ca-certificates \ + gnupg2 \ + wget ;\ + wget -q -O- ${CEPH_KEY} | apt-key add - ;\ + echo "${CEPH_REPO}" | tee /etc/apt/sources.list.d/ceph.list ;\ + apt-get remove -y wget gnupg2 ;\ + apt-get clean ;\ + rm -rf /var/lib/apt/lists/* diff --git a/zuul.d/playbooks/build-loci.yml b/zuul.d/playbooks/build-loci.yml index 7b252e5f..c62e7b1c 100644 --- a/zuul.d/playbooks/build-loci.yml +++ b/zuul.d/playbooks/build-loci.yml @@ -32,7 +32,14 @@ pip_index_url: "{{ _zuul_mirrors.stdout_lines[1] | default('https://pypi.python.org/simple/') }}" pip_trusted_host: "{{ _zuul_mirrors.stdout_lines[2] | default('pypi.python.org') }}" - - name: Build base and requirements images + - name: Build base image + include_role: + name: build-docker-image + vars: + zuul_work_dir: "{{ zuul.project.src_dir }}" + docker_images: "{{ base_docker_image }}" + + - name: Build base requirements image include_role: name: build-docker-image vars: