This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/artifact-show-remote
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 5275d1deac6f4bbaa22ad5a02a2233cd81757f8c
Author: Tristan van Berkom <[email protected]>
AuthorDate: Sun Nov 9 04:20:01 2025 +0900

    Support artifact remote arguments in bst artifact show command.
    
    This is useful for ensuring that the shallow artifacts have been downloaded
    from the remotes, without requiring heavy duty `bst artifact pull`, and
    is particularly useful with the advent of `%{artifact-cas-digest}` being
    available in `bst show` output.
    
    This updates the CLI to support the new arguments which we missed
    adding previously, and adds the glue code in Stream() object to
    load the pipeline with the artifact remote related arguments.
---
 src/buildstream/_frontend/cli.py | 23 ++++++++++++++++++++---
 src/buildstream/_stream.py       | 18 ++++++++++++++++--
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index 77f3f118b..4b697fa74 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -1302,12 +1302,29 @@ def artifact():
     ),
     help="The dependencies we also want to show",
 )
[email protected](
+    "--artifact-remote",
+    "artifact_remotes",
+    type=RemoteSpecType(RemoteSpecPurpose.PULL),
+    multiple=True,
+    help="A remote for downloading artifacts (Since: 2.7)",
+)
[email protected](
+    "--ignore-project-artifact-remotes",
+    is_flag=True,
+    help="Ignore remote artifact cache servers recommended by projects (Since: 
2.7)",
+)
 @click.argument("artifacts", type=click.Path(), nargs=-1)
 @click.pass_obj
-def artifact_show(app, deps, artifacts):
-    """show the cached state of artifacts"""
+def artifact_show(app, deps, artifact_remotes, 
ignore_project_artifact_remotes, artifacts):
+    """Show the cached state of artifacts"""
     with app.initialized():
-        targets = app.stream.artifact_show(artifacts, selection=deps)
+        targets = app.stream.artifact_show(
+            artifacts,
+            selection=deps,
+            artifact_remotes=artifact_remotes,
+            ignore_project_artifact_remotes=ignore_project_artifact_remotes,
+        )
         click.echo(app.logger.show_state_of_artifacts(targets))
         sys.exit(0)
 
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index da8d48550..a143509f7 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -788,11 +788,25 @@ class Stream:
     #
     # Args:
     #    targets (str): Targets to show the cached state of
+    #    artifact_remotes: Artifact cache remotes specified on the commmand 
line
+    #    ignore_project_artifact_remotes: Whether to ignore artifact remotes 
specified by projects
     #
-    def artifact_show(self, targets, *, selection=_PipelineSelection.NONE):
+    def artifact_show(
+            self,
+            targets,
+            *,
+            selection=_PipelineSelection.NONE,
+            artifact_remotes: Iterable[RemoteSpec] = (),
+            ignore_project_artifact_remotes: bool = False,
+    ):
         # Obtain list of Element and/or ArtifactElement objects
         target_objects = self.load_selection(
-            targets, selection=selection, connect_artifact_cache=True, 
load_artifacts=True
+            targets,
+            selection=selection,
+            connect_artifact_cache=True,
+            load_artifacts=True,
+            artifact_remotes=artifact_remotes,
+            ignore_project_artifact_remotes=ignore_project_artifact_remotes,
         )
 
         self.query_cache(target_objects)

Reply via email to