mirror of
https://github.com/dokku/dokku.git
synced 2026-07-10 20:40:43 +02:00
The bash :report implementations for the dockerfile, herokuish, lambda, nixpacks, pack, and railpack builders are replaced with a compiled golang binary that collects report keys in parallel and marshals json directly, avoiding the per-key subshell and jq forks that made the bash reports slow. The subcommands/report and root report trigger become symlinks to the compiled binary, while the non-report bash helpers each plugin still relies on are left in place.
67 lines
1.9 KiB
Go
67 lines
1.9 KiB
Go
package builderpack
|
|
|
|
import (
|
|
"github.com/dokku/dokku/plugins/common"
|
|
)
|
|
|
|
// ReportSingleApp is an internal function that displays the builder-pack report for one or more apps
|
|
func ReportSingleApp(appName string, format string, infoFlag string) error {
|
|
if appName != "--global" {
|
|
if err := common.VerifyAppName(appName); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
var flags map[string]common.ReportFunc
|
|
if appName == "--global" {
|
|
flags = map[string]common.ReportFunc{
|
|
"--builder-pack-computed-projecttoml-path": reportComputedProjecttomlPath,
|
|
"--builder-pack-global-projecttoml-path": reportGlobalProjecttomlPath,
|
|
}
|
|
} else {
|
|
flags = map[string]common.ReportFunc{
|
|
"--builder-pack-computed-projecttoml-path": reportComputedProjecttomlPath,
|
|
"--builder-pack-global-projecttoml-path": reportGlobalProjecttomlPath,
|
|
"--builder-pack-projecttoml-path": reportProjecttomlPath,
|
|
}
|
|
}
|
|
|
|
flagKeys := []string{}
|
|
for flagKey := range flags {
|
|
flagKeys = append(flagKeys, flagKey)
|
|
}
|
|
|
|
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
|
return common.ReportSingleApp(common.ReportSingleAppInput{
|
|
ReportType: "builder-pack",
|
|
AppName: appName,
|
|
InfoFlag: infoFlag,
|
|
InfoFlags: infoFlags,
|
|
InfoFlagKeys: flagKeys,
|
|
Format: format,
|
|
TrimPrefix: true,
|
|
UppercaseFirstCharacter: true,
|
|
EmitLegacyPrefix: false,
|
|
})
|
|
}
|
|
|
|
func reportProjecttomlPath(appName string) string {
|
|
return common.PropertyGet("builder-pack", appName, "projecttoml-path")
|
|
}
|
|
|
|
func reportGlobalProjecttomlPath(appName string) string {
|
|
return common.PropertyGet("builder-pack", "--global", "projecttoml-path")
|
|
}
|
|
|
|
func reportComputedProjecttomlPath(appName string) string {
|
|
value := reportProjecttomlPath(appName)
|
|
if value == "" {
|
|
value = reportGlobalProjecttomlPath(appName)
|
|
}
|
|
if value == "" {
|
|
value = "project.toml"
|
|
}
|
|
|
|
return value
|
|
}
|