This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch v1-10-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit ff5b33ea1f2e86a75b10ca435b6207f4a431dbc1 Author: Jarek Potiuk <[email protected]> AuthorDate: Mon May 11 11:58:25 2020 +0200 Useful help information in test-target and docker-compose commands (#8796) There was no useful information printed in test-target and docker-compose commands. It's fixed now (cherry picked from commit d5c4001f8db198be31e366a39b0faa8543e45844) --- .pre-commit-config.yaml | 11 ----- BREEZE.rst | 30 ++++++++------ breeze | 104 ++++++++++++++++++++++++++++++++---------------- breeze-complete | 35 ++++++++++++++-- 4 files changed, 120 insertions(+), 60 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3621795..68ddcd5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -242,17 +242,6 @@ repos: files: \.py$ exclude: ^airflow/_vendor|^dev/ pass_filenames: true - - id: check-providers-package - language: pygrep - name: Find providers package added in 2.0.* - entry: > - (?x) - ( - ^.*airflow\.providers.* # Matches import airflow.providers - )$ - files: \.py$ - exclude: ^airflow/_vendor - pass_filenames: true - id: python2-compile name: Compile code using python2 language: system diff --git a/BREEZE.rst b/BREEZE.rst index 7212d0e..44af4e5 100644 --- a/BREEZE.rst +++ b/BREEZE.rst @@ -954,7 +954,7 @@ This is the current syntax for `./breeze <./breeze>`_: Detailed usage for command: docker-compose - breeze [FLAGS] docker-compose -- <EXTRA_ARGS> + breeze [FLAGS] docker-compose <DOCKER_COMPOSE_COMMAND> -- <EXTRA_ARGS> Run docker-compose command instead of entering the environment. Use 'help' as command to see available commands. The <EXTRA_ARGS> passed after -- are treated @@ -1046,15 +1046,18 @@ This is the current syntax for `./breeze <./breeze>`_: Detailed usage for command: static-check - breeze [FLAGS] static-check -- <EXTRA_ARGS> + breeze [FLAGS] static-check <STATIC_CHECK> -- <EXTRA_ARGS> Run selected static checks for currently changed files. You should specify static check that you would like to run or 'all' to run all checks. One of: - all bat-tests check-apache-license check-executables-have-shebangs check-hooks-apply - check-merge-conflict check-xml debug-statements doctoc detect-private-key - end-of-file-fixer flake8 forbid-tabs insert-license lint-dockerfile - mixed-line-ending mypy setup-order shellcheck + all airflow-config-yaml bat-tests build check-apache-license + check-executables-have-shebangs check-hooks-apply check-integrations + check-merge-conflict check-xml debug-statements detect-private-key doctoc + end-of-file-fixer fix-encoding-pragma flake8 forbid-tabs insert-license + lint-dockerfile mixed-line-ending mypy pydevd python2-compile python2-fastcheck + python-no-log-warn rst-backticks setup-order shellcheck trailing-whitespace + update-breeze-file update-extras update-local-yml-file yamllint You can pass extra arguments including options to to the pre-commit framework as <EXTRA_ARGS> passed after --. For example: @@ -1072,15 +1075,18 @@ This is the current syntax for `./breeze <./breeze>`_: Detailed usage for command: static-check-all-files - breeze [FLAGS] static-check-all-files -- <EXTRA_ARGS> + breeze [FLAGS] static-check-all-files <STATIC_CHECK> -- <EXTRA_ARGS> Run selected static checks for all applicable files. You should specify static check that you would like to run or 'all' to run all checks. One of: - all bat-tests check-apache-license check-executables-have-shebangs check-hooks-apply - check-merge-conflict check-xml debug-statements doctoc detect-private-key - end-of-file-fixer flake8 forbid-tabs insert-license lint-dockerfile - mixed-line-ending mypy setup-order shellcheck + all airflow-config-yaml bat-tests build check-apache-license + check-executables-have-shebangs check-hooks-apply check-integrations + check-merge-conflict check-xml debug-statements detect-private-key doctoc + end-of-file-fixer fix-encoding-pragma flake8 forbid-tabs insert-license + lint-dockerfile mixed-line-ending mypy pydevd python2-compile python2-fastcheck + python-no-log-warn rst-backticks setup-order shellcheck trailing-whitespace + update-breeze-file update-extras update-local-yml-file yamllint You can pass extra arguments including options to the pre-commit framework as <EXTRA_ARGS> passed after --. For example: @@ -1098,7 +1104,7 @@ This is the current syntax for `./breeze <./breeze>`_: Detailed usage for command: test-target - breeze [FLAGS] test-target -- <EXTRA_ARGS> + breeze [FLAGS] test-target <TEST_TARGET> -- <EXTRA_ARGS> Run the specified unit test target. There might be multiple targets specified separated with comas. The <EXTRA_ARGS> passed after -- are treated diff --git a/breeze b/breeze index 4ec67c6..7f5958b 100755 --- a/breeze +++ b/breeze @@ -837,14 +837,17 @@ function parse_arguments() { COMMAND_TO_RUN="cleanup_image" shift ;; docker-compose) - if [[ "$#" -lt 2 ]]; then + LAST_SUBCOMMAND="${1}" + if [[ $# -lt 2 ]]; then echo "You should specify docker compose command to run" - exit 1 + shift + RUN_HELP="true" + else + DOCKER_COMPOSE_COMMAND="${2}" + shift 2 fi - LAST_SUBCOMMAND="${1}" - DOCKER_COMPOSE_COMMAND="${2}" COMMAND_TO_RUN="run_docker_compose" - shift 2 ;; + ;; execute-command) LAST_SUBCOMMAND="${1}" COMMAND_TO_RUN="run_in_bash" @@ -869,34 +872,56 @@ function parse_arguments() { LAST_SUBCOMMAND="${1}" COMMAND_TO_RUN="perform_static_checks" if [[ "$#" -lt 2 ]]; then - echo "You should specify static check that you would like to run or 'all' to run all checks." - echo "One of [${_BREEZE_ALLOWED_STATIC_CHECKS:=}]." - echo - echo "For example:" - echo "${CMDNAME} static-check MyPy" - exit 1 + if [[ ${RUN_HELP} != "true" ]]; then + echo "You should specify static check that you would like to run or 'all' to run all checks." + echo + echo "One of :" + echo + echo "${_BREEZE_ALLOWED_STATIC_CHECKS:=}" + echo + echo "For example:" + echo + echo "${CMDNAME} static-check mypy" + echo + exit 1 + else + shift + fi + else + export PYTHON_MAJOR_MINOR_VERSION=${STATIC_CHECK_PYTHON_MAJOR_MINOR_VERSION} + export STATIC_CHECK="${2:-}" + export STATIC_CHECK_ALL_FILES="false" + EXTRA_STATIC_CHECK_OPTIONS+=("--show-diff-on-failure") + shift 2 fi - export PYTHON_MAJOR_MINOR_VERSION=${STATIC_CHECK_PYTHON_MAJOR_MINOR_VERSION} - export STATIC_CHECK="${2}" - export STATIC_CHECK_ALL_FILES="false" - EXTRA_STATIC_CHECK_OPTIONS+=("--show-diff-on-failure") - shift 2 ;; + ;; static-check-all-files) LAST_SUBCOMMAND="${1}" + COMMAND_TO_RUN="perform_static_checks" if [[ "$#" -lt 2 ]]; then - echo "You should specify static check that you would like to run or 'all' to run all checks." - echo "One of [${_BREEZE_ALLOWED_STATIC_CHECKS:=}]." - echo - echo "For example:" - echo "${CMDNAME} static-check-all-files MyPy" - exit 1 + if [[ ${RUN_HELP} != "true" ]]; then + echo "You should specify static check that you would like to run or 'all' to run all checks." + echo + echo "One of :" + echo + echo "${_BREEZE_ALLOWED_STATIC_CHECKS:=}" + echo + echo "For example:" + echo + echo "${CMDNAME} static-check-all-files mypy" + echo + exit 1 + else + shift + fi + else + export PYTHON_MAJOR_MINOR_VERSION=${STATIC_CHECK_PYTHON_MAJOR_MINOR_VERSION} + export STATIC_CHECK="${2:-}" + export STATIC_CHECK_ALL_FILES="true" + EXTRA_STATIC_CHECK_OPTIONS+=("--all-files" "--show-diff-on-failure") + shift 2 fi - COMMAND_TO_RUN="perform_static_checks" - export PYTHON_MAJOR_MINOR_VERSION=${STATIC_CHECK_PYTHON_MAJOR_MINOR_VERSION} - export STATIC_CHECK="${2}" - export STATIC_CHECK_ALL_FILES="true" - EXTRA_STATIC_CHECK_OPTIONS+=("--all-files" "--show-diff-on-failure") - shift 2 ;; + ;; stop) LAST_SUBCOMMAND="${1}" COMMAND_TO_RUN="run_docker_compose" @@ -913,13 +938,14 @@ function parse_arguments() { shift ;; test-target) LAST_SUBCOMMAND="${1}" - if [[ "${TEST_TARGET}" == "." ]]; then - export TEST_TARGET="" + if [[ $# -lt 2 ]]; then + RUN_HELP="true" + shift else - export TEST_TARGET="${2}" + export TEST_TARGET="${2}" + shift 2 fi - COMMAND_TO_RUN="run_tests" - shift 2 ;; + COMMAND_TO_RUN="run_tests" ;; toggle-suppress-cheatsheet) LAST_SUBCOMMAND="${1}" if [[ -f "${SUPPRESS_CHEATSHEET_FILE}" ]]; then @@ -1289,11 +1315,21 @@ Help commands: # Prints detailed usage for command specified function detailed_usage() { SUBCOMMAND=${1} + COMMAND_PARAMETER="" + if [[ ${SUBCOMMAND} == "static-check" ]]; then + COMMAND_PARAMETER="<STATIC_CHECK> " + elif [[ ${SUBCOMMAND} == "static-check-all-files" ]]; then + COMMAND_PARAMETER="<STATIC_CHECK> " + elif [[ ${SUBCOMMAND} == "test-target" ]]; then + COMMAND_PARAMETER="<TEST_TARGET> " + elif [[ ${SUBCOMMAND} == "docker-compose" ]]; then + COMMAND_PARAMETER="<DOCKER_COMPOSE_COMMAND> " + fi echo " Detailed usage for command: ${SUBCOMMAND} -${CMDNAME} [FLAGS] ${SUBCOMMAND} -- <EXTRA_ARGS> +${CMDNAME} [FLAGS] ${SUBCOMMAND} ${COMMAND_PARAMETER}-- <EXTRA_ARGS> $(get_detailed_usage "${SUBCOMMAND}") " diff --git a/breeze-complete b/breeze-complete index 4fea00f..3164851 100644 --- a/breeze-complete +++ b/breeze-complete @@ -42,9 +42,38 @@ EOF _BREEZE_ALLOWED_STATIC_CHECKS=$(cat <<-EOF all -bat-tests check-apache-license check-executables-have-shebangs check-hooks-apply check-merge-conflict -check-xml debug-statements doctoc detect-private-key end-of-file-fixer flake8 forbid-tabs -insert-license lint-dockerfile mixed-line-ending mypy setup-order shellcheck +airflow-config-yaml +bat-tests +build +check-apache-license +check-executables-have-shebangs +check-hooks-apply +check-integrations +check-merge-conflict +check-xml +debug-statements +detect-private-key +doctoc +end-of-file-fixer +fix-encoding-pragma +flake8 +forbid-tabs +insert-license +lint-dockerfile +mixed-line-ending +mypy +pydevd +python2-compile +python2-fastcheck +python-no-log-warn +rst-backticks +setup-order +shellcheck +trailing-whitespace +update-breeze-file +update-extras +update-local-yml-file +yamllint EOF )
