Fix ocata branch gate

This patch is include five backport commits.

Gate fix: Cap hacking to avoid gate failure

hacking is not capped in g-r and it is in
blacklist for requirement as hacking new version
can break the gate jobs.

Hacking can break gate jobs because of various
reasons:
- There might be new rule addition in hacking
- Some rules becomes default from non-default
- Updates in pycodestyle etc

That was the main reason it was not added in g-r
auto sync also. Most of the project maintained the
compatible and cap the hacking version in
test-requirements.txt and update to new version when
project is ready. Bumping new version might need code
fix also on project side depends on what new in that
version.

If project does not have cap the hacking version then,
there is possibility of gate failure whenever new hacking
version is released by QA team.

Example of such failure in recent release of hacking 1.1.0
-
http://lists.openstack.org/pipermail/openstack-dev/2018-May/130282.html

Move ansible to virtualenv in kolla_toolbox

Now the ansible and its python dependencies are installed on system. It
may be failed to install in some case. This patch installs python
packages in virtualenv for kolla_toolbox image.

Closes-Bug: #1771717
(cherry picked from commit ce31fa4b1c)

base: set $contentdir for CentOS

CentOS recently started syncing alternate arch repos to mirrors. And to
make it easier to play with centos-* packages idea of 'contentdir'
appeared.

https://lists.centos.org/pipermail/centos-devel/2018-March/016542.html
(cherry picked from commit ec5daaaa63)

base: bump centos-release-qemu-ev for oraclelinux

(cherry picked from commit 2f27152258)

Skip pip install when packages variable is empty

pip 10 is release recently. `pip install` without any package will raise
an error now.

Closes-Bug: #1764369
Change-Id: Ic81181b8b87ccbac489d993f05c125e224922077
This commit is contained in:
Jeffrey Zhang 2018-04-02 09:09:24 +08:00
parent c67d4f9fb4
commit 67b092ead7
4 changed files with 23 additions and 8 deletions

View File

@ -40,6 +40,12 @@ RUN CURRENT_DISTRO_RELEASE=$(awk '{match($0, /[0-9]+/,version)}END{print version
&& cat /tmp/kolla_bashrc >> /etc/bashrc \
&& sed -i 's|^\(override_install_langs=.*\)|# \1|' /etc/yum.conf
{% block base_yum_conf %}
RUN echo centos >> /etc/yum/vars/contentdir
{% endblock %}
#### BEGIN REPO ENABLEMENT
{% set base_yum_repo_files = [
'elasticsearch.repo',
@ -149,7 +155,7 @@ RUN yum -y install \
&& rpm -Uvh --nodeps \
http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-openstack-ocata-1-2.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-qemu-ev-1.0-2.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 \

View File

@ -3,7 +3,8 @@ MAINTAINER {{ maintainer }}
{% block kolla_toolbox_header %}{% endblock %}
{% set os_client_config='/usr/lib/python2.7/site-packages/os_client_config/defaults.json' %}
{% set virtualenv_path='/opt/ansible' %}
{% set os_client_config= virtualenv_path + '/lib/python2.7/site-packages/os_client_config/defaults.json' %}
{% import "macros.j2" as macros with context %}
@ -44,10 +45,6 @@ MAINTAINER {{ maintainer }}
'python-dev'
] %}
{% if base_distro == 'debian' %}
{% set os_client_config='/usr/local/lib/python2.7/dist-packages/os_client_config/defaults.json' %}
{% endif %}
{% endif %}
{{ macros.install_packages(kolla_toolbox_packages | customizable("packages")) }}
@ -57,6 +54,12 @@ RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& rm get-pip.py
{% endblock %}
RUN pip --no-cache-dir install \
virtualenv \
&& virtualenv --system-site-packages {{ virtualenv_path }}
ENV PATH {{ virtualenv_path }}/bin:$PATH
RUN pip --no-cache-dir install \
pytz \
ansible==2.1.1.0 \
@ -67,9 +70,13 @@ RUN pip --no-cache-dir install \
shade==1.5.0
RUN mkdir -p /etc/ansible /usr/share/ansible \
&& echo 'localhost ansible_connection=local' > /etc/ansible/hosts \
&& ln -s {{ virtualenv_path }}/bin/ansible /usr/bin/ansible \
&& ln -s {{ virtualenv_path }}/bin/ansible-playbook /usr/bin/ansible-playbook \
&& echo 'localhost ansible_connection=local ansible_python_interpreter={{ virtualenv_path }}/bin/python' > /etc/ansible/hosts \
&& sed -i 's| "identity_api_version": "2.0",| "identity_api_version": "3",|' {{ os_client_config }}
ENV ANSIBLE_LIBRARY /usr/share/ansible:$ANSIBLE_LIBRARY
COPY find_disks.py kolla_keystone_service.py kolla_keystone_user.py kolla_sanity.py /usr/share/ansible/
COPY ansible.cfg /var/lib/ansible/.ansible.cfg

View File

@ -15,7 +15,9 @@
{% macro install_pip(packages) %}
{% if packages|length > 0 %}
RUN /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt {% for package in packages %}{{ package }} {% endfor %}
{% endif %}
{% endmacro %}

View File

@ -9,7 +9,7 @@ ddt>=1.0.1 # MIT
doc8 # Apache-2.0
extras # MIT
graphviz!=0.5.0,>=0.4.0 # MIT License
hacking>=0.10.0
hacking>=0.10.0,<1.1.0
oslo.log>=3.11.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0
oslosphinx>=4.7.0 # Apache-2.0