GoogleCloudPlatform / cloud-code-intellij

Plugin to support the Google Cloud Platform in IntelliJ IDEA - Docs and Issues Repository
Apache License 2.0
319 stars 59 forks source link

Can not create skaffold run configuration #2510

Closed wstrange closed 5 years ago

wstrange commented 5 years ago

What did you do?

Tried to add a run configuration for skaffold. Through the pull right menu (click right on the skaffold.yaml file) and also via Edit Configurations dialog (see screen shot)

I can not select a skaffold file for running. The drop down box is empty and it wont let me type in the window.

Note that I have skaffold installed via homebrew, and my Preferences have been updated to include skaffold

This is an existing project I opened up in IntelliJ. It is all docker / K8s - no Java artifacts.

What did you expect to see?

Allow me to select a skaffold.yaml file for deployment

What did you see instead?

https://www.dropbox.com/s/kd187c7w0vdd3ne/Screenshot%202019-04-23%2012.41.45.png?dl=0

etanshaul commented 5 years ago

Hi @wstrange thanks for reporting!

Do you have a skaffold.yaml file in your project tree? We don't yet have support for generating the config for you, but this will come in the next release.

Once you create the skaffold.yaml config file, that dropdown box should automatically get populated for you and then you can go ahead and deploy / continuous dev.

See this simple tutorial to help get started creating the configuration (if this indeed was the issue): https://github.com/GoogleCloudPlatform/cloud-code-intellij/blob/master/kubernetes/docs/existing-k8s-projects.md

wstrange commented 5 years ago

My project has it one level down, but I did try to create a new intellij project one level down (so skaffold.yaml is at the root). It has the same issue.

My skaffold.yaml files are fine (I use them in the terminal) - but I never get the prompt to enable skaffold support, and I can not add it manually

Is there some kind of module support that has to be added? This is not a java based project - just a free form intellij project that was created with "import from existing source"

etanshaul commented 5 years ago

Interesting.

So your project doesn't have any modules? (Note it doesn't have to be a Java project for the plugin to work; also the skaffold.yaml doesn't have to live in the root either).

@ivanporty does something here jump out at you with the way we are discovering skaffold.yaml files?

wstrange commented 5 years ago

I'm not sure it is possible to have no modules? It is not a Java project (there is no Java code..) but it has the Module settings for the JDK, etc.

etanshaul commented 5 years ago

yeah I didn't think it was possible either. We are searching the project file index to locate skaffold.yaml configs in the project, so I'm wondering if it is something to do with the structure of your project causing the file not to get indexed in the way we expect.

Do you happen to have a sample project (on GitHub for example) that reproduces this behavior?

wstrange commented 5 years ago

The project is here: https://github.com/ForgeRock/forgeops/ If you open up the dev/ folder as the top level project - the skaffold.yaml files are there

etanshaul commented 5 years ago

That's helpful.

Here's what I did:

