Merge pull request #6737 from thaJeztah/rm_deprecated_buildutils

cli/command/image/build: remove deprecated utilities and consts
This commit is contained in:
Paweł Gronowski
2026-05-08 13:54:28 +02:00
committed by GitHub
-44
View File
@@ -25,11 +25,6 @@ import (
"github.com/moby/patternmatcher" "github.com/moby/patternmatcher"
) )
// DefaultDockerfileName is the Default filename with Docker commands, read by docker build
//
// Deprecated: this const is no longer used and will be removed in the next release.
const DefaultDockerfileName string = "Dockerfile"
const ( const (
// defaultDockerfileName is the Default filename with Docker commands, read by docker build // defaultDockerfileName is the Default filename with Docker commands, read by docker build
defaultDockerfileName string = "Dockerfile" defaultDockerfileName string = "Dockerfile"
@@ -100,17 +95,6 @@ func filepathMatches(matcher *patternmatcher.PatternMatcher, file string) (bool,
return matcher.MatchesOrParentMatches(file) return matcher.MatchesOrParentMatches(file)
} }
// DetectArchiveReader detects whether the input stream is an archive or a
// Dockerfile and returns a buffered version of input, safe to consume in lieu
// of input. If an archive is detected, ok is set to true, and to false
// otherwise, in which case it is safe to assume input represents the contents
// of a Dockerfile.
//
// Deprecated: this utility was only used internally, and will be removed in the next release.
func DetectArchiveReader(input io.ReadCloser) (rc io.ReadCloser, ok bool, err error) {
return detectArchiveReader(input)
}
// detectArchiveReader detects whether the input stream is an archive or a // detectArchiveReader detects whether the input stream is an archive or a
// Dockerfile and returns a buffered version of input, safe to consume in lieu // Dockerfile and returns a buffered version of input, safe to consume in lieu
// of input. If an archive is detected, ok is set to true, and to false // of input. If an archive is detected, ok is set to true, and to false
@@ -127,15 +111,6 @@ func detectArchiveReader(input io.ReadCloser) (rc io.ReadCloser, ok bool, err er
return newReadCloserWrapper(buf, func() error { return input.Close() }), isArchive(magic), nil return newReadCloserWrapper(buf, func() error { return input.Close() }), isArchive(magic), nil
} }
// WriteTempDockerfile writes a Dockerfile stream to a temporary file with a
// name specified by defaultDockerfileName and returns the path to the
// temporary directory containing the Dockerfile.
//
// Deprecated: this utility was only used internally, and will be removed in the next release.
func WriteTempDockerfile(rc io.ReadCloser) (dockerfileDir string, err error) {
return writeTempDockerfile(rc)
}
// writeTempDockerfile writes a Dockerfile stream to a temporary file with a // writeTempDockerfile writes a Dockerfile stream to a temporary file with a
// name specified by defaultDockerfileName and returns the path to the // name specified by defaultDockerfileName and returns the path to the
// temporary directory containing the Dockerfile. // temporary directory containing the Dockerfile.
@@ -201,14 +176,6 @@ func GetContextFromReader(rc io.ReadCloser, dockerfileName string) (out io.ReadC
}), defaultDockerfileName, nil }), defaultDockerfileName, nil
} }
// IsArchive checks for the magic bytes of a tar or any supported compression
// algorithm.
//
// Deprecated: this utility was used internally and will be removed in the next release.
func IsArchive(header []byte) bool {
return isArchive(header)
}
// isArchive checks for the magic bytes of a tar or any supported compression // isArchive checks for the magic bytes of a tar or any supported compression
// algorithm. // algorithm.
func isArchive(header []byte) bool { func isArchive(header []byte) bool {
@@ -305,17 +272,6 @@ func GetContextFromLocalDir(localDir, dockerfileName string) (string, string, er
return localDir, relDockerfile, err return localDir, relDockerfile, err
} }
// ResolveAndValidateContextPath uses the given context directory for a `docker build`
// and returns the absolute path to the context directory.
//
// Deprecated: this utility was used internally and will be removed in the next
// release. Use [DetectContextType] to detect the context-type, and use
// [GetContextFromLocalDir], [GetContextFromLocalDir], [GetContextFromGitURL],
// or [GetContextFromURL] instead.
func ResolveAndValidateContextPath(givenContextDir string) (string, error) {
return resolveAndValidateContextPath(givenContextDir)
}
// resolveAndValidateContextPath uses the given context directory for a `docker build` // resolveAndValidateContextPath uses the given context directory for a `docker build`
// and returns the absolute path to the context directory. // and returns the absolute path to the context directory.
func resolveAndValidateContextPath(givenContextDir string) (string, error) { func resolveAndValidateContextPath(givenContextDir string) (string, error) {