launchrctl / launchr

Launchr is a CLI action runner that executes actions inside short-lived local containers.
Apache License 2.0
10 stars 2 forks source link

Implement --entrypoint Option for Customized Container Execution #29

Closed dhia-gharsallaoui closed 3 months ago

dhia-gharsallaoui commented 7 months ago

Description:

Introduce a --entrypoint option in relevant commands, mirroring existing action commands. This enhancement allows users to customize Docker container entrypoints while preserving CLI-generated environment settings and mounts.

Issue Description: Implement --entrypoint Option for Customized Container Execution

Benefits:

Implementation:

Modify commands to support the --entrypoint option, adapting container execution logic.

lexbritvin commented 5 months ago

After a discussion in chat, we agreed on the following:

  1. The purpose of the enhancement is to run debugging commands in action environment (currently container only) overriding
  2. --entrypoint definition is not correct in the context of the enhancement.
  3. We will implement an --exec flag that will override current command definition in action.yaml
  4. Action arguments will be ignored to prevent the ambiguity.
  5. We may also introduce an option --entrypoint to override container definition.

Usage example:

launchr my.container.action --exec -- /bin/bash -c "ls -al"
launchr my.container.action --entrypoint="ls" --exec -- -al
launchr my.container.action --entrypoint="" --exec -- /bin/bash -c "ls -al"

The command may be used without -- if no flags are provided. Here, it's important to have -- to make sure that -c flag is not parsed as a flag of launchr. Ref: https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html

Note: it's not possible to define --entrypoint="/bin/bash -c", as it must be a path to an executable without flags.