Skip to content

Commit 4987b00

Browse files
sndagsterDagster Devtools
authored andcommitted
Scope serverless deploy registry URL to the target deployment (#25879)
## Summary & Motivation Target the deployment when pushing images to harbor else it will fail on non-prod deployments Internal-RevId: 4529fb377b0cbe7e6e5cd3ca50f673cc2ba6bef4
1 parent 1b75e14 commit 4987b00

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

python_modules/libraries/dagster-cloud-cli/dagster_cloud_cli/commands/ci/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ def _build_docker(
832832
) -> state.DockerBuildOutput:
833833
name = location_state.location_name
834834
docker_utils.verify_docker()
835-
registry_info = utils.get_registry_info(url)
835+
registry_info = utils.get_registry_info(url, location_state.deployment_name)
836836
repo_location = name if registry_info.get("is_harbor") else None
837837

838838
docker_image_tag = docker_utils.default_image_tag(

python_modules/libraries/dagster-cloud-cli/dagster_cloud_cli/commands/ci/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ def client_from_env(url: str, deployment: str | None = None):
1717
yield client
1818

1919

20-
def get_registry_info(url: str) -> dict[str, Any]:
21-
with client_from_env(url) as client:
20+
def get_registry_info(url: str, deployment: str) -> dict[str, Any]:
21+
with client_from_env(url, deployment=deployment) as client:
2222
return gql.get_ecr_info(client)

python_modules/libraries/dagster-cloud-cli/dagster_cloud_cli_tests/test_ci_commands.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def test_ci_deploy_docker(
407407
mocker, monkeypatch, deployment_name: str, initialized_runner: CliRunner
408408
) -> None:
409409
monkeypatch.setenv("DAGSTER_CLOUD_API_TOKEN", "fake-token")
410-
mocker.patch(
410+
mock_get_registry_info = mocker.patch(
411411
"dagster_cloud_cli.commands.ci.utils.get_registry_info",
412412
return_value={"registry_url": "example.com/image-registry"},
413413
)
@@ -423,6 +423,12 @@ def test_ci_deploy_docker(
423423
initialized_runner.invoke(app, ["ci", "locations-deselect", "a", "d"])
424424
result = initialized_runner.invoke(app, ["ci", "build"])
425425
assert not result.exit_code, result.output
426+
427+
# registry info must be scoped to the target deployment (per-deployment Harbor tenant)
428+
assert mock_get_registry_info.call_args_list
429+
for call_args in mock_get_registry_info.call_args_list:
430+
assert call_args.args[1] == deployment_name
431+
426432
result = initialized_runner.invoke(app, ["ci", "deploy"])
427433
assert not result.exit_code, result.output
428434

0 commit comments

Comments
 (0)