k-kinzal/aliases

feat: Command definition for dependency

k-kinzal opened this issue · 0 comments

When using the bash command with helm-secrets, defining the command will taint the host's bash.

/bin/sops:
  image: mozilla/sops
  tag: 8fcd61e8a3d1709ae37d7ae55d49cfe6b8aeda8b
  entrypoint: /bin/sops
  env:
    AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
    AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
    AWS_PROFILE: $AWS_PROFILE
    AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
    SOPS_KMS_ARN: $SOPS_KMS_ARN
  volume:
  - $HOME/.aws:/root/.aws
  - $PWD:/sops
  - $PWD:/helm
  - $PWD:/helmfile
  workdir: /sops

/bin/bash:
  image: bash
  tag: 4.4.23
  env:
    AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
    AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
    AWS_PROFILE: $AWS_PROFILE
    AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
    SOPS_KMS_ARN: $SOPS_KMS_ARN
  volume:
  - /tmp:/tmp
  - $HOME/.helm:/root/.helm
  - $PWD:/bash
  - $PWD:/helm
  - $PWD:/helmfile
  workdir: /bash
  dependencies:
  - /bin/sops
  - /usr/local/bin/helm

/usr/local/bin/helm:
  image: chatwork/helm
  tag: 2.11.0
  env:
    AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
    AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
    AWS_PROFILE: $AWS_PROFILE
    AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
    SOPS_KMS_ARN: $SOPS_KMS_ARN
  volume:
  - /tmp:/tmp
  - $HOME/.kube:/root/.kube
  - $HOME/.helm:/root/.helm
  - $PWD:/helm
  - $PWD:/helmfile
  workdir: /helm
  dependencies:
  - /bin/bash

proposal

/bin/sops:
  image: mozilla/sops
  tag: 8fcd61e8a3d1709ae37d7ae55d49cfe6b8aeda8b
  entrypoint: /bin/sops
  env:
    AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
    AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
    AWS_PROFILE: $AWS_PROFILE
    AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
    SOPS_KMS_ARN: $SOPS_KMS_ARN
  volume:
  - $HOME/.aws:/root/.aws
  - $PWD:/sops
  - $PWD:/helm
  - $PWD:/helmfile
  workdir: /sops

/usr/local/bin/helm:
  image: chatwork/helm
  tag: 2.11.0
  env:
    AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
    AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
    AWS_PROFILE: $AWS_PROFILE
    AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
    SOPS_KMS_ARN: $SOPS_KMS_ARN
  volume:
  - /tmp:/tmp
  - $HOME/.kube:/root/.kube
  - $HOME/.helm:/root/.helm
  - $PWD:/helm
  - $PWD:/helmfile
  workdir: /helm
  dependencies:
  - /bin/bash:
    image: bash
    tag: 4.4.23
    env:
      AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
      AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
      AWS_PROFILE: $AWS_PROFILE
      AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
      SOPS_KMS_ARN: $SOPS_KMS_ARN
    volume:
    - /tmp:/tmp
    - $HOME/.helm:/root/.helm
    - $PWD:/bash
    - $PWD:/helm
    - $PWD:/helmfile
    workdir: /bash
    dependencies:
    - /bin/sops
    - /usr/local/bin/helm
$ eval $(aliases gen --export)
$ which bash
/bin/bash

So we want to be able to define commands for dependency.