|
1 | 1 | #
|
2 | 2 | # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3 | 3 | #
|
4 |
| - |
| 4 | +from pathlib import Path |
5 | 5 | from typing import Dict, List, Optional
|
6 | 6 |
|
7 | 7 | import dagger
|
@@ -55,13 +55,21 @@ def _mount_paths(self, container: dagger.Container) -> dagger.Container:
|
55 | 55 | if path_to_mount.optional and not path_to_mount.get_path().exists():
|
56 | 56 | continue
|
57 | 57 |
|
58 |
| - path_string = str(path_to_mount) |
59 |
| - destination_path = f"/{path_string}" |
60 |
| - if path_to_mount.is_file: |
61 |
| - file_to_load = self.context.get_repo_file(path_string) |
62 |
| - container = container.with_mounted_file(destination_path, file_to_load) |
63 |
| - else: |
64 |
| - container = container.with_mounted_directory(destination_path, self.context.get_repo_dir(path_string)) |
| 58 | + if path_to_mount.get_path().is_symlink(): |
| 59 | + container = self._mount_path(container, path_to_mount.get_path().readlink()) |
| 60 | + |
| 61 | + container = self._mount_path(container, path_to_mount.get_path()) |
| 62 | + return container |
| 63 | + |
| 64 | + def _mount_path(self, container: dagger.Container, path: Path) -> dagger.Container: |
| 65 | + path_string = str(path) |
| 66 | + destination_path = f"/{path_string}" |
| 67 | + if path.is_file(): |
| 68 | + file_to_load = self.context.get_repo_file(path_string) |
| 69 | + container = container.with_mounted_file(destination_path, file_to_load) |
| 70 | + else: |
| 71 | + dir_to_load = self.context.get_repo_dir(path_string) |
| 72 | + container = container.with_mounted_directory(destination_path, dir_to_load) |
65 | 73 | return container
|
66 | 74 |
|
67 | 75 | async def _install_internal_tools(self, container: dagger.Container) -> dagger.Container:
|
|
0 commit comments