tripleo-common doesn't do pagination when listing container image tags

Bug #2028260 reported by Yamato Tanaka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
In Progress
Undecided
Yamato Tanaka

Bug Description

Description
===========

Some container image repositories possibly do pagination when listing container image tags.
One repository which does pagination is registry.redhat.io.
Ref: https://docs.docker.com/registry/spec/api/#pagination-1

However, tripleo-common doesn't do pagination.
Because of this, the following error can occur.

~~~
[stack@undercloud ~]$ sudo openstack tripleo container image prepare -e /home/stack/containers-prepare-parameter.yaml --output-env-file overcloud-images.yaml
Exception occured while running the command
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/tripleoclient/command.py", line 32, in run
    super(Command, self).run(parsed_args)
  File "/usr/lib/python3.6/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/lib/python3.6/site-packages/cliff/command.py", line 185, in run
    return_code = self.take_action(parsed_args) or 0
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/container_image.py", line 1055, in take_action
    cleanup=parsed_args.cleanup, lock=lock)
  File "/usr/lib/python3.6/site-packages/tripleo_common/image/kolla_builder.py", line 228, in container_images_prepare_multi
    lock=lock
  File "/usr/lib/python3.6/site-packages/tripleo_common/image/kolla_builder.py", line 357, in container_images_prepare
    images, tag_from_label, default_tag)
  File "/usr/lib/python3.6/site-packages/tripleo_common/image/image_uploader.py", line 1137, in discover_image_tags
    discover_args):
  File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 586, in result_iterator
    yield fs.pop().result()
  File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/tripleo_common/image/image_uploader.py", line 2773, in discover_tag_from_inspect
    i, image, tag_from_label, fallback_tag)
  File "/usr/lib/python3.6/site-packages/tripleo_common/image/image_uploader.py", line 1117, in _discover_tag_from_inspect
    (image, tag_label, ', '.join(repo_tags))
tripleo_common.image.exception.ImageUploaderException: Image registry.redhat.io/rhosp-rhel8/openstack-aodh-api has no tag 16.2.
Available tags: 16.1.3-5.1610364748, 16.1.7-10.1646285508, 16.1.6-6, 16.0-79, 16.2.1-6, 16.0-106, 16.0, 16.1.5-1.1618379098, 16.1.8-9, 16.2.0-66-source, 16.1-50, 16.2.2-16-source, 16.2.3-9-source, 16.1.8-10.1655151541-source, 16.1.8-10-source, 16.0-104, 16.1.8-7-source, 16.1.8-9.1651483883-source, 16.2.0-70-source, 16.1.7-10.1643120407-source, 16.2.1-6.1645706313-source, 16.2.2-12, 16.2.2-14-source, 16.2.1-6.1645706313, 16.1.8-10.1655151541, 16.1.6-6.1634111158, 16.0-105, 16.1.8-7, 16.1.6-6.1634111158-source, 16.1.3-6.1614770396, 16.1.3-5.1611701331-source, 16.1.3-6.1614770396-source, 16.2.1-6.1643118678-source, 16.1.7, 16.2.1-6.1643118678, 16.1-45, 16.1.7-10.1643120407, 16.1.4, 16.2.2-12-source, 16.2.3-9, 16.1.6, 16.1-51, 16.1.3-6, 16.1.7-10, 16.1.6-6.1627296110, 16.1-50-source, 16.1.8-10, 16.1.3-5, 16.2.2-16, 16.1.6-6.1627296110-source
Image registry.redhat.io/rhosp-rhel8/openstack-aodh-api has no tag 16.2.
Available tags: 16.1.3-5.1610364748, 16.1.7-10.1646285508, 16.1.6-6, 16.0-79, 16.2.1-6, 16.0-106, 16.0, 16.1.5-1.1618379098, 16.1.8-9, 16.2.0-66-source, 16.1-50, 16.2.2-16-source, 16.2.3-9-source, 16.1.8-10.1655151541-source, 16.1.8-10-source, 16.0-104, 16.1.8-7-source, 16.1.8-9.1651483883-source, 16.2.0-70-source, 16.1.7-10.1643120407-source, 16.2.1-6.1645706313-source, 16.2.2-12, 16.2.2-14-source, 16.2.1-6.1645706313, 16.1.8-10.1655151541, 16.1.6-6.1634111158, 16.0-105, 16.1.8-7, 16.1.6-6.1634111158-source, 16.1.3-6.1614770396, 16.1.3-5.1611701331-source, 16.1.3-6.1614770396-source, 16.2.1-6.1643118678-source, 16.1.7, 16.2.1-6.1643118678, 16.1-45, 16.1.7-10.1643120407, 16.1.4, 16.2.2-12-source, 16.2.3-9, 16.1.6, 16.1-51, 16.1.3-6, 16.1.7-10, 16.1.6-6.1627296110, 16.1-50-source, 16.1.8-10, 16.1.3-5, 16.2.2-16, 16.1.6-6.1627296110-source
~~~

Steps to reproduce
==================
Create containers-prepare-parameter.yaml with "tag_from_label" and without "tag".

~~~
(undercloud) [stack@undercloud ~]$ cat containers-prepare-parameter.yaml
parameter_defaults:
  ContainerImagePrepare:
  - push_destination: true
    set:
          :
          :
      name_prefix: openstack-
      name_suffix: ''
      namespace: registry.redhat.io/rhosp-rhel8
      neutron_driver: ovn
      rhel_containers: false
      # tag: '16.2.5'
    tag_from_label: '{version}-{release}'
~~~

Run the following command:

~~~
[stack@undercloud ~]$ sudo openstack tripleo container image prepare -e /home/stack/containers-prepare-parameter.yaml --output-env-file overcloud-images.yaml
~~~

Expected result
===============
tripleo-common does pagination when listing container image tags.
"openstack tripleo container image prepare" succeeds.

Actual result
=============
tripleo-common doesn't do pagination when listing container image tags.
"openstack tripleo container image prepare" fails

Environment
===========
I observed this bug on train-based environment (RHOSP 16).
As far as I see the source code, this issue should happen in master/zed/wallaby as well.

Logs & Configs
==============
The source code which is missing pagination:
https://github.com/openstack/tripleo-common/blob/stable/wallaby/tripleo_common/image/image_uploader.py#L915-L916

Changed in tripleo:
assignee: nobody → Yamato Tanaka (yatanaka-1007)
Revision history for this message
Yamato Tanaka (yatanaka-1007) wrote :

I made the following change for the Wallaby branch:
- https://review.opendev.org/c/openstack/tripleo-common/+/889091

Note: As master and Zed branches have been abandoned in TripleO, I made this change in Wallaby first.
      I'll backport this to the Train branch after this patch is merged into Wallaby.

Revision history for this message
Yamato Tanaka (yatanaka-1007) wrote :
Changed in tripleo:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-common train-eol

This issue was fixed in the openstack/tripleo-common train-eol release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.