Bug 2046435

Summary: Better Devfile Import Strategy support in the 'Import from Git' flow
Product: OpenShift Container Platform Reporter: Ilya Buziuk <ibuziuk>
Component: Dev ConsoleAssignee: Jaivardhan Kumar <jakumar>
Status: CLOSED ERRATA QA Contact: spathak <spathak>
Severity: medium Docs Contact: Olivia Payne <opayne>
Priority: medium    
Version: 4.10CC: aos-bugs, cbremble, cjerolim, eyuen, msaud, nmukherj
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Git import form has shows a misleading error message when an invalid devfile repository (older than devfile v2.2) is entered. Consequence: The message is unclear on why the provided devfile repository cannot be used. Fix: Update the error message to explicitly state that devfiles older than v2.2 are not supported. Result: Reason for failure to import from the devfile repository is clear.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-10 10:44:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Ilya Buziuk 2022-01-26 16:50:42 UTC
Description of problem:

Currently, the `Import from Git` flow from the `+Add` page can be really misleading with the Openshift 4.10 (4.10.0-0.nightly-2022-01-26-234447)

A couple of examples using the following repositories:

1. Repository with devfile v1 e.g. https://github.com/edeandrea/summit-lab-spring-music

ERROR: Import is not possible.
Failed to parse devfile: schemaVersion not present in devfile:

However, devfile is valid and the error message is misleading - https://github.com/edeandrea/summit-lab-spring-music/blob/pipeline/devfile.yaml

The error message could be better e.g. `deviles v1 are not suported`

2. Repository with Devfile 2.1 - https://github.com/eclipse-che/blog

ERROR: Import is not possible.
Console Devfile Import Dev Preview, supports only one image component, now has 0

The error message should provide clarification why this particular devfile can not be used for the import.

In general, it looks like `Import from Git` flow expects very specific devfiles with an image component for outerloop deployment e.g. https://registry.devfile.io/viewer/devfiles/Community+nodejs-basic 

Other valid devfiles v1, v2.1, v2.2 could fail with `ERROR: Import is not possible` + error message with no clarification on how to fix it.

Additional info:

In general, if devfile is not supported it might be a good idea to switch automatically to another import strategy e.g. "Builder Image", or provide clear instructions/documentation link with clarification on how to make a proper devfile for the `Git Import` flow

Comment 3 eyuen 2022-01-27 17:18:58 UTC
1. The devfile is actually not valid for the devfile 2.x spec. That error is coming from a combination of ODC and devfile library. The error from the devfile library side is correct since devfile v1 and v2 are using different fields to store the devfile version number. Devfile 2.x is using `schemaVersion` while devfile 1 is using `apiVersion`. The listed devfile is missing the `schemaVersion` field so the error message is correct. 

I suggest fixing the message on the ODC side since ODC only supports devfile 2.2 or above (since this is ODC specific) by changing/adding to the generic "ERROR: Import is not possible." to something more specific that mention only supporting devfiles using version 2.2 or above.

2. Again, since ODC only supports devfile 2.2, we should provide similar message as suggested in #1.

Comment 4 eyuen 2022-01-28 21:39:35 UTC
I assume the part "ERROR: Import is not possible" is the generic import error message that ODC provides and will remain unchanged. It is the second line of the error that needs to be updated.

1. Original:
ERROR: Import is not possible.
Failed to parse devfile: schemaVersion not present in devfile:

ERROR: Import is not possible.
Failed to parse devfile: schemaVersion not present in devfile. Only devfile 2.2.0 or above is supported. The devfile needs to have the schemaVersion set in the metadata section with a value of 2.2.0 or above.

2. Original:
ERROR: Import is not possible.
Console Devfile Import Dev Preview, supports only one image component, now has 0

ERROR: Import is not possible.
Only devfile 2.2.0 or above with one image component is supported. 

If we have any documentation that documents the requirement, also add this to the end of the message above:
Refer to ??? for more details.

Comment 8 Christoph Jerolimov 2022-06-20 10:07:35 UTC
Verified improved labels on 4.11.0-0.nightly-2022-06-15-222801

Hey ibuziuk, please take a look and reopen the issue if you see any other improvement options.

Comment 9 errata-xmlrpc 2022-08-10 10:44:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.