GoogleCloudPlatform / cloud-code-intellij

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

Cloud Code for Cloud Run doesn't load builders to run code locally #3196

Open fulviomanente opened 2 months ago

fulviomanente commented 2 months ago

PY-232.10300.41, JRE 17.0.10+7-b1000.48x64 JetBrains s.r.o., OS Mac OS X(aarch64) v14.1.2, screens 1920.0x1080.0

I'm trying to run a Google Cloud Run locally, as per the instructions. Everything goes fine if I use a Dockerfile however the new option to build it via build packs (which is how I build them in Cloud Build) is not showing up as an option on the IDE Screenshot 2024-04-25 at 6 32 29 PM

ivanporty commented 2 months ago

Thank you for the report. Are there any exceptions in your log file (idea.log, Help -> Show Log file..)

codonist commented 2 months ago

same thing there. Here are some information:

intellij IntelliJ IDEA 2024.1 (Ultimate Edition) Build #IU-241.14494.240, built on March 28, 2024 Licensed to Pengyu Zhao Subscription is active until August 25, 2024. Runtime version: 17.0.10+8-b1207.12 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 14.3.1 GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 12 Metal Rendering is ON Registry: ide.balloon.shadow.size=0 ide.new.editor.tabs.vertical.borders=true ide.animate.toolwindows=true ide.experimental.ui=true ide.editor.tab.selection.animation=true Non-Bundled Plugins: com.jetbrains.plugins.ini4idea (241.14494.240) com.intellij.apacheConfig (241.14494.240) de.netnexus.camelcaseplugin (3.0.12) IdeaVIM (2.10.2) com.intellij.plugins.watcher (241.14494.150) org.jetbrains.plugins.go-template (241.14494.150) org.jetbrains.plugins.go (241.14494.240) Pythonid (241.14494.240) com.jetbrains.space (241.14494.150) net.seesharpsoft.intellij.plugins.csv (3.3.0-241) com.intellij.ml.llm (241.14494.240) com.github.copilot (1.5.2.5345) com.intellij.lang.jsgraphql (241.14494.150) com.jetbrains.packagesearch.intellij-plugin (241.0.8) mobi.hsz.idea.gitignore (4.5.3) com.google.gct.core (24.4.2-api-version-223) com.jetbrains.php (241.14494.240) com.chrisrm.idea.MaterialThemeUI (9.2.0) com.jetbrains.php.wordPress (241.14494.240) ru.adelf.idea.dotenv (2024.1) com.google.cloud.workstations.ide.jetbrains.connector (24.3.1-api-version-231) Kotlin: 241.14494.240-IJ

Log when i open the run local dialog:

2024-04-28 10:51:06,954 [3391265]   WARN - #com.google.cloud.tools.intellij.kubernetes.skaffold.run.ui.build.SkaffoldBuilderSettingsPanel - Unable to detect images and builders

when i open intellij setting dialog (not sure this is related):

2024-04-28 10:49:39,619 [3303930]   INFO - #com.google.cloud.tools.intellij.kubernetes.kpt.KptExecutorService - Error parsing kpt version
com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "kpt": error=2, No such file or directory
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:366)
    at com.google.cloud.tools.intellij.util.CommandExecutor.run(CommandExecutor.kt:76)
    at com.google.cloud.tools.intellij.util.CommandExecutor.run$default(CommandExecutor.kt:60)
    at com.google.cloud.tools.intellij.kubernetes.kpt.KptExecutorService.createProcess(KptExecutorService.kt:133)
    at com.google.cloud.tools.intellij.kubernetes.kpt.KptExecutorService.executeKpt(KptExecutorService.kt:101)
    at com.google.cloud.tools.intellij.kubernetes.kpt.KptExecutorService.getKptVersion(KptExecutorService.kt:79)
    at com.google.cloud.tools.intellij.kubernetes.kpt.KptExecutorService.getManagedKptVersion(KptExecutorService.kt:67)
    at com.google.cloud.tools.intellij.configurables.DeploymentToolsDependenciesPanel$setManagedDependencyVersions$1$kptVersion$1.invokeSuspend(DeploymentToolsDependenciesPanel.kt:351)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Caused by: java.io.IOException: Cannot run program "kpt": error=2, No such file or directory
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:490)
    at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:463)
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:356)
    ... 15 more

Let me know if you need more information, thanks.

fulviomanente commented 2 months ago

