Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion frontend/dockerfile/dockerfile2llb/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -2041,7 +2041,13 @@ func addReachableStages(s *dispatchState, stages map[*dispatchState]struct{}) {
}

func validateCopySourcePath(src string, cfg *copyConfig) error {
if cfg.ignoreMatcher == nil {
// Do not validate copy source paths if there is no dockerignore file
// or if the dockerignore file contains exclusions.
//
// Exclusions are too difficult to statically determine if they're proper
// because it's ok for a directory to be excluded and a file inside the directory
// to be negated.
if cfg.ignoreMatcher == nil || cfg.ignoreMatcher.Exclusions() {
return nil
}
cmd := "Copy"
Expand Down
10 changes: 10 additions & 0 deletions frontend/dockerfile/dockerfile_lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,16 @@ COPY ./Dockerfile .
Dockerfile: dockerfile,
DockerIgnore: dockerignore,
})

// No warnings should occur if we copy the directory.
dockerfile = []byte(`
FROM scratch
COPY . .
`)
checkLinterWarnings(t, sb, &lintTestParams{
Dockerfile: dockerfile,
DockerIgnore: dockerignore,
})
}

func testSecretsUsedInArgOrEnv(t *testing.T, sb integration.Sandbox) {
Expand Down
Loading