Skip to content

Conversation

@coreydaley
Copy link

@coreydaley coreydaley commented Aug 16, 2018

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 16, 2018
@coreydaley
Copy link
Author

/assign bparees

@coreydaley
Copy link
Author

/retest

sort.Sort(sort.Reverse(sort.IntSlice(tagsToRemove)))
for _, objIndex := range tagsToRemove {
objects = append(objects[:objIndex], objects[objIndex+1:]...)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks overly cute (and is probably incorrect. each time you change objects, objIndex becomes invalid for the next reference). Just iterate the original list and copy the ones that aren't in "tagsToRemove" into a new list.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in current push

}
if len(r.ObjectName) > 0 {
return ""
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in current push

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still here, still not clear why?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regressed, will be removed in next push


objectsToKeep := app.Objects{}
for i, obj := range objects {
if _, ok := objectsToRemove[i]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just key objectsToRemove by the "namespace/name" value?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(that would seem less fragile to me)

@coreydaley
Copy link
Author

@bparees ptal, comments have been addressed

@coreydaley
Copy link
Author

/retest

ObjectMeta: metav1.ObjectMeta{
Name: istname,
Annotations: map[string]string{"openshift.io/imported-from": r.Reference.Exact()},
Namespace: r.SuggestNamespace(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this no longer needed? it seems like a useful disambiguation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setting namespace in another function to c.OriginNamespace if one doesn't exist

istNamespace = c.OriginNamespace
}
streamName, tagName, ok := imageapi.SplitImageStreamTag(ist.Name)
if ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to do something(throw an error?) if !ok

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in next push

if ist, ok := obj.(*imageapi.ImageStreamTag); ok {
istNamespace := ist.Namespace
if len(istNamespace) == 0 {
istNamespace = c.OriginNamespace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess this is why/how you got rid of the suggestnamespace logic.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct.

os::cmd::expect_failure 'oc get dc/php'
os::cmd::expect_success_and_text 'oc new-app -f test/testdata/template-without-app-label.json -o yaml' 'app: ruby-helloworld-sample'

# remove duplicate imagestream tags before creating objects
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this testing that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in current push

@bparees
Copy link
Contributor

bparees commented Aug 16, 2018

existing imagestreams/tags:

openshift/php:5.6
myproject/perl:1.0

scenarios:

# set project to myproject
oc project myproject

# should fail (openshift/php:latest isn't a valid tag in the openshift/php imagestream)
oc new-app --image-stream=openshift/php somerepo 

# should create a myproject/php imagestream with a "latest" tag
oc new-app --docker-image=library/php somerepo 

# should create a myproject/perl:latest tag in the myproject/perl imagestream
oc new-app --docker-image=library/perl somerepo 

that's the sort of scenarios i'd expect to see test coverage for (and anything else you've stumbled across while working on this). i'd expect them to be well defined and more explicit than what you currently have.

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 19, 2018
@coreydaley
Copy link
Author

@bparees ptal, updates tests, hopefully that is more what you are looking for.

os::cmd::expect_success_and_text 'oc new-app openshift/ruby-22-centos7 https://github.com/openshift/ruby-hello-world --strategy=docker --loglevel=5' 'Removing duplicate tag from object list: myproject/ruby-22-centos7:latest'
os::cmd::expect_success 'oc delete all -l app=ruby-22-centos7'

# create imagestreams in the correct namespace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would this invocation create an imagestream at all?

# should succeed and create the php:latest tag in the current namespace
os::cmd::expect_success 'oc new-app --docker-image=library/php https://github.com/sclorg/cakephp-ex --strategy=source'
os::cmd::try_until_success 'oc get imagestreamtag php:latest -n test-imagestreams'
os::cmd::expect_success 'oc create imagestreamtag php:latest -n openshift'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is valid? what does it do? (what does php:latest point to?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in next push

os::cmd::expect_success 'oc create imagestreamtag php:latest -n openshift'

# create a new tag for an existing imagestream in the current namespace
os::cmd::expect_success 'oc create imagestreamtag perl:5.0'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in next push

os::cmd::try_until_success 'oc get imagestreamtag perl:latest -n test-imagestreams'

# remove redundant imagestream tag before creating objects
os::cmd::expect_success_and_text 'oc new-app openshift/ruby-22-centos7 https://github.com/openshift/ruby-hello-world --strategy=docker --loglevel=5' 'Removing duplicate tag from object list'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what redundant tag is being removed? I would expect this invocation to create a new imagetream named "ruby-22-centos7" with a tag named "latest" pointing to the image "docker.io/openshift/ruby-22-centos7:latest", in the current namespace.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1612723

Command output: Removing duplicate tag from object list: myproject/ruby-22-centos7:latest

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, this was the case where the processing creates both the imagestreamtag and the imagestream containing the tag?


# create imagestream in the correct namespace
os::cmd::expect_success 'oc new-app --name=mytest --image-stream=mysql --env=MYSQL_USER=test --env=MYSQL_PASSWORD=redhat --env=MYSQL_DATABASE=testdb -l app=mytest'
os::cmd::try_until_success 'oc get is mytest -n test-imagestreams'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would this create an imagestream? you asked new-app to create an app based on an existing imagestream (named mysql, located in either this namespace or the openshift namespace). I wouldn't expect it to ever create an imagestream though (you haven't pointed to an image, so what image would the imagestream reference?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have based this test off of this bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1611462
This command was trying to create the imagestream in the openshift namespace, now it creates it in the users namespace (and it does create an imagestream)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm. it's odd to me that new-app creates a new imagestream in this scenario (rather than pointing the openshift/mysql imagestream) but i guess it's one of the many mysteries of new-app.


# don't create an unnecessary imagestream
os::cmd::expect_success 'oc new-app https://github.com/sclorg/nodejs-ex'
os::cmd::expect_failure_and_text 'oc get is nodejs:10 -n test-imagestreams' 'not found'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the imagestream name (if created) would be nodejs, nodejs:10 is an istag name. actually it might be "nodejs-ex" too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in next push

os::cmd::expect_success 'oc project cmd-newapp'
os::cmd::expect_success 'oc delete project test-imagestreams'

# end imagestream/tag creation and reuse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where's the test that ensures that if you've already got a "nodejs" imagestream in the current namespace, but it doesn't contain a "nodejs:10" tag, the "nodejs:10" tag is added to the existing "nodejs" imagestream and you don't get an error trying to create a new "nodejs" imagestream?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restored in next push

os::cmd::expect_success "oc new-build -D $'FROM node:8\nRUN echo \"Test\"' --name=node8"
os::cmd::try_until_success 'oc get imagestreamtags node:8'
os::cmd::expect_success "oc new-build -D $'FROM node:10\nRUN echo \"Test\"' --name=node10"
os::cmd::try_until_success 'oc get imagestreamtags node:10'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per my comment above, i think these 4 lines should be retained/restored. I don't think this behavior is covered/tested in what you have above.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restored in next push

@coreydaley
Copy link
Author

@bparees updated per your comments, also responded to your comments about specific sections and why they are there

@coreydaley
Copy link
Author

/retest

@coreydaley
Copy link
Author

/refresh

@coreydaley
Copy link
Author

/retest

Copy link
Contributor

@bparees bparees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more question/comment and then i think this will be good to go


# don't create an unnecessary imagestream
os::cmd::expect_success 'oc new-app https://github.com/sclorg/nodejs-ex'
os::cmd::expect_failure_and_text 'oc get istag node:10 -n test-imagestreams' 'not found'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be "nodejs:10"? "nodejs" is the name of the imagestream in openshift, at least.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also should probably just look for the "nodejs" imagestream (the imagestream shouldn't be created at all, right?), not a specific tag.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in current push

@coreydaley
Copy link
Author

@bparees updated per your comment

@coreydaley
Copy link
Author

/refresh

@coreydaley
Copy link
Author

/retest

@coreydaley coreydaley changed the title [WIP] Fix imagestream bugs Fix imagestream bugs Aug 20, 2018
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 20, 2018
@coreydaley
Copy link
Author

@bparees ptal

@bparees
Copy link
Contributor

bparees commented Aug 20, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 20, 2018
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bparees, coreydaley

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 20, 2018
@juanvallejo
Copy link
Contributor

@bparees @coreydaley any chance we could have this PR wait for #20645? It definitely overlaps with this one and I'd like to avoid having to rebase that if at all possible

@juanvallejo
Copy link
Contributor

/hold

Would like to wait for a response to above comment

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 20, 2018
@bparees
Copy link
Contributor

bparees commented Aug 20, 2018

@juanvallejo this fixes two bugs for QE, how soon will your PR go in?

@juanvallejo
Copy link
Contributor

@bparees

this fixes two bugs for QE, how soon will your PR go in?

Just need to get tests passing for it, will try to have it mergeable by end of day today. If I encounter any problems between now and end of day that might delay it from merging any longer, I'll just go ahead and unhold this one and take the rebase on mine

@bparees
Copy link
Contributor

bparees commented Aug 20, 2018 via email

@juanvallejo
Copy link
Contributor

/hold cancel

Will keep working on my PR, will rebase since this will most likely merge first

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 20, 2018
@openshift-merge-robot openshift-merge-robot merged commit a166e3e into openshift:master Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants