Bug 1514907

Summary: oc tag does not allow to add alias of ImageStreamTag in the same ImageStream
Product: OpenShift Container Platform Reporter: Kenjiro Nakayama <knakayam>
Component: ocAssignee: Fabiano Franz <ffranz>
Status: CLOSED WONTFIX QA Contact: Xingxing Xia <xxia>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.6.0CC: aos-bugs, bparees, jokerman, jvallejo, mmccomas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-28 19:33: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 Kenjiro Nakayama 2017-11-19 11:54:12 UTC
Description of problem:
- Default (openshift project) imageStream https://github.com/openshift/openshift-ansible/blob/release-3.6/roles/openshift_examples/files/examples/v3.6/image-streams/image-streams-rhel7.json creates the ImageStream with ImageStreamTag alias like [1].

- However, when we try to create such ImageStream(Tags) by `oc tag` command, it fails due to the validation error.

```
# oc tag registry.access.redhat.com/rhscl/perl-520-rhel7:latest perl:latest --source=docker
# oc tag perl:latest perl:5.20 --source=istag 
# oc tag 5.20 perl:latest --source=istag --alias
error: --source=ImageStreamTag requires a valid <name>:<tag> in SOURCE
```

Version-Release number of selected component (if applicable):
- OCP 3.3 (also reproduced by OCP 3.6)

How reproducible: 100%

Steps to Reproduce:
- 1. Add alias of ImageStreamTag with following commands:

```
# oc tag registry.access.redhat.com/rhscl/perl-520-rhel7:latest perl:latest --source=docker
# oc tag perl:latest perl:5.20 --source=istag 
# oc tag 5.20 perl:latest --source=istag --alias
```
Actual results:
- oc tag 5.20 perl:latest --source=istag --alias fails due to this error.

```
# oc tag 5.20 perl:latest --source=istag --alias
error: --source=ImageStreamTag requires a valid <name>:<tag> in SOURCE
```

Expected results:
- Create the ImageStream as [1].

Additional info: proposal patch https://github.com/openshift/origin/pull/17377

[1]
```
apiVersion: v1
kind: ImageStream
metadata:
  annotations:
    openshift.io/display-name: Perl
  name: perl
spec:
  tags:
  - annotations:
      version: "5.20"
    from:
      kind: DockerImage
      name: registry.access.redhat.com/rhscl/perl-520-rhel7:latest
    generation: 2
    importPolicy: {}
    name: "5.20"
  - annotations:
      version: "latest"
    from:
      kind: ImageStreamTag
      name: "5.20"
    generation: 1
    importPolicy: {}
    name: latest
```

Comment 1 Juan Vallejo 2017-11-20 15:12:56 UTC
Origin PR: https://github.com/openshift/origin/pull/17377

Comment 2 Ben Parees 2017-11-28 18:45:53 UTC
per my comments in https://github.com/openshift/origin/pull/17377#issuecomment-347619700

i think this should be closed as not a bug/won't fix.

Comment 3 Juan Vallejo 2017-11-28 19:33:25 UTC
> per my comments in https://github.com/openshift/origin/pull/17377#issuecomment-347619700

> i think this should be closed as not a bug/won't fix.

Given that usability is currently not affected in any way, and per bparees 's comment on the PR [1], I agree that the command's current behavior of specifying an imagestreamtag for both the source and destination, rather than just the tag name for either, is the least ambiguous approach.

1. https://github.com/openshift/origin/pull/17377#issuecomment-347619700

Comment 4 Kenjiro Nakayama 2017-11-29 05:41:15 UTC
As per Ben's comment https://github.com/openshift/origin/pull/17377#issuecomment-347743443 I opened another bz ticket as https://bugzilla.redhat.com/show_bug.cgi?id=1518497