Skip to content

Conversation

@hunsche
Copy link
Contributor

@hunsche hunsche commented Oct 19, 2025

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 URL that points directly to the log-{build_id}.txt file 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 4b541c7c removed 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.

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.
@hunsche
Copy link
Contributor Author

hunsche commented Oct 19, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer

@hunsche
Copy link
Contributor Author

hunsche commented Oct 19, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build

@hunsche
Copy link
Contributor Author

hunsche commented Oct 19, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build

@hunsche
Copy link
Contributor Author

hunsche commented Oct 19, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build

@hunsche hunsche requested a review from vitaliset October 19, 2025 21:53
@hunsche hunsche enabled auto-merge (squash) October 19, 2025 21:54
@hunsche hunsche requested a review from oliverchang October 19, 2025 22:35
'----------------------------------------------------------------')
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/'
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build

hunsche and others added 3 commits October 20, 2025 10:12
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.
@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build

@hunsche hunsche requested a review from oliverchang October 20, 2025 13:14
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.
@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/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.
@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build

@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build

@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build

@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/gcbrun skip

@hunsche hunsche force-pushed the feat/add-public-log-urls branch from 883b75b to 605c7e3 Compare October 20, 2025 20:06
@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/gcbrun skip

@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/gcbrun skip

@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build

@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/gcbrun skip

@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/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')
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

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/'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_logs_url ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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/'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_logs_url ?

Copy link
Contributor Author

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.
@hunsche
Copy link
Contributor Author

hunsche commented Oct 20, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build

@hunsche hunsche requested a review from oliverchang October 20, 2025 23:48
Change flag file path to be relative for CI test compatibility.
Rename flag to trial_build_skipped.flag for clarity.
@hunsche
Copy link
Contributor Author

hunsche commented Oct 21, 2025

/gcbrun skip

@hunsche
Copy link
Contributor Author

hunsche commented Oct 21, 2025

/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.
@hunsche
Copy link
Contributor Author

hunsche commented Oct 21, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build

hunsche and others added 2 commits October 21, 2025 01:42
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.
@hunsche
Copy link
Contributor Author

hunsche commented Oct 21, 2025

/gcbrun trial_build.py zlib --sanitizer introspector --fuzzing-engine libfuzzer --force-build

@hunsche
Copy link
Contributor Author

hunsche commented Oct 21, 2025

/gcbrun skip

@hunsche hunsche merged commit 1242ccb into master Oct 21, 2025
19 checks passed
@hunsche hunsche deleted the feat/add-public-log-urls branch October 21, 2025 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants