Significant refactor of base image

This refactor organizes the code as follows:

If RPM family:
    execute YUM repo setup
    if binary
        install binary tools
    if source
        install source tools

IF DEB family:
   install source tools

I have tested building and everything seems fairly solid except
possilby RHOS.  The long term goal of this patch is to allow us to
add our own repos in the "execute YUM repo setup" section of the base
file based upon OpenStack Infrastructure YUM repos.

Partially-Implements: blueprint rhel-based-image-support
Change-Id: I759fb8fc050973460c9c69bb500de68e88a68b3b
This commit is contained in:
Steven Dake 2015-09-12 18:34:55 -07:00
parent 0e99b69de4
commit f74cd0ecb8

View File

@ -30,65 +30,96 @@ ENV KOLLA_BASE_DISTRO {{ base_distro }}
ENV KOLLA_INSTALL_TYPE {{ install_type }} ENV KOLLA_INSTALL_TYPE {{ install_type }}
ENV KOLLA_INSTALL_METATYPE {{ install_metatype }} ENV KOLLA_INSTALL_METATYPE {{ install_metatype }}
# For RPM Variants, enable the correct repositories - this should all be done
# in the base image so repos are consistent throughout the system. This also
# enables to provide repo overrides at a later date in a simple fashion if we
# desire such functionality. I think we will :)
{% if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel'] %} {% if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel'] %}
# Turns on MariaDB repos throughout the build #### BEGIN REPO ENABLEMENT
# Turns on MariaDB repos throughout the RPM build
COPY mariadb.yum.repo /etc/yum.repos.d/MariaDB.repo COPY mariadb.yum.repo /etc/yum.repos.d/MariaDB.repo
RUN yum install -y http://www.percona.com/redir/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm \ RUN yum install -y http://www.percona.com/redir/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm \
&& sed -i 's|$releasever|centos/latest|g' /etc/yum.repos.d/percona-release.repo && sed -i 's|$releasever|centos/latest|g' /etc/yum.repos.d/percona-release.repo
{% if base_distro == 'rhel' %} {% if install_metatype == 'rdo' %}
# Turn on EPEL, rhel7-extras, and rhel7-optional throughout all builds for RHEL
RUN yum install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
&& subscription-manager repos --enable rhel-7-server-optional-rpms \
&& subscription-manager repos --enable rhel-7-server-extras-rpms \
&& yum clean all
{% endif %}
{% if install_type == 'binary' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
# Set up repositories
# This repository provides all dependencies used by RDO OpenStack # This repository provides all dependencies used by RDO OpenStack
RUN yum install -y https://rdoproject.org/repos/openstack-kilo/rdo-release-kilo.rpm RUN yum install -y https://rdoproject.org/repos/openstack-kilo/rdo-release-kilo.rpm
# This repository provides latest packages built from trunk master into RPMs # This repository provides latest packages built from trunk master into RPMs
RUN curl http://trunk.rdoproject.org/centos7/current/delorean.repo -o /etc/yum.repos.d/delorean-current.repo RUN curl http://trunk.rdoproject.org/centos7/current/delorean.repo -o /etc/yum.repos.d/delorean-current.repo
RUN curl http://trunk.rdoproject.org/centos7/delorean-deps.repo -o /etc/yum.repos.d/delorean-deps.repo RUN curl http://trunk.rdoproject.org/centos7/delorean-deps.repo -o /etc/yum.repos.d/delorean-deps.repo
{% if base_distro == 'centos' %} {% endif %}
# endif for repo setup for all RHEL except RHEL OSP
{% if install_metatype == 'rhos' %}
# Turn on the RHOS 7.0 repo for RHOS
RUN subscription-manager repos --enable rhel-7-server-rpms \
&& subscription-manager repos --enable rhel-7-server-openstack-7.0-rpms
{% endif %}
{% if base_distro == 'centos' %}
# CentOS 7.1 workaround for conflicting packages with libvirt # CentOS 7.1 workaround for conflicting packages with libvirt
RUN rpm -e --nodeps systemd-container systemd-container-libs \ RUN rpm -e --nodeps systemd-container systemd-container-libs \
&& rpm -e --nodeps yum-plugin-fastestmirror \ && rpm -e --nodeps yum-plugin-fastestmirror \
&& yum -d 10 -y install systemd systemd-libs systemd-devel \ && yum -d 10 -y install systemd systemd-libs systemd-devel \
&& yum install -y epel-release \ && yum install -y epel-release \
&& yum clean all && yum clean all
{% endif %}
{% if base_distro == 'oraclelinux' %} {% endif %}
# Endif for base_distro centos
{% if base_distro == 'rhel' %}
# Enable couple required repositories for all RHEL builds
# Turn on EPEL throughout the build
RUN yum install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
&& yum clean all \
&& subscription-manager repos --enable rhel-7-server-optional-rpms \
&& subscription-manager repos --enable rhel-7-server-extras-rpms
{% endif %}
# Endif for base_distro RHEL
{% if base_distro == 'oraclelinux' %}
RUN yum install -y \ RUN yum install -y \
yum-utils \ yum-utils \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
&& yum clean all && yum clean all
RUN yum-config-manager --enable ol7_optional_latest ol7_addons RUN yum-config-manager --enable ol7_optional_latest ol7_addons
{% endif %}
# Endif for base_distro centos/oraclelinux {% endif %}
{% elif base_distro == 'fedora' %} # Endif for base_distro oraclelinux
{% if base_distro == 'fedora' %}
# Set up repositories # Set up repositories
RUN yum install -y https://rdo.fedorapeople.org/rdo-release.rpm \ RUN yum install -y https://rdo.fedorapeople.org/rdo-release.rpm \
&& yum -y install dnf dnf-plugins-core \ && yum -y install dnf dnf-plugins-core \
&& yum clean all && yum clean all
{% endif %} {% endif %}
# Endif for base_distro fedora
#### END REPO ENABLEMENT
# We are back to the basic if conditional here which is:
# if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel']
# Update packages
RUN yum update -y \ RUN yum update -y \
&& yum clean all && yum clean all
{% if install_type == 'binary' %}
# Install base packages # Install base packages
RUN yum install -y \ RUN yum install -y \
git \ git \
@ -177,8 +208,10 @@ RUN yum install -y \
which \ which \
&& yum clean all && yum clean all
{% endif %}
# Endif for install_type binary # Endif for install_type binary
{% elif install_type == 'source' %}
{% if install_type == 'source' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
@ -206,17 +239,15 @@ RUN yum update -y \
postgresql \ postgresql \
postgresql-devel \ postgresql-devel \
python-devel \ python-devel \
python-oslo-policy \
sqlite-devel \ sqlite-devel \
sudo \ sudo \
tar \ tar \
which \ which \
&& yum clean all && yum clean all
# Endif for install_type source {% endif %}
{% endif %} # endif for install type is binary/rhos/rdo for RPM based distros
# endif for base_distro centos,fedora,oraclelinux,rhel
# Endif for base_distro centos,fedora,oraclelinux,rhel
{% elif base_distro in ['ubuntu', 'debian'] %} {% elif base_distro in ['ubuntu', 'debian'] %}
# This will prevent questions from being asked during the install # This will prevent questions from being asked during the install