Bug 1302512

Summary: oc tag does not work as our document
Product: OpenShift Container Platform Reporter: Qi Yong <yoqi>
Component: Image RegistryAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: Wei Sun <wsun>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.1.0CC: aos-bugs, jkaur, jokerman, mmccomas, tdawson, wili
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-12 16:27:25 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:

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