Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] useDocker is not passing the user and group when running through the passthrough service #716

Open
devzeebo opened this issue Nov 1, 2023 · 2 comments · May be fixed by #717
Open
Assignees
Labels
bug Something isn't working

Comments

@devzeebo
Copy link

devzeebo commented Nov 1, 2023

⚠️ Important Notice

Please differentiate the bug

This repository is not responsible for the actual code generation. If you have problems with the code generation, please open the bug at OpenAPITools/openapi-generator.

Please also check if the bug is already known before you open a new bug.


🐛 Bug Report:

Describe the bug

#647 fixed the docker permissions for the generator.service. When executing the cli with options that use the passthrough.service instead, the docker user and group is not set, resulting in root:root permissions

Steps to Reproduce

Steps to reproduce the behavior:

  1. Run a generate command that invokes the passthrough service while using the useDocker option

Expected behavior

When using the passthrough service, the user and group flags are passed to docker

Screenshots

If applicable, add screenshots to help explain your problem.

Operation System (please complete the following information):

  • OS: Arch / WSL
  • Version: 2023-10-31

Package System (please complete the following information):

  • Version [e.g. 22]

Additional context

Add any other context about the problem here.

@kasir-barati
Copy link

Having same issue...

@anonysoul
Copy link

docker run --user preventing file writing

[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml] [main] WARN  o.o.c.l.AbstractTypeScriptClientCodegen - Error (model name matches existing language type) cannot be used as a model name. Renamed to ModelError
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml] [main] INFO  o.o.codegen.TemplateManager - writing file /local/output/model/./audit.ts
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml] Exception in thread "main" java.lang.RuntimeException: Could not generate model 'Audit'
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:596)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:451)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:1304)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:535)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml] Caused by: java.nio.file.NoSuchFileException: /local/output/model/./audit.ts
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:484)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at java.base/java.nio.file.Files.newOutputStream(Files.java:228)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at java.base/java.nio.file.Files.write(Files.java:3512)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.TemplateManager.writeToFileRaw(TemplateManager.java:255)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.TemplateManager.writeToFile(TemplateManager.java:237)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.TemplateManager.writeToFile(TemplateManager.java:198)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.TemplateManager.write(TemplateManager.java:164)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:1455)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:1442)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.DefaultGenerator.generateModel(DefaultGenerator.java:439)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:587)
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml]        ... 5 more
[[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml] docker run --rm --user 1000:1000 -v "/home/anonysoul/workspace/company/xsec-server/xsec-portal/src/main/resources/openapi/protocol.yaml:/local/input-spec" -v "/home/anonysoul/workspace/company/xsec-server/xsec-webapp/src/app/core/openapi:/local/output" anonysoul/openapi-generator-cli:v7.6.0 generate --input-spec="/local/input-spec" --generator-name="typescript-angular" --output="/local/output" --additional-properties="fileNaming=kebab-case,withInterfaces=true" --generate-alias-as-model exited with code 1
[v3.0] ../xsec-portal/src/main/resources/openapi/protocol.yaml
  docker run --rm --user 1000:1000 -v "/home/anonysoul/workspace/company/xsec-server/xsec-portal/src/main/resources/openapi/protocol.yaml:/local/input-spec" -v "/home/anonysoul/workspace/company/xsec-server/xsec-webapp/src/app/core/openapi:/local/output" anonysoul/openapi-generator-cli:v7.6.0 generate --input-spec="/local/input-spec" --generator-name="typescript-angular" --output="/local/output" --additional-properties="fileNaming=kebab-case,withInterfaces=true" --generate-alias-as-model

Code generation failed

❌ [openapi-generate] exited with exit code 1.
❌ 1 script failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants