devfile / api

Kube-native API for cloud development workspaces specification
Apache License 2.0
235 stars 58 forks source link

Python v3.0.0 and Spring Boot stack sample doesn't show composite commands in Eclipse Che #1524

Open dmytro-ndp opened 1 month ago

dmytro-ndp commented 1 month ago

Which area this feature is related to?

/kind bug

Which area this bug is related to?

/area registry

What versions of software are you using?

Eclipse Che Next (7.85.0-SNAPSHOT) Dev Spaces 3.12.0 deployed to workspaces.openshift.com

Web browser

Operating System and version:

Browser name and version:

Bug Summary

Describe the bug:

When I create workspace using devfile https://github.com/devfile/registry/blob/main/stacks/python/3.0.0/devfile.yaml Eclipse Che 7.85.0 / Dev Spaces 3.12.0, I see no composite commands build-image, deployk8s in the devfile task list in VS Code editor:

  - id: build-image
    apply:
      component: build
  - id: deployk8s
    apply:
      component: deploy
  - id: deploy
    composite:
      commands:
        - build-image
        - deployk8s
      group:
        kind: deploy
        isDefault: true

To Reproduce:

  1. Create and open workspace on DevSandbox using the link https://workspaces.openshift.com/#/https://raw.githubusercontent.com/devfile/registry/main/stacks/python/3.0.0/devfile.yaml
  2. Go to top left menu > Terminal > Run Task...
  3. Open list of devfile commands.

There are only 3 commands in the list:

Expected behavior

Task list includes next composite commands described in the https://github.com/devfile/registry/blob/main/stacks/python/3.0.0/devfile.yaml:

Any logs, error output, screenshots etc? Provide the devfile that sees this bug, if applicable

Additional context

Any workaround?

Suggestion on how to fix the bug

thepetk commented 3 weeks ago

I can confirm the same case happens for all the devfile having commands using the apply instead of exec. (e.g python/3.0.0, go/2.3.0 etc)

johnmcollier commented 2 weeks ago

Spring Boot also affected, see https://github.com/devfile/api/issues/1526#issuecomment-2077214603

Jdubrick commented 1 week ago

Closing this issue as not completed after discussion here in Slack. The only commands that are intended to run via command line are exec and those are properly showing in the devspaces editor. As mentioned in the Slack discussion apply commands are run as init containers and are not intended to show up in an IDE, rather they are for interacting and working with clusters.

While true that you should be able to run composite commands consisting of exec commands, I believe this currently is a limitation of Che as they have an open issue here for adding that functionality. At this time I don't believe there is an issue on the Devfile end for why these are not showing up.

If things change or I am incorrect in my reasoning we can re-open this issue!

dmytro-ndp commented 1 week ago

@Jdubrick : do you happen to know the propose of composite commands build-image and deployk8s in the next devfiles taking into account that the commands don't have exec property:

?

Jdubrick commented 1 week ago

@dmytro-ndp From my understanding the purpose of those composite commands that are combining two apply commands, build-image and deployk8s, in all of the linked Devfiles is to be able to apply those resources at some time, whether it is preStart or postStart. There may be a default of when they are applied if it is not specified but I'm unsure off the top of my head. The docs related to the schema version applying to those v2.2.0 are here for commands. The API docs here also outline the apply command.

I'm tagging the rest of the team in this comment incase any of them want to fill in any knowledge gaps I may have on this topic!

@devfile/devfile-services-team

Jdubrick commented 5 days ago

@dmytro-ndp Does the above response answer your question?

dmytro-ndp commented 5 days ago

@Jdubrick : thank you for the answer I have expected build-image and deployk8s commands to be useful, and somehow involve build and deploy containers along with docker and kubernetes folders.

Shouldn't there be exec commands to build and deploy the Python container, or preStart / postStart in the devfile? Without those elements devfile looks incomplete, IMHO.

Jdubrick commented 5 days ago

@dmytro-ndp the commands are useful but I believe they may be intended for use with odo and not Che, I could be wrong however I can only think of the use case of them using odo at this time, which also consumes the devfile registry. By using the odo deploy command you can take advantage of the apply commands and the composite that combines them to deploy your project as an outerloop deployment. More on odo deploy here: https://odo.dev/docs/command-reference/deploy

For example, running odo init for me and choosing the python 3.0.0 stack as my starter with the flask starter project, I was able to run odo deploy and it deployed to my minikube cluster:

Image

ibuziuk commented 4 days ago

@azatsarynnyy could you please take a look? is it related to https://github.com/eclipse-che/che/issues/21859