-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix log in github action to debug. (#1889)
### What problem does this PR solve? Copy test log file to a random path if an error occurred. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
- Loading branch information
1 parent
e2263b4
commit e761e5c
Showing
12 changed files
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import os | ||
import shutil | ||
import random | ||
import string | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(description="Collect and copy log files.") | ||
parser.add_argument( | ||
"--log_path", type=str, required=True, help="Path to the infinity log file" | ||
) | ||
parser.add_argument( | ||
"--stdout_path", type=str, required=True, help="Path to the output debug log file" | ||
) | ||
parser.add_argument( | ||
"--output_dir", | ||
type=str, | ||
default="/var/infinity/log", | ||
help="Path to the output directory", | ||
) | ||
args = parser.parse_args() | ||
|
||
log_path = args.log_path | ||
stdout_path = args.stdout_path | ||
output_dir = args.output_dir | ||
|
||
if not os.path.isdir(output_dir): | ||
os.makedirs(output_dir) | ||
|
||
|
||
random_name = "".join(random.choices(string.ascii_lowercase + string.digits, k=8)) | ||
print(f"Random log file name: {random_name}") | ||
|
||
if not os.path.isfile(stdout_path): | ||
print("Error: stdout file not found") | ||
else: | ||
shutil.copy(stdout_path, f"{output_dir}/{random_name}_.log") | ||
|
||
if not os.path.isfile(log_path): | ||
print("Error: /var/infinity/log/infinity.log not found") | ||
else: | ||
shutil.copy(log_path, f"{output_dir}/{random_name}.log") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters