Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds error checks for output validation #319

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions .github/workflows/citus-package-all-platforms-beta-test.yml

This file was deleted.

26 changes: 23 additions & 3 deletions packaging_automation/packaging_warning_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def validate_output(output: str, ignore_file_path: str, package_type: PackageTyp
print(f"Base ignore list:{base_ignore_list}")

output_lines = output.splitlines()

error_lines = return_lines_starts_with_error(output_lines)

warning_lines, package_type_specific_warning_lines = filter_warning_lines(
output_lines, package_type
)
Expand All @@ -50,18 +53,35 @@ def validate_output(output: str, ignore_file_path: str, package_type: PackageTyp
if (
len(base_warnings_to_be_raised) > 0
or len(package_type_specific_warnings_to_be_raised) > 0
or len(error_lines) > 0
):
error_message = get_error_message(
error_message_for_warnings = get_error_message_for_warnings(
base_warnings_to_be_raised,
package_type_specific_warnings_to_be_raised,
package_type,
)
print(f"Build output check failed. Error Message: \n{error_message}")

if len(error_lines) > 0:
error_message_for_warnings += "\n\nError Lines:\n"
for error_line in error_lines:
error_message_for_warnings += error_line + "\n"

print(
f"Build output check failed. Error Message: \n{error_message_for_warnings}"
)
sys.exit(1)
else:
print("Build output check completed succesfully. No warnings")


def return_lines_starts_with_error(output_lines: List[str]) -> List[str]:
error_lines = []
for line in output_lines:
if line.startswith("error"):
error_lines.append(line)
return error_lines


def filter_warning_lines(
output_lines: List[str], package_type: PackageType
) -> Tuple[List[str], List[str]]:
Expand Down Expand Up @@ -144,7 +164,7 @@ def get_warnings_to_be_raised(
return warnings_to_be_raised


def get_error_message(
def get_error_message_for_warnings(
base_warnings_to_be_raised: List[str],
package_specific_warnings_to_be_raised: List[str],
package_type: PackageType,
Expand Down
1 change: 1 addition & 0 deletions packaging_automation/requirements.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
attrs
black
docker
GitPython
Expand Down
Loading