Bug 1302512 - oc tag does not work as our document
Summary: oc tag does not work as our document
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Image Registry
Version: 3.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Maciej Szulik
QA Contact: Wei Sun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-28 02:55 UTC by Qi Yong
Modified: 2019-11-14 07:22 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-12 16:27:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:1064 0 normal SHIPPED_LIVE Important: Red Hat OpenShift Enterprise 3.2 security, bug fix, and enhancement update 2016-05-12 20:19:17 UTC

Description Qi Yong 2016-01-28 02:55:02 UTC
Description of problem:
in our document:
https://docs.openshift.com/enterprise/3.1/architecture/core_concepts/builds_and_image_streams.html#tag-tracking
you could set tag as following using oc tag command:
"spec": {
    "tags": [
      {
        "name": "latest",
        "from": {
          "kind": "ImageStreamTag",
          "name": "2.0"
        }
      }
    ]
  }
in this way you could make sure you will deploy latest by deploy 2.0.
However in 3.1 when you use oc tag, you will get following in image stream:
"spec": {
        "tags": [
            {
                "name": "2.0",
                "from": {
                    "kind": "ImageStreamImage",
                    "name": "cakephp-example@sha256:218dcb6c709960e62e1e1ee46721bed35dfe141695f3f0df60b755a0e66ed420"
                }
            },
            {
                "name": "latest",
                "from": {
                    "kind": "ImageStreamImage",
                    "name": "cakephp-example@sha256:218dcb6c709960e62e1e1ee46721bed35dfe141695f3f0df60b755a0e66ed420"
                }
            }
        ]
    },

You could also deploy 2.0 by deploy latest but the difference between this and the document is you lose the track between 2.0 and latest. It means when you want to use this image in multiple project with multiple tags, you are not sure which image is deployed unless you check sha value. 

Version-Release number of selected component (if applicable):


How reproducible:
# oc tag cakephp-example:latest cakephp-example:2.0

Steps to Reproduce:
1.oc tag cakephp-example:latest cakephp-example:2.0
2.
3.

Actual results:
"spec": {
        "tags": [
            {
                "name": "2.0",
                "from": {
                    "kind": "ImageStreamImage",
                    "name": "cakephp-example@sha256:218dcb6c709960e62e1e1ee46721bed35dfe141695f3f0df60b755a0e66ed420"
                }
            },
            {
                "name": "latest",
                "from": {
                    "kind": "ImageStreamImage",
                    "name": "cakephp-example@sha256:218dcb6c709960e62e1e1ee46721bed35dfe141695f3f0df60b755a0e66ed420"
                }
            }
        ]
    },

Expected results:
"spec": {
        "tags": [
            {
                "name": "0.0.2",
                "from": {
                    "kind": "ImageStreamImage",
                    "name": "aem-processing@sha256:the_built_0.0.2_image"
                }
            },
            {
                "name": "0.0.1",
                "from": {
                    "kind": "ImageStreamImage",
                    "name": "aem-processing@sha256:the_built_0.0.1_image"
                }
            },
            {
                "name": "release",
                "from": {
                    "kind": "ImageStreamTag",
                    "name": "0.0.1"
                }
            },
            {
                "name": "prerelease",
                "from": {
                    "kind": "ImageStreamTag",
                    "name": "0.0.2"
                }
            },
            {
                "name": "latest",
                "from": {
                    "kind": "DockerImage",
                    "name": "aem-processing:latest"
                }
            }
        ]
    }

Additional info:

Comment 1 Maciej Szulik 2016-01-29 16:57:56 UTC
What you're looking for is --alias option to oc tag. I've create is python and then tagged it twice:

oc tag python:latest python:normal
oc tag python:latest python:alias --alias

and this is what I got:

spec:
  tags:
  - from:
      kind: DockerImage
      name: centos/python-34-centos7
    name: latest
  - from:
      kind: ImageStreamImage
      name: python@sha256:ec180c95fe33723f843355b461827cfbef2e7a19b987f7799e029df99d66fdbf
    name: regular
  - from:
      kind: ImageStreamTag
      name: python:latest
    name: alias

Comment 2 Wei Sun 2016-02-01 05:51:08 UTC
Verified using the following version:

$ openshift version
openshift v3.1.1.6
kubernetes v1.1.0-origin-1107-g4c8e6f4
etcd 2.1.2

Result:
oc tag python:3.4 python:normal
oc tag python:3.4 python:alias --alias
oc get is python -o yaml



   from:
      kind: DockerImage
      name: centos/python-34-centos7:latest
    name: "3.4"
  - from:
      kind: ImageStreamTag
      name: python:3.4
    name: alias
  - from:
      kind: ImageStreamTag
      name: "3.4"
    name: latest
  - from:
      kind: ImageStreamImage
      name: python@sha256:ec180c95fe33723f843355b461827cfbef2e7a19b987f7799e029df99d66fdbf
    name: normal

Comment 6 errata-xmlrpc 2016-05-12 16:27:25 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/RHSA-2016:1064


Note You need to log in before you can comment on or make changes to this bug.