Skip to content

Commit 30145c6

Browse files
authored
Merge pull request #2088 from apache/tristan/artifact-show-remote
Support artifact remote options in `bst artifact show`
2 parents 4067353 + ccb6f55 commit 30145c6

11 files changed

Lines changed: 189 additions & 11 deletions

File tree

src/buildstream/_frontend/cli.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,12 +1302,29 @@ def artifact():
13021302
),
13031303
help="The dependencies we also want to show",
13041304
)
1305+
@click.option(
1306+
"--artifact-remote",
1307+
"artifact_remotes",
1308+
type=RemoteSpecType(RemoteSpecPurpose.PULL),
1309+
multiple=True,
1310+
help="A remote for downloading artifacts (Since: 2.7)",
1311+
)
1312+
@click.option(
1313+
"--ignore-project-artifact-remotes",
1314+
is_flag=True,
1315+
help="Ignore remote artifact cache servers recommended by projects (Since: 2.7)",
1316+
)
13051317
@click.argument("artifacts", type=click.Path(), nargs=-1)
13061318
@click.pass_obj
1307-
def artifact_show(app, deps, artifacts):
1308-
"""show the cached state of artifacts"""
1319+
def artifact_show(app, deps, artifact_remotes, ignore_project_artifact_remotes, artifacts):
1320+
"""Show the cached state of artifacts"""
13091321
with app.initialized():
1310-
targets = app.stream.artifact_show(artifacts, selection=deps)
1322+
targets = app.stream.artifact_show(
1323+
artifacts,
1324+
selection=deps,
1325+
artifact_remotes=artifact_remotes,
1326+
ignore_project_artifact_remotes=ignore_project_artifact_remotes,
1327+
)
13111328
click.echo(app.logger.show_state_of_artifacts(targets))
13121329
sys.exit(0)
13131330

src/buildstream/_stream.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,11 +788,25 @@ def _export_artifact(self, tar, location, compression, target, hardlinks, virdir
788788
#
789789
# Args:
790790
# targets (str): Targets to show the cached state of
791+
# artifact_remotes: Artifact cache remotes specified on the commmand line
792+
# ignore_project_artifact_remotes: Whether to ignore artifact remotes specified by projects
791793
#
792-
def artifact_show(self, targets, *, selection=_PipelineSelection.NONE):
794+
def artifact_show(
795+
self,
796+
targets,
797+
*,
798+
selection=_PipelineSelection.NONE,
799+
artifact_remotes: Iterable[RemoteSpec] = (),
800+
ignore_project_artifact_remotes: bool = False,
801+
):
793802
# Obtain list of Element and/or ArtifactElement objects
794803
target_objects = self.load_selection(
795-
targets, selection=selection, connect_artifact_cache=True, load_artifacts=True
804+
targets,
805+
selection=selection,
806+
connect_artifact_cache=True,
807+
load_artifacts=True,
808+
artifact_remotes=artifact_remotes,
809+
ignore_project_artifact_remotes=ignore_project_artifact_remotes,
796810
)
797811

798812
self.query_cache(target_objects)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
kind: compose
2+
3+
depends:
4+
- filename: import-bin.bst
5+
type: build
6+
- filename: import-dev.bst
7+
type: build
8+
9+
config:
10+
# Dont try running the sandbox, we dont have a
11+
# runtime to run anything in this context.
12+
integrate: False
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
kind: import
2+
sources:
3+
- kind: local
4+
path: files/bin-files
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
kind: import
2+
sources:
3+
- kind: local
4+
path: files/dev-files
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
kind: manual
2+
3+
config:
4+
build-commands:
5+
- echo "hello"
6+
7+
sources:
8+
- kind: local
9+
path: elements/manual.bst
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
kind: stack
2+
description: |
3+
4+
Main stack target for the bst build test
5+
6+
depends:
7+
- import-bin.bst
8+
- compose-all.bst
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
echo "Hello !"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef __PONY_H__
2+
#define __PONY_H__
3+
4+
#define PONY_BEGIN "Once upon a time, there was a pony."
5+
#define PONY_END "And they lived happily ever after, the end."
6+
7+
#define MAKE_PONY(story) \
8+
PONY_BEGIN \
9+
story \
10+
PONY_END
11+
12+
#endif /* __PONY_H__ */
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Project config for frontend build test
2+
name: test
3+
min-version: 2.0
4+
element-path: elements
5+
6+
plugins:
7+
- origin: pip
8+
package-name: sample-plugins
9+
sources:
10+
- git

0 commit comments

Comments
 (0)