feat: implement builder plugin

This plugin will allow users to override the builder used for their application, enabling users to use custom builders if desired.
This commit is contained in:
Jose Diaz-Gonzalez
2021-02-28 17:25:03 -05:00
parent 1ec71cd509
commit 8c34cfe64e
21 changed files with 566 additions and 28 deletions

View File

@@ -0,0 +1,36 @@
package builder
import (
"fmt"
"github.com/dokku/dokku/plugins/common"
)
// TriggerBuilderDetect outputs a manually selected builder for the app
func TriggerBuilderDetect(appName string) error {
if builder := common.PropertyGet("builder", appName, "selected"); builder != "" {
fmt.Println(builder)
return nil
}
if builder := common.PropertyGet("builder", "--global", "selected"); builder != "" {
fmt.Println(builder)
return nil
}
return nil
}
// TriggerInstall runs the install step for the builder plugin
func TriggerInstall() error {
if err := common.PropertySetup("builder"); err != nil {
return fmt.Errorf("Unable to install the builder plugin: %s", err.Error())
}
return nil
}
// TriggerPostDelete destroys the builder property for a given app container
func TriggerPostDelete(appName string) error {
return common.PropertyDestroy("builder", appName)
}