Bug 1339754

Summary: oc import-image does not pull "highest" tags
Product: OpenShift Container Platform Reporter: Steven Walter <stwalter>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: Xingxing Xia <xxia>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.2.0CC: alwong, aos-bugs, erich, jokerman, maszulik, mmccomas, pep, tdawson, yinzhou
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Tags were not sorted according to http://semver.org/ Consequence: The "highest" tags were not imported, when image import limit was cutting down the amount of imported images. Fix: Fix tag sorting according to semantic versioning rules. Result: The "highest" tags are properly imported, even when only a limited number of tags is allowed to be imported.
Story Points: ---
Clone Of: Environment:
OpenShift Enterprise 3.2
Last Closed: 2017-04-12 19:05:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1267746    

Description Steven Walter 2016-05-25 18:57:41 UTC
Description of problem:
Running oc import-image is supposed to pull the 5 tags with the "highest" tag (i.e. 5.1.1 is higher priority to 5.1, and 5.0)

Version-Release number of selected component (if applicable):
OpenShift Enterprise 3.2
Docker 1.9.1

How reproducible:
Reproduced

Steps to Reproduce:
oc import-image --all  postgresql-92-rhel7 --from=registry.access.redhat.com/rhscl/postgresql-94-rhel7 -n openshift --confirm


Actual results:
The import completed successfully.

Name:			postgresql-92-rhel7
Created:		1 seconds ago
Labels:			<none>
Annotations:		openshift.io/image.dockerRepositoryCheck=2016-05-25T18:44:56Z
Docker Pull Spec:	172.30.205.232:5000/openshift/postgresql-92-rhel7

Tag	Spec								Created		PullSpec	Image
latest	registry.access.redhat.com/rhscl/postgresql-94-rhel7:latest	1 seconds ago	<same>		66cab47273749c3c0478f130ddb851e327ce271305e1d0e4621cc0278000598f
9.4	registry.access.redhat.com/rhscl/postgresql-94-rhel7:9.4	1 seconds ago	<same>		66cab47273749c3c0478f130ddb851e327ce271305e1d0e4621cc0278000598f
9.4-2	registry.access.redhat.com/rhscl/postgresql-94-rhel7:9.4-2	1 seconds ago	<same>		5ca02059038e328f3af81d375f95d785412caf049fca77c0a100c6716d8f7cf8
9.4-3	registry.access.redhat.com/rhscl/postgresql-94-rhel7:9.4-3	1 seconds ago	<same>		0d9ea62a74e95b2d3772c53ea257983f822945492f9d364e642b57187a7273f6
9.4-5	registry.access.redhat.com/rhscl/postgresql-94-rhel7:9.4-5	1 seconds ago	<same>		188ef9ac0fef5972f5868126afe1c4a87de069ed1d564500395740cff2c12d32


info: The remote repository contained 4 additional tags which were not imported: 9.4-6, 9.4-6.1, 9.4-6.2, 9.4-6.4


Expected results:
Expected to pull 9.4-6 family over 9.4-5 and lower

Comment 1 Josep 'Pep' Turro Mauri 2016-06-23 11:03:25 UTC
I think that this might be a duplicate of bug 1338965, but also that the other bug is too focused on one of the consequences of the problem... in any case, I believe this belongs to the CLI instead of the registry.

Comment 2 Maciej Szulik 2016-06-28 12:46:53 UTC
The image are far away from supported semver naming scheme [1]. I've created a partial solution in [2] but it will not fully support the usecase you're describing in comment 1.

[1] http://semver.org/
[2] https://github.com/openshift/origin/pull/9600

Comment 3 Steven Walter 2016-07-26 15:30:13 UTC
Hi, I'm seeing that the work at [1] seems to have made progress. I am attaching another case to this; something to take note is that our official images sometimes use a format like, "2.7-11.2", so since they are officially supported images then we should support this process even if not according to semver. Seems like this justification may not be necessary though, since it looks like this format is going to work as per a comment in that thread!




[1] https://github.com/openshift/origin/pull/9600

Comment 5 Albert Wong 2016-11-11 19:01:22 UTC
SA for the account is also here.

Comment 7 openshift-github-bot 2016-11-21 18:37:32 UTC
Commits pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/bff7cab055c437cba747899d5c5fed90120a55ad
Bug 1339754 - Fix tag sorting according to semantic versioning rules

https://github.com/openshift/origin/commit/ea2c8f58f6c779da15bd5bce820ba558d8fab523
Merge pull request #9600 from soltysh/bug1339754

Merged by openshift-bot

Comment 8 zhou ying 2016-11-22 06:26:30 UTC
Confirmed with latest origin, the issue has fixed.
openshift version
openshift v1.5.0-alpha.0+75aa09c-30
kubernetes v1.4.0+776c994
etcd 3.1.0-rc.0

oc import-image --all  postgresql-92-rhel7 --from=registry.access.redhat.com/rhscl/postgresql-94-rhel7  --confirm
The import completed successfully.

