-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
oc new-app applying language detection when not needed, causing an error. #11602
Comments
I'm pretty sure we can't actually change this behavior now, but we should at least fix the docs to clarify what happens in each of these scenarios (and make sure we actually understand too):
|
In what scenario would running language detection still be valid when you have that image/repo case and know the image is a builder image, such that you can't change the behaviour? Or are you talking about the bigger picture of how |
"oc new-app openshift/jenkins-1-centos7 https://github.com/openshift/nodejs-ex" (do you want to build nodejs-ex w/ the jenkins image, which is a valid s2i image? or do you want to deploy jenkins and build nodejs-ex with whatever builder we normally recommend for nodejs-ex based on source detection?)
yes I think we need to run through the matrix I described above, see what the current behavior is for each case, and then we can decide what can/can't be changed or what is/isn't behaving in a useful/consistent way. So let's gather the data and then debate the solution. |
The matrix should also be perhaps be expanded to include checking what happens when the For example, what should:
do. |
@bparees Can you point me to somewhere that clarifies (or can you clarify) the builder vs non builder images? (builder images are s2i images correct?) |
@coreydaley yeah builder images are s2i-enabled images. here's the new-app codes that decides if an image is an (s2i) builder image or not: there are a couple things it checks, as you can see. |
I found it also problematic when building from source a Gradle-based application. Without |
@szpak you can't force the source type (and then let new-app pick an image for that source type), unfortunately, but if you know of an image can build your source code, you can just specify that image/imagestream explicitly. --image-stream should work assuming the imagestream you're specifying is marked as a builder. Barring that, you can always use the ~ syntax:
does that help? |
I've tried it already and it bypassed that validation, however, later on the build was treated as binary deployment and my image tries to find JAR instead of cloning a Git repo and build the code. Nevertheless, today I tried with remote Git repo instead of local directory and it worked. Thanks. |
hmm, i'd have to see your exact new-app invocation, and the buildconfig json that was produced, to understand why that would be the case. binary build has multiple meanings unfortunately. if you're not providing a remote git repo, you will need to supply the source code from your local machine via a "binary build" (e.g. oc start-build mybuild --from-dir .), but that should not preclude the source code being compiled into a jar, if you are providing a pom.xml+java source, so i'm not sure why your build would be ignoring your source and only expecting a jar (normally the JEE builder images will both try to build source if a pom.xml is present, or just deploy a .jar file if one is present in the "source") |
@mjudeikis very related to the PR you were already working related to not doing source detection when a builder image is provided. |
@bparees will check, thanks. |
k, I can still see that issue is still there. But before jumping to the code, lets flush right behavior (and update doc after).
Please Update the table with what do you think is right. And we can check what is valid in the code :) |
@mjudeikis I think those look fine for expected behaviors. I could quibble with (5) (it's possible we should error in that case and force you to use the ~ syntax) but then it would be unclear what to do for (7) and (8) where you can't use the ~ syntax. |
@bparees this is where I was in doubt too. I tend to "put a dot here and say |
@bparees spent few hours going via code, and all this behavior does not look like easy win without a lot of refactoring. All this logic, where we decide if we should detect code or now, looks flaky at minimum... Was thinking under these lines
|
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
/lifecycle frozen |
According to:
oc new-app
can be passed multiple applications to deploy as separate deployments.There is one caveat on that though as explained in the note in that section.
Thus one can have two arguments where one is a builder image and the other is a source code repository. In that case the image would be applied as an S2I builder with the source code repository as input. Thus the three command lines below should all be equivalent:
That is not the case though as the first and second commands will actually fail.
The problem is that although
oc new-app
recognises that it needs to run the image as an S2I builder with the source code, before it does that it is running language detection on the source code repository to determine what builder it should use, even though not necessary, as the builder image was provided.When this language detection runs, if the source code repository doesn't have any of the special files in it that the builtin language builders are looking for, the detection fails and causes
oc new-app
to fail. As a consequence, the first two commands fail with the error:The third command where
~
is used doesn't suffer this problem as in that case language detection does appear to be disabled.Worth noting that if any of the special files looked for by language detection is added then it will then run okay, but with the language being detected being ignored anyway as it still uses the builder image given on the command line. Thus the commands:
work fine, as they have a dummy
project.json
in the source code repository even though not required by the image builder nor anything to do with dotNet.In summary, in this two argument case where one is a builder image and the other is a source code repository, language detection should be disabled, in the same way as occurs when using
~
.Version
oc v1.3.1
kubernetes v1.3.0+52492b4
features: Basic-Auth
Server https://127.0.0.1:8443
openshift v1.3.1
kubernetes v1.3.0+52492b4
Steps To Reproduce
See above.
Current Result
Fails with error:
Expected Result
Should executed the image as an S2I with source code repository as input.
Additional Information
There is nothing of relevance in log output, even at log level 5 or above.
Most you get is:
The image is believed to have labels defined which identify it as a builder image and works fine when using
~
.The text was updated successfully, but these errors were encountered: