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
@@ -104,6 +104,50 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(builder-herokuish:report) stack raw vs computed vs global" {
|
||||
local default_stack="gliderlabs/herokuish:latest-24"
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-stack"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-global-stack"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-computed-stack"
|
||||
assert_success
|
||||
assert_output "$default_stack"
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:set --global stack gliderlabs/herokuish:global"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-global-stack"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:global"
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-computed-stack"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:global"
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:set $TEST_APP stack gliderlabs/herokuish:app"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-stack"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:app"
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-computed-stack"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:app"
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:set $TEST_APP stack"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:set --global stack"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(builder-herouish:build .env)" {
|
||||
run /bin/bash -c "dokku docker-options:add $TEST_APP build '--label=com.dokku.build-test=safe'"
|
||||
echo "output: $output"
|
||||
|
||||
@@ -107,6 +107,55 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(builder-pack:report) stack raw vs computed vs global" {
|
||||
run /bin/bash -c "dokku builder-pack:set --global stack"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-stack"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-global-stack"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-computed-stack"
|
||||
assert_success
|
||||
assert_output "heroku/builder:24"
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:set --global stack paketobuildpacks/builder:global"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-global-stack"
|
||||
assert_success
|
||||
assert_output "paketobuildpacks/builder:global"
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-computed-stack"
|
||||
assert_success
|
||||
assert_output "paketobuildpacks/builder:global"
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:set $TEST_APP stack paketobuildpacks/builder:app"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-stack"
|
||||
assert_success
|
||||
assert_output "paketobuildpacks/builder:app"
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-computed-stack"
|
||||
assert_success
|
||||
assert_output "paketobuildpacks/builder:app"
|
||||
|
||||
run /bin/bash -c "cat $DOKKU_LIB_ROOT/config/builder-pack/$TEST_APP/clear-cache"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:set $TEST_APP stack"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:set --global stack"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(builder-pack:set)" {
|
||||
run /bin/bash -c "dokku config:set $TEST_APP SECRET_KEY=fjdkslafjdk"
|
||||
echo "output: $output"
|
||||
@@ -118,11 +167,17 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:set-property $TEST_APP stack heroku/builder:24"
|
||||
run /bin/bash -c "dokku builder-pack:set $TEST_APP stack heroku/builder:24"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "cat $DOKKU_LIB_ROOT/config/builder-pack/$TEST_APP/clear-cache"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP add_requirements_txt_cnb
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -130,6 +185,11 @@ teardown() {
|
||||
assert_output_contains 'Building with buildpack 1' 0
|
||||
assert_output_contains 'Installing dependencies using pip'
|
||||
|
||||
run /bin/bash -c "test -f $DOKKU_LIB_ROOT/config/builder-pack/$TEST_APP/clear-cache"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:set $TEST_APP projecttoml-path nonexistent.toml"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
|
||||
+27
-47
@@ -253,71 +253,51 @@ teardown() {
|
||||
assert_output "https://github.com/heroku/heroku-buildpack-nodejs.git"
|
||||
}
|
||||
|
||||
@test "(buildpacks) buildpacks:set-property" {
|
||||
run /bin/bash -c "dokku buildpacks:set-property --global stack gliderlabs/herokuish:latest"
|
||||
@test "(buildpacks) buildpacks:set-property forwards stack to the detected builder" {
|
||||
run /bin/bash -c "dokku buildpacks:set-property $TEST_APP stack gliderlabs/herokuish:app"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
assert_output_contains "Deprecated"
|
||||
|
||||
@test "(buildpacks:report) stack raw vs computed vs global" {
|
||||
run /bin/bash -c "dokku buildpacks:set-property --global stack"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-stack\"'"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-global-stack\"'"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:set-property --global stack gliderlabs/herokuish:global"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-global-stack\"'"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:global"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-computed-stack\"'"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:global"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:set-property $TEST_APP stack gliderlabs/herokuish:app"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-stack\"'"
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-stack"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:app"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-global-stack\"'"
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-stack"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:global"
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-computed-stack\"'"
|
||||
run /bin/bash -c "dokku buildpacks:set-property $TEST_APP stack heroku/builder:24"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:app"
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-stack"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "heroku/builder:24"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:set-property $TEST_APP stack"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:set-property --global stack"
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-stack"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-stack"
|
||||
assert_success
|
||||
assert_output ""
|
||||
}
|
||||
|
||||
@test "(buildpacks:report) emits new stripped JSON keys alongside legacy" {
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r 'has(\"stack\") and has(\"buildpacks-stack\")'"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r 'has(\"global-stack\") and has(\"buildpacks-global-stack\")'"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r 'has(\"computed-stack\") and has(\"buildpacks-computed-stack\")'"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r 'has(\"list\") and has(\"buildpacks-list\")'"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
Reference in new issue
Block a user