From d7dfc5d30bdd50e78ba733ef22a084c05215ffae Mon Sep 17 00:00:00 2001 From: Vincent Boisard Date: Thu, 13 Jan 2022 19:42:11 +0100 Subject: [PATCH 1/2] Purge cache for all apps when calling buildpacks:set-property with --global flag --- plugins/buildpacks/subcommands.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/buildpacks/subcommands.go b/plugins/buildpacks/subcommands.go index c3c427ea5..9a49ffabc 100644 --- a/plugins/buildpacks/subcommands.go +++ b/plugins/buildpacks/subcommands.go @@ -148,7 +148,19 @@ func CommandSetProperty(appName string, property string, value string) error { common.CommandPropertySet("buildpacks", appName, property, value, DefaultProperties, GlobalProperties) if property == "stack" && oldStack != value { - return common.PlugnTrigger("post-stack-set", []string{appName, value}...) + if appName != "--global" { + return common.PlugnTrigger("post-stack-set", []string{appName, value}...) + } + + apps, err := common.DokkuApps() + if err != nil { + return err + } + for _, app := range apps { + if err := common.PlugnTrigger("post-stack-set", []string{app, value}...); err != nil { + return err + } + } } return nil From cf4eed2de055b373328d0ac8d8c1d9076fb88b22 Mon Sep 17 00:00:00 2001 From: Vincent Boisard Date: Thu, 13 Jan 2022 23:21:57 +0100 Subject: [PATCH 2/2] Add test for buildpacks:set-property --global --- tests/unit/buildpacks.bats | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/unit/buildpacks.bats b/tests/unit/buildpacks.bats index 898032608..3382a8a88 100644 --- a/tests/unit/buildpacks.bats +++ b/tests/unit/buildpacks.bats @@ -184,6 +184,13 @@ teardown() { assert_output "https://github.com/heroku/heroku-buildpack-golang.git https://github.com/heroku/heroku-buildpack-python.git https://github.com/heroku/heroku-buildpack-php.git" } +@test "(buildpacks) buildpacks:set-property" { + run /bin/bash -c "dokku buildpacks:set-property --global stack gliderlabs/herokuish:latest" + echo "output: $output" + echo "status: $status" + assert_success +} + @test "(buildpacks) buildpacks:remove" { run /bin/bash -c "dokku buildpacks:set $TEST_APP heroku/nodejs" echo "output: $output"