GoogleCloudPlatform / cloud-code-intellij

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

Allow Cloud Code to run Skaffold relative to a non-root directory #2785

Open hypnoglow opened 4 years ago

hypnoglow commented 4 years ago

What did you do?

We store our skaffold.yaml files not in a project root, but in nested directory, i.e. deployment/skaffold.yaml. In the same manner we have Helm chart in deployment directory, i.e. deployment/mychart. In skaffold.yaml, this chart is referenced relative to the project root:

deploy:
  helm:
    releases:
      - name: myrelease
        namespace: mynamespace
        chartPath: deployment/mychart

When I run skaffold run -f deployment/skaffold.yaml -p dev-env from the project root, everything works correclty, and chart reference deployment/mychart is handled properly, so chart gets deployed. However, this is not the case for Cloud Run plugin.

Cloud Code Kubernetes confiuration allows specifying skaffold file in advanced section, but it seems it treats its directory as the project root and thus all references inside this file are treated relative to it. So I get the error:

watching files for deployer: listing files: issue walking releases: lstat deployment/mychart: no such file or directory

What did you expect to see?

I expect that the plugin assumes project root as the base directory for skaffold relative paths. Otherwise configurable.

What did you see instead?

/usr/bin/skaffold dev --filename skaffold.yaml --profile dev-env --label ide=GoLand --label ideVersion=2020.1.3.0.0 --label ijPluginVersion=unknown --cleanup=false --auto-build=false --auto-deploy=false --rpc-port 50051 --port-forward=true --status-check=true --enable-rpc=true --verbosity info
time="2020-06-30T12:28:21+03:00" level=info msg="starting gRPC server on port 50051"
time="2020-06-30T12:28:21+03:00" level=info msg="starting gRPC HTTP server on port 50052"
time="2020-06-30T12:28:21+03:00" level=info msg="Skaffold &{Version:v1.12.0 ConfigVersion:skaffold/v2beta5 GitVersion: GitCommit:e680a831292e1c7efc54e0c6d40544ae141e6354 GitTreeState:clean BuildDate:2020-06-25T13:14:09Z GoVersion:go1.14.2 Compiler:gc Platform:linux/amd64}"
time="2020-06-30T12:28:21+03:00" level=info msg="applying profile: dev-env"
time="2020-06-30T12:28:21+03:00" level=info msg="no values found in profile for field TagPolicy, using original config values"
time="2020-06-30T12:28:21+03:00" level=info msg="no values found in profile for field BuildType, using original config values"
time="2020-06-30T12:28:21+03:00" level=info msg="Using kubectl context: *redacted*"
watching files for deployer: listing files: issue walking releases: lstat deployment/mychart: no such file or directory
Listing files to watch...
 - eu.gcr.io/myproject/myapp
etanshaul commented 4 years ago

@hypnoglow thanks - this is a good feature request. I've tagged it and we'll triage internally.

I think another setting in the UI like Working Directory (or something similar) would help here.

etanshaul commented 4 years ago

Kamino cloned this issue to GoogleCloudPlatform/cloud-code-intellij-internal