cloud-code-intellij icon indicating copy to clipboard operation
cloud-code-intellij copied to clipboard

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

Open hypnoglow opened this issue 4 years ago • 2 comments

  • Cloud Code for IntelliJ version: 20.6.1
  • OS: Linux 5.7.6-arch1-1 x86_64 GNU/Linux

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

hypnoglow avatar Jun 30 '20 09:06 hypnoglow

@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 avatar Jun 30 '20 16:06 etanshaul

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

etanshaul avatar Jun 30 '20 17:06 etanshaul