-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat(ci): Add public log URLs to build failure reports #14154
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
Conversation
Adds a direct link to the public GCS log file in the failure summary for both Phase 1 (base image) and Phase 2 (project) builds. This provides immediate and easy access to raw build logs for project maintainers, who do not have access to the GCP console, improving the debugging workflow for trial builds.
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer |
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
| '----------------------------------------------------------------') | ||
| logging.info('GCB Build ID: %s', build_id) | ||
| logging.info('GCB Build URL: %s', logs_url) | ||
| log_url = (f'https://oss-fuzz-gcb-logs.storage.googleapis.com/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is repeated many times in this PR. Can you create a common helper in build_lib for this and use that everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I've moved the repeated logging into a common helper function.
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
Created a new helper function `get_build_info_lines` in `build_lib.py` to generate formatted build information (ID, GCB URL, Log URL). This centralizes the logic and removes code duplication. All call sites in `trial_build.py` and `build_and_push_test_images.py` have been updated to use this new function, preserving the original indentation and formatting at each location.
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
Increased the base backoff time to 5 seconds to reduce the frequency of retries. Removed the warning log for each retry attempt and added a final error log that only triggers when the maximum number of retries is exhausted. This makes the logs cleaner in case of transient API failures.
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
The previous implementation assumed that the `run_build` function would always return a dictionary containing an 'id' key. However, in cases where the build fails to start, it could return a different value, causing a `TypeError: string indices must be integers`. This change adds a check to validate the response from `run_build` before accessing the 'id'. If the response is not the expected dictionary, it logs the complete error, providing better diagnostics for build startup failures.
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
|
/gcbrun skip |
883b75b to
605c7e3
Compare
|
/gcbrun skip |
|
/gcbrun skip |
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
|
/gcbrun skip |
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
|
|
||
| def main(): | ||
| """Main function to generate report and determine pipeline status.""" | ||
| comment = os.environ.get('_COMMENT_BODY') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what sets _COMMENT_BODY ?
I cannot find a reference to it anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake, I thought this was a valid substitution variable. I've refactored the logic to use a simple flag instead, which is more robust and works.
infra/build/functions/trial_build.py
Outdated
| logs_url = build_lib.get_gcb_url(build_id, cloud_project) | ||
| failed_builds[project].append((status, logs_url, build_type)) | ||
| gcb_url = build_lib.get_gcb_url(build_id, cloud_project) | ||
| log_url = (f'https://oss-fuzz-gcb-logs.storage.googleapis.com/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_logs_url ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
infra/build/functions/trial_build.py
Outdated
| for build_id, build_type in project_builds: | ||
| logs_url = build_lib.get_gcb_url(build_id, cloud_project) | ||
| gcb_url = build_lib.get_gcb_url(build_id, cloud_project) | ||
| log_url = (f'https://oss-fuzz-gcb-logs.storage.googleapis.com/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_logs_url ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
- In gcb.py, create a 'build_skipped.flag' in /workspace if no /gcbrun command is found. - In report_generator.py, check for this flag and exit gracefully if it exists. This prevents CI failures on pull requests where a trial build was not requested. - In trial_build.py, refactor log URL generation to use the centralized build_lib.get_logs_url function.
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
Change flag file path to be relative for CI test compatibility. Rename flag to trial_build_skipped.flag for clarity.
|
/gcbrun skip |
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
Fixes a regression that caused malformed GCS URLs for corpus downloads. The logic was incorrectly stripping the leading slash from the GCS path, resulting in a double slash ("//") in the final signed URL. This caused downloads to fail silently, leading to invalid corpus zip files and subsequent `unzip` failures in the coverage builds. This change restores the correct URL parsing logic.
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
Fixes a regression that caused malformed GCS URLs for corpus downloads. The logic was incorrectly stripping the leading slash from the GCS path, resulting in a double slash ("//") in the final signed URL. This caused downloads to fail silently, leading to invalid corpus zip files and subsequent `unzip` failures in the coverage builds. This change restores the correct URL parsing logic.
|
/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build |
|
/gcbrun skip |
This PR improves the trial build process by providing direct, public links to raw log files in the failure reports. When a build fails during either Phase 1 (base image creation) or Phase 2 (project compilation), the summary report will now include a
Log URLthat points directly to thelog-{build_id}.txtfile in the public GCS bucket.Motivation
Project maintainers without direct GCP access often have difficulty viewing detailed logs for build failures in their pull requests. This issue was highlighted after commit
4b541c7cremoved the immediate logging of build URLs upon job creation.This change restores and enhances log visibility in a clean, accessible way, allowing maintainers to quickly diagnose and fix build issues without needing special permissions.
Changes Made
trial_build.py: Modified to construct and display the public log URL for any failed Phase 2 project build.build_and_push_test_images.py: Modified to display the public log URL for a failed Phase 1 base image build.