You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/08/15 08:00:17 UTC

[buildstream] branch tristan/shell-artifacts created (now 428261957)

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

tvb pushed a change to branch tristan/shell-artifacts
in repository https://gitbox.apache.org/repos/asf/buildstream.git


      at 428261957 tests/integration/shellbuildtrees.py: Add test for shelling into an artifact

This branch includes the following new commits:

     new 055e79706 _stream.py: Allow loading artifacts in `bst shell`
     new a1e59f105 _frontend/cli.py: Rename bst shell element argument to 'target'
     new 428261957 tests/integration/shellbuildtrees.py: Add test for shelling into an artifact

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 01/03: _stream.py: Allow loading artifacts in `bst shell`

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 055e7970641dbdc19faf4e885add5c99cdedc48f
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Mon Aug 15 16:49:41 2022 +0900

    _stream.py: Allow loading artifacts in `bst shell`
    
    Now that we cache the full sandbox root for failed builds we can debug
    builds directly on downloaded artifacts.
    
    Fixes #1711
---
 src/buildstream/_stream.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 1ae6049fe..45922bc5b 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -288,6 +288,7 @@ class Stream:
             elements = self.load_selection(
                 (target,),
                 selection=selection,
+                load_artifacts=True,
                 connect_artifact_cache=True,
                 connect_source_cache=True,
                 artifact_remotes=artifact_remotes,


[buildstream] 03/03: tests/integration/shellbuildtrees.py: Add test for shelling into an artifact

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4282619570b30e16e916aaf7fde9b176f41ab3c9
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Mon Aug 15 16:58:25 2022 +0900

    tests/integration/shellbuildtrees.py: Add test for shelling into an artifact
---
 tests/integration/shellbuildtrees.py | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tests/integration/shellbuildtrees.py b/tests/integration/shellbuildtrees.py
index b27a25a88..0dfeb6587 100644
--- a/tests/integration/shellbuildtrees.py
+++ b/tests/integration/shellbuildtrees.py
@@ -326,6 +326,40 @@ def test_shell_pull_cached_buildtree(share_with_buildtrees, datafiles, cli, pull
     assert "Hi" in result.output
 
 
+#
+# Test behavior of shelling into a buildtree by its artifact name
+#
+@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox")
+def test_shell_pull_artifact_cached_buildtree(share_with_buildtrees, datafiles, cli):
+    project = str(datafiles)
+    artifact_name = "test/build-shell-buildtree/4a47c98a10df39e65e99d471f96edc5b58d4ea5b9b1f221d0be832a8124b8099"
+
+    cli.configure({"artifacts": {"servers": [{"url": share_with_buildtrees.repo}]}})
+
+    # Run the shell and request that required artifacts and buildtrees should be pulled
+    result = cli.run(
+        project=project,
+        args=[
+            "--pull-buildtrees",
+            "shell",
+            "--build",
+            "--use-buildtree",
+            artifact_name,
+            "--",
+            "cat",
+            # We don't preserve the working directory in artifacts, so we will executing be at /
+            "/buildstream/test/build-shell/buildtree.bst/test",
+        ],
+    )
+
+    # In this case, we should succeed every time, regardless of what was
+    # originally available in the local cache.
+    #
+    result.assert_success()
+    assert "Hi" in result.output
+
+
 #
 # Test behavior of launching a shell and requesting to use a buildtree.
 #


[buildstream] 02/03: _frontend/cli.py: Rename bst shell element argument to 'target'

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a1e59f105f22b7ff4ce83e981e3265a2f979f043
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Mon Aug 15 16:51:31 2022 +0900

    _frontend/cli.py: Rename bst shell element argument to 'target'
    
    This will enable bash completions on artifact names for `bst shell`
---
 src/buildstream/_frontend/cli.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index 39469a42c..fa4e0b6d2 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -668,12 +668,12 @@ def show(app, elements, deps, except_, order, format_):
 @click.option(
     "--ignore-project-source-remotes", is_flag=True, help="Ignore remote source cache servers recommended by projects"
 )
-@click.argument("element", required=False, type=click.Path(readable=False))
+@click.argument("target", required=False, type=click.Path(readable=False))
 @click.argument("command", type=click.STRING, nargs=-1)
 @click.pass_obj
 def shell(
     app,
-    element,
+    target,
     command,
     mount,
     isolate,
@@ -713,16 +713,16 @@ def shell(
     scope = _Scope.BUILD if build_ else _Scope.RUN
 
     with app.initialized():
-        if not element:
-            element = app.project.get_default_target()
-            if not element:
-                raise AppError('Missing argument "ELEMENT".')
+        if not target:
+            target = app.project.get_default_target()
+            if not target:
+                raise AppError('Missing argument "TARGET".')
 
         mounts = [_HostMount(path, host_path) for host_path, path in mount]
 
         try:
             exitcode = app.stream.shell(
-                element,
+                target,
                 scope,
                 app.shell_prompt,
                 mounts=mounts,