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,6 +1,8 @@
|
||||
package builderherokuish
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
)
|
||||
|
||||
@@ -17,12 +19,17 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--builder-herokuish-computed-allowed": reportComputedAllowed,
|
||||
"--builder-herokuish-global-allowed": reportGlobalAllowed,
|
||||
"--builder-herokuish-computed-stack": reportComputedStack,
|
||||
"--builder-herokuish-global-stack": reportGlobalStack,
|
||||
}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--builder-herokuish-computed-allowed": reportComputedAllowed,
|
||||
"--builder-herokuish-global-allowed": reportGlobalAllowed,
|
||||
"--builder-herokuish-allowed": reportAllowed,
|
||||
"--builder-herokuish-computed-stack": reportComputedStack,
|
||||
"--builder-herokuish-global-stack": reportGlobalStack,
|
||||
"--builder-herokuish-stack": reportStack,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +75,29 @@ func reportComputedAllowed(appName string) string {
|
||||
return allowed
|
||||
}
|
||||
|
||||
func reportStack(appName string) string {
|
||||
return common.PropertyGet("builder-herokuish", appName, "stack")
|
||||
}
|
||||
|
||||
func reportGlobalStack(appName string) string {
|
||||
return common.PropertyGet("builder-herokuish", "--global", "stack")
|
||||
}
|
||||
|
||||
func reportComputedStack(appName string) string {
|
||||
stack := reportStack(appName)
|
||||
if stack == "" {
|
||||
stack = reportGlobalStack(appName)
|
||||
}
|
||||
if stack == "" {
|
||||
stack = os.Getenv("DOKKU_IMAGE")
|
||||
}
|
||||
if stack == "" {
|
||||
stack = "gliderlabs/herokuish:latest-24"
|
||||
}
|
||||
|
||||
return stack
|
||||
}
|
||||
|
||||
// hostArchitecture returns the dpkg architecture of the host, or an empty string
|
||||
// when it cannot be determined (matching the bash `dpkg --print-architecture` check)
|
||||
func hostArchitecture() string {
|
||||
|
||||
Reference in new issue
Block a user