mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-08-02 00:28:04 +08:00
bake: allow dot in target names for compose
This is a hotfix for v0.8 to unblock release and restore backward compatibility. More proper fix coming later. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
13
bake/bake.go
13
bake/bake.go
@@ -28,8 +28,10 @@ var (
|
||||
httpPrefix = regexp.MustCompile(`^https?://`)
|
||||
gitURLPathWithFragmentSuffix = regexp.MustCompile(`\.git(?:#.+)?$`)
|
||||
|
||||
validTargetNameChars = `[a-zA-Z0-9_-]+`
|
||||
targetNamePattern = regexp.MustCompile(`^` + validTargetNameChars + `$`)
|
||||
validTargetNameChars = `[a-zA-Z0-9_-]+`
|
||||
validTargetNameCharsCompose = `[a-zA-Z0-9._-]+`
|
||||
targetNamePattern = regexp.MustCompile(`^` + validTargetNameChars + `$`)
|
||||
targetNamePatternCompose = regexp.MustCompile(`^` + validTargetNameCharsCompose + `$`)
|
||||
)
|
||||
|
||||
type File struct {
|
||||
@@ -968,6 +970,13 @@ func validateTargetName(name string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateTargetNameCompose(name string) error {
|
||||
if !targetNamePatternCompose.MatchString(name) {
|
||||
return errors.Errorf("only %q are allowed", validTargetNameCharsCompose)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func sliceEqual(s1, s2 []string) bool {
|
||||
if len(s1) != len(s2) {
|
||||
return false
|
||||
|
Reference in New Issue
Block a user