-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add support for entrypoint attribute #1088
base: main
Are you sure you want to change the base?
Add support for entrypoint attribute #1088
Conversation
Uh, this looks juicy, ty!
First and foremost: Big thx! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile
runner.py
Outdated
if 'entrypoint' in service: | ||
docker_run_string.extend(shlex.split(service['entrypoint'])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: entrypoint should be added before any docker-run-args to match Docker's behavior where entrypoint is processed before additional arguments
runner.py
Outdated
if 'entrypoint' in service: | ||
docker_run_string.extend(shlex.split(service['entrypoint'])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: verify that entrypoint is not empty or None before extending docker_run_string
if 'entrypoint' in service: | |
docker_run_string.extend(shlex.split(service['entrypoint'])) | |
if 'entrypoint' in service and service['entrypoint']: | |
docker_run_string.extend(shlex.split(service['entrypoint'])) |
runner.py
Outdated
if 'entrypoint' in service: | ||
docker_run_string.extend(shlex.split(service['entrypoint'])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: check that entrypoint is a string type before calling shlex.split()
if 'entrypoint' in service: | |
docker_run_string.extend(shlex.split(service['entrypoint'])) | |
if 'entrypoint' in service and isinstance(service['entrypoint'], str): | |
docker_run_string.extend(shlex.split(service['entrypoint'])) |
@@ -121,6 +121,7 @@ def check_usage_scenario(self, usage_scenario): | |||
Optional("setup-commands"): [And(str, Use(self.not_empty))], | |||
Optional("volumes"): self.single_or_list(str), | |||
Optional("folder-destination"):And(str, Use(self.not_empty)), | |||
Optional("entrypoint"): And(str, Use(self.not_empty)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider adding validation to ensure entrypoint doesn't contain shell syntax that could be unsafe (similar to contains_no_invalid_chars check)
Optional("entrypoint"): And(str, Use(self.not_empty)), | |
Optional("entrypoint"): And(str, Use(self.not_empty), Use(self.contains_no_invalid_chars)), |
My initial implementation was completely wrong. Sorry for that. |
I think the PR is now ready for review. I added now 3 unit tests in total to have a good understanding of how the I didn't do the changes greptile proposed, because then it would not be consistent with the rest of the code. |
Closes #1085
Only the short form of the
entrypoint
attribute is implemented (see Docker Compose specification).This is also the case for the `command' attribute, where only the short form is currently implemented.
Greptile Summary
Added support for Docker entrypoint attribute in service configurations, allowing overriding of predefined container ENTRYPOINTs to enable execution of runtime commands in test flows.
lib/schema_checker.py
as an optional string field in service definitionstest_entrypoint_ran()
intests/test_usage_scenario.py
to verify entrypoint command executionrunner.py
to support entrypoint attribute using secure command parsing viashlex.split()
entrypoint_stress.yml
demonstrating entrypoint usage with stress testing commandsThe implementation enables use of common API/load testing tools like JMeter, k6, Artillery and grpcurl that have predefined ENTRYPOINTs.
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!