devfile / api

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

Nx no longer uses `workspace.json` files #1497

Open michael-valdron opened 1 month ago

michael-valdron commented 1 month ago

Which area this feature is related to?

/kind bug

Which area this bug is related to?

/area registry-viewer /area landing-page

What versions of software are you using?

Node.js project

Operating System and version: N/A

Node.js version: 18

Yarn version: 1.22.19

Project.json: @nx/node

Bug Summary

Describe the bug:

Nx build produces warnings due to the newer version of Nx using different project.json files to define the multiple projects.

To Reproduce:

Run yarn nx affected --target=build.

Expected behavior

yarn nx affected --target=build should not produce warnings about workspace.json.

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

Output of yarn nx affected --target=build --parallel=3:

yarn run v1.22.19
$ /home/runner/work/devfile-web/devfile-web/node_modules/.bin/nx affected --target=build --parallel=3

 >  NX   workspace.json is ignored

   Nx no longer reads configuration from workspace.json.
   Run "nx g @nrwl/workspace:fix-configuration" to split workspace.json into individual project.json files.

 >  NX   No explicit --base argument provided, but found environment variable NX_BASE so using its value as the affected base: a0bc065e4c9b3ae9b93a5fa2b0e5102abdbc3243

 >  NX   No explicit --head argument provided, but found environment variable NX_HEAD so using its value as the affected head: f980d517bfb02f8d27455c0e8b9c88bdab6d4c90

 >  NX   No projects with target build for 0 projects were run

 >  NX   Successfully ran target build for 0 projects

   View logs and run details at https://cloud.nx.app/runs/gqnh2u7gpj

Done in 0.93s.

Additional context

Any workaround?

N/A

Suggestion on how to fix the bug

michael-valdron commented 1 month ago

Explains why checks are now passing: https://github.com/devfile/api/issues/1464#issuecomment-2033079380

See #1464 for details.

Jdubrick commented 1 month ago

I believe we are already using project.json and the workspace.json is just left there, the fix to this possibly is to just remove workspace.json?

Core: https://github.com/devfile/devfile-web/blob/main/libs/core/project.json Docs: https://github.com/devfile/devfile-web/blob/main/libs/docs/project.json Landing Page E2E: https://github.com/devfile/devfile-web/blob/main/apps/landing-page-e2e/project.json Landing Page: https://github.com/devfile/devfile-web/blob/main/apps/landing-page/project.json Registry-Viewer E2E: https://github.com/devfile/devfile-web/blob/main/apps/registry-viewer-e2e/project.json Registry-Viewer: https://github.com/devfile/devfile-web/blob/main/apps/registry-viewer/project.json

fyi @michael-valdron

michael-valdron commented 1 month ago

I believe we are already using project.json and the workspace.json is just left there, the fix to this possibly is to just remove workspace.json?

Core: https://github.com/devfile/devfile-web/blob/main/libs/core/project.json Docs: https://github.com/devfile/devfile-web/blob/main/libs/docs/project.json Landing Page E2E: https://github.com/devfile/devfile-web/blob/main/apps/landing-page-e2e/project.json Landing Page: https://github.com/devfile/devfile-web/blob/main/apps/landing-page/project.json Registry-Viewer E2E: https://github.com/devfile/devfile-web/blob/main/apps/registry-viewer-e2e/project.json Registry-Viewer: https://github.com/devfile/devfile-web/blob/main/apps/registry-viewer/project.json

fyi @michael-valdron

@Jdubrick This might need further investigation, though the project.json files are there the project builds are still being ignored. This is possibly related to the workspace.json that is still present that pointed to each project, it might be a possible file change or command change that would fix this process to detect the inner projects.

Jdubrick commented 1 month ago

I believe we are already using project.json and the workspace.json is just left there, the fix to this possibly is to just remove workspace.json? Core: https://github.com/devfile/devfile-web/blob/main/libs/core/project.json Docs: https://github.com/devfile/devfile-web/blob/main/libs/docs/project.json Landing Page E2E: https://github.com/devfile/devfile-web/blob/main/apps/landing-page-e2e/project.json Landing Page: https://github.com/devfile/devfile-web/blob/main/apps/landing-page/project.json Registry-Viewer E2E: https://github.com/devfile/devfile-web/blob/main/apps/registry-viewer-e2e/project.json Registry-Viewer: https://github.com/devfile/devfile-web/blob/main/apps/registry-viewer/project.json fyi @michael-valdron

@Jdubrick This might need further investigation, though the project.json files are there the project builds are still being ignored. This is possibly related to the workspace.json that is still present that pointed to each project, it might be a possible file change or command change that would fix this process to detect the inner projects.

This may be related to the nx cache also, its possible the env variable for skipping it isn't working so it skips the tests, but I agree investigation should be done.

Jdubrick commented 1 month ago

I know that the command in the issue will output a project build if something in the project was changed, else, it will have 0 builds

michael-valdron commented 1 month ago

I know that the command in the issue will output a project build if something in the project was changed, else, it will have 0 builds

Yeah you correct, this would lower the priority and scope of this report as its just warnings.

michael-valdron commented 1 month ago

Nx build no longer builds any projects due to the newer version of Nx using different project.json files to define the multiple projects. Without these files, all projects are ignored during yarn nx affected --target=build.

Revising to:

Nx build produces warnings due to the newer version of Nx using different project.json files to define the multiple projects.

michael-valdron commented 1 month ago

yarn nx affected --target=build should trigger building the Nx projects.

Revising to:

yarn nx affected --target=build should not produce warnings about workspace.json.

michael-valdron commented 1 month ago

Revert version of Nx and dependencies to a previous state to restore usage of workspace.json.

Revising to:

N/A