k-kinzal / aliases Goto Github PK
View Code? Open in Web Editor NEWResolve dependency on all commands by container
License: Apache License 2.0
Resolve dependency on all commands by container
License: Apache License 2.0
Enabling tty occurs error in some cases.
alises.yaml
/usr/local/bin/alpine:
image: alpine
tag: 3.8
tty: true
$ echo "foo" | alpine sh -c "cat -"
the input device is not a TTY
aliases.yaml
/usr/local/bin/helm:
image: chatwork/helm
tag: 2.11.0
volume:
- /tmp:/tmp
- $HOME/.kube:/root/.kube
- $HOME/.helm:/root/.helm
- $PWD:/helm
- $PWD:/helmfile
workdir: /helm
/usr/local/bin/helmfile:
image: chatwork/helmfile
tag: 0.40.1-2.10.0-1.11.3
volume:
- /tmp:/tmp
- $HOME/.helm:/root/.helm
- $PWD:/helmfile
workdir: /helmfile
dependencies:
- /usr/local/bin/helm
We need a tty
when using helm secret edit
with helm.
However, to execute helm from helmfile we need to turn off tty
.
It is a pain to specify a command name with aliases run
.
So I would like to consider whether bash completion can solve it.
Derived from #17.
/usr/local/bin/kubectl:
image: chatwork/kubectl
tag: 1.11.2
experimental: true
env:
KUBECONFIG: $KUBECONFIG
volume:
- $HOME/.kube:/root/.kube
- $PWD:/kube
workdir: /kube
$ KUBECONFIG=$HOME/.kube2/config:$HOME/.kube/config kubectl get all
We propose to mount the path automatically if the environment variable specified in env
is in PATH format (colon delimited).
However, this is complicated.
Therefore we want to work only when experimental
flag is enabled.
If it stabilizes, remove the flag of experimental
to make it the default behavior.
We may need helm plugins
when using helm
.
It is very troublesome to recreate containers.
So we need a way to install A with entrypoint
.
aliases.yaml
/usr/local/bin/helm
image: chatwork/helm
tag: 2.11.0
volumes:
- $HOME/.kube:/root/.kube
- $HOME/.helm:/root/.helm
- $PWD:/helm
workdir: /helm
entrypoint: |
#!/bin/sh
if [ -f $(helm home)/plugins/helm-import ]; then
helm plugin install https://github.com/k-kinzal/helm-import
if
helm "$@"
dependencies:
- /bin/bash
- /bin/git
script
$ docker run ... -v $HOME/.aliases/entrypoints/xxx:/xxx --entrypoint /xxx chatwork/helm:${HELM_VERSION:-2.11.0}
We think that we should be able to extend entrypoint
like this.
I typo.
/usr/local/bin/jq:
image: chatwork/jq
tag: 1.5-r5
volumes:
- $PWD:/jq
workdir: /jq
volume
rather than volumes
is correct.
We do not want to use time for this, so I want to make an undefined key an error.
awscli
does not work if there is an empty environment variable.
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_REGION
Therefore, empty environment variables should be removed.
However, we must consider cases where you want to use empty environment variables.
For example, when enclosed in double quotes, it is necessary to propose a workaround such as using an empty environment variable.
aliases.yaml
/usr/local/bin/kubectl:
image: chatwork/kubectl
tag: 1.11.2
volume:
- $HOME/.kube:/root/.kube
- $PWD:/kube
workdir: /kube
/usr/local/bin/alpine:
image: alpine
tag: 3.8
dependencies:
- /usr/local/bin/kubectl
$ kubectl version -c
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:17:28Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
It works when kubectl
is executed
$ alpine kubect version -c
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:17:28Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
But execute alpine
through kubect
does not end the command.
In order to solve this problem alpine
needs to be tty: true
.
Installing helm plugin locally creates a symbolic link.
$ ls -la ~/.helm/plugins/helm-github.git
lrwxrwxrwx 1 k-kinzal staff 71 Dec 5 12:49 /Users/k-kinzal/.helm/plugins/helm-github.git -> /root/.helm/cache/plugins/https-github.com-sagansystems-helm-github.git
If aliases
mounts this ~/.helm
directory it will not work.
We want to enable aliases
automatically when move to a directory with aliases.yaml
like direnv
.
We are using different versions of commands in multiple projects.
In this case it is impossible to manage all commands with $HOME/.aliases/aliases.yaml
.
It is preferable to define different aliases.yaml
for PROJ1/aliases.yaml
and PROJ2/aliases.yaml
respectively.
$ eval $(aliases hook zsh)
It is wonderful to make such a command.
Derived from #17.
/usr/local/bin/helm:
image: chatwork/helm
tag: 2.11.0
volume:
- $HOME/.kube:/root/.kube
- $HOME/.helm:/root/.helm
- $PWD:/helm
workdir: /helm
$ aliases gen
WARNGING: /Users/k-kinzal/.helm/plugins/helm-secrets -> /root/.helm/cache/plugins/https-github.com-futuresimple-helm-secrets: not mounting this symbolic link destination
We propose to display warnings for symbolic links.
If a symbolic link exists and the link destination is not mounted, a warning is displayed.
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
/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.
I had a problem.
/usr/local/bin/kubectl:
image: chatwork/kubectl
tag: 1.11.2
env:
KUBECONFIG: $KUBECONFIG
volume:
- $HOME/.kube:/root/.kube
- $PWD:/kube
workdir: /kube
$ KUBECONFIG=$HOME/Downloads/kube-config.cfg kubectl config view --flatten
it does not work because it is not mounted $HOME/Downloads/kube-config.cfg
.
it possible to solve this problem if it can be automatically mounted under conditions at execution.
If linting YAML with aliases lint
, it will be easier to debug.
docker run
Derived from #17.
/bin/curl:
image: tutum/curl
tag: alpine
experimental: true
entrypoint: curl
$ curl ... -O $HOME/Downloads
$ cat $HOME/Downloads/[your download file]
We propose mounting the path specified by the argument.
host
: Always mount if the argument contains a pathguest
: If mounted on guest
mount it. Otherwise, a warning is displayed.However, this is complicated.
Therefore we want to work only when experimental
flag is enabled.
If it stabilizes, remove the flag of experimental
to make it the default behavior.
There is a problem that YAML becomes long when using helm secrets.
/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
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
workdir: /bash
dependencies:
- /bin/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:
- $HOME/.kube:/root/.kube
- $HOME/.helm:/root/.helm
- $PWD:/helm
workdir: /helm
dependencies:
- /bin/bash
In this way we need to inherit the environment variable.
This not very readable.
/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
workdir: /sops
/bin/bash:
image: bash
tag: 4.4.23
workdir: /bash
dependencies:
- /bin/sops
/usr/local/bin/helm:
image: chatwork/helm
tag: 2.11.0
volume:
- $HOME/.kube:/root/.kube
- $HOME/.helm:/root/.helm
- $PWD:/helm
workdir: /helm
dependencies:
- /bin/bash
$ SOPS_KMS_ARN=xxx AWS_PROFILE=[your procile] helm secrets enc secrets.yaml
I would like to readability by inheriting the dependency parameters.
aliases
works only on host.
However, if we use tcp: //
for DOCKER_HOST
, the host will be in a different environment.
This is a problem that aliases
can not solve.
We should only support DOCKER_HOST
with unix://
before releasing v0.1.0.
An error occurs when sharing docker container and docker binary on Ubuntu.
https://twitter.com/amaya382/status/1077874567119396864
https://amaya382.hatenablog.jp/entry/2016/10/05/030254
It is necessary to solve this problem in order to operate on CircleCI as a use case.
/bin/sh:
docker:
image: docker
tag: 18.09.0
image: alpine
tag 3.8
command: /bin/sh
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
if [ ! -f $ALIASES_HOME/docker/docker-18.09.0 ]; then
docker run -v $ALIASES_HOME/docker:/data --name docker-18-09-0 docker:18.09.0 /bin/sh -c 'cp $(which docker) /data/docker-18.09.0'
fi
docker run --interactive --privileged --rm --volume $ALIASES_HOME/docker/docker-18.09.0:/usr/local/bin/docker --volume /var/run/docker.sock:/var/run/docker.sock alpine:${SH_VERSION:-"3.8"} /bin/sh "$@"
We propose to download docker binary via docker image.
It is preferable that the downloading timing be executed when aliases
is running.
https://github.com/k-kinzal/aliases/blob/master/pkg/export/path.go#L12
It looks like this code is not working.
We should change the interface and catch errors.
aliases
is hard to debug when it does not work.
which [aliases generate cmd]
cat [aliases binary]
docker run --entrypoint '' -it ... /bin/sh
Therefore, I want to be able to debug with aliases run
.
$ aliases run --entrypointy '' -it [cmd name] /bin/sh
aliases run
should be able to override all docker run
options.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.