Stabilize dockerfile heredoc support

Signed-off-by: Justin Chadwell <me@jedevc.com>
master
Justin Chadwell 2022-02-01 08:13:24 +00:00
parent 9fb13f77c3
commit e3fd4a6450
7 changed files with 12 additions and 31 deletions

View File

@ -7,7 +7,6 @@ run:
build-tags:
- dfrunsecurity
- dfheredoc
linters:
enable:

View File

@ -1,6 +1,3 @@
//go:build dfheredoc
// +build dfheredoc
package dockerfile
import (

View File

@ -1,6 +1,3 @@
//go:build dfheredoc
// +build dfheredoc
package instructions
import (

View File

@ -130,8 +130,17 @@ var validDirectives = map[string]struct{}{
}
var (
heredocDirectives map[string]bool // directives allowed to contain heredocs
heredocCompoundDirectives map[string]bool // directives allowed to contain directives containing heredocs
// Directives allowed to contain heredocs
heredocDirectives = map[string]bool{
command.Add: true,
command.Copy: true,
command.Run: true,
}
// Directives allowed to contain directives containing heredocs
heredocCompoundDirectives = map[string]bool{
command.Onbuild: true,
}
)
// directive is the structure used during a build run to hold the state of

View File

@ -1,18 +0,0 @@
//go:build dfheredoc
// +build dfheredoc
package parser
import "github.com/moby/buildkit/frontend/dockerfile/command"
func init() {
heredocDirectives = map[string]bool{
command.Add: true,
command.Copy: true,
command.Run: true,
}
heredocCompoundDirectives = map[string]bool{
command.Onbuild: true,
}
}

View File

@ -1,6 +1,3 @@
//go:build dfheredoc
// +build dfheredoc
package parser
import (

View File

@ -1 +1 @@
dfrunsecurity dfheredoc
dfrunsecurity