-
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.
Fix WCOW COPY --from failure in multistage builds on Windows
Fixes: #5193 Signed-off-by: Billy Owire <billyowire95@gmail.com>
- Loading branch information
Showing
3 changed files
with
31 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package contenthash | ||
|
||
import "path/filepath" | ||
|
||
func (cc *cacheContext) walk(scanPath string, walkFunc filepath.WalkFunc) error { | ||
return filepath.Walk(scanPath, walkFunc) | ||
} |
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,16 @@ | ||
package contenthash | ||
|
||
import ( | ||
"path/filepath" | ||
|
||
"github.com/Microsoft/go-winio" | ||
) | ||
|
||
// elevating the admin privileges to walk special files/directory | ||
// like `System Volume Information`, etc. See similar in #4994 | ||
func (cc *cacheContext) walk(scanPath string, walkFunc filepath.WalkFunc) error { | ||
privileges := []string{winio.SeBackupPrivilege} | ||
return winio.RunWithPrivileges(privileges, func() error { | ||
return filepath.Walk(scanPath, walkFunc) | ||
}) | ||
} |