Skip to content
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

Update ODC's Devfile Library version #1136

Closed
2 tasks
maysunfaisal opened this issue Jun 16, 2023 · 10 comments · Fixed by openshift/console#13045
Closed
2 tasks

Update ODC's Devfile Library version #1136

maysunfaisal opened this issue Jun 16, 2023 · 10 comments · Fixed by openshift/console#13045
Assignees
Labels
area/library Common devfile library for interacting with devfiles

Comments

@maysunfaisal
Copy link
Member

maysunfaisal commented Jun 16, 2023

Which area/kind this issue is related to?

/area library

Issue Description

Update to a newer version of devfile/library on ODC.

This issue should also

  • look at if switching to the latest version of the library, affects ODC because of the proxy support that is required on git cli, that was put in devfile/library.
  • Update to the devfile/library version that has the new devfile validation for same port numbers in devfile components

Target Date: Mar 31, 2024

@maysunfaisal maysunfaisal self-assigned this Jun 16, 2023
@openshift-ci openshift-ci bot added the area/library Common devfile library for interacting with devfiles label Jun 16, 2023
@maysunfaisal maysunfaisal moved this to In Progress 🚧 in Devfile Project Jun 16, 2023
@kim-tsao
Copy link
Contributor

@maysunfaisal we can also consider introducing a new parser arg to disable downloading from parent devfiles, especially if ODC is not relying on these artifacts right now (download by default so it doesn't change existing behaviour).

@thepetk thepetk moved this from In Progress 🚧 to In Review 👀 in Devfile Project Aug 21, 2023
@michael-valdron michael-valdron moved this from In Review 👀 to Waiting in Devfile Project Sep 6, 2023
@github-actions
Copy link

This issue is stale because it has been open for 90 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the lifecycle/stale Stale items. These items have not been updated for 90 days. label Oct 23, 2023
@thepetk
Copy link
Contributor

thepetk commented Oct 23, 2023

I think this issue is still work in progress and the PR is under review

@github-actions github-actions bot removed the lifecycle/stale Stale items. These items have not been updated for 90 days. label Oct 25, 2023
@maysunfaisal maysunfaisal moved this from Waiting to In Progress 🚧 in Devfile Project Oct 26, 2023
@thepetk thepetk moved this from In Progress 🚧 to In Review 👀 in Devfile Project Oct 27, 2023
@thepetk
Copy link
Contributor

thepetk commented Oct 27, 2023

@maysunfaisal I've tested locally your branch of console and I was able to create an application for each one of our samples:

  • nodejs-basic
  • code-with-quarkus
  • java-springboot-basic
  • python-basic
  • go-basic

Image

@thepetk
Copy link
Contributor

thepetk commented Oct 27, 2023

@maysunfaisal my main concern is when I'm trying to parse a new sample:

  • I have created a new version of go-basic here: https://github.com/thepetk/devfile-sample-go-basic.git
  • This version uses consistent ports and the latest go parent.
  • I've included this version in a locally running image of the registry which I connected with my locally running ODC instance.
  • When I'm trying to create an application for this sample I have the following error:
Failed to parse devfile: failed to convert kubernetes uri to inlined for component 'deploy':
error getting kubernetes resources definition information, unable to resolve the file uri: deploy.yaml

This error comes from here: https://github.com/openshift/console/blob/master/pkg/devfile/handler.go#L55.

From what I can understand this error comes from the library and we are not able to locate the deploy.yaml file.

As a result, I'm not able to test your update against a new version of a sample that will have multiple components using the same port.

@thepetk
Copy link
Contributor

thepetk commented Oct 30, 2023

Adding a blocker label due to #1112 (comment)

@thepetk thepetk added the severity/blocker Issues that prevent developers from working label Oct 30, 2023
@thepetk
Copy link
Contributor

thepetk commented Nov 2, 2023

@maysunfaisal update for comment #1136 (comment):

TL:DR
When a devfile sample includes components inside the parent sections (parentOverrides) we are not able to use this sample to create an application in console.

Steps to reproduce

  • I've created locally a new image of the registry and used my go-basic fork as the golang sample. This devfile overrides the parent components like this:
parent:
  id: go
  registryUrl: 'https://registry.devfile.io'
  version: 2.1.0
  components:
    - name: deploy
      attributes:
        deployment/replicas: 1
        deployment/cpuRequest: 10m
        deployment/memoryRequest: 10Mi
        deployment/container-port: 8080
      kubernetes:
        uri: kubernetes/deploy.yaml
        endpoints:
        - name: http-8080
          targetPort: 8080
          path: /
  • I've started a local registry using minikube.
  • I've started an instance of console locally using CRC.
  • When I'm trying to create an application using the go-basic sample I have the error:
Failed to parse devfile: failed to convert kubernetes uri to inlined for component 'deploy':
error getting kubernetes resources definition information, unable to resolve the file
uri: kubernetes/deploy.yaml

Why this is happening?

  1. The console frontend is inlining all components that a devfile sample is using here.

  2. As a result when a devfile defines a component inside the parent block the frontend doesn't detect the component and as a result it doesn't inline it.

  3. Then it calls the ParseDevfileAndValidate function of the library.

  4. The ParseDevfileAndValidate leads to getKubernetesDefinitionFromUri which tries to inline the parent components that are now part of the flattened Devfile.

  5. As the DevfileCtx passed to the getKubernetesDefinitionFromUri by the frontend has no abspath or absoluteUrl the function returns the error shown above.

Workarounds

  • Frontend should inline the flattened devfile.: This requires frontend work from the ODC side, as they should add a feature to flatten the devfile before inlining it.

  • Convert sample uris to URLs: En example of the converted parent section is here:

parent:
  id: go
  registryUrl: 'https://registry.devfile.io'
  version: 2.1.0
  components:
    - name: build
      image:
        imageName: go-image:latest
        dockerfile:
          uri: https://github.com/thepetk/devfile-sample-go-basic/blob/main/docker/Dockerfile
          buildContext: .
          rootRequired: false
    - name: deploy
      attributes:
        deployment/replicas: 1
        deployment/cpuRequest: 10m
        deployment/memoryRequest: 10Mi
        deployment/container-port: 8080
      kubernetes:
        uri: https://github.com/thepetk/devfile-sample-go-basic/blob/main/kubernetes/deploy.yaml
        endpoints:
        - name: http-8080
          targetPort: 8080
          path: /

I've tried locally the second workaround and now with the update version of library, we are able to build applications with consistent ports.

@thepetk thepetk removed the severity/blocker Issues that prevent developers from working label Nov 8, 2023
@thepetk
Copy link
Contributor

thepetk commented Nov 8, 2023

This is not a blocker anymore as the scope of the blocked item has changed.

@thepetk
Copy link
Contributor

thepetk commented Mar 13, 2024

@maysunfaisal closing as the related PR was merged

@thepetk thepetk closed this as completed Mar 13, 2024
@github-project-automation github-project-automation bot moved this from In Review 👀 to Done ✅ in Devfile Project Mar 13, 2024
@thepetk thepetk reopened this Mar 13, 2024
@thepetk thepetk moved this from Done ✅ to In Review 👀 in Devfile Project Mar 13, 2024
@maysunfaisal
Copy link
Member Author

maysunfaisal commented Apr 22, 2024

Back ported to Openshift 4.15 openshift/console#13762

Did not proceed with back port to Openshift 4.14 because the updates for non-devfiles related go modules were a bit more significant than my liking for a "back port".

@github-project-automation github-project-automation bot moved this from In Review 👀 to Done ✅ in Devfile Project Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/library Common devfile library for interacting with devfiles
Projects
Status: Done ✅
Development

Successfully merging a pull request may close this issue.

3 participants