diff --git a/openhands-agent-server/openhands/agent_server/docker/build.py b/openhands-agent-server/openhands/agent_server/docker/build.py index 074b85963..c1c527407 100755 --- a/openhands-agent-server/openhands/agent_server/docker/build.py +++ b/openhands-agent-server/openhands/agent_server/docker/build.py @@ -4,7 +4,7 @@ - Targets: binary | binary-minimal | source | source-minimal - Multi-tagging via CUSTOM_TAGS (comma-separated) -- Versioned tag includes primary custom tag: v{SDK}_{BASE_SLUG} +- Versioned tags for custom tags: {SDK_VERSION}-{CUSTOM_TAG} - Branch-scoped cache keys - CI (push) vs local (load) behavior - sdist-based builds: Uses `uv build` to create clean build contexts @@ -379,8 +379,12 @@ def base_image_slug(self) -> str: return _base_slug(self.base_image) @property - def versioned_tag(self) -> str: - return f"v{self.sdk_version}_{self.base_image_slug}" + def versioned_tags(self) -> list[str]: + """ + Generate simple version tags for each custom tag variant. + Returns tags like: 1.2.0-python, 1.2.0-java, 1.2.0-golang + """ + return [f"{self.sdk_version}-{t}" for t in self.custom_tag_list] @property def base_tag(self) -> str: @@ -412,7 +416,8 @@ def all_tags(self) -> list[str]: if self.include_base_tag: tags.append(f"{self.image}:{self.base_tag}{arch_suffix}") if self.include_versioned_tag: - tags.append(f"{self.image}:{self.versioned_tag}{arch_suffix}") + for versioned_tag in self.versioned_tags: + tags.append(f"{self.image}:{versioned_tag}{arch_suffix}") # Append target suffix for clarity (binary is default, no suffix needed) if self.target != "binary": @@ -734,7 +739,7 @@ def main(argv: list[str]) -> int: fh.write(f"build_context={ctx}\n") fh.write(f"dockerfile={ctx / 'Dockerfile'}\n") fh.write(f"tags_csv={','.join(opts.all_tags)}\n") - fh.write(f"versioned_tag={opts.versioned_tag}\n") + fh.write(f"versioned_tags_csv={','.join(opts.versioned_tags)}\n") fh.write(f"base_image_slug={opts.base_image_slug}\n") logger.info("[build] Wrote outputs to $GITHUB_OUTPUT") @@ -773,13 +778,16 @@ def main(argv: list[str]) -> int: # --- expose outputs for GitHub Actions --- def _write_gha_outputs( - image: str, short_sha: str, versioned_tag: str, tags_list: list[str] + image: str, + short_sha: str, + versioned_tags: list[str], + tags_list: list[str], ) -> None: """ If running in GitHub Actions, append step outputs to $GITHUB_OUTPUT. - image: repo/name (no tag) - short_sha: 7-char SHA - - versioned_tag: e.g. v{SDK}_{BASE_SLUG}_{target}[ -dev ] + - versioned_tags_csv: comma-separated list of versioned tags - tags: multiline output (one per line) - tags_csv: single-line, comma-separated """ @@ -789,13 +797,13 @@ def _write_gha_outputs( with open(out_path, "a", encoding="utf-8") as fh: fh.write(f"image={image}\n") fh.write(f"short_sha={short_sha}\n") - fh.write(f"versioned_tag={versioned_tag}\n") + fh.write(f"versioned_tags_csv={','.join(versioned_tags)}\n") fh.write(f"tags_csv={','.join(tags_list)}\n") fh.write("tags<