fix: respect quoting in procfile commands
Procfile commands for the `docker-local` scheduler were split differently on deploy and on `dokku run`. Deploys failed on escaped quotes, and `dokku run` ignored quotes entirely. Both now split commands using shell quoting rules, and commands containing bare shell operators fail with a clear error, matching the `k3s` scheduler.
This commit is contained in:
13 files changed
+317
-92
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
"github.com/dokku/dokku/plugins/common/shellwords"
|
||||
flag "github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
@@ -92,6 +93,16 @@ func main() {
|
||||
case "is-valid-app-name-old":
|
||||
appName := flag.Arg(1)
|
||||
err = common.IsValidAppNameOld(appName)
|
||||
case "split-command":
|
||||
var fields []string
|
||||
fields, err = shellwords.Split(flag.Arg(1))
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Unable to parse command %q: %w", flag.Arg(1), err)
|
||||
break
|
||||
}
|
||||
for _, field := range fields {
|
||||
fmt.Printf("%s\x00", field)
|
||||
}
|
||||
case "verify-app-name":
|
||||
appName := flag.Arg(1)
|
||||
err = common.VerifyAppName(appName)
|
||||
|
||||
Reference in new issue
Block a user