Skip to content

Commit 2847a55

Browse files
authored
fix(infra): Remove local file check in base_images Cloud Function (#14340)
The Cloud Function environment does not include the full repository, so checking for the existence of Dockerfiles locally (os.path.exists) causes a FileNotFoundError and crashes the function. This change assumes that if a supported version is requested (e.g. ubuntu-20-04), the corresponding Dockerfile exists, which is verified by the project structure.
1 parent 1bf2302 commit 2847a55

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

infra/build/functions/base_images.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,8 @@ def _resolve_dockerfile(self) -> str:
9999
if self.version != 'legacy':
100100
versioned_dockerfile = os.path.join(self.path,
101101
f'{self.version}.Dockerfile')
102-
if os.path.exists(versioned_dockerfile):
103-
logging.info('Using versioned Dockerfile: %s', versioned_dockerfile)
104-
return versioned_dockerfile
105-
raise FileNotFoundError(
106-
f'Versioned Dockerfile not found for {self.name}:{self.version}')
102+
logging.info('Using versioned Dockerfile: %s', versioned_dockerfile)
103+
return versioned_dockerfile
107104

108105
legacy_dockerfile = os.path.join(self.path, 'Dockerfile')
109106
logging.info('Using legacy Dockerfile: %s', legacy_dockerfile)

0 commit comments

Comments
 (0)