feat: properly export env vars for cnb apps

They are not baked into the image like they are for herokuish, so we need to manually set them via --env. Additionally, due to newline constraints in docker, we need to use `--env=key` format to correctly pull the values into place.
This commit is contained in:
Jose Diaz-Gonzalez
2021-02-11 03:52:02 -05:00
parent 5921692f83
commit 812e34c6f5
5 changed files with 48 additions and 3 deletions

31
tests/unit/ps-cnb.bats Normal file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bats
load test_helper
setup() {
global_setup
create_app
}
teardown() {
destroy_app
global_teardown
}
@test "(ps) cnb env vars" {
run /bin/bash -c "dokku config:set $TEST_APP DOKKU_CNB_EXPERIMENTAL=1"
echo "output: $output"
echo "status: $status"
assert_success
run deploy_app python dokku@dokku.me:$TEST_APP add_requirements_txt
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "curl $(dokku url $TEST_APP)/env"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains '"DOKKU_CNB_EXPERIMENTAL": "1"'
}

View File

@@ -513,6 +513,13 @@ add_release_command() {
echo "release: touch /app/release.test" >> "$APP_REPO_DIR/Procfile"
}
add_requirements_txt() {
local APP="$1"
local APP_REPO_DIR="$2"
[[ -z "$APP" ]] && local APP="$TEST_APP"
echo "flask" >> "$APP_REPO_DIR/requirements.txt"
}
build_nginx_config() {
# simulate nginx post-deploy
dokku domains:setup "$TEST_APP"