-
Notifications
You must be signed in to change notification settings - Fork 223
Implement wave container commands #3954
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
base: dev
Are you sure you want to change the base?
Changes from 1 commit
cb07e9d
aa40d8b
6b73c3c
5819387
e689754
c8873db
8328f6f
6fba8ae
78358ae
4493cad
1915c15
109d0b8
e723d5b
f44757b
7c369a4
81ddaf8
882ed67
aa9fa01
3e119a4
11228d4
c08a6dd
c6e8360
4317977
e1d7f7d
6cd3380
180287e
d6e744f
ad5463c
e0edf97
141c2b8
972cd5e
78bd273
ad640fa
9b821e7
f117fca
d0f42cc
3ccd190
cf1dcfa
76c64f2
6a69fb2
ff23c7d
b7e5102
2fa3538
af97d90
77e263e
8f3bfb1
3221030
6aca629
69b6424
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,10 @@ class ModuleContainers: | |
| Helpers for building, linting and listing module containers. | ||
| """ | ||
|
|
||
| IMAGE_KEY = "name" | ||
| BUILD_ID_KEY = "buildId" | ||
| SCAN_ID_KEY = "scanId" | ||
|
|
||
| def __init__( | ||
| self, | ||
| directory: str | Path = ".", | ||
|
|
@@ -41,12 +45,19 @@ def create(self, module: str, await_: bool = False, dry_run: bool = False) -> di | |
| for platform in CONTAINER_PLATFORMS: | ||
| containers[cs][platform] = self.request_container(cs, platform, env_path, await_, dry_run) | ||
|
|
||
| for platform in CONTAINER_PLATFORMS: | ||
|
||
| build_id = containers.get("docker", dict()).get(platform, dict()).get(self.BUILD_ID_KEY, "") | ||
| if build_id: | ||
| # TODO: Add conda-lock url for platform based on the build_id for docker and the same platform | ||
| pass | ||
| # containers["conda"].update(dict((platform, dict(())))) | ||
|
|
||
| self.containers = containers | ||
| return containers | ||
|
|
||
| @staticmethod | ||
| @classmethod | ||
| def request_container( | ||
| container_system: str, platform: str, conda_file: Path, await_build=False, dry_run=False | ||
| cls, container_system: str, platform: str, conda_file: Path, await_build=False, dry_run=False | ||
| ) -> dict: | ||
| assert conda_file.exists() | ||
| assert container_system in CONTAINER_SYSTEMS | ||
|
|
@@ -78,15 +89,15 @@ def request_container( | |
| if not image: | ||
| raise RuntimeError(f"Wave build ({container_system} {platform}) did not return a image name") | ||
JulianFlesch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| container["name"] = image | ||
| container[cls.IMAGE_KEY] = image | ||
|
|
||
| build_id = meta_data.get("buildId", "") | ||
| build_id = meta_data.get(cls.BUILD_ID_KEY, "") | ||
| if build_id: | ||
| container["buildId"] = build_id | ||
| container[cls.BUILD_ID_KEY] = build_id | ||
|
|
||
| scan_id = meta_data.get("scanId", "") | ||
| scan_id = meta_data.get(cls.SCAN_ID_KEY, "") | ||
| if scan_id: | ||
| container["scanId"] = scan_id | ||
| container[cls.SCAN_ID_KEY] = scan_id | ||
|
|
||
| return container | ||
|
|
||
|
|
||
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.
I don't think any of these will change in the future. clearer if we just use them as strings in the code I think.
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.
If you don't feel strongly about this, I think we should keep them. They only exist in the class scope, close to where they are being used, but there we use them quite a lot as it helps us to not have redundant literals