Repository navigation
Fix bashrc interactive guard, bake kubectl completion, load for any HOME - #3
Open
ngpayyappilly wants to merge 2 commits into
Open
ngpayyappilly wants to merge 2 commits into
ngpayyappilly wants to merge 2 commits into
Conversation
- The banner guard tested $PS1, which the file exports two lines earlier, so it was always true. Use [[ $- == *i* ]] and return early for non-interactive shells. - `source <(kubectl completion bash)` forked kubectl on every shell start. Generate the completion file once at image build time and source it. - Install the config as /etc/bash.bashrc instead of /root/.bashrc so it applies when the pod runs the debug container with a different UID/HOME; stub out /root/.bashrc so Ubuntu's skel copy cannot reset PS1. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014iDTyB5N8EdZyyZo4ymUVR
This was referenced Nov 12, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three shell-experience fixes found in the SRE review:
[ -n "$PS1" ], butPS1is exported earlier in the same file, so the guard was always true. Now[[ $- == *i* ]] || return 0at the top.source <(kubectl completion bash)forked kubectl on every shell start. The completion file is now generated once at build time into/usr/share/bash-completion/completions/kubectland sourced from there.HOME. It was installed as/root/.bashrc, so a pod running the container with another UID/HOME got a bare shell. It is now installed as/etc/bash.bashrc;/root/.bashrcbecomes a stub so Ubuntu's skel copy cannot resetPS1afterwards.Testing
No Docker daemon was available, so the image was not built locally. Checked the
bashrcitself in a shell:kalias,PS1and banner path work.complete -p kgivescomplete -o default -F __start_kubectl k.The PR workflow's build and smoke test (which checks
type k) will exercise the image end to end. TheRUN kubectl completion bashstep runs after kubectl is installed (the Shell experience section is last).Part of an SRE review series (operability).
Generated by Claude Code