oc new-app applying language detection when not needed, causing an error.
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 8.7k
- Forks
- 4.8k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 53
Description
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.
If a source code repository and a builder image are specified as separate arguments, new-app uses the builder image as the builder for the source code repository. If this is not the intent, simply specify a specific builder image for the source using the ~ separator.
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:
oc new-app getwarped/s2i-httpd-server https://gitlab.com/graham-dumpleton/static-website-test-1.git --name test1
oc new-app --docker-image=getwarped/s2i-httpd-server https://gitlab.com/graham-dumpleton/static-website-test-1.git --name test1
oc new-app getwarped/s2i-httpd-server~https://gitlab.com/graham-dumpleton/static-website-test-1.git --name test1
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:
error: No language matched the source repository
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:
oc new-app getwarped/s2i-httpd-server~https://gitlab.com/graham-dumpleton/static-website-test-2.git --name test2
oc new-app --docker-image=getwarped/s2i-httpd-server https://gitlab.com/graham-dumpleton/static-website-test-2.git --name test2
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:
error: No language matched the source repository
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:
I1026 15:40:12.503453 52500 repository.go:355] Executing git ls-remote https://gitlab.com/graham-dumpleton/static-website-test-1.git
I1026 15:40:14.541400 52500 sourcelookup.go:516] No source ref specified, using shallow git clone
I1026 15:40:14.541453 52500 repository.go:355] Executing git clone --recursive --depth=1 https://gitlab.com/graham-dumpleton/static-website-test-1.git /var/folders/0p/4vcv19pj5d72m_bx0h40sw340000gp/T/gen754776583
F1026 15:40:18.184447 52500 helpers.go:110] error: No language matched the source repository
The image is believed to have labels defined which identify it as a builder image and works fine when using ~.
"io.k8s.description": "S2I builder for hosting files with Apache HTTPD server",
"io.k8s.display-name": "Apache HTTPD Server",
"io.openshift.expose-services": "8080:http",
"io.openshift.s2i.scripts-url": "image:///opt/app-root/s2i/bin",
"io.openshift.tags": "builder,httpd",
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the two-argument oc new-app commands and start by tracing the language-detection path after the source clone. The log names repository.go, sourcelookup.go, and helpers.go; done means a builder image plus source repository no longer requires language detection and succeeds like the ~ form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100