I have this exact same message on my logs

SkaffoldBuilderSettingsPanel - Unable to detect images and builders

The other interesting info, If I start from the examples, it at leader can read my docker file, there are still, no options for build back. If I add a docker file to an existing project, it doesn’t give me the option to use it, like in the example

Sent from my iPhone

On Apr 28, 2024, at 9:59 AM, codonist @.***> wrote:

SkaffoldBuilderSettingsPanel - Unable to detect images and builders

codonist commented 2 months ago

i am wondering if we could get around the UI by putting the config inside the Run_locally.xml configuration file (by checking "store as project file" in run locally dialog). In my case is something like this

<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="my-service: Run Locally" type="CloudCodeCloudRunConfigurationType" factoryName="CloudCodeCloudRunDevelopConfigurationFactory" show_console_on_std_err="false" show_console_on_std_out="false">
    <option name="allowRunningInParallel" value="false" />
    <option name="buildpacksEnv">
      <map />
    </option>
    <option name="cloudSqlConnections">
      <list />
    </option>
    <option name="cpuAllocated" value="NO_LIMIT" />
    <option name="dockerBuildArgs">
      <map />
    </option>
    <option name="dockerTarget" value="" />
    <option name="environmentVariables">
      <map />
    </option>
    <option name="loadingAvailableBuilders" value="false" />
    <option name="mappings">
      <list />
    </option>
    <option name="memoryAllocated" value="MIB_256" />
    <option name="projectPathOnTarget" />
    <option name="selectedOptions">
      <list />
    </option>
    <option name="serviceAccount" value="" />
    <option name="serviceName" value="my-service" />
    <option name="skaffoldWatchMode" value="ON_DEMAND" />
    <method v="2" />
  </configuration>
</component>

Is there something we could add here to make it work?

apeltop commented 1 month ago

I also had the same problem. I resolved it by uninstalling and reinstalling the Cloud Code plugin in IntelliJ.

codonist commented 1 month ago

@apeltop thanks for the suggestion, unfortunately it seems uninstalling and reinstalling doesn't work on my end.

codonist commented 1 month ago

@apeltop would you mind share your Run_locally.xml configuration file when checking the checkbox of "store as project file" in run locally dialog. The file would end up in .idea folder of your project. You can hide or replace any private content in that file if there is any. I am just wondering if it's possible for me to add the related builder configs in the xml directly to work around it. Thanks in advance.

apeltop commented 1 month ago

@codonist hope this helps.

<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="Unnamed" type="CloudCodeCloudRunConfigurationType" factoryName="CloudCodeCloudRunDevelopConfigurationFactory" show_console_on_std_err="false" show_console_on_std_out="false" imageBuilder="{&quot;name&quot;:&quot;Docker&quot;,&quot;payload&quot;:{&quot;path&quot;:&quot;Dockerfile&quot;}}">
    <option name="allowRunningInParallel" value="false" />
    <option name="buildpacksEnv">
      <map />
    </option>
    <option name="cloudSqlConnections">
      <list />
    </option>
    <option name="cpuAllocated" value="NO_LIMIT" />
    <option name="dockerBuildArgs">
      <map />
    </option>
    <option name="dockerTarget" value="" />
    <option name="environmentVariables">
      <map />
    </option>
    <option name="loadingAvailableBuilders" value="false" />
    <option name="mappings">
      <list />
    </option>
    <option name="memoryAllocated" value="MIB_256" />
    <option name="projectPathOnTarget" />
    <option name="selectedOptions">
      <list />
    </option>
    <option name="serviceAccount" value="" />
    <option name="serviceName" value="my-service" />
    <option name="skaffoldWatchMode" value="ON_DEMAND" />
    <method v="2" />
  </configuration>
</component>
codonist commented 1 month ago

@apeltop thanks a lot, but unfortunately i still can't get it working.

angelmzn commented 3 weeks ago

I was able to reproduce the issue by uninstalling Docker Engine and Docker Desktop, Then installing the plug in. To fix it, I had to do the following:

  1. Installed Docker Engine and Docker Desktop through the terminal.
  2. Even after that, Cloud Code wouldn't find the builders.
  3. I removed Cloud Code, then installed it again, and now it recognized it.
codonist commented 2 weeks ago

@angelmzn thanks for sharing your solution. I tried it, but unfortunately I still wasn't able to resolve the issue.