OpenAPITools / OpenAPITools/openapi-generator
[BUG] docker-entrypoint.sh fails with error if no parameters passed
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
If no command line argument is passed to docker-entrypoint.sh, when it tries to use $1 on lines 18 and 22 it fails with the error:
./docker-entrypoint.sh: line 22: $1: unbound variable
openapi-generator version
Latest master from Git
OpenAPI declaration file content or url
n/a
Command line used for generation
n/a
Steps to reproduce
$ ./run-in-docker.sh
++ dirname ./run-in-docker.sh
+ cd .
+ maven_cache_repo=/home/robin/.m2/repository
+ mkdir -p /home/robin/.m2/repository
++ id -u
++ id -g
+ docker run --rm -it -w /gen -e GEN_DIR=/gen -e MAVEN_CONFIG=/var/maven/.m2 -e 'MAVEN_OPTS=-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=/var/maven/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true' -u 1000:1000 -v /tmp/openapi-generator-4.3.1x:/gen -v /tmp/openapi-generator-4.3.1x/CI/run-in-docker-settings.xml:/var/maven/.m2/settings.xml -v /home/robin/.m2/repository:/var/maven/.m2/repository --entrypoint /gen/docker-entrypoint.sh maven:3-jdk-8
/gen/docker-entrypoint.sh: line 18: $1: unbound variable
/gen/docker-entrypoint.sh: line 22: $1: unbound variable
Related issues/PRs
Could not find any
Suggest a fix
I'm submitting a PR to go with this as one way to fix it, but there may be better ways.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with docker-entrypoint.sh, especially lines 18 and 22, and review how run-in-docker.sh invokes it without arguments. Reproduce the failure by running ./run-in-docker.sh with no parameters; done means this invocation no longer reports an unbound-variable error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, shell
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100