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

Implemement .devpodignore #1337

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Implemement .devpodignore #1337

wants to merge 2 commits into from

Conversation

bkneis
Copy link
Contributor

@bkneis bkneis commented Oct 28, 2024

This PR implements the logic to support .devpodignore file. It has been tested using the docker and kubernetes provider with a local and git workspace source. I managed to exclude a test file from a repo with .devpodignore

Fixes #1299

@bkneis bkneis requested review from pascalbreuninger and a team October 28, 2024 14:25
}
// Remove files from workspace content folder
for _, exclude := range excludes {
os.RemoveAll(filepath.Join(workspaceDir, exclude))
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if this is expected. We're using a bind mount for the devcontainer with local docker and this would delete the excludes on the users machine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, but only from the content folder, i.e. ~/.devpod/context/..., which I think is fine? since other devpod functionality could use this so deleting would help "ignore" the files elsewhere

Copy link
Member

Choose a reason for hiding this comment

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

True, but only from the content folder, i.e. ~/.devpod/context/...

Yep, we still need to make an exception for local docker and local folder because there it's a direct bind mount to the origin folder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yes your right, my PR description was wrong I had not tested local dir and local docker. Only local dir with kubernetes, which uses the stream RPCs. The deletion here only happens with a git source (since it's in CloneRepositoryForWorkspace). I'm not sure how we can support .devpodignore for the local docker and local dir use case. Unless I symlinked or moved the original folder elsewhere, there will be no way around the bind mount mounting ignored files. But maybe this is fine? Since if you are using local docker and dir, you proboably want everything mounted? What do you think? Can you see a way of supporting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create .devpodignore to avoid copying files/folders to the devcontianer
2 participants