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 2021/02/04 08:20:08 UTC

[buildstream] branch raoul/pull-refs created (now 55705ab)

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

tvb pushed a change to branch raoul/pull-refs
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at 55705ab  Add test for pulling artifact refs

This branch includes the following new commits:

     new b0795da  stream: Allow refs to be used with deps none
     new 55705ab  Add test for pulling artifact refs

The 2 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] 02/02: Add test for pulling artifact refs

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

tvb pushed a commit to branch raoul/pull-refs
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 55705aba3600f61f75859ce7f8af2c35f9f421ea
Author: Raoul Hidalgo Charman <ra...@codethink.co.uk>
AuthorDate: Fri Jul 5 15:59:51 2019 +0100

    Add test for pulling artifact refs
---
 tests/frontend/pull.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/tests/frontend/pull.py b/tests/frontend/pull.py
index a87a311..aa5853d 100644
--- a/tests/frontend/pull.py
+++ b/tests/frontend/pull.py
@@ -6,6 +6,7 @@ import shutil
 import stat
 import pytest
 from buildstream import utils
+from buildstream._exceptions import ErrorDomain
 from buildstream.testing import cli  # pylint: disable=unused-import
 from tests.testutils import create_artifact_share, generate_junction, assert_shared, assert_not_shared
 
@@ -558,3 +559,51 @@ def test_pull_access_rights(cli, tmpdir, datafiles):
         st = os.lstat(os.path.join(checkout, 'usr/share/big-file'))
         assert stat.S_ISREG(st.st_mode)
         assert stat.S_IMODE(st.st_mode) == 0o0644
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_pull_artifact_ref(cli, tmpdir, datafiles):
+    project = str(datafiles)
+
+    with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share:
+
+        # First build the target element and push to the remote.
+        cli.configure({
+            'artifacts': {'url': share.repo, 'push': True}
+        })
+        result = cli.run(project=project, args=['build', 'target.bst'])
+        result.assert_success()
+        assert cli.get_element_state(project, 'target.bst') == 'cached'
+
+        # Assert that everything is now cached in the remote.
+        all_elements = ['target.bst', 'import-bin.bst', 'import-dev.bst', 'compose-all.bst']
+        for element_name in all_elements:
+            assert_shared(cli, share, project, element_name)
+
+        # get target cache key to pull ref of
+        cache_key = cli.get_element_key(project, 'target.bst')
+        target = "test/target/{}".format(cache_key)
+
+        # Now we've pushed, delete the user's local artifact cache
+        # directory and try to redownload it from the share
+        #
+        casdir = os.path.join(cli.directory, 'cas')
+        shutil.rmtree(casdir)
+        artifactdir = os.path.join(cli.directory, 'artifacts')
+        shutil.rmtree(artifactdir)
+
+        # Assert that nothing is cached locally anymore
+        states = cli.get_element_states(project, all_elements)
+        assert not any(states[e] == 'cached' for e in all_elements)
+
+        # Now try bst artifact pull
+        result = cli.run(project=project, args=['artifact', 'pull', target])
+        result.assert_success()
+
+        # And assert that it's again in the local cache, without having built
+        assert cli.get_element_state(project, 'target.bst') == 'cached'
+
+        # check that it fails if you try and pull with dependencies
+        result = cli.run(project=project, args=[
+            'artifact', 'pull', '--deps', 'all', target])
+        result.assert_main_error(ErrorDomain.ELEMENT, None, debug=True)


[buildstream] 01/02: stream: Allow refs to be used with deps none

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

tvb pushed a commit to branch raoul/pull-refs
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit b0795daa7e21b160e0f0c685c1d4762e07c14273
Author: Raoul Hidalgo Charman <ra...@codethink.co.uk>
AuthorDate: Fri Jul 5 15:59:06 2019 +0100

    stream: Allow refs to be used with deps none
---
 src/buildstream/_stream.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index c6d748f..0755e8b 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -397,7 +397,8 @@ class Stream():
                                  selection=selection,
                                  ignore_junction_targets=ignore_junction_targets,
                                  use_artifact_config=use_config,
-                                 artifact_remote_url=remote)
+                                 artifact_remote_url=remote,
+                                 load_refs=selection == PipelineSelection.NONE)
 
         if not self._artifacts.has_fetch_remotes():
             raise StreamError("No artifact caches available for pulling artifacts")