feat: split stack property into per-builder properties
The `stack` property lived on the `buildpacks` plugin but was shared by both the herokuish and pack builders, so a value valid for one builder broke the other. Each builder now owns its own `stack` property managed via `builder-herokuish:set` and `builder-pack:set`, while `buildpacks:set-property stack` is deprecated and forwards the value to the builder detected from it; existing values migrate automatically on upgrade and changing a builder's stack clears that builder's cache.
This commit is contained in:
23 files changed
+449
-178
No files matched your search
@@ -1,7 +1,6 @@
|
||||
package buildpacks
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
@@ -17,15 +16,10 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
|
||||
var flags map[string]common.ReportFunc
|
||||
if appName == "--global" {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--buildpacks-global-stack": reportGlobalStack,
|
||||
}
|
||||
flags = map[string]common.ReportFunc{}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--buildpacks-computed-stack": reportComputedStack,
|
||||
"--buildpacks-global-stack": reportGlobalStack,
|
||||
"--buildpacks-list": reportList,
|
||||
"--buildpacks-stack": reportStack,
|
||||
"--buildpacks-list": reportList,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,31 +42,6 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
})
|
||||
}
|
||||
|
||||
func reportComputedStack(appName string) string {
|
||||
if stack := common.PropertyGetDefault("buildpacks", appName, "stack", ""); stack != "" {
|
||||
return stack
|
||||
}
|
||||
|
||||
if stack := common.PropertyGetDefault("buildpacks", "--global", "stack", ""); stack != "" {
|
||||
return stack
|
||||
}
|
||||
|
||||
results, _ := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "config-get",
|
||||
Args: []string{appName, "DOKKU_IMAGE"},
|
||||
})
|
||||
if dokkuImage := results.StdoutContents(); dokkuImage != "" {
|
||||
common.LogWarn("Deprecated: use buildpacks:set-property instead of specifying DOKKU_IMAGE environment variable")
|
||||
return dokkuImage
|
||||
}
|
||||
|
||||
return os.Getenv("DOKKU_IMAGE")
|
||||
}
|
||||
|
||||
func reportGlobalStack(appName string) string {
|
||||
return common.PropertyGetDefault("buildpacks", "--global", "stack", "")
|
||||
}
|
||||
|
||||
func reportList(appName string) string {
|
||||
buildpacks, err := common.PropertyListGet("buildpacks", appName, "buildpacks")
|
||||
if err != nil {
|
||||
@@ -81,7 +50,3 @@ func reportList(appName string) string {
|
||||
|
||||
return strings.Join(buildpacks, ",")
|
||||
}
|
||||
|
||||
func reportStack(appName string) string {
|
||||
return common.PropertyGetDefault("buildpacks", appName, "stack", "")
|
||||
}
|
||||
Reference in new issue
Block a user