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

Plugin reports "no modules defined" when there are modules defined in skaffold.yaml #3157

Open
dallasvaughan opened this issue Aug 17, 2023 · 10 comments

Comments

@dallasvaughan
Copy link

Expected Behavior

When there are multiple skaffold.yaml modules defined, these modules aren't listed in the Build/Deploy configuration "Skaffold modules" section and cannot be selected to be run for a particular Run/Debug config.

Running with a particular module works correctly via CLI:

skaffold run -m <module>

Actual Behavior

When there are multiple skaffold.yaml modules defined, these modules are listed in the Build/Deploy configuration "Skaffold modules" section and are able to be selected to be run for a particular Run/Debug config.

Additional Information

  • IDE type (e.g. IntelliJ, Pycharm): IntelliJ IDEA
  • IDE version: 2023.2 (Ultimate Edition)
  • Cloud Code version (Settings > Plugins > Cloud Code): 23.8.1-api-version-222
  • Cloud SDK (Settings > Cloud Code > Cloud SDK)
    • Are you allowing the plugin to manage the Cloud SDK: Yes
    • Version of the Cloud SDK: 443.0.0
  • Skaffold version (If you are using Kubernetes features; Settings > Cloud Code > Kubernetes): 2.6.0
  • Operating System: macOS 13.4.1
@ivanporty
Copy link
Contributor

ivanporty commented Aug 17, 2023

Thanks for the report @dallasvaughan!

What is your version of skaffold on CLI you use to run, vs. bundled skaffold version in IDE (Tools -> Google Cloud Code -> Tools -> Terminal, and then which skaffold && skaffold version - according to settings, this seems to be 2.6.0) - are they the same?

@ivanporty
Copy link
Contributor

Another question - current version of your skaffold.yaml (apiVersion: skaffold/v...)

@dallasvaughan
Copy link
Author

The apiVersion of both configs in the skaffold.yaml is skaffold/v4beta6.
The Managed Skaffold version in Google Cloud Code settings is v2.6.0

My locally-installed version is 2.6.2:

$ which skaffold && skaffold version
/opt/homebrew/bin/skaffold
v2.6.2

@ivanporty
Copy link
Contributor

Thanks! We don't see issues with this setup with our module-based guestbook application so far. Are there any exceptions logged in idea.log (Help -> Show Log...)?

Other option - is there a single skaffold file in your project or multiple ones? Sometimes a module skaffold.yaml file gets selected in skaffold configuration file drop down instead of the one with all modules defined, if they are in the same project, and that could lead to no modules. I.e. for guestbook sample:

Screenshot 2023-08-17 at 1 41 14 PM

You will see different set of modules depending on which skaffold.yaml file is selected.

@dallasvaughan
Copy link
Author

dallasvaughan commented Aug 17, 2023

Apparently, the presence of #nonk8s at the top of the skaffold.yaml file is causing this issue. After removing this comment, it shows the modules as expected. (Please see #3125)

However, having this comment at the top of the skaffold.yaml file is necessary to prevent the Kubernetes Plugin from validating the skaffold.yaml file - otherwise it validates it as if it were a Kubernetes file, causing it to display multiple syntax errors, etc.

Can the plugin's module processing logic be updated to ignore comments on the first line of skaffold.yaml?

@ivanporty
Copy link
Contributor

@dallasvaughan we tried to reproduce same steps, with K8s plugin installed and #nonk8s and we still see modules detected properly. Can you please create a guestbook K8s sample, add #nonk8s and see if modules are still detected? Again, it would be helpful if you could check for exceptions related to skaffold in idea.log file.

@dallasvaughan
Copy link
Author

Okay, it's weird. It seems to have "worked itself out" somehow... I noticed while trying to edit my own project with different apiVersions that perhaps the error is intermittent. Here is the log which contains errors that might explain it. Notice the later entry
2023-08-18 14:57:11,850 [98212766] WARN - #com.google.cloud.tools.intellij.kubernetes.skaffold.modules.SkaffoldModuleService - Error reading and parsing skaffold modules

which seems like it might be why the UI doesn't display the modules at that moment (but this seems like a temporary state that eventually is corrected).

idea.log

@ivanporty
Copy link
Contributor

Thank you for the log, indeed, this is the command used for getting module list behind the scenes, and it fails (intermittent, as you said):

2023-08-18 14:57:11,850 [98212766]   WARN - #com.google.cloud.tools.intellij.kubernetes.skaffold.modules.SkaffoldModuleService - Error reading and parsing skaffold modules
java.lang.UnsupportedOperationException: Exit code `1` when listing skaffold modules: `/Users/dallas/Library/Application Support/cloud-code/bin/versions/51eeb6552821471de759eca7bca6bddfbffcb626539e9866d0262357c042e157/skaffold inspect modules list --filename /Users/dallas/IdeaProjects/ngss-docs-site/skaffold.yaml`.
	at com.google.cloud.tools.intellij.kubernetes.skaffold.modules.SkaffoldModuleService.runSkaffoldCommand(SkaffoldModuleService.kt:98)
	at com.google.cloud.tools.intellij.kubernetes.skaffold.modules.SkaffoldModuleService.runSkaffoldCommand$default(SkaffoldModuleService.kt:80)
	at com.google.cloud.tools.intellij.kubernetes.skaffold.modules.SkaffoldModuleService.getModules(SkaffoldModuleService.kt:56)
	at com.google.cloud.tools.intellij.kubernetes.skaffold.run.ui.module.SkaffoldModuleSelectorPanel$updateModuleSettings$1$moduleList$1.invokeSuspend(SkaffoldModuleSelectorPanel.kt:135)

One possibility is somehow corrupted state of the skaffold.yaml file not saved yet, or not in valid state when a run configuration was opened - do you recall anything like this - opening a run configuration while in the middle of editing cycle?

It looks like around the same time when all skaffold inspection / configuration command failed for a selected skaffold.yaml file which might point to the same conclusion

@ivanporty
Copy link
Contributor

@dallasvaughan any updates on the last comment - do you think this could be a probable cause of what you are seeing?

@dallasvaughan
Copy link
Author

@dallasvaughan any updates on the last comment - do you think this could be a probable cause of what you are seeing?

Yes, that is a definite possibility since I was frequently editing the skaffold.yaml at the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants