Skip to content

Commit

Permalink
Document CopyIgnoredFile check as initially experimental.
Browse files Browse the repository at this point in the history
Signed-off-by: Talon Bowler <talon.bowler@docker.com>
  • Loading branch information
daghack committed Jul 10, 2024
1 parent 91eb1d7 commit 1a0c826
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 2 additions & 4 deletions frontend/dockerfile/dockerfile2llb/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ func toDispatchState(ctx context.Context, dt []byte, opt ConvertOpt) (*dispatchS
if err != nil {
return nil, err
}
if len(dockerIgnorePatterns) > 0 {
if len(dockerIgnorePatterns) > 0 && opt.Client.CopyIgnoredCheckEnabled {
dockerIgnoreMatcher, err = patternmatcher.New(dockerIgnorePatterns)
if err != nil {
return nil, err
Expand Down Expand Up @@ -668,7 +668,6 @@ func toDispatchState(ctx context.Context, dt []byte, opt ConvertOpt) (*dispatchS
sourceMap: opt.SourceMap,
lint: lint,
dockerIgnoreMatcher: dockerIgnoreMatcher,
copyIgnoredCheckEnabled: opt.Client.CopyIgnoredCheckEnabled,
}

if err = dispatchOnBuildTriggers(d, d.image.Config.OnBuild, opt); err != nil {
Expand Down Expand Up @@ -844,7 +843,6 @@ type dispatchOpt struct {
sourceMap *llb.SourceMap
lint *linter.Linter
dockerIgnoreMatcher *patternmatcher.PatternMatcher
copyIgnoredCheckEnabled bool
}

func getEnv(state llb.State) shell.EnvGetter {
Expand Down Expand Up @@ -1898,7 +1896,7 @@ func addReachableStages(s *dispatchState, stages map[*dispatchState]struct{}) {
}

func validateCopySourcePath(src string, cfg *copyConfig) error {
if cfg.ignoreMatcher == nil || !cfg.opt.copyIgnoredCheckEnabled {
if cfg.ignoreMatcher == nil {
return nil
}
cmd := "Copy"
Expand Down
3 changes: 3 additions & 0 deletions frontend/dockerui/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ func (bc *Client) init() error {
}
}

// CopyIgnoredCheckEnabled is an experimental feature to check if COPY is ignored by .dockerignore,
// and it is disabled by default. It is expected that this feature will be enabled by default in a future
// release, and this build-arg will be removed.
if v, ok := opts[keyCopyIgnoredCheckEnabled]; ok {
bc.CopyIgnoredCheckEnabled, err = strconv.ParseBool(v)
if err != nil {
Expand Down

0 comments on commit 1a0c826

Please sign in to comment.