Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions dagster_uc/uc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from kr8s.objects import RoleBinding as RoleBinding
from kr8s.objects import Service as Service
from kr8s.objects import ServiceAccount as ServiceAccount
from packaging.version import Version

from dagster_uc.config import UserCodeDeploymentsConfig
from dagster_uc.configmaps import BASE_CONFIGMAP, BASE_CONFIGMAP_DATA
Expand Down Expand Up @@ -430,10 +431,25 @@ def get_deployment_name(self, deployment_name_suffix: str | None = None) -> str:
def _ensure_dagster_version_match(self) -> None:
"""Raises an exception if the cluster version of dagster is different than the local version"""
logger.debug("Going to read the cluster dagster version...")
local_dagster_version = self.config.dagster_version
cluster_dagster_version = self._read_namespaced_config_map("dagster-instance")["metadata"][
"labels"
]["chart"].split("-")[1]
local_dagster_version = Version(self.config.dagster_version)

## GETS cluster version from dagster deamon pod
deamon_pod = cast(
list[Pod],
self.api.get(Pod, label_selector="deployment=daemon", namespace=self.config.namespace),
)[0]

ex = deamon_pod.exec(command=["dagster", "--version"])
output = ex.stdout.decode("ascii") # type: ignore
cluster_dagster_version = re.findall("version (.*)", output)

if len(cluster_dagster_version) != 1:
raise Exception(
f"Failed parsing the cluster dagster version, exec response from container `{output}`",
)
else:
cluster_dagster_version = Version(cluster_dagster_version[0])

logger.debug(f"Cluster dagster version detected to be '{cluster_dagster_version}'")
if not cluster_dagster_version == local_dagster_version:
raise Exception(
Expand Down
2 changes: 1 addition & 1 deletion dagster_uc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def build_and_push(
BuildTool.podman.value,
"build",
"-f",
os.path.join(repository_root, dockerfile),
os.path.join(os.getcwd(), dockerfile),
"-t",
os.path.join(image_registry, f"{image_name}:{tag}"),
"--build-arg=BRANCH_NAME=" + branch_name,
Expand Down
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[project]
name = "dagster-uc"
version = "0.2.1"
authors = [{name = "Stefan Verbruggen", email="[email protected]"}, {name = "Ion Koutsouris"}]
version = "0.2.2"
authors = [
{name = "Stefan Verbruggen"},
{name = "Ion Koutsouris"},
]
description = "CLI for managing user code deployments of a Dagster instance that was deployed on kubernetes."
readme = "README.md"
requires-python = ">=3.9"
Expand Down Expand Up @@ -159,4 +162,4 @@ suppress-none-returning = true

[tool.ruff.lint.pydocstyle]
# Use Google-style docstrings.
convention = "google"
convention = "google"
Loading