-
Couldn't load subscription status.
- Fork 4
Feat add in build tool control to config #35
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
Merged
ion-elgreco
merged 17 commits into
ASML-Labs:main
from
mackenziedott:feat-add-in-build-tool-control-to-config
Oct 20, 2025
Merged
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
342fa69
Added control of the UC name to the config file. This allows for mor…
b9a87a2
handling an issue when dagster-uc is downloaded without build depende…
43a4c77
bumping version
c43e551
Merge branch 'main' of https://github.com/ASML-Labs/dagster-uc into f…
95bbe7e
ruff updates
ea9d93f
updated build_tool to use values from config
3f5d2f5
Merge branch 'main' of https://github.com/ASML-Labs/dagster-uc into f…
049643f
ruff cleanup
08282e4
Updating Error warning to check for required sudo to run podman
5f41acd
ruff format
ed3f624
Removed build tool selection per PR comments. Added more sudo usage.
b69594e
added missing sudos
0f83a1e
Updated per PR,
084f9a1
ruff updates
e8ccbe3
removed instances of using build_tool
22916ef
cleanout of build tool
ef6d234
fixing comment typo
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| import sys | ||
| from enum import Enum | ||
| from subprocess import Popen, TimeoutExpired | ||
| from typing import Literal | ||
|
|
||
| import typer | ||
|
|
||
|
|
@@ -68,13 +69,15 @@ def gen_tag( | |
| container_registry: str, | ||
| dagster_version: str, | ||
| use_az_login: bool, | ||
| build_tool: Literal["podman", "docker", "auto"] = "podman", | ||
| use_sudo: bool = False, | ||
| ) -> str: | ||
| """Identifies the latest tag present in the container registry and increments it by one.""" | ||
| if use_az_login: | ||
| login_registry(container_registry) | ||
| login_registry(container_registry, build_tool=build_tool, use_sudo=use_sudo) | ||
|
|
||
| res = run_cli_command( | ||
| f"podman search {os.path.join(container_registry, deployment_name)} --list-tags --format {{{{.Tag}}}} --limit 9999999", | ||
| f"{'sudo ' if use_sudo else ''}{BuildTool.podman.value} search {os.path.join(container_registry, deployment_name)} --list-tags --format {{{{.Tag}}}} --limit 9999999", | ||
| ignore_failures=True, | ||
| capture_output=True, | ||
| timeout=15, | ||
|
|
@@ -134,18 +137,24 @@ def get_azure_access_token(image_registry: str) -> bytes: | |
| return token | ||
|
|
||
|
|
||
| def login_registry(image_registry: str) -> None: | ||
| def login_registry( | ||
| image_registry: str, | ||
| build_tool: Literal["podman", "docker", "auto"] = "podman", | ||
| use_sudo: bool = False, | ||
| ) -> None: | ||
| """Logs into registry with az cli""" | ||
| typer.echo(f"Logging into acr with {BuildTool.podman.value}...") | ||
| token = get_azure_access_token(image_registry) | ||
| cmd = [ | ||
| BuildTool.podman.value, | ||
| f"{build_tool}", | ||
| "login", | ||
| "--username", | ||
| "00000000-0000-0000-0000-000000000000", | ||
| "--password-stdin", | ||
| image_registry, | ||
| ] | ||
| if use_sudo: | ||
| cmd = ["sudo"] + cmd | ||
| exception_on_failed_subprocess(subprocess.run(cmd, input=token, capture_output=False)) | ||
|
|
||
|
|
||
|
|
@@ -175,22 +184,26 @@ def build_and_push( | |
| branch_name: str, | ||
| use_az_login: bool, | ||
| build_envs: list[str], | ||
| build_tool: Literal["podman", "docker", "auto"] = "podman", | ||
| build_format: Literal["OCI", "docker"] = "OCI", | ||
| ): | ||
| """Build a docker image and push it to the registry""" | ||
| # We need to work from the root of the repo so docker can access all files | ||
| previous_dir = os.getcwd() | ||
| os.chdir(repository_root) | ||
|
|
||
| cmd = [ | ||
| BuildTool.podman.value, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would keep BuildTool.podman.value |
||
| build_tool, | ||
| "build", | ||
| "-f", | ||
| os.path.join(os.getcwd(), dockerfile), | ||
| "-t", | ||
| os.path.join(image_registry, f"{image_name}:{tag}"), | ||
| "--build-arg=BRANCH_NAME=" + branch_name, | ||
| ".", | ||
| ] | ||
| if build_tool == BuildTool.podman.value and build_format == "docker": | ||
| cmd += ["--format", "docker"] | ||
| cmd += ["."] # Since this always has to be at the nd | ||
mackenziedott marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| for env_var in build_envs: | ||
| cmd.extend(["--env", env_var]) | ||
|
|
||
|
|
@@ -200,10 +213,10 @@ def build_and_push( | |
| exception_on_failed_subprocess(subprocess.run(cmd, capture_output=False)) | ||
|
|
||
| if use_az_login: | ||
| login_registry(image_registry=image_registry) | ||
| login_registry(image_registry=image_registry, build_tool=build_tool, use_sudo=use_sudo) | ||
|
|
||
| typer.echo("Pushing image...") | ||
| cmd = [BuildTool.podman.value, "push", os.path.join(image_registry, f"{image_name}:{tag}")] | ||
mackenziedott marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| cmd = [build_tool, "push", os.path.join(image_registry, f"{image_name}:{tag}")] | ||
| if use_sudo: | ||
| cmd = ["sudo"] + cmd | ||
| exception_on_failed_subprocess(subprocess.run(cmd, capture_output=False)) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 would keep
BuildTool.podman.value