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

git: restrict definition of git ref to previous behavior #4849

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented Apr 16, 2024

Fixes #4777 (again - thanks @raylu), and fixes #4846. See where this regression was introduced: https://github.com/moby/buildkit/pull/4142/files#diff-1bb11d110027d34708083bbbd69dbd446eadf916857680c279a31038268163b6L59-L60

During git refactoring, git refs accidentally became significantly broader in definition - specifically, files like "foo.bar/test.git" - is this a git repo at "foo.bar", or a local git directory?

We need to restrict this a lot more, previously, we only did this clever conversion for the "github.com" prefix. This restores this previous behavior.

During git refactoring, git refs accidentally became significantly
broader in definition - specifically, files like "foo.bar/test.git" - is
this a git repo at "foo.bar", or a local git directory?

We need to restrict this a lot more, previously, we only did this clever
conversion for the "github.com" prefix. This restores this previous
behavior.

Signed-off-by: Justin Chadwell <me@jedevc.com>
@jedevc
Copy link
Member Author

jedevc commented Apr 16, 2024

Note, this function is not called in the buildkit daemon - it's only called by dockerui/dockerfile, and by buildx (for determining context path / repo to load).

@jedevc jedevc changed the title git: restrict definition of git ref git: restrict definition of git ref to previous behavior Apr 16, 2024
Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

LGTM for restoring behavior but overall I think we might need some better detection for the ambiguous cases (in buildx). For example, we can check if a local folder with that name exists and if it does then use the local dir.

@tonistiigi tonistiigi merged commit 3617025 into moby:master Apr 17, 2024
74 checks passed
@jedevc jedevc deleted the fix-git-ref-to-broad branch April 17, 2024 09:02
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.

Can't use ".git" folder as a build context COPY ./.git X command errors in buildx v0.13.1
2 participants