Gyeongtae Park created ZEPPELIN-6271:
----------------------------------------

             Summary: Refactor save-logs.py and travis-install.sh for improved 
robustness and readability
                 Key: ZEPPELIN-6271
                 URL: https://issues.apache.org/jira/browse/ZEPPELIN-6271
             Project: Zeppelin
          Issue Type: Task
            Reporter: Gyeongtae Park
            Assignee: Gyeongtae Park
             Fix For: 1.0.0, 0.12.1, 0.13.0


*Jira Issue Description*
Both {{zeppelin/dev/travis/save-logs.py}} and 
{{zeppelin/dev/travis/travis-install.sh}} have been refactored to improve code 
clarity, error handling, and compatibility with modern environments.

*Changes in {{save-logs.py}}*
 * Migrated to Python 3 syntax with {{f-strings}} and explicit UTF-8 encoding.

 * Added docstring to clearly describe script behavior and parameters.

 * Enabled line-buffered output for real-time log writing.

 * Improved progress reporting logic for better readability.

 * Added {{KeyboardInterrupt}} handling to allow graceful termination.

 * Ensured subprocess output is read in a safe, text-based mode 
({{{}encoding="utf-8"{}}}, {{{}errors="replace"{}}}).

*Changes in {{travis-install.sh}}*
 * Added strict mode ({{{}set -Eeuo pipefail{}}} and {{IFS}} safety settings) 
to prevent common shell pitfalls.

 * Added {{usage()}} function for clearer command-line guidance.

 * Verified that the provided source directory exists before proceeding.

 * Introduced dynamic Python binary detection ({{{}python3{}}} preferred, 
fallback to {{{}python{}}}).

 * Added explicit validation for {{save-logs.py}} existence.

 * Improved error messages for missing dependencies or invalid arguments.

 * Enhanced log output handling when build fails (prints warning if log file is 
missing).

*Motivation*
The original scripts had minimal validation, limited error handling, and used 
outdated Python 2 constructs. These updates make the scripts more robust, 
portable, and maintainable in modern CI environments, particularly in Travis CI 
and GitHub Actions pipelines.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to