Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-4812

oc new-app command using s2i with private Github repo (over SSH) fails using oc v4.10

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • 4.12.0, 4.11.z, 4.10.z
    • oc
    • None
    • Sprint 229
    • 1
    • False
    • Hide

      None

      Show
      None

      Description of problem:

      The oc new-app command using a private Git repository no longer works with oc v4.10. Specifically, the private Git repository is authenticating over SSH and this occurs when no image stream is specified in the command so that the language detection step is required. Here is an example command:

      oc new-app git@github.com:scottishkiwi/test-oc-newapp.git --source-secret github-repo-key --name test-app

      Version-Release number of selected component (if applicable):
      oc v4.10

      How reproducible:

      Easily reproducible.

      Steps to Reproduce:

      1. Download v4.10 of the oc tool and add to local executable path as 'oc':
      https://access.redhat.com/downloads/content/290/ver=4.10/rhel---8/4.10.10/x86_64/product-software

      ➜ ~ oc version
      Client Version: 4.10.9

      2. Setup a private Github repository

      3. Add SSH public key as a deploy key to the private Github repository

      4. Push some empty test file like index.php to the private repository (used for language detection)

      5. Create a new OpenShift project:
      ➜ ~ oc new-project test-oc-newapp

      6. Create a secret to hold the private key of the SSH key pair
      ➜ ~ oc create secret generic github-repo-key --from-file=ssh-privatekey=/Users/daniel/test/github-repo --type=kubernetes.io/ssh-auth
      secret/github-repo-key created

      7. Enable access to the secret from the builder service account:
      ➜ ~ oc secrets link builder github-repo-key

      8. Create a new application using the source secret:
      oc new-app git@github.com:scottishkiwi/test-oc-newapp.git --source-secret github-repo-key --name test-app

      Actual results:

      ➜ ~ oc new-app git@github.com:scottishkiwi/test-oc-newapp.git --source-secret github-repo-key --name test-app
      warning: Cannot check if git requires authentication.
      error: local file access failed with: stat git@github.com:scottishkiwi/test-oc-newapp.git: no such file or directory
      error: unable to locate any images in image streams, templates loaded in accessible projects, template files, local docker images with name "git@github.com:scottishkiwi/test-oc-newapp.git"

      Argument 'git@github.com:scottishkiwi/test-oc-newapp.git' was classified as an image, image~source, or loaded template reference.

      The 'oc new-app' command will match arguments to the following types:

      1. Images tagged into image streams in the current project or the 'openshift' project

      • if you don't specify a tag, we'll add ':latest'
        2. Images in the container storage, on remote registries, or on the local container engine
        3. Templates in the current project or the 'openshift' project
        4. Git repository URLs or local paths that point to Git repositories

      --allow-missing-images can be used to point to an image that does not exist yet.

      Expected results (with oc v4.8):

      ➜ ~ oc-4.8 version
      Client Version: 4.8.37

      ➜ oc-4.8 new-app git@github.com:scottishkiwi/test-oc-newapp.git --source-secret github-repo-key --name test-app
      warning: Cannot check if git requires authentication.
      --> Found image 22f1bf3 (4 weeks old) in image stream "openshift/php" under tag "7.4-ubi8" for "php"

      Apache 2.4 with PHP 7.4
      -----------------------
      PHP 7.4 available as container is a base platform for building and running various PHP 7.4 applications and frameworks. PHP is an HTML-embedded scripting language. PHP attempts to make it easy for developers to write dynamically generated web pages. PHP also offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled webpage with PHP is fairly simple. The most common use of PHP coding is probably as a replacement for CGI scripts.

      Tags: builder, php, php74, php-74

      • The source repository appears to match: php
      • A source build using source code from git@github.com:scottishkiwi/test-oc-newapp.git will be created
      • The resulting image will be pushed to image stream tag "test-app:latest"
      • Use 'oc start-build' to trigger a new build
      • WARNING: this source repository may require credentials.
        Create a secret with your git credentials and use 'oc set build-secret' to assign it to the build config.

      --> Creating resources ...
      imagestream.image.openshift.io "test-app" created
      buildconfig.build.openshift.io "test-app" created
      deployment.apps "test-app" created
      service "test-app" created
      --> Success
      Build scheduled, use 'oc logs -f buildconfig/test-app' to track its progress.
      Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
      'oc expose service/test-app'
      Run 'oc status' to view your app.

      Additional info:

      Also tested with oc v4.9 and works as expected:

      ➜ ~ oc-4.9 version
      Client Version: 4.9.29

      ➜ ~ oc-4.9 new-app git@github.com:scottishkiwi/test-oc-newapp.git --source-secret github-repo-key --name test-app
      warning: Cannot check if git requires authentication.
      --> Found image 22f1bf3 (4 weeks old) in image stream "openshift/php" under tag "7.4-ubi8" for "php"

      Apache 2.4 with PHP 7.4
      -----------------------
      PHP 7.4 available as container is a base platform for building and running various PHP 7.4 applications and frameworks. PHP is an HTML-embedded scripting language. PHP attempts to make it easy for developers to write dynamically generated web pages. PHP also offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled webpage with PHP is fairly simple. The most common use of PHP coding is probably as a replacement for CGI scripts.

      Tags: builder, php, php74, php-74

      • The source repository appears to match: php
      • A source build using source code from git@github.com:scottishkiwi/test-oc-newapp.git will be created
      • The resulting image will be pushed to image stream tag "test-app:latest"
      • Use 'oc start-build' to trigger a new build
      • WARNING: this source repository may require credentials.
        Create a secret with your git credentials and use 'oc set build-secret' to assign it to the build config.

      --> Creating resources ...
      buildconfig.build.openshift.io "test-app" created
      deployment.apps "test-app" created
      service "test-app" created
      --> Success
      Build scheduled, use 'oc logs -f buildconfig/test-app' to track its progress.
      Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
      'oc expose service/test-app'
      Run 'oc status' to view your app.
      ➜ ~ oc status
      In project dan-test-oc-newapp on server https://api.dsquirre.2b7w.p1.openshiftapps.com:6443

      svc/test-app - 172.30.238.75 ports 8080, 8443
      deployment/test-app deploys istag/test-app:latest <-
      bc/test-app source builds git@github.com:scottishkiwi/test-oc-newapp.git on openshift/php:7.4-ubi8
      deployment #3 running for 38 minutes - 1 pod
      deployment #2 deployed 38 minutes ago
      deployment #1 deployed 38 minutes ago

      1 info identified, use 'oc status --suggest' to see details.

              olemefer Otávio Fernandes
              cdaley Corey Daley
              ying zhou ying zhou
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: