aquaproj / aqua

Declarative CLI Version manager written in Go. Support Lazy Install, Registry, and continuous update with Renovate. CLI version is switched seamlessly
https://aquaproj.github.io
829 stars 35 forks source link

aqua proxy might solve managing pinned dockerized cli tools #1928

Open sheldonhull opened 1 year ago

sheldonhull commented 1 year ago

Proposal: Adding a docker_command package type to the Aqua toolchain.

Whalebrew provides a cli experience to invoke dockerized commands. However, it was more clunky than I'd like. But there seems to be a lot of interest in the project in the past. People working with mixed toolchains would like to have tools that don't have static binaries contained in a docker image. For example, the AWS CLI requires running Python install commands, and conflicts between version one and two could occur. Using a docker image solves those concerns.

My proposal is to add a new package type called docker_command to the Aqua toolchain. This would allow users to invoke CLI commands that Aqua proxy resolves since it was shimmed. Here's an example of how this could work:

- name: aws-cli@v2.0
  registry: local
  args_docker_custom: []
  args_cli_custom: []
registry:
- name: aws-cli
  type: docker_command
  image: amazon/aws-cli:2.11.16
  args_docker_default:
    - '--rm'
  volume_mounts:
    - '${PWD}:/work'
    - '${HOME}/.aws:/home/nonroot/.aws:ro'

Invoke aws would then be aqua proxy constructing that docker command with volume mounts and such so it works be transparent and function like a normal cli.

This feature would let me use Aqua to manage and pin dockerized tools in the same wonderful experience I get through Aqua. This would eliminate clunky shell aliases trying to accomplish the same thing and benefit from the same version pinned and managed process aqua currently provides.

Reference

suzuki-shunsuke commented 11 months ago

I'm interested in how whalebrew mounts the host directory. Does it mount the root directory? 🤔

suzuki-shunsuke commented 11 months ago

Oh, I see.

https://github.com/whalebrew/whalebrew#how-it-works

When a package is executed, Whalebrew will run the specified image with Docker, mount the current working directory in /workdir, and pass through all of the arguments.

So whalebrew can't read and write files outside of the current directory.