feat: add ability to manage stacks on an app or global level

The previous lever for manipulating this was the DOKKU_IMAGE environment variable. While this is all well and good, it only works for CNB and is yet another `DOKKU_*` environment variable that need not exist.

While this does not add support for manipulating the CNB stack just yet, the groundwork is set for the future.

Closes #4306
This commit is contained in:
Jose Diaz-Gonzalez
2021-01-17 23:20:16 -05:00
parent 4c74e0dfba
commit bad90b2b1d
11 changed files with 134 additions and 8 deletions

View File

@@ -24,6 +24,7 @@ Additional commands:`
buildpacks:remove <app> <buildpack>, Remove a buildpack set on the app
buildpacks:report [<app>] [<flag>], Displays a buildpack report for one or more apps
buildpacks:set [--index 1] <app> <buildpack>, Set new app buildpack at a given position defaulting to the first buildpack if no index is specified
buildpacks:stacks-set <app> <stack>, Sets the stack of an app
`
)

View File

@@ -57,6 +57,17 @@ func main() {
appName := args.Arg(0)
buildpack := args.Arg(1)
err = buildpacks.CommandSet(appName, buildpack, *index)
case "stacks-set":
args := flag.NewFlagSet("buildpacks:stacks-set", flag.ExitOnError)
global := args.Bool("global", false, "--global: set a global property")
args.Parse(os.Args[2:])
appName := args.Arg(0)
stack := args.Arg(1)
if *global {
appName = "--global"
stack = args.Arg(0)
}
err = buildpacks.CommandStacksSet(appName, stack)
default:
common.LogFail(fmt.Sprintf("Invalid plugin subcommand call: %s", subcommand))
}

View File

@@ -18,6 +18,9 @@ func main() {
var err error
switch trigger {
case "buildpack-stack-name":
appName := flag.Arg(0)
err = buildpacks.TriggerBuildpackStackName(appName)
case "install":
err = buildpacks.TriggerInstall()
case "post-app-clone-setup":