origin: oc new-app applying language detection when not needed, causing an error.

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",

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 20 (14 by maintainers)

Most upvoted comments

@mjudeikis very related to the PR you were already working related to not doing source detection when a builder image is provided.