
I think this simple change will make it much more readable Change-Id: I369aee3a19d17c134db1d13b94b8c45a44733149
211 lines
6.8 KiB
Django/Jinja
211 lines
6.8 KiB
Django/Jinja
|
||
# 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 :)
|
||
|
||
RUN CURRENT_DISTRO_RELEASE=$(awk '{match($0, /[0-9]+/,version)}END{print version[0]}' /etc/system-release); \
|
||
if [ $CURRENT_DISTRO_RELEASE != "{{ supported_distro_release }}" ]; then \
|
||
echo "Only release '{{ supported_distro_release }}' is supported on {{ base_distro }}"; false; \
|
||
fi \
|
||
&& cat /tmp/kolla_bashrc >> /etc/bashrc \
|
||
&& sed -i 's|^\(override_install_langs=.*\)|# \1|' /etc/yum.conf
|
||
|
||
#### BEGIN REPO ENABLEMENT
|
||
{% set base_yum_repo_files = [
|
||
] %}
|
||
|
||
{% set base_yum_url_packages = [
|
||
] %}
|
||
|
||
{% set base_yum_repo_keys = [
|
||
] %}
|
||
|
||
{% if base_arch == 'aarch64' %}
|
||
{% set base_yum_repo_files = [
|
||
'aarch64-cbs.repo'
|
||
] %}
|
||
|
||
{% elif base_arch == 'x86_64' %}
|
||
{% set base_yum_repo_files = [
|
||
'elasticsearch.repo',
|
||
'grafana.repo',
|
||
'influxdb.repo',
|
||
'kibana.yum.repo',
|
||
'MariaDB.repo',
|
||
'td.repo',
|
||
'zookeeper.repo'
|
||
] %}
|
||
|
||
{% set base_yum_url_packages = [
|
||
'http://repo.percona.com/release/7/RPMS/x86_64/percona-release-0.1-4.noarch.rpm'
|
||
] %}
|
||
|
||
{% set base_yum_repo_keys = [
|
||
'http://yum.mariadb.org/RPM-GPG-KEY-MariaDB',
|
||
'/etc/pki/rpm-gpg/RPM-GPG-KEY-Percona',
|
||
'https://packages.elastic.co/GPG-KEY-elasticsearch',
|
||
'https://repos.influxdata.com/influxdb.key',
|
||
'https://packagecloud.io/gpg.key',
|
||
'https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana',
|
||
'https://packages.treasuredata.com/GPG-KEY-td-agent'
|
||
] %}
|
||
{% endif %}
|
||
|
||
{%- for repo_file in base_yum_repo_files | customizable('yum_repo_files') %}
|
||
COPY {{ repo_file }} /etc/yum.repos.d/{{ repo_file }}
|
||
{%- endfor %}
|
||
|
||
{{ macros.install_packages(base_yum_url_packages | customizable("yum_url_packages")) }}
|
||
|
||
{% for key in base_yum_repo_keys | customizable('yum_repo_keys') %}
|
||
{%- if loop.first %}RUN {% else %} && {% endif -%}
|
||
rpm --import {{ key }}
|
||
{%- if not loop.last %} \{% endif %}
|
||
{% endfor -%}
|
||
|
||
{% if install_metatype in ['rdo', 'mixed'] %}
|
||
|
||
{% for cmd in rpm_setup %}
|
||
{{ cmd }}
|
||
{% endfor %}
|
||
|
||
{% endif %}
|
||
{# endif for repo setup for all RHEL except RHEL OSP #}
|
||
|
||
{% if install_metatype == 'rhos' %}
|
||
|
||
{% block base_rhos_repo_enablement %}
|
||
# Turn on the RHOS 7.0 repo for RHOS
|
||
RUN yum-config-manager --enable rhel-7-server-rpms \
|
||
&& yum-config-manager --enable rhel-7-server-openstack-7.0-rpms
|
||
{% endblock %}
|
||
|
||
{% endif %}
|
||
|
||
{% if base_distro == 'centos' %}
|
||
|
||
{% block base_centos_gpg_key_import %}
|
||
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
|
||
{% endblock %}
|
||
|
||
{% set base_centos_yum_repo_keys = [
|
||
] %}
|
||
|
||
{% set base_centos_yum_repo_packages = [
|
||
'epel-release',
|
||
'yum-plugin-priorities'
|
||
] %}
|
||
|
||
{% if base_arch == 'x86_64' %}
|
||
{% set base_centos_yum_repo_keys = base_centos_yum_repo_keys + [
|
||
'/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Storage',
|
||
'/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization'
|
||
] %}
|
||
|
||
{% set base_centos_yum_repo_packages = base_centos_yum_repo_packages + [
|
||
'centos-release-ceph-jewel',
|
||
'centos-release-qemu-ev'
|
||
] %}
|
||
{% endif %}
|
||
|
||
{{ macros.install_packages(base_centos_yum_repo_packages | customizable("centos_yum_repo_packages")) }}
|
||
{% for key in base_centos_yum_repo_keys | customizable('centos_yum_repo_keys') %}
|
||
{%- if loop.first %}RUN {% else %} && {% endif -%}
|
||
rpm --import {{ key }} \
|
||
{% endfor -%}
|
||
{%- if base_centos_yum_repo_keys|customizable('centos_yum_repo_keys')|length == 0 %}RUN {% else %} && {% endif -%}
|
||
yum clean all
|
||
|
||
{% endif %}
|
||
{# Endif for base_distro centos #}
|
||
|
||
{% if base_distro == 'rhel' %}
|
||
|
||
{% block base_rhel_package_installation %}
|
||
# Enable couple required repositories for all RHEL builds
|
||
# Turn on EPEL throughout the build
|
||
RUN yum -y install \
|
||
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
|
||
&& rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 \
|
||
&& yum -y install \
|
||
yum-plugin-priorities \
|
||
&& yum clean all \
|
||
&& yum-config-manager --enable rhel-7-server-optional-rpms \
|
||
&& yum-config-manager --enable rhel-7-server-extras-rpms
|
||
{% endblock %}
|
||
|
||
{% endif %}
|
||
{# Endif for base_distro RHEL #}
|
||
|
||
{% if base_distro == 'oraclelinux' %}
|
||
|
||
{% block base_oraclelinux_package_installation %}
|
||
COPY oraclelinux-extras.repo /etc/yum.repos.d/oraclelinux-extras.repo
|
||
RUN yum -y install \
|
||
tar \
|
||
yum-utils \
|
||
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
|
||
&& rpm -Uvh --nodeps \
|
||
https://buildlogs.centos.org/centos/7/cloud/x86_64/openstack-mitaka/centos-release-openstack-mitaka-1-3.el7.noarch.rpm \
|
||
http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-ceph-jewel-1.0-1.el7.centos.noarch.rpm \
|
||
http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-qemu-ev-1.0-1.el7.noarch.rpm \
|
||
http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-virt-common-1-1.el7.centos.noarch.rpm \
|
||
http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-storage-common-1-2.el7.centos.noarch.rpm \
|
||
&& sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS-*.repo \
|
||
&& rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 \
|
||
&& rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Storage \
|
||
&& rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization \
|
||
&& yum-config-manager --enable ol7_optional_latest ol7_addons \
|
||
&& yum -y install \
|
||
yum-plugin-priorities \
|
||
&& yum clean all
|
||
{% endblock %}
|
||
|
||
{% endif %}
|
||
{# Endif for base_distro oraclelinux #}
|
||
|
||
#### END REPO ENABLEMENT
|
||
|
||
{# We are back to the basic if conditional here which is:
|
||
if base_distro in ['centos', 'oraclelinux', 'rhel'] #}
|
||
|
||
{% set base_compiler_packages = [
|
||
'gcc',
|
||
'glibc-static'
|
||
] %}
|
||
|
||
{% block base_redhat_binary_versionlock %}{% endblock %}
|
||
{% if install_type == 'binary' %}
|
||
{% set base_centos_binary_packages = [
|
||
'iproute',
|
||
'iscsi-initiator-utils',
|
||
'lvm2',
|
||
'python',
|
||
'scsi-target-utils',
|
||
'sudo',
|
||
'which'
|
||
] %}
|
||
# Install base packages
|
||
{{ macros.install_packages( base_centos_binary_packages | customizable("centos_binary_packages")) }}
|
||
{% endif %}
|
||
{# Endif for install_type binary #}
|
||
|
||
{% if install_type == 'source' %}
|
||
|
||
{% set base_centos_source_packages = [
|
||
'curl',
|
||
'iproute',
|
||
'iscsi-initiator-utils',
|
||
'lvm2',
|
||
'scsi-target-utils',
|
||
'sudo',
|
||
'tar',
|
||
'which'
|
||
] %}
|
||
# Update packages
|
||
{{ macros.install_packages( base_centos_source_packages | customizable("centos_source_packages")) }}
|
||
|
||
{% endif %}
|
||
{# endif for install type is source for RPM based distros #}
|