1) git clone the project you referenced 2) Open it up in IDEA with the plugin 3) In the Event log, I see the following notification: image (Note that sometimes the notification doesn't pop up if there are several other notifications, instead IDEA places them in the event log (where they always appear regardless)). 4) I accept the prompt to create the run configs 5) Inspecting the new Run Config, I see: image

Which seems to correctly pick up the skaffold.yaml from the subdirectory.

I will test out the import from existing source workflow to see if that makes the difference.

etanshaul commented 5 years ago

@wstrange how did you trigger "import from existing source"? I wasn't able to do this - no matter how I open up the project, the Kubernetes notification pops up (or appears in the Event Log).

Also what version of IntelliJ are you using?

etanshaul commented 5 years ago

ah I see the option now. I forgot that it lives on File -> New. Testing it now

etanshaul commented 5 years ago

Even when I import the project from existing source, the notification was triggered and the skaffold.yaml file was detected: image

This is what the project structure looks like after accepting all the defaults in the import wizard: image

I'd be curious to see if you tried to open the project using File > Open after a fresh clone to see if you can still reproduce the issue.

wstrange commented 5 years ago

I'd be curious to see if you tried to open the project using File > Open after a fresh clone to see if you can still reproduce the issue.

I just tried that - I get the same results - no ability to select skaffold. I did a git clone, followed by File -> Open, and then selected the project.

I wonder If I have some other plugin that is interfering with the cloud code one?

wstrange commented 5 years ago

OK - I finally got the dialog to come up.

I think this was a conflict between this plugin and another Kubernetes plugin ("Kubernetes and OpenShift Support v0.9"). I disabled this and a couple more plugins, restarted, and now I get the skaffold dialog to come up.

I'll close this off for now. Thanks for your help!

etanshaul commented 5 years ago

Great thanks for the update. We’ll investigate this incompatibility. Don’t hesitate to reopen if needed or open a new issue for anything else.

canmanmake commented 5 years ago

@etanshaul The same issue here. Plugin disabling and restarting does not help. No new skaffold.yaml file is detected. Configuration only works when cloning a repo.

etanshaul commented 5 years ago

@canmanmake thanks for report, I'm reopening the issue to investigate more.

Do you have any more details about your project that may help us investigate? You mentioned that disabling the plugin and restarting does not help - do you mean disabling the "Kubernetes OpenShift plugin" (and if you not, could you try that too assuming you had it installed?)?

Also you mentioned that the configuration only works when cloning a repo. Do you mind elaborating a bit? Do you mean that when you clone the repo fresh then you can get the skaffold configuration detection notice?

Thanks again, and we'll help get to the bottom of this.

canmanmake commented 5 years ago

@etanshaul Thanks.

IntelliJ: Disabling the Kubernetes (v191.6183.20) and Cloud Code (v19.4.1) plugins did not help (besides, I only have GitToolbox and VueJs plugins enabled).

Exactly. The only way I could see the configuration detection message, was by setting up a "new project from version control"

etanshaul commented 5 years ago

@canmanmake thanks for the info. And just to get a bit more details if you don’t mind:

\ \ @GoogleCloudPlatform/cloud-tools-for-intellij anyone want to help investigate this?

canmanmake commented 5 years ago

@etanshaul Sure.

ivanporty commented 5 years ago

@canmanmake what if you right-click skaffold.yaml and select Synchronize action? Does this make it appear?

ivanporty commented 5 years ago

Or potentially do this on the whole project or a directory where Skaffold YAML is?

canmanmake commented 5 years ago

@ivanporty No. Both actions as well as restarting the IDE do not change anything.

etanshaul commented 5 years ago

One thing that came to mind. Since you say it does work when cloning the project, is there anything you can notice that is different in the structure of the project when cloning fresh vs when you can reproduce the issue with the already open project. Perhaps the module structure, or directory structure is different somehow?

canmanmake commented 5 years ago

@etanshaul It works now. I did de- and re-install plugins in different combinations. It seems there was a conflict with either the GitToolbox (v191.1.2) or the Vue.js (v191.6183.20) plugin. Now, as soon as "apiVersion: skaffold/v1beta9" is in the file, skaffold.yalm is detected (not directly after creating the file) and configuration detects correct file automatically.

Before, I tried with different project structure with no effect.

Thanks a lot!

etanshaul commented 5 years ago

Your welcome! Although I’m not sure we helped that much :)

In any case, it sounds like there are some takeaways here for us to investigate how to improve skaffold config file detection.

bbhuston commented 5 years ago

OK - I finally got the dialog to come up.

I think this was a conflict between this plugin and another Kubernetes plugin ("Kubernetes and OpenShift Support v0.9"). I disabled this and a couple more plugins, restarted, and now I get the skaffold dialog to come up.

I'll close this off for now. Thanks for your help!

I was running into the exact same issue as described by the OP when running latest version of Intellij and CloudCode. Disabling the other k8s plugins mentioned above resolved the issue and allowed Intellij to find the skaffold file. Thanks for the tip!

sageprice commented 5 years ago

@bbhuston glad you were able to get this working, but sorry to see others running into this. We should put some effort into making sure our plugin is able to find the files it needs regardless of whether other plugins are present. I've filed https://github.com/GoogleCloudPlatform/cloud-code-intellij/issues/2603 to track this work in future.