feat: show error message when docker-related build commands fail

This makes it more apparent that a deploy has failed than the silent error exit that might otherwise happen.
This commit is contained in:
Jose Diaz-Gonzalez committed 2019-08-20 17:31:14 -04:00
1 parent 2b1c8f64fb
commit 9734d09ff1
3 files changed
+24 -6

No files matched your search

@@ -23,13 +23,19 @@ trigger-pre-build-buildpack-builder-herokuish() {
# create build env files for use in buildpacks like this:
# https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34
CID=$(config_bundle --merged "$APP" | "$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /tmp/env; cat | tar -x -C /tmp/env")
test "$("$DOCKER_BIN" wait "$CID")" -eq 0
if test "$("$DOCKER_BIN" wait "$CID")" -ne 0; then
dokku_log_warn "Failure injecting BUILD_ENV into build environment"
return 1
fi
"$DOCKER_BIN" commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$CID" "$IMAGE" >/dev/null
# create build env for 'old style' buildpacks and dokku plugins
CID=$(config_export app "$APP" --format envfile --merged | "$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS -i -a stdin "$IMAGE" /bin/bash -c "cat >> /app/.env")
test "$("$DOCKER_BIN" wait "$CID")" -eq 0
if test "$("$DOCKER_BIN" wait "$CID")" -ne 0; then
dokku_log_warn "Failure injecting old-style BUILD_ENV"
return 1
fi
"$DOCKER_BIN" commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$CID" "$IMAGE" >/dev/null
}