Skip to content
Merged
2 changes: 1 addition & 1 deletion .zuul.d/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
pre-run: tests/playbooks/pre.yml
run: tests/playbooks/run.yml
post-run: tests/playbooks/post.yml
attempts: 1
attempts: 5
irrelevant-files:
- ^.*\.rst$
- ^doc/.*
Expand Down
2 changes: 1 addition & 1 deletion docker/barbican/barbican-api/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RUN sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf \
'apache2',
'barbican-api',
'libapache2-mod-wsgi-py3',
'uwsgi-plugin-python'
'uwsgi-plugin-python3'
] %}

{{ macros.install_packages(barbican_api_packages | customizable("packages")) }}
Expand Down
5 changes: 2 additions & 3 deletions docker/base/opendaylight.repo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[opendaylight]
name=CentOS CBS OpenDaylight Release Repository
# opendaylight package is not signed, so download from HTTPS source at least
baseurl=https://cbs.centos.org/repos/nfv7-opendaylight-6-release/x86_64/os/
name=OpenDaylight Carbon
baseurl=https://nexus.opendaylight.org/content/repositories/opendaylight-carbon-epel-7-x86_64-devel/
enabled=1
gpgcheck=0
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{% block prometheus_openstack_exporter_header %}{% endblock %}

{% block prometheus_openstack_exporter_repository_version %}
ENV prometheus_openstack_exporter_version=0.2.1
ENV prometheus_openstack_exporter_version=0.6.0
{% endblock %}

{% block prometheus_openstack_exporter_install %}
Expand Down
3 changes: 3 additions & 0 deletions docker/qdrouterd/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
'qpid-dispatch-tools'
] %}

# make sure qpid is pulled from centos-openstack-RELEASE (RDO) repo
RUN yum-config-manager --disable epel centos-release-opstools extras

{{ macros.install_packages(qdrouterd_packages | customizable("packages")) }}

{% elif base_package_type == 'deb' %}
Expand Down
11 changes: 9 additions & 2 deletions kolla/image/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ def run(self):
self.success = True


class PushError(Exception):
"""Raised when there is a problem with pushing image to repository."""
pass


class PushTask(DockerTask):
"""Task that pushes an image to a docker repository."""

Expand All @@ -340,6 +345,9 @@ def run(self):
' have the correct privileges to run Docker'
' (root)')
image.status = STATUS_CONNECTION_ERROR
except PushError as exception:
self.logger.error(exception)
image.status = STATUS_PUSH_ERROR
except Exception:
self.logger.exception('Unknown error when pushing')
image.status = STATUS_PUSH_ERROR
Expand All @@ -364,8 +372,7 @@ def push_image(self, image):
if 'stream' in response:
self.logger.info(response['stream'])
elif 'errorDetail' in response:
image.status = STATUS_ERROR
self.logger.error(response['errorDetail']['message'])
raise PushError(response['errorDetail']['message'])

# Reset any previous errors.
image.status = STATUS_BUILT
Expand Down
40 changes: 40 additions & 0 deletions kolla/tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def test_push_image(self, mock_client):
@mock.patch.dict(os.environ, clear=True)
@mock.patch('docker.APIClient')
def test_push_image_failure(self, mock_client):
"""failure on connecting Docker API"""
self.dc = mock_client
mock_client().push.side_effect = Exception
pusher = build.PushTask(self.conf, self.image)
Expand All @@ -96,6 +97,7 @@ def test_push_image_failure(self, mock_client):
@mock.patch.dict(os.environ, clear=True)
@mock.patch('docker.APIClient')
def test_push_image_failure_retry(self, mock_client):
"""failure on connecting Docker API, success on retry"""
self.dc = mock_client
mock_client().push.side_effect = [Exception, []]
pusher = build.PushTask(self.conf, self.image)
Expand All @@ -112,6 +114,44 @@ def test_push_image_failure_retry(self, mock_client):
self.assertTrue(pusher.success)
self.assertEqual(build.STATUS_BUILT, self.image.status)

@mock.patch('docker.version', '3.0.0')
@mock.patch.dict(os.environ, clear=True)
@mock.patch('docker.APIClient')
def test_push_image_failure_error(self, mock_client):
"""Docker connected, failure to push"""
self.dc = mock_client
mock_client().push.return_value = [{'errorDetail': {'message':
'mock push fail'}}]
pusher = build.PushTask(self.conf, self.image)
pusher.run()
mock_client().push.assert_called_once_with(
self.image.canonical_name, decode=True, stream=True)
self.assertFalse(pusher.success)
self.assertEqual(build.STATUS_PUSH_ERROR, self.image.status)

@mock.patch('docker.version', '3.0.0')
@mock.patch.dict(os.environ, clear=True)
@mock.patch('docker.APIClient')
def test_push_image_failure_error_retry(self, mock_client):
"""Docker connected, failure to push, success on retry"""
self.dc = mock_client
mock_client().push.return_value = [{'errorDetail': {'message':
'mock push fail'}}]
pusher = build.PushTask(self.conf, self.image)
pusher.run()
mock_client().push.assert_called_once_with(
self.image.canonical_name, decode=True, stream=True)
self.assertFalse(pusher.success)
self.assertEqual(build.STATUS_PUSH_ERROR, self.image.status)

# Try again, this time without exception.
mock_client().push.return_value = [{'stream': 'mock push passes'}]
pusher.reset()
pusher.run()
self.assertEqual(2, mock_client().push.call_count)
self.assertTrue(pusher.success)
self.assertEqual(build.STATUS_BUILT, self.image.status)

@mock.patch.dict(os.environ, clear=True)
@mock.patch('docker.APIClient')
def test_build_image(self, mock_client):
Expand Down