From e902c9fac43138f6b3b243f778cc3f66cf75bc21 Mon Sep 17 00:00:00 2001 From: Dulaj Disanayaka Date: Mon, 20 Apr 2026 11:58:37 +0200 Subject: [PATCH 1/2] fix: jig build should error when deploy.image is set --- src/together/lib/cli/api/beta/jig/jig.py | 5 +++++ tests/cli/test_beta_jig.py | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/together/lib/cli/api/beta/jig/jig.py b/src/together/lib/cli/api/beta/jig/jig.py index 11d3a951..c74aab69 100644 --- a/src/together/lib/cli/api/beta/jig/jig.py +++ b/src/together/lib/cli/api/beta/jig/jig.py @@ -592,6 +592,11 @@ def delete_secret(self, name: str) -> None: # == Build / Push / Deploy / Track == def build(self, tag: str = "latest", warmup: bool = False, docker_args: str | None = None) -> None: + if self.config.deploy.image: + raise JigError( + f"Cannot build: deploy.image is set to '{self.config.deploy.image}'. " + "Use 'jig deploy' to deploy the configured image, or remove deploy.image to build from source." + ) image = self.image(tag) if not _dockerfile(self.config): diff --git a/tests/cli/test_beta_jig.py b/tests/cli/test_beta_jig.py index dd9bd3ae..fc443398 100644 --- a/tests/cli/test_beta_jig.py +++ b/tests/cli/test_beta_jig.py @@ -228,6 +228,28 @@ def test_unset_missing_secret_message(self, tmp_path: Path) -> None: assert "Secret nope is not set" in result.output +class TestBetaJigBuild: + def test_build_blocked_when_deploy_image_set(self, tmp_path: Path) -> None: + with patch.object(_jig_mod.Config, "__post_init__", _noop_config_post_init): + cfg = _jig_mod.Config( + model_name=_DEPLOY_NAME, + image=_jig_mod.ImageConfig(), + deploy=_jig_mod.DeployConfig(image="ghcr.io/org/prebuilt:latest"), + _path=tmp_path / "pyproject.toml", + _unique_name_hint="h", + ) + + def _find(*_args: Any): + return cfg + + with patch.object(_jig_mod.Config, "find", classmethod(_find)): + runner = CliRunner(env=_ENV) + with _chdir(tmp_path): + result = runner.invoke(main, ["beta", "jig", "build"]) + assert result.exit_code == 1 + assert "deploy.image is set" in result.output + + class TestBetaJigVolumes: @pytest.mark.respx(base_url=base_url) def test_delete(self, respx_mock: MockRouter, tmp_path: Path) -> None: From 731a90987db8407ff6573754e045083344c3ab99 Mon Sep 17 00:00:00 2001 From: Dulaj Disanayaka Date: Mon, 20 Apr 2026 13:39:02 +0200 Subject: [PATCH 2/2] chore: fix error msg --- src/together/lib/cli/api/beta/jig/jig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/together/lib/cli/api/beta/jig/jig.py b/src/together/lib/cli/api/beta/jig/jig.py index c74aab69..2e9bd683 100644 --- a/src/together/lib/cli/api/beta/jig/jig.py +++ b/src/together/lib/cli/api/beta/jig/jig.py @@ -594,7 +594,7 @@ def delete_secret(self, name: str) -> None: def build(self, tag: str = "latest", warmup: bool = False, docker_args: str | None = None) -> None: if self.config.deploy.image: raise JigError( - f"Cannot build: deploy.image is set to '{self.config.deploy.image}'. " + f"Invalid command: deploy.image is set to '{self.config.deploy.image}'. " "Use 'jig deploy' to deploy the configured image, or remove deploy.image to build from source." ) image = self.image(tag)