Repository navigation
Report an unreadable build context as permission denied, not a missing Dockerfile - #2093
Open
devops-thiago wants to merge 1 commit into
Open
devops-thiago wants to merge 1 commit into
devops-thiago wants to merge 1 commit into
Conversation
devops-thiago
force-pushed
the
build-context-unreadable-error
branch
2 times, most recently
from
September 6, 2026 15:40
1647bb3 to
f77754e
Compare
devops-thiago
force-pushed
the
build-context-unreadable-error
branch
from
September 14, 2026 10:46
f77754e to
05acaa0
Compare
3 of 7 tasks
devops-thiago
force-pushed
the
build-context-unreadable-error
branch
from
September 21, 2026 15:20
05acaa0 to
2841325
Compare
devops-thiago
force-pushed
the
build-context-unreadable-error
branch
3 times, most recently
from
October 1, 2026 18:34
371230d to
3d62a6b
Compare
This was referenced Oct 1, 2026
Code Coverage
|
Author
|
@dkovba thank you for approving the workflows. CI passes on this PR and it still merges cleanly into main. Is it good to merge as it is, or is there anything else you need from me? |
…erfile FileManager.fileExists is false both for a path that is not there and for one the process may not look at. A build whose context directory was unreadable therefore reported "dockerfile not found in context dir", and with --file "file does not exist". Both sent people looking for a Dockerfile that was there. When the lookup fails, check stat's errno. EACCES or EPERM now reports "cannot read context dir <path>: permission denied" or "cannot read file <path>: permission denied". A directory that simply holds no Dockerfile keeps the old messages.
devops-thiago
force-pushed
the
build-context-unreadable-error
branch
from
October 14, 2026 21:01
3d62a6b to
fd428d9
Compare
Author
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.
Type of Change
Motivation and Context
Fixes #2089.
FileManager.fileExistsis false both for a path that is not there and for one the process may not look at, and the build options reported "not found" for both. On the 1.5.0 release:Both messages send the user to inspect a Dockerfile that is there. The same conflation is still on main, with a new wording for
--file(file does not exist ctx/Dockerfile, fromBuildOptions.validate()) and the old one for the default lookup (dockerfile not found in context dir, fromresolveDockerfile()).When the lookup fails, the code now checks
stat's errno.EACCESorEPERMreportscannot read context dir <path>: permission deniedfor the default lookup, orcannot read file <path>: permission deniedfor--file. A directory that simply holds no Dockerfile keepsdockerfile not found in context dir, and a missing--filekeepsfile does not exist.The first version of this change was in
BuildCommand. #2298 moved the build command into a plugin, so I ported the change toBuildOptionsand force-pushed the branch.Testing
BuildOptionsTestsparses the options against temporary contexts and callsresolveDockerfile(): unreadable, unreadable with--file, readable without a Dockerfile, a missing--file, and a readable context with a Dockerfile. On current main the two unreadable cases fail because the message has nopermission denied, and the other three pass. With this change all five pass, and so does the full unit suite. The two permission tests skip themselves when run as root.--fileis checked while the arguments are validated, so it needs no daemon. I ran it from debug builds ofcontainer-build, one at main (b3eb7030) and one with this change:The default lookup runs after the plugin's daemon health check, so I covered it with the unit test and did not run it end to end.