kubernetes-client / gen

Common generator scripts for all client libraries
Apache License 2.0
148 stars 145 forks source link

Error generating c# codes #195

Closed jack4it closed 2 years ago

jack4it commented 3 years ago

Trying to follow the python-crd-cmd.sh and see if c# models can be generated, but failed with a mysterious error. Wish someone has experiences of this repo can shed some lights

[INFO] NOTE: AutoRest core version selected from configuration: ~3.1.0.
[INFO] Network Enabled: true
[INFO] Starting @autorest/core from /tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core
[INFO]    Loading AutoRest core      '/tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist' (3.1.3)
[INFO] VERBOSE [0.44 s]: No configuration found at 'file:///'.
[INFO] VERBOSE [0.45 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/default-configuration.md'
[INFO] VERBOSE [0.47 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/inspect.md'
[INFO] VERBOSE [0.47 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/directives.md'
[INFO] VERBOSE [0.48 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/pipeline.md'
[INFO] VERBOSE [0.5 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/loader-openapi.md'
[INFO] VERBOSE [0.5 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/miscellaneous.md'
[INFO] VERBOSE [0.51 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/patches.md'
[INFO] VERBOSE [0.53 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-powershell.md'
[INFO] VERBOSE [0.54 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-azureresourceschema.md'
[INFO] VERBOSE [0.55 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-csharp.md'
[INFO] VERBOSE [0.56 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-go.md'
[INFO] VERBOSE [0.57 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-java.md'
[INFO] VERBOSE [0.58 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-nodejs.md'
[INFO] VERBOSE [0.59 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-php.md'
[INFO] VERBOSE [0.6 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-python.md'
[INFO] VERBOSE [0.61 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-ruby.md'
[INFO] VERBOSE [0.62 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-typescript.md'
[INFO] VERBOSE [0.63 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-validators.md'
[INFO] VERBOSE [0.65 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-az.md'
[INFO] VERBOSE [0.66 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-terraform.md'
[INFO] VERBOSE [0.67 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/plugin-azure-functions.md'
[INFO] VERBOSE [0.69 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/graphs.md'
[INFO] VERBOSE [0.71 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/resources/help-configuration.md'
[INFO] INFORMATION: > Loading AutoRest extension '@autorest/csharp' (latest->3.0.0-beta.20210712.1)
[INFO] VERBOSE [0.92 s]: > Including extension configuration file 'file:///tmp/.autorest/@autorest_csharp@3.0.0-beta.20210712.1/node_modules/@autorest/csharp/readme.md'
[INFO] VERBOSE [0.92 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_csharp@3.0.0-beta.20210712.1/node_modules/@autorest/csharp/readme.md'
[INFO] INFORMATION: > Loading AutoRest extension '@autorest/modelerfour' (4.19.3->4.19.3)
[INFO] VERBOSE [0.99 s]: > Including extension configuration file 'file:///tmp/.autorest/@autorest_modelerfour@4.19.3/node_modules/@autorest/modelerfour/readme.md'
[INFO] VERBOSE [0.99 s]: > Including configuration file 'file:///tmp/.autorest/@autorest_modelerfour@4.19.3/node_modules/@autorest/modelerfour/readme.md'
[INFO] Error: write EPIPE
[INFO]     at afterWriteDispatched (internal/stream_base_commons.js:156:25)
[INFO]     at writeGeneric (internal/stream_base_commons.js:147:3)
[INFO]     at Socket._writeGeneric (net.js:787:11)
[INFO]     at Socket._write (net.js:799:8)
[INFO]     at writeOrBuffer (internal/streams/writable.js:358:12)
[INFO]     at Socket.Writable.write (internal/streams/writable.js:303:10)
[INFO]     at Writable.write [as _write] (/tmp/.autorest/@autorest_core@3.1.3/node_modules/@autorest/core/dist/src_lib_autorest-core_ts.js:1989:31)
[INFO]     at doWrite (internal/streams/writable.js:377:12)
[INFO]     at clearBuffer (internal/streams/writable.js:529:7)
[INFO]     at onwrite (internal/streams/writable.js:430:7)
[INFO]     at afterWrite (internal/streams/writable.js:466:5)
[INFO]     at afterWriteTick (internal/streams/writable.js:453:10)
[INFO]     at processTicksAndRejections (internal/process/task_queues.js:81:21)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.510 s
[INFO] Finished at: 2021-07-12T23:20:51Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:exec (generate) on project client-csharp: Result of /bin/sh -c cd / && node --max-old-space-size=8192 /usr/bin/autorest --input-file=/output_dir/swagger.json --csharp --namespace=k8s --package-version=0.0.1 --output-folder=/output_dir --add-credentials --debug --verbose execution is: '1'. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
jack4it commented 3 years ago

Managed to move further with the above @tg123's tip of fixing autorest to version 2. But hit a hard stop as the CRD I'm trying to generate a c# model is based on openapi v3 which the k8s openapi endpoint doesn't really support yet.

Sadly, a hard stop

tg123 commented 3 years ago

see thread https://github.com/kubernetes-client/csharp/issues/563 too many breaking changes if move to other generator

you can find current c# generator script at https://dev.azure.com/farmer1992/opensources/_build?definitionId=16&_a=summary

brendandburns commented 2 years ago

Fixed by #201