KusionStack / konfig

Shared repository of application models and components, and CI suite for GitOps workflows
Apache License 2.0
27 stars 32 forks source link

bug: code-city `kusion apply main.k` failed in Konfig codepaces #115

Closed niconical closed 1 year ago

niconical commented 1 year ago

What happened?

kusion apply failed because of kclvm.

And it seems that the version of kcl installed in KusionStack/devcontainer-features is not consistent with the actual output kcl version.

@niconical ➜ /workspaces/konfig/code-city/dev (main) $ kusion apply main.k 
 ✘  Compiling in stack dev...                                                                                                                                                                                             
 ❌  Exception: Internal Error! Please report a bug to us: method=ExecProgram, err=Exception=Expecting value: line 1 column 1 (char 0), warn_json_result=called `Result::unwrap()` on an `Err` value: Timeout, stack trace=Traceback (most recent call last):
        File "/home/vscode/.kusion/kclvm/lib/python3.7/kclvm/program/exec/kclvm_cli.py", line 157, in kclvm_cli_native_run_dylib
          panic_info = json.loads(warn_json_result)
        File "/home/vscode/.kusion/kclvm/lib/python3.7/json/__init__.py", line 348, in loads
          return _default_decoder.decode(s)
        File "/home/vscode/.kusion/kclvm/lib/python3.7/json/decoder.py", line 337, in decode
          obj, end = self.raw_decode(s, idx=_w(s, 0).end())
        File "/home/vscode/.kusion/kclvm/lib/python3.7/json/decoder.py", line 355, in raw_decode
          raise JSONDecodeError("Expecting value", s, err.value) from None
      json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/home/vscode/.kusion/kclvm/lib/python3.7/kclvm/internal/gpyrpc/protorpc.py", line 233, in _accept_one_call
          resp = service.call_method(method_name, req)
        File "/home/vscode/.kusion/kclvm/lib/python3.7/kclvm/internal/gpyrpc/gpyrpc_pb_protorpc.py", line 340, in call_method
          return self._instance.ExecProgram(req)
        File "/home/vscode/.kusion/kclvm/lib/python3.7/kclvm/program/rpc-server/__main__.py", line 181, in ExecProgram
          debug=debug,
        File "/home/vscode/.kusion/kclvm/lib/python3.7/kclvm/program/exec/runner.py", line 128, in Run
          return kclvm_cli_native_run_dylib(args)
        File "/home/vscode/.kusion/kclvm/lib/python3.7/kclvm/program/exec/kclvm_cli.py", line 159, in kclvm_cli_native_run_dylib
          raise Exception(f"Exception={e}, warn_json_result={warn_json_result}")
      Exception: Exception=Expecting value: line 1 column 1 (char 0), warn_json_result=called `Result::unwrap()` on an `Err` value: Timeout

What did you expect to happen?

code-city deploy successed.

How can we reproduce it (as minimally and precisely as possible)?

  1. Click Kusion in Codespaces.
  2. kusion init --online and then select code-city
  3. cd code-city/dev && kusion apply main.k

Anything else we need to know?

No response

Kusion version

```console @niconical ➜ ~/.kusion/kclvm/bin $ kclvm_cli --version kcl @niconical ➜ ~/.kusion/kclvm/bin $ kcl --version kclvm version is 0.4.3; checksum: e07ed7af0d9bd1e86a3131714e4bd20c @niconical ➜ ~/.kusion/kclvm/bin $ kcl-go --version kcl-go version (devel) ```

OS version

Kusion in Codespaces. ```console @niconical ➜ ~/.kusion/kclvm/bin $ cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" ```

Install tools

Kusion in Codespaces.
Peefy commented 1 year ago

Pls upgrade the latest kusion version. cc @amyXia1994

niconical commented 1 year ago

@Peefy

@niconical ➜ /workspaces/konfig (main) $ kusion version
releaseVersion: v0.7.1
gitInfo:
    latestTag: v0.7.1
    commit: 10eac925825c1bd087ad590d78670d3bcad6d5fd
    treeState: clean
buildInfo:
    goVersion: go1.17.13
    GOOS: linux
    GOARCH: amd64
    numCPU: 2
    compiler: gc
    buildTime: "2022-11-02 13:04:49"
dependency:
    kclvmgoVersion: v0.4.3
    kclPluginVersion: v0.4.1-alpha2
amyXia1994 commented 1 year ago

@niconical hi niconical, sorry for that mistake, after I updated the kusion version in the devcontainer-feature, I forgot to release it to the latest version.

I fixed that and now the version is upgraded. Please re-create a workspace and retry.

niconical commented 1 year ago

@niconical hi niconical, sorry for that mistake, after I updated the kusion version in the devcontainer-feature, I forgot to release it to the latest version.

I fixed that and now the version is upgraded. Please re-create a workspace and retry.

Thanks!

amyXia1994 commented 1 year ago

@niconical and hey, by the way, you could use the interactive way to create and run the configurations! For example to create the project using the code-city template:

Open the Command Palatte > type 'kusion: create' > select 'create from template' > select code-city template > click create and select the target folder to store the project

if you want a walk through of vscode kusion

[Command+Shift+P] to open the Command Palette > type 'welcome: walkthrough' > select the kusion walkthrough

image

niconical commented 1 year ago

@niconical and hey, by the way, you could use the interactive way to create and run the configurations! For example to create the project using the code-city template:

Open the Command Palatte > type 'kusion: create' > select 'create from template' > select code-city template > click create and select the target folder to store the project

if you want a walk through of vscode kusion

[Command+Shift+P] to open the Command Palette > type 'welcome: walkthrough' > select the kusion walkthrough

image

Thank you so much! I know this method, and I submitted a PR to try to translate this part of the English documentation into Chinese.

amyXia1994 commented 1 year ago

@niconical That's really nice and thanks to your productive work 👍