Skip to content

Conversation

@taoyama
Copy link
Contributor

@taoyama taoyama commented Sep 21, 2020

Description

Add bash-completion package for auto completion such as kubectl.

Testing Guide

$ docker build .

History Notes


This checklist is used to make sure that common guidelines for a pull request are followed.

@yungezz yungezz added this to the S176 milestone Sep 22, 2020
@Azure Azure deleted a comment from yonzhan Sep 22, 2020
@yungezz
Copy link
Member

yungezz commented Sep 22, 2020

Thanks for the contribution!

@fengzhou-msft fengzhou-msft changed the title Add bash-completion to Dockerfile [Docker] Add bash-completion to Dockerfile Sep 23, 2020
@yungezz yungezz modified the milestones: S176, S177 Oct 12, 2020
@fengzhou-msft
Copy link
Member

@taoyama I built the image and run az acs kubernetes install-cli to install kubectl, then try the autocompletion for kubectl subcommands, but it does not work. Are there any extra settings needed?

@taoyama
Copy link
Contributor Author

taoyama commented Oct 13, 2020

@fengzhou-msft , we need to source completion scripts like this.

$ docker run -it --rm mcr.microsoft.com/azure-cli /bin/bash
bash-5.0# apk add --no-cache bash-completion
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/2) Installing bash-completion (2.9-r0)
(2/2) Installing git-bash-completion (2.24.3-r0)
OK: 220 MiB in 77 packages
bash-5.0# source /etc/profile.d/bash_completion.sh
bash-5.0# az aks install-cli
Downloading client to "/usr/local/bin/kubectl" from "https://storage.googleapis.com/kubernetes-release/release/v1.19.2/bin/linux/amd64/kubectl"
Please ensure that /usr/local/bin is in your search PATH, so the `kubectl` command can be found.
Downloading client to "/tmp/tmpxjg9il_o/kubelogin.zip" from "https://github.com/Azure/kubelogin/releases/download/v0.0.6/kubelogin.zip"
Please ensure that /usr/local/bin is in your search PATH, so the `kubelogin` command can be found.
bash-5.0# source <(kubectl completion bash)
bash-5.0# kubectl
alpha          attach         completion     create         edit           kustomize      plugin         run            uncordon
annotate       auth           config         delete         exec           label          port-forward   scale          version
api-resources  autoscale      convert        describe       explain        logs           proxy          set            wait
api-versions   certificate    cordon         diff           expose         options        replace        taint
apply          cluster-info   cp             drain          get            patch          rollout        top

@fengzhou-msft fengzhou-msft merged commit fc84d24 into Azure:dev Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants