From 247af4972610e0cfedee20d58db6425d0d20200a Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Fri, 26 Feb 2021 21:49:56 +0100 Subject: [PATCH] Log all breeze output to a file automatically (#14470) (cherry picked from commit 4a54292b69bb9a68a354c34246f019331270df3d) --- BREEZE.rst | 2 ++ breeze | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/BREEZE.rst b/BREEZE.rst index 131f94c7d0db6..c79cdeebc2192 100644 --- a/BREEZE.rst +++ b/BREEZE.rst @@ -36,6 +36,8 @@ We called it *Airflow Breeze* as **It's a Breeze to contribute to Airflow**. The advantages and disadvantages of using the Breeze environment vs. other ways of testing Airflow are described in `CONTRIBUTING.rst `_. +All the output from the last ./breeze command is automatically logged to the ``logs/breeze.out`` file. + Watch the video below about Airflow Breeze. It explains the motivation for Breeze and screencasts all its uses. diff --git a/breeze b/breeze index c5d420bad8870..124ed855f1271 100755 --- a/breeze +++ b/breeze @@ -18,10 +18,20 @@ # under the License. set -euo pipefail + AIRFLOW_SOURCES="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +if [[ ${BREEZE_REDIRECT=} == "" ]]; then + mkdir -p "${AIRFLOW_SOURCES}"/logs + export BREEZE_REDIRECT="true" + "${0}" "${@}" 2>&1 | tee "${AIRFLOW_SOURCES}"/logs/breeze.out + exit +fi + export AIRFLOW_SOURCES readonly AIRFLOW_SOURCES + # Bash arrays need to be defined outside of functions unfortunately :( # Because on Mac OS Bash 3.4 defining arrays inside functions does not work # Array with extra options for Docker compose