Name:			postgresql-92-rhel7
Namespace:		zhouy
Created:		Less than a second ago
Labels:			<none>
Annotations:		openshift.io/image.dockerRepositoryCheck=2016-11-22T06:22:39Z
Docker Pull Spec:	172.30.225.48:5000/zhouy/postgresql-92-rhel7
Unique Images:		5
Tags:			5

latest
  tagged from registry.access.redhat.com/rhscl/postgresql-94-rhel7:latest

  * registry.access.redhat.com/rhscl/postgresql-94-rhel7@sha256:6f52d1967852cf0f9072c1aea1af00fc2c55ff483ef27bedda59b4f96a57df01
      Less than a second ago

9.4
  tagged from registry.access.redhat.com/rhscl/postgresql-94-rhel7:9.4

  * registry.access.redhat.com/rhscl/postgresql-94-rhel7@sha256:c4441fc2ccce946d3f863c83f3bca8346ab31764f03e77b94193f9756de8b4b7
      Less than a second ago

9.4-6
  tagged from registry.access.redhat.com/rhscl/postgresql-94-rhel7:9.4-6

  * registry.access.redhat.com/rhscl/postgresql-94-rhel7@sha256:a37d7e6a1a02bfc7d82637bcc1115693914d7304e5b194467f376d4413e1dec5
      Less than a second ago

9.4-5
  tagged from registry.access.redhat.com/rhscl/postgresql-94-rhel7:9.4-5

  * registry.access.redhat.com/rhscl/postgresql-94-rhel7@sha256:560b4822b1165f582b06f5865850e5fba07c1ee6ffe356804d7e7f103926aa83
      Less than a second ago

9.4-3
  tagged from registry.access.redhat.com/rhscl/postgresql-94-rhel7:9.4-3

  * registry.access.redhat.com/rhscl/postgresql-94-rhel7@sha256:fdc1137cfb508e6b8e493905b59100a5af740df8452b1c4d65c880d963e2fdc6
      Less than a second ago


info: The remote repository contained 8 additional tags which were not imported: 9.4-2, 9.4-6.1, 9.4-6.2, 9.4-6.4, 9.4-6.5, 9.4-6.6, 9.4-6.7, 9.4-6.8


Will verify after tested with latest OCP

Comment 9 Troy Dawson 2017-01-20 23:24:14 UTC
This has been merged into ocp and is in OCP v3.5.0.7 or newer.

Comment 10 zhou ying 2017-01-22 05:37:48 UTC
Confirmed with OCP 3.5 , the issue has fixed:
openshift version
openshift v3.5.0.7+390ef18
kubernetes v1.5.2+43a9be4
etcd 3.1.0-rc.0


oc import-image --all  postgresql-92-rhel7 --from=registry.access.redhat.com/rhscl/postgresql-94-rhel7 --confirm
The import completed successfully.

Name:			postgresql-92-rhel7
Namespace:		testzy
Created:		Less than a second ago
Labels:			<none>
Annotations:		openshift.io/image.dockerRepositoryCheck=2017-01-22T03:04:49Z
Docker Pull Spec:	172.30.184.82:5000/testzy/postgresql-92-rhel7
Unique Images:		5
Tags:			5

latest
  tagged from registry.access.redhat.com/rhscl/postgresql-94-rhel7:latest

  * registry.access.redhat.com/rhscl/postgresql-94-rhel7@sha256:ff6f7e8b2ad571db7ee136a55f898734eaac4c21731629c184388daff8353f5b
      Less than a second ago

9.4
  tagged from registry.access.redhat.com/rhscl/postgresql-94-rhel7:9.4

  * registry.access.redhat.com/rhscl/postgresql-94-rhel7@sha256:ac3de212454895779e6faf2f46a3954006dfa0d35f9826941c603a5dd2b45db4
      Less than a second ago

9.4-6
  tagged from registry.access.redhat.com/rhscl/postgresql-94-rhel7:9.4-6

  * registry.access.redhat.com/rhscl/postgresql-94-rhel7@sha256:a37d7e6a1a02bfc7d82637bcc1115693914d7304e5b194467f376d4413e1dec5
      Less than a second ago

9.4-5
  tagged from registry.access.redhat.com/rhscl/postgresql-94-rhel7:9.4-5

  * registry.access.redhat.com/rhscl/postgresql-94-rhel7@sha256:560b4822b1165f582b06f5865850e5fba07c1ee6ffe356804d7e7f103926aa83
      Less than a second ago

9.4-3
  tagged from registry.access.redhat.com/rhscl/postgresql-94-rhel7:9.4-3

  * registry.access.redhat.com/rhscl/postgresql-94-rhel7@sha256:fdc1137cfb508e6b8e493905b59100a5af740df8452b1c4d65c880d963e2fdc6
      Less than a second ago


info: The remote repository contained 10 additional tags which were not imported: 9.4-2, 9.4-6.1, 9.4-6.11, 9.4-6.2, 9.4-6.4, 9.4-6.5, 9.4-6.6, 9.4-6.7, 9.4-6.8, 9.4-6.9

Comment 12 errata-xmlrpc 2017-04-12 19:05:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:0884