Bug 1302512 - oc tag does not work as our document
oc tag does not work as our document
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Image Registry (Show other bugs)
3.1.0
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Maciej Szulik
Wei Sun
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-27 21:55 EST by Qi Yong
Modified: 2016-05-12 12:27 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-05-12 12:27:25 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:1064 normal SHIPPED_LIVE Important: Red Hat OpenShift Enterprise 3.2 security, bug fix, and enhancement update 2016-05-12 16:19:17 EDT

  None (edit)
Description Qi Yong 2016-01-27 21:55:02 EST
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 11:57:56 EST
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 00:51:08 EST
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 12:27:25 EDT
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.