Skip to content

Dockerfile: Use CLI generated completions in the dev shell#47649

Merged
thaJeztah merged 1 commit intomoby:masterfrom
vvoland:dev-completions
Jan 29, 2025
Merged

Dockerfile: Use CLI generated completions in the dev shell#47649
thaJeztah merged 1 commit intomoby:masterfrom
vvoland:dev-completions

Conversation

@vvoland
Copy link
Copy Markdown
Contributor

@vvoland vvoland commented Mar 28, 2024

- What I did
Enabled Docker shell completions in the dev container shell.
This doesn't affect anything outside the development shell.

- How I did it
Use Cobra-generated completion scripts for the CLI inside the dev container shell.

- How to verify it

$ make shell
$ docker im<TAB>
image   images  import
$ docker pull --<TAB>
--all-tags               --disable-content-trust  --platform               --quiet

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@vvoland vvoland added status/2-code-review kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. area/testing labels Mar 28, 2024
@vvoland vvoland added this to the 27.0.0 milestone Mar 28, 2024
@vvoland vvoland self-assigned this Mar 28, 2024
Comment thread Dockerfile Outdated
# Activate bash completion
RUN echo "source /usr/share/bash-completion/bash_completion" >> /etc/bash.bashrc
RUN ln -s /usr/local/completion/bash/docker /etc/bash_completion.d/docker
# Include Docker's completion if mounted with DOCKER_BASH_COMPLETION_PATH
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhat wondering if we still need the DOCKER_BASH_COMPLETION_PATH code 🤔 It was added in #33801 to help with the manually written bash-completion scripts, so ... perhaps? That said, we also have the moby-bin image, so maybe we could create something in the docker/cli repository to help spin up a docker-in-docker environment with the latest daemon and the current CLI (and completion script)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah looks like we could remove it from moby and do that in the CLI which would be more appropriate place for shell completion development.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you rebased this one; still think we should probably just remove this, and perhaps this step could happen after we copy the CLI into the dev-image? At least, I think that way we can skip the complexity around mounting etc?

RUN /usr/local/cli/docker completion bash >/etc/bash_completion.d/docker

Maybe the other (completion-related) steps should be moved there to the end as well, or would that all impact caching?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, and moved the completion generation to the stage which builds the cli

@vvoland vvoland modified the milestones: 26.1.0, 27.0.0 Apr 10, 2024
@vvoland vvoland modified the milestones: 27.0.0, v-future Jun 14, 2024
@vvoland vvoland force-pushed the dev-completions branch 2 times, most recently from 7cca5b7 to d998668 Compare January 28, 2025 11:37
Use Cobra-generated completion scripts for the CLI inside the dev
container shell.

Remove `DOCKER_BASH_COMPLETION_PATH`.

Signed-off-by: Paweł Gronowski <[email protected]>
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vvoland vvoland modified the milestones: v-future, 28.0.0 Jan 28, 2025
@thaJeztah
Copy link
Copy Markdown
Member

Heh; yeah, we need to tweak this one; I saw it fail elsewhere as well; what I think happens is that tests run in parallel, and it may therefore count unrelated things;

=== Failed
=== FAIL: cmd/dockerd TestOtelMeterLeak (0.66s)
    daemon_test.go:307: Allocations: 11
    daemon_test.go:312: Possible OTel leak; got more than 10 allocations (allocs: 11).

@thaJeztah thaJeztah merged commit dcaf8cb into moby:master Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants