-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4561 from leandrosansilva/feature/exclude-pattern…
…-on-dockerfile Dockerfile: Allow files to be excluded from cache on COPY and ADD commands
- Loading branch information
Showing
11 changed files
with
406 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
27 changes: 27 additions & 0 deletions
27
frontend/dockerfile/dockerfile2llb/exclude_patterns_test.go
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//go:build dfexcludepatterns | ||
// +build dfexcludepatterns | ||
|
||
package dockerfile2llb | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/moby/buildkit/util/appcontext" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestDockerfileCopyExcludePatterns(t *testing.T) { | ||
df := `FROM scratch | ||
COPY --exclude=src/*.go --exclude=tmp/*.txt dir /sub/ | ||
` | ||
_, _, _, err := Dockerfile2LLB(appcontext.Context(), []byte(df), ConvertOpt{}) | ||
assert.NoError(t, err) | ||
} | ||
|
||
func TestDockerfileAddExcludePatterns(t *testing.T) { | ||
df := `FROM scratch | ||
ADD --exclude=src/*.go --exclude=tmp/*.txt dir /sub/ | ||
` | ||
_, _, _, err := Dockerfile2LLB(appcontext.Context(), []byte(df), ConvertOpt{}) | ||
assert.NoError(t, err) | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.