Skip to content

Commit c8c1b25

Browse files
authored
Fix TypeError in ClusterFuzzLite and CloudBuild tags (#14388)
**Fix TypeError in ClusterFuzzLite** This PR fixes a TypeError that occurs in ClusterFuzzLite projects when the PROJECT_SRC_PATH environment variable is not set. This issue was introduced in #14382, which added the base_os_version property to check for Ubuntu 24.04 migration. In ClusterFuzzLite (external projects), base_os_version attempts to read project.yaml using PROJECT_SRC_PATH, which can be missing in some configurations. The fix adds a fallback to self.workspace when PROJECT_SRC_PATH is missing, which is the default behavior for ClusterFuzzLite on GitHub Actions. A warning is also logged when this fallback occurs. **Fix CloudBuild tags**: The CloudBuild for infra/cifuzz was failing because it was trying to use the ubuntu-24-04 tag for the base image, but only ubuntu-24-04-v1 was available in GCR. The fix updates infra/cifuzz/cloudbuild.yaml to create both ubuntu-24-04 and ubuntu-24-04-v1 tags for all images. This ensures compatibility with existing configurations while supporting the new versioned tags.
1 parent b0cacbd commit c8c1b25

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

infra/cifuzz/cloudbuild.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ steps:
4343
- build
4444
- '-t'
4545
- gcr.io/oss-fuzz-base/cifuzz-base:ubuntu-24-04-v1
46+
- '-t'
47+
- gcr.io/oss-fuzz-base/cifuzz-base:ubuntu-24-04
4648
- '-f'
4749
- infra/cifuzz/cifuzz-base/ubuntu-24-04.Dockerfile
4850
- .
@@ -52,7 +54,11 @@ steps:
5254
- '-t'
5355
- gcr.io/oss-fuzz-base/clusterfuzzlite-build-fuzzers:ubuntu-24-04-v1
5456
- '-t'
57+
- gcr.io/oss-fuzz-base/clusterfuzzlite-build-fuzzers:ubuntu-24-04
58+
- '-t'
5559
- gcr.io/oss-fuzz-base/cifuzz-build-fuzzers:ubuntu-24-04-v1
60+
- '-t'
61+
- gcr.io/oss-fuzz-base/cifuzz-build-fuzzers:ubuntu-24-04
5662
- '-f'
5763
- infra/build_fuzzers.ubuntu-24-04.Dockerfile
5864
- infra
@@ -62,7 +68,11 @@ steps:
6268
- '-t'
6369
- gcr.io/oss-fuzz-base/clusterfuzzlite-run-fuzzers:ubuntu-24-04-v1
6470
- '-t'
71+
- gcr.io/oss-fuzz-base/clusterfuzzlite-run-fuzzers:ubuntu-24-04
72+
- '-t'
6573
- gcr.io/oss-fuzz-base/cifuzz-run-fuzzers:ubuntu-24-04-v1
74+
- '-t'
75+
- gcr.io/oss-fuzz-base/cifuzz-run-fuzzers:ubuntu-24-04
6676
- '-f'
6777
- infra/run_fuzzers.ubuntu-24-04.Dockerfile
6878
- infra
@@ -78,8 +88,13 @@ images:
7888
- gcr.io/oss-fuzz-base/clusterfuzzlite-run-fuzzers
7989
- gcr.io/oss-fuzz-base/clusterfuzzlite-run-fuzzers:v1
8090
- gcr.io/oss-fuzz-base/cifuzz-base:ubuntu-24-04-v1
91+
- gcr.io/oss-fuzz-base/cifuzz-base:ubuntu-24-04
8192
- gcr.io/oss-fuzz-base/cifuzz-run-fuzzers:ubuntu-24-04-v1
93+
- gcr.io/oss-fuzz-base/cifuzz-run-fuzzers:ubuntu-24-04
8294
- gcr.io/oss-fuzz-base/cifuzz-build-fuzzers:ubuntu-24-04-v1
95+
- gcr.io/oss-fuzz-base/cifuzz-build-fuzzers:ubuntu-24-04
8396
- gcr.io/oss-fuzz-base/clusterfuzzlite-run-fuzzers:ubuntu-24-04-v1
97+
- gcr.io/oss-fuzz-base/clusterfuzzlite-run-fuzzers:ubuntu-24-04
8498
- gcr.io/oss-fuzz-base/clusterfuzzlite-build-fuzzers:ubuntu-24-04-v1
99+
- gcr.io/oss-fuzz-base/clusterfuzzlite-build-fuzzers:ubuntu-24-04
85100
timeout: 1800s

infra/cifuzz/config_utils.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,20 +209,32 @@ def base_os_version(self):
209209
'project.yaml')
210210
else:
211211
# External project.
212-
project_yaml_path = os.path.join(self.project_src_path,
212+
project_src_path = self.project_src_path
213+
if project_src_path is None:
214+
logging.info('PROJECT_SRC_PATH not set. Using workspace: %s',
215+
self.workspace)
216+
project_src_path = self.workspace
217+
218+
project_yaml_path = os.path.join(project_src_path,
213219
self.build_integration_path,
214220
'project.yaml')
215221

216-
if not os.path.exists(project_yaml_path):
222+
try:
223+
if not os.path.exists(project_yaml_path):
224+
return 'legacy'
225+
226+
with open(project_yaml_path) as file_handle:
227+
content = file_handle.read()
228+
for line in content.splitlines():
229+
match = BASE_OS_VERSION_REGEX.match(line)
230+
if match:
231+
return match.group(1).strip('\'"')
232+
except Exception: # pylint: disable=broad-except
233+
logging.warning(
234+
'Failed to read project.yaml at %s. Falling back to legacy.',
235+
project_yaml_path)
217236
return 'legacy'
218237

219-
with open(project_yaml_path) as file_handle:
220-
content = file_handle.read()
221-
for line in content.splitlines():
222-
match = BASE_OS_VERSION_REGEX.match(line)
223-
if match:
224-
return match.group(1).strip('\'"')
225-
226238
return 'legacy'
227239

228240

0 commit comments

Comments
 (0)