feat: allow replacing buildpack list atomically

Add buildpacks:set --replace so callers can replace an app's complete ordered buildpack list in one command while preserving existing single-buildpack and --index behavior.

Closes #8802
This commit is contained in:
Jose Diaz-Gonzalez
2026-07-07 18:37:38 -04:00
parent 25b1356435
commit 16f8b25bda
6 changed files with 205 additions and 4 deletions

View File

@@ -25,6 +25,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:set --replace <app> <buildpack> [<buildpack> ...], Replace the entire ordered buildpack list with the specified buildpacks
buildpacks:set-property [--global|<app>] <key> <value>, Set or clear a buildpacks property for an app`
)

View File

@@ -66,10 +66,11 @@ func main() {
case "set":
args := flag.NewFlagSet("buildpacks:set", flag.ExitOnError)
index := args.Int("index", 0, "--index: the 1-based index of the URL in the list of URLs")
replace := args.Bool("replace", false, "--replace: replace the entire ordered buildpack list")
args.Parse(os.Args[2:])
appName := args.Arg(0)
buildpack := args.Arg(1)
err = buildpacks.CommandSet(appName, buildpack, *index)
_, buildpackList := common.ShiftString(args.Args())
err = buildpacks.CommandSet(appName, buildpackList, *index, *replace)
case "set-property":
args := flag.NewFlagSet("buildpacks:set-property", flag.ExitOnError)
global := args.Bool("global", false, "--global: set a global property")