From f9023402ad413fab1ac0e412d26ab1f64a8df4d5 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 14 Mar 2019 12:00:23 -0400 Subject: [PATCH 1/3] fix: correct the argument for get_release_cmd Closes #3438 --- plugins/app-json/internal-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/app-json/internal-functions b/plugins/app-json/internal-functions index 37599fbf0..a3351df47 100755 --- a/plugins/app-json/internal-functions +++ b/plugins/app-json/internal-functions @@ -38,7 +38,7 @@ execute_script() { IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG") if [[ "$PHASE_SCRIPT_KEY" == "release" ]]; then - SCRIPT_CMD=$(get_release_cmd "$APP" "$IMAGE" 2>/dev/null || true) + SCRIPT_CMD=$(get_release_cmd "$APP" "$IMAGE_TAG" 2>/dev/null || true) else SCRIPT_CMD=$(get_phase_script "$IMAGE" "$PHASE_SCRIPT_KEY" 2>/dev/null || true) fi From 8dcbfe55426baf6f27281ec64e10423abf709923 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 14 Mar 2019 13:12:07 -0400 Subject: [PATCH 2/3] fix: correct case where there could be multiple build containers post-build This happens when we execute several post-release scripts. --- tests/unit/20_build-env.bats | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/20_build-env.bats b/tests/unit/20_build-env.bats index 688d088a0..48e2626b0 100644 --- a/tests/unit/20_build-env.bats +++ b/tests/unit/20_build-env.bats @@ -74,7 +74,7 @@ teardown() { @test "(build-env) DOKKU_ROOT cache bind is used by default" { deploy_app - BUILD_CID=$(docker ps -a |grep $TEST_APP |grep /bin/bash | awk '{print $1}') + BUILD_CID=$(docker ps -a | grep $TEST_APP | grep /bin/bash | awk '{print $1}' | head -n1) run /bin/bash -c "docker inspect --format '{{ .HostConfig.Binds }}' $BUILD_CID | tr -d '[]' | cut -f1 -d:" echo "output: $output" echo "status: $status" @@ -87,7 +87,7 @@ teardown() { echo export DOKKU_HOST_ROOT="$TMP_ROOT" > $DOKKU_ROOT/.dokkurc/HOST_ROOT DOKKU_HOST_ROOT="$TMP_ROOT" deploy_app - BUILD_CID=$(docker ps -a |grep $TEST_APP |grep /bin/bash | awk '{print $1}') + BUILD_CID=$(docker ps -a | grep $TEST_APP | grep /bin/bash | awk '{print $1}') run /bin/bash -c "docker inspect --format '{{ .HostConfig.Binds }}' $BUILD_CID | tr -d '[]' | cut -f1 -d:" echo "output: $output" echo "status: $status" From 7d2f5b84c80ee443158572a9cb96fdefd0665540 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 14 Mar 2019 13:44:54 -0400 Subject: [PATCH 3/3] fix: add missing head -n1 call to second build-env test Otherwise `docker inspect` outputs a "condensed" json output that doesn't parse as well... --- tests/unit/20_build-env.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/20_build-env.bats b/tests/unit/20_build-env.bats index 48e2626b0..8b59c61c5 100644 --- a/tests/unit/20_build-env.bats +++ b/tests/unit/20_build-env.bats @@ -87,7 +87,7 @@ teardown() { echo export DOKKU_HOST_ROOT="$TMP_ROOT" > $DOKKU_ROOT/.dokkurc/HOST_ROOT DOKKU_HOST_ROOT="$TMP_ROOT" deploy_app - BUILD_CID=$(docker ps -a | grep $TEST_APP | grep /bin/bash | awk '{print $1}') + BUILD_CID=$(docker ps -a | grep $TEST_APP | grep /bin/bash | awk '{print $1}' | head -n1) run /bin/bash -c "docker inspect --format '{{ .HostConfig.Binds }}' $BUILD_CID | tr -d '[]' | cut -f1 -d:" echo "output: $output" echo "status: $status"