Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for devcontainers #288

Merged
merged 1 commit into from
Jan 6, 2025
Merged

Add support for devcontainers #288

merged 1 commit into from
Jan 6, 2025

Conversation

Kidswiss
Copy link
Contributor

@Kidswiss Kidswiss commented Dec 27, 2024

Summary

  • Adds support for devcontainers to streamline the dev ux

Checklist

  • Categorize the PR by setting a good title and adding one of the labels:
    bug, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog
  • Update tests.
  • Link this PR to related issues.

@Kidswiss Kidswiss force-pushed the add/devcontainers branch 2 times, most recently from 74d3254 to c3925d1 Compare December 31, 2024 14:53
@Kidswiss Kidswiss added the minor label Dec 31, 2024
@Kidswiss Kidswiss requested review from a team, TheBigLee, wejdross and zugao and removed request for a team January 6, 2025 08:51
Copy link
Member

@wejdross wejdross left a comment

Choose a reason for hiding this comment

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

I like it a lot, it'll grow with time for sure with some customizations and aliases, but I'm ok with that, I think it might make even bigger sense to make dev container with necessary tooling etc. for components, so we have correct jsonnets, commodore etc. that should shorten onboarding drastically

.devcontainer/postCreateCommand.sh Show resolved Hide resolved
printf "
source /usr/share/bash-completion/bash_completion
source $HOME/.kube/completion.bash.inc
alias k=kubectl
Copy link
Member

Choose a reason for hiding this comment

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

small request from my side:

alias ka='kubectl --as cluster-admin'
alias kwp='watch -n 0.1 kubectl get pod'
alias kwo='watch -n 0.1 kubectl get object'
alias kwoa='watch -n 0.1 kubectl --as cluster-admin get object'

Copy link
Member

Choose a reason for hiding this comment

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

alias of ll is also missing in bash spec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can add your own aliases via dotfiles. I wouldn't clutter the defaults too much, as everybody wants different things.

Here's an example of my dotfiles: https://git.earthnet.ch/simon.beck/devcontainerdotfiles/src/branch/main/zshrc

@wejdross
Copy link
Member

wejdross commented Jan 6, 2025

the only thing is that rebuilding is enforced and it takes time to achieve, on metered connections it can take ages, maybe we could think of some caching in kindev?

@Kidswiss
Copy link
Contributor Author

Kidswiss commented Jan 6, 2025

the only thing is that rebuilding is enforced and it takes time to achieve, on metered connections it can take ages, maybe we could think of some caching in kindev?

What do you mean by "rebuilding is enforced"? Once the container is built you can simply start it.

@wejdross
Copy link
Member

wejdross commented Jan 6, 2025

the only thing is that rebuilding is enforced and it takes time to achieve, on metered connections it can take ages, maybe we could think of some caching in kindev?

What do you mean by "rebuilding is enforced"? Once the container is built you can simply start it.

but any interruption, change to dotfiles, oom, whatever will result in rebuilding whole container, this is something I don't like, I can't find any docs, how to shutdown gracefully (keep container in background) and shutdown IDE for exmaple.

@Kidswiss
Copy link
Contributor Author

Kidswiss commented Jan 6, 2025

the only thing is that rebuilding is enforced and it takes time to achieve, on metered connections it can take ages, maybe we could think of some caching in kindev?

What do you mean by "rebuilding is enforced"? Once the container is built you can simply start it.

but any interruption, change to dotfiles, oom, whatever will result in rebuilding whole container, this is something I don't like, I can't find any docs, how to shutdown gracefully (keep container in background) and shutdown IDE for exmaple.

You can docker stop the container. In vscode if you do the open in devcontainer it will simply start the container again, without any rebuilding.

As to your other things, yes if it gets interrupted during the execution of the postCreateCommand.sh you might end up with a half-provisioned kindev. If it gets interrupted, you can do cd .kind and then make vshnall. It should then behave like normal kindev and continue where it left of. Or run the postCreateCommand.sh again by calling .devcontainer/postCreateCommand.sh.

Also, you don't have to rebuild the whole thing if you change your dotfiles. The dotfiles are stored in ~/dotfiles and are a simple git repo. So if you change your dotfiles, you can just do something like this:

~/dotfiles
git pull
./install.sh

And your new things will be applied.

Rebuilding is only really required if something fundamentally changes in the Dockerfile. Or if you break the container somehow :D

@Kidswiss Kidswiss merged commit 5b2dee8 into master Jan 6, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants