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:16:09 UTC

[buildstream] 01/09: Move push and pull to the new artifact subcommand group

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

tvb pushed a commit to branch jennis/push_pull_artifacts
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 94b309c323ecaefb28ac787604a0a35e899d48de
Author: James Ennis <ja...@codethink.com>
AuthorDate: Mon Jan 7 18:00:54 2019 +0000

    Move push and pull to the new artifact subcommand group
    
    This commit also ensures that if we try to use the 'old' commands,
    BuildStream will fail and instruct the user to use the new command.
---
 buildstream/_frontend/cli.py          | 178 ++++++++++++++++++++--------------
 tests/artifactcache/config.py         |   2 +-
 tests/artifactcache/junctions.py      |   4 +-
 tests/completions/completions.py      |  14 +--
 tests/frontend/help.py                |   3 +-
 tests/frontend/pull.py                |  12 +--
 tests/frontend/push.py                |  16 +--
 tests/frontend/workspace.py           |   4 +-
 tests/integration/build-tree.py       |   5 +-
 tests/integration/pullbuildtrees.py   |  34 +++----
 tests/sandboxes/remote-exec-config.py |   4 +-
 11 files changed, 156 insertions(+), 120 deletions(-)

diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py
index bdcf3ca..e8e4c8b 100644
--- a/buildstream/_frontend/cli.py
+++ b/buildstream/_frontend/cli.py
@@ -356,78 +356,6 @@ def build(app, elements, all_, track_, track_save, track_all, track_except, trac
 
 
 ##################################################################
-#                           Pull Command                         #
-##################################################################
-@cli.command(short_help="Pull a built artifact")
-@click.option('--deps', '-d', default='none',
-              type=click.Choice(['none', 'all']),
-              help='The dependency artifacts to pull (default: none)')
-@click.option('--remote', '-r',
-              help="The URL of the remote cache (defaults to the first configured cache)")
-@click.argument('elements', nargs=-1,
-                type=click.Path(readable=False))
-@click.pass_obj
-def pull(app, elements, deps, remote):
-    """Pull a built artifact from the configured remote artifact cache.
-
-    By default the artifact will be pulled one of the configured caches
-    if possible, following the usual priority order. If the `--remote` flag
-    is given, only the specified cache will be queried.
-
-    Specify `--deps` to control which artifacts to pull:
-
-    \b
-        none:  No dependencies, just the element itself
-        all:   All dependencies
-    """
-
-    with app.initialized(session_name="Pull"):
-        if not elements:
-            guessed_target = app.context.guess_element()
-            if guessed_target:
-                elements = (guessed_target,)
-
-        app.stream.pull(elements, selection=deps, remote=remote)
-
-
-##################################################################
-#                           Push Command                         #
-##################################################################
-@cli.command(short_help="Push a built artifact")
-@click.option('--deps', '-d', default='none',
-              type=click.Choice(['none', 'all']),
-              help='The dependencies to push (default: none)')
-@click.option('--remote', '-r', default=None,
-              help="The URL of the remote cache (defaults to the first configured cache)")
-@click.argument('elements', nargs=-1,
-                type=click.Path(readable=False))
-@click.pass_obj
-def push(app, elements, deps, remote):
-    """Push a built artifact to a remote artifact cache.
-
-    The default destination is the highest priority configured cache. You can
-    override this by passing a different cache URL with the `--remote` flag.
-
-    If bst has been configured to include build trees on artifact pulls,
-    an attempt will be made to pull any required build trees to avoid the
-    skipping of partial artifacts being pushed.
-
-    Specify `--deps` to control which artifacts to push:
-
-    \b
-        none:  No dependencies, just the element itself
-        all:   All dependencies
-    """
-    with app.initialized(session_name="Push"):
-        if not elements:
-            guessed_target = app.context.guess_element()
-            if guessed_target:
-                elements = (guessed_target,)
-
-        app.stream.push(elements, selection=deps, remote=remote)
-
-
-##################################################################
 #                           Show Command                         #
 ##################################################################
 @cli.command(short_help="Show elements in the pipeline")
@@ -1011,6 +939,78 @@ def artifact():
 
 
 ################################################################
+#                     Artifact Pull Command                    #
+################################################################
+@artifact.command(name="pull", short_help="Pull a built artifact")
+@click.option('--deps', '-d', default='none',
+              type=click.Choice(['none', 'all']),
+              help='The dependency artifacts to pull (default: none)')
+@click.option('--remote', '-r',
+              help="The URL of the remote cache (defaults to the first configured cache)")
+@click.argument('elements', nargs=-1,
+                type=click.Path(readable=False))
+@click.pass_obj
+def artifact_pull(app, elements, deps, remote):
+    """Pull a built artifact from the configured remote artifact cache.
+
+    By default the artifact will be pulled one of the configured caches
+    if possible, following the usual priority order. If the `--remote` flag
+    is given, only the specified cache will be queried.
+
+    Specify `--deps` to control which artifacts to pull:
+
+    \b
+        none:  No dependencies, just the element itself
+        all:   All dependencies
+    """
+
+    with app.initialized(session_name="Pull"):
+        if not elements:
+            guessed_target = app.context.guess_element()
+            if guessed_target:
+                elements = (guessed_target,)
+
+        app.stream.pull(elements, selection=deps, remote=remote)
+
+
+##################################################################
+#                     Artifact Push Command                      #
+##################################################################
+@artifact.command(name="push", short_help="Push a built artifact")
+@click.option('--deps', '-d', default='none',
+              type=click.Choice(['none', 'all']),
+              help='The dependencies to push (default: none)')
+@click.option('--remote', '-r', default=None,
+              help="The URL of the remote cache (defaults to the first configured cache)")
+@click.argument('elements', nargs=-1,
+                type=click.Path(readable=False))
+@click.pass_obj
+def artifact_push(app, elements, deps, remote):
+    """Push a built artifact to a remote artifact cache.
+
+    The default destination is the highest priority configured cache. You can
+    override this by passing a different cache URL with the `--remote` flag.
+
+    If bst has been configured to include build trees on artifact pulls,
+    an attempt will be made to pull any required build trees to avoid the
+    skipping of partial artifacts being pushed.
+
+    Specify `--deps` to control which artifacts to push:
+
+    \b
+        none:  No dependencies, just the element itself
+        all:   All dependencies
+    """
+    with app.initialized(session_name="Push"):
+        if not elements:
+            guessed_target = app.context.guess_element()
+            if guessed_target:
+                elements = (guessed_target,)
+
+        app.stream.push(elements, selection=deps, remote=remote)
+
+
+################################################################
 #                     Artifact Log Command                     #
 ################################################################
 @artifact.command(name='log', short_help="Show logs of an artifact")
@@ -1116,3 +1116,37 @@ def fetch(app, elements, deps, track_, except_, track_cross_junctions):
 def track(app, elements, deps, except_, cross_junctions):
     click.echo("This command is now obsolete. Use `bst source track` instead.", err=True)
     sys.exit(1)
+
+
+################################################################
+#                          Pull Command                        #
+################################################################
+@cli.command(short_help="Pull a built artifact", hidden=True)
+@click.option('--deps', '-d', default='none',
+              type=click.Choice(['none', 'all']),
+              help='The dependency artifacts to pull (default: none)')
+@click.option('--remote', '-r',
+              help="The URL of the remote cache (defaults to the first configured cache)")
+@click.argument('elements', nargs=-1,
+                type=click.Path(readable=False))
+@click.pass_obj
+def pull(app, elements, deps, remote):
+    click.echo("This command is now obsolete. Use `bst artifact pull` instead.", err=True)
+    sys.exit(1)
+
+
+##################################################################
+#                           Push Command                         #
+##################################################################
+@cli.command(short_help="Push a built artifact", hidden=True)
+@click.option('--deps', '-d', default='none',
+              type=click.Choice(['none', 'all']),
+              help='The dependencies to push (default: none)')
+@click.option('--remote', '-r', default=None,
+              help="The URL of the remote cache (defaults to the first configured cache)")
+@click.argument('elements', nargs=-1,
+                type=click.Path(readable=False))
+@click.pass_obj
+def push(app, elements, deps, remote):
+    click.echo("This command is now obsolete. Use `bst artifact push` instead.", err=True)
+    sys.exit(1)
diff --git a/tests/artifactcache/config.py b/tests/artifactcache/config.py
index df40d10..bd7d119 100644
--- a/tests/artifactcache/config.py
+++ b/tests/artifactcache/config.py
@@ -138,5 +138,5 @@ def test_missing_certs(cli, datafiles, config_key, config_value):
     # Use `pull` here to ensure we try to initialize the remotes, triggering the error
     #
     # This does not happen for a simple `bst show`.
-    result = cli.run(project=project, args=['pull', 'element.bst'])
+    result = cli.run(project=project, args=['artifact', 'pull', 'element.bst'])
     result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)
diff --git a/tests/artifactcache/junctions.py b/tests/artifactcache/junctions.py
index 378d007..c6d6921 100644
--- a/tests/artifactcache/junctions.py
+++ b/tests/artifactcache/junctions.py
@@ -58,7 +58,7 @@ def test_push_pull(cli, tmpdir, datafiles):
         project_set_artifacts(base_project, base_share.repo)
 
         # Now try bst push
-        result = cli.run(project=project, args=['push', '--deps', 'all', 'target.bst'])
+        result = cli.run(project=project, args=['artifact', 'push', '--deps', 'all', 'target.bst'])
         assert result.exit_code == 0
 
         # And finally assert that the artifacts are in the right shares
@@ -78,7 +78,7 @@ def test_push_pull(cli, tmpdir, datafiles):
         assert state != 'cached'
 
         # Now try bst pull
-        result = cli.run(project=project, args=['pull', '--deps', 'all', 'target.bst'])
+        result = cli.run(project=project, args=['artifact', 'pull', '--deps', 'all', 'target.bst'])
         assert result.exit_code == 0
 
         # And assert that they are again in the local cache, without having built
diff --git a/tests/completions/completions.py b/tests/completions/completions.py
index 372ed78..53d0e97 100644
--- a/tests/completions/completions.py
+++ b/tests/completions/completions.py
@@ -11,8 +11,6 @@ MAIN_COMMANDS = [
     'checkout ',
     'help ',
     'init ',
-    'pull ',
-    'push ',
     'shell ',
     'show ',
     'source ',
@@ -54,6 +52,12 @@ SOURCE_COMMANDS = [
     'track ',
 ]
 
+ARTIFACT_COMMANDS = [
+    'push ',
+    'pull ',
+    'log ',
+]
+
 WORKSPACE_COMMANDS = [
     'close ',
     'list ',
@@ -117,8 +121,7 @@ def assert_completion_failed(cli, cmd, word_idx, expected, cwd=None):
 @pytest.mark.parametrize("cmd,word_idx,expected", [
     ('bst', 0, []),
     ('bst ', 1, MAIN_COMMANDS),
-    ('bst pu', 1, ['pull ', 'push ']),
-    ('bst pul', 1, ['pull ']),
+    ('bst artifact ', 2, ARTIFACT_COMMANDS),
     ('bst source ', 2, SOURCE_COMMANDS),
     ('bst w ', 1, ['workspace ']),
     ('bst workspace ', 2, WORKSPACE_COMMANDS),
@@ -272,9 +275,8 @@ def test_argument_element_invalid(datafiles, cli, project, cmd, word_idx, expect
 @pytest.mark.parametrize("cmd,word_idx,expected", [
     ('bst he', 1, ['help ']),
     ('bst help ', 2, MAIN_COMMANDS),
+    ('bst help artifact ', 3, ARTIFACT_COMMANDS),
     ('bst help in', 2, ['init ']),
-    ('bst help p', 2, ['pull ', 'push ']),
-    ('bst help p', 2, ['pull ', 'push ']),
     ('bst help source ', 3, SOURCE_COMMANDS),
     ('bst help w', 2, ['workspace ']),
     ('bst help workspace ', 3, WORKSPACE_COMMANDS),
diff --git a/tests/frontend/help.py b/tests/frontend/help.py
index e3b406f..331eb43 100644
--- a/tests/frontend/help.py
+++ b/tests/frontend/help.py
@@ -18,10 +18,9 @@ def test_help_main(cli):
 
 
 @pytest.mark.parametrize("command", [
+    ('artifact'),
     ('build'),
     ('checkout'),
-    ('pull'),
-    ('push'),
     ('shell'),
     ('show'),
     ('source'),
diff --git a/tests/frontend/pull.py b/tests/frontend/pull.py
index c883e20..254b6d5 100644
--- a/tests/frontend/pull.py
+++ b/tests/frontend/pull.py
@@ -70,7 +70,7 @@ def test_push_pull_all(cli, tmpdir, datafiles):
             assert cli.get_element_state(project, element_name) != 'cached'
 
         # Now try bst pull
-        result = cli.run(project=project, args=['pull', '--deps', 'all', 'target.bst'])
+        result = cli.run(project=project, args=['artifact', 'pull', '--deps', 'all', 'target.bst'])
         result.assert_success()
 
         # And assert that it's again in the local cache, without having built
@@ -111,7 +111,7 @@ def test_pull_secondary_cache(cli, tmpdir, datafiles):
         assert cli.get_element_state(project, 'target.bst') != 'cached'
 
         # Now try bst pull
-        result = cli.run(project=project, args=['pull', 'target.bst'])
+        result = cli.run(project=project, args=['artifact', 'pull', 'target.bst'])
         result.assert_success()
 
         # And assert that it's again in the local cache, without having built,
@@ -146,7 +146,7 @@ def test_push_pull_specific_remote(cli, tmpdir, datafiles):
 
         # Now try `bst push` to the good_share.
         result = cli.run(project=project, args=[
-            'push', 'target.bst', '--remote', good_share.repo
+            'artifact', 'push', 'target.bst', '--remote', good_share.repo
         ])
         result.assert_success()
 
@@ -161,7 +161,7 @@ def test_push_pull_specific_remote(cli, tmpdir, datafiles):
         artifacts = os.path.join(cli.directory, 'artifacts')
         shutil.rmtree(artifacts)
 
-        result = cli.run(project=project, args=['pull', 'target.bst', '--remote',
+        result = cli.run(project=project, args=['artifact', 'pull', 'target.bst', '--remote',
                                                 good_share.repo])
         result.assert_success()
 
@@ -216,7 +216,7 @@ def test_push_pull_non_strict(cli, tmpdir, datafiles):
         assert cli.get_element_state(project, 'target.bst') == 'waiting'
 
         # Now try bst pull
-        result = cli.run(project=project, args=['pull', '--deps', 'all', 'target.bst'])
+        result = cli.run(project=project, args=['artifact', 'pull', '--deps', 'all', 'target.bst'])
         result.assert_success()
 
         # And assert that the target is again in the local cache, without having built
@@ -291,7 +291,7 @@ def test_push_pull_cross_junction(cli, tmpdir, datafiles):
         assert cli.get_element_state(project, 'junction.bst:import-etc.bst') == 'buildable'
 
         # Now try bst pull
-        result = cli.run(project=project, args=['pull', 'junction.bst:import-etc.bst'])
+        result = cli.run(project=project, args=['artifact', 'pull', 'junction.bst:import-etc.bst'])
         result.assert_success()
 
         # And assert that it's again in the local cache, without having built
diff --git a/tests/frontend/push.py b/tests/frontend/push.py
index 153d433..6ed163a 100644
--- a/tests/frontend/push.py
+++ b/tests/frontend/push.py
@@ -82,7 +82,7 @@ def test_push(cli, tmpdir, datafiles):
         with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare2')) as share2:
 
             # Try pushing with no remotes configured. This should fail.
-            result = cli.run(project=project, args=['push', 'target.bst'])
+            result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
             result.assert_main_error(ErrorDomain.STREAM, None)
 
             # Configure bst to pull but not push from a cache and run `bst push`.
@@ -90,7 +90,7 @@ def test_push(cli, tmpdir, datafiles):
             cli.configure({
                 'artifacts': {'url': share1.repo, 'push': False},
             })
-            result = cli.run(project=project, args=['push', 'target.bst'])
+            result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
             result.assert_main_error(ErrorDomain.STREAM, None)
 
             # Configure bst to push to one of the caches and run `bst push`. This works.
@@ -100,7 +100,7 @@ def test_push(cli, tmpdir, datafiles):
                     {'url': share2.repo, 'push': True},
                 ]
             })
-            result = cli.run(project=project, args=['push', 'target.bst'])
+            result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
 
             assert_not_shared(cli, share1, project, 'target.bst')
             assert_shared(cli, share2, project, 'target.bst')
@@ -114,7 +114,7 @@ def test_push(cli, tmpdir, datafiles):
                     {'url': share2.repo, 'push': True},
                 ]
             })
-            result = cli.run(project=project, args=['push', 'target.bst'])
+            result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
 
             assert_shared(cli, share1, project, 'target.bst')
             assert_shared(cli, share2, project, 'target.bst')
@@ -156,7 +156,7 @@ def test_push_all(cli, tmpdir, datafiles):
 
         # Now try bst push all the deps
         result = cli.run(project=project, args=[
-            'push', 'target.bst',
+            'artifact', 'push', 'target.bst',
             '--deps', 'all'
         ])
         result.assert_success()
@@ -346,7 +346,7 @@ def test_recently_pulled_artifact_does_not_expire(cli, datafiles, tmpdir):
         assert cli.get_element_state(project, 'element1.bst') != 'cached'
 
         # Pull the element1 from the remote cache (this should update its mtime)
-        result = cli.run(project=project, args=['pull', 'element1.bst', '--remote',
+        result = cli.run(project=project, args=['artifact', 'pull', 'element1.bst', '--remote',
                                                 share.repo])
         result.assert_success()
 
@@ -386,7 +386,7 @@ def test_push_cross_junction(cli, tmpdir, datafiles):
         cli.configure({
             'artifacts': {'url': share.repo, 'push': True},
         })
-        result = cli.run(project=project, args=['push', 'junction.bst:import-etc.bst'])
+        result = cli.run(project=project, args=['artifact', 'push', 'junction.bst:import-etc.bst'])
 
         cache_key = cli.get_element_key(project, 'junction.bst:import-etc.bst')
         assert share.has_artifact('subtest', 'import-etc.bst', cache_key)
@@ -407,7 +407,7 @@ def test_push_already_cached(caplog, cli, tmpdir, datafiles):
         result.assert_success()
         assert "SKIPPED Push" not in result.stderr
 
-        result = cli.run(project=project, args=['push', 'target.bst'])
+        result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
 
         result.assert_success()
         assert not result.get_pushed_elements(), "No elements should have been pushed since the cache was populated"
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index 00c0bd8..912cc9f 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -1105,10 +1105,10 @@ def test_external_push_pull(cli, datafiles, tmpdir_factory, guess_element):
             'artifacts': {'url': share.repo, 'push': True}
         })
 
-        result = cli.run(project=project, args=['-C', workspace, 'push'] + arg_elm)
+        result = cli.run(project=project, args=['-C', workspace, 'artifact', 'push'] + arg_elm)
         result.assert_success()
 
-        result = cli.run(project=project, args=['-C', workspace, 'pull', '--deps', 'all'] + arg_elm)
+        result = cli.run(project=project, args=['-C', workspace, 'artifact', 'pull', '--deps', 'all'] + arg_elm)
         result.assert_success()
 
 
diff --git a/tests/integration/build-tree.py b/tests/integration/build-tree.py
index 8c0628d..b50d841 100644
--- a/tests/integration/build-tree.py
+++ b/tests/integration/build-tree.py
@@ -130,7 +130,8 @@ def test_buildtree_pulled(cli, tmpdir, datafiles):
         assert cli.get_element_state(project, element_name) != 'cached'
 
         # Pull from cache, ensuring cli options is set to pull the buildtree
-        result = cli.run(project=project, args=['--pull-buildtrees', 'pull', '--deps', 'all', element_name])
+        result = cli.run(project=project,
+                         args=['--pull-buildtrees', 'artifact', 'pull', '--deps', 'all', element_name])
         result.assert_success()
 
         # Check it's using the cached build tree
@@ -164,7 +165,7 @@ def test_buildtree_options(cli, tmpdir, datafiles):
         assert cli.get_element_state(project, element_name) != 'cached'
 
         # Pull from cache, but do not include buildtrees.
-        result = cli.run(project=project, args=['pull', '--deps', 'all', element_name])
+        result = cli.run(project=project, args=['artifact', 'pull', '--deps', 'all', element_name])
         result.assert_success()
 
         # The above is the simplest way I know to create a local cache without any buildtrees.
diff --git a/tests/integration/pullbuildtrees.py b/tests/integration/pullbuildtrees.py
index f6fc712..89710a7 100644
--- a/tests/integration/pullbuildtrees.py
+++ b/tests/integration/pullbuildtrees.py
@@ -55,12 +55,12 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache):
         # Pull artifact with default config, assert that pulling again
         # doesn't create a pull job, then assert with buildtrees user
         # config set creates a pull job.
-        result = cli.run(project=project, args=['pull', element_name])
+        result = cli.run(project=project, args=['artifact', 'pull', element_name])
         assert element_name in result.get_pulled_elements()
-        result = cli.run(project=project, args=['pull', element_name])
+        result = cli.run(project=project, args=['artifact', 'pull', element_name])
         assert element_name not in result.get_pulled_elements()
         cli.configure({'cache': {'pull-buildtrees': True}})
-        result = cli.run(project=project, args=['pull', element_name])
+        result = cli.run(project=project, args=['artifact', 'pull', element_name])
         assert element_name in result.get_pulled_elements()
         default_state(cli, tmpdir, share1)
 
@@ -68,13 +68,13 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache):
         # with buildtrees cli flag set creates a pull job.
         # Also assert that the buildtree is added to the artifact's
         # extract dir
-        result = cli.run(project=project, args=['pull', element_name])
+        result = cli.run(project=project, args=['artifact', 'pull', element_name])
         assert element_name in result.get_pulled_elements()
         elementdigest = share1.has_artifact('test', element_name, cli.get_element_key(project, element_name))
         buildtreedir = os.path.join(str(tmpdir), 'artifacts', 'extract', 'test', 'autotools-amhello',
                                     elementdigest.hash, 'buildtree')
         assert not os.path.isdir(buildtreedir)
-        result = cli.run(project=project, args=['--pull-buildtrees', 'pull', element_name])
+        result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
         assert element_name in result.get_pulled_elements()
         assert os.path.isdir(buildtreedir)
         default_state(cli, tmpdir, share1)
@@ -83,21 +83,21 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache):
         # that pulling with the same user config doesn't creates a pull job,
         # or when buildtrees cli flag is set.
         cli.configure({'cache': {'pull-buildtrees': True}})
-        result = cli.run(project=project, args=['pull', element_name])
+        result = cli.run(project=project, args=['artifact', 'pull', element_name])
         assert element_name in result.get_pulled_elements()
-        result = cli.run(project=project, args=['pull', element_name])
+        result = cli.run(project=project, args=['artifact', 'pull', element_name])
         assert element_name not in result.get_pulled_elements()
-        result = cli.run(project=project, args=['--pull-buildtrees', 'pull', element_name])
+        result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
         assert element_name not in result.get_pulled_elements()
         default_state(cli, tmpdir, share1)
 
         # Pull artifact with default config and buildtrees cli flag set, then assert
         # that pulling with pullbuildtrees set in user config doesn't create a pull
         # job.
-        result = cli.run(project=project, args=['--pull-buildtrees', 'pull', element_name])
+        result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
         assert element_name in result.get_pulled_elements()
         cli.configure({'cache': {'pull-buildtrees': True}})
-        result = cli.run(project=project, args=['pull', element_name])
+        result = cli.run(project=project, args=['artifact', 'pull', element_name])
         assert element_name not in result.get_pulled_elements()
         default_state(cli, tmpdir, share1)
 
@@ -105,10 +105,10 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache):
         # can't be pushed to an artifact share, then assert that a complete build element
         # can be. This will attempt a partial pull from share1 and then a partial push
         # to share2
-        result = cli.run(project=project, args=['pull', element_name])
+        result = cli.run(project=project, args=['artifact', 'pull', element_name])
         assert element_name in result.get_pulled_elements()
         cli.configure({'artifacts': {'url': share2.repo, 'push': True}})
-        result = cli.run(project=project, args=['push', element_name])
+        result = cli.run(project=project, args=['artifact', 'push', element_name])
         assert element_name not in result.get_pushed_elements()
         assert not share2.has_artifact('test', element_name, cli.get_element_key(project, element_name))
 
@@ -116,10 +116,10 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache):
         # successfully pushed to the remote. This will attempt to pull the buildtree
         # from share1 and then a 'complete' push to share2
         cli.configure({'artifacts': {'url': share1.repo, 'push': False}})
-        result = cli.run(project=project, args=['--pull-buildtrees', 'pull', element_name])
+        result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
         assert element_name in result.get_pulled_elements()
         cli.configure({'artifacts': {'url': share2.repo, 'push': True}})
-        result = cli.run(project=project, args=['push', element_name])
+        result = cli.run(project=project, args=['artifact', 'push', element_name])
         assert element_name in result.get_pushed_elements()
         assert share2.has_artifact('test', element_name, cli.get_element_key(project, element_name))
         default_state(cli, tmpdir, share1)
@@ -128,10 +128,10 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache):
         # if pull-buildtrees is set, however as share3 is the only defined remote and is empty,
         # assert that no element artifact buildtrees are pulled (no available remote buildtree) and thus the
         # artifact cannot be pushed.
-        result = cli.run(project=project, args=['pull', element_name])
+        result = cli.run(project=project, args=['artifact', 'pull', element_name])
         assert element_name in result.get_pulled_elements()
         cli.configure({'artifacts': {'url': share3.repo, 'push': True}})
-        result = cli.run(project=project, args=['--pull-buildtrees', 'push', element_name])
+        result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'push', element_name])
         assert "Attempting to fetch missing artifact buildtrees" in result.stderr
         assert element_name not in result.get_pulled_elements()
         assert not os.path.isdir(buildtreedir)
@@ -143,7 +143,7 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache):
         # to the empty share3. This gives the ability to attempt push currently partial artifacts to a remote,
         # without exlipictly requiring a bst pull.
         cli.configure({'artifacts': [{'url': share1.repo, 'push': False}, {'url': share3.repo, 'push': True}]})
-        result = cli.run(project=project, args=['--pull-buildtrees', 'push', element_name])
+        result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'push', element_name])
         assert "Attempting to fetch missing artifact buildtrees" in result.stderr
         assert element_name in result.get_pulled_elements()
         assert os.path.isdir(buildtreedir)
diff --git a/tests/sandboxes/remote-exec-config.py b/tests/sandboxes/remote-exec-config.py
index 31cb072..9cf0a8f 100644
--- a/tests/sandboxes/remote-exec-config.py
+++ b/tests/sandboxes/remote-exec-config.py
@@ -42,7 +42,7 @@ def test_old_and_new_configs(cli, datafiles):
     # Use `pull` here to ensure we try to initialize the remotes, triggering the error
     #
     # This does not happen for a simple `bst show`.
-    result = cli.run(project=project, args=['pull', 'element.bst'])
+    result = cli.run(project=project, args=['artifact', 'pull', 'element.bst'])
     result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA, "specify one")
 
 
@@ -97,5 +97,5 @@ def test_empty_config(cli, datafiles):
     # Use `pull` here to ensure we try to initialize the remotes, triggering the error
     #
     # This does not happen for a simple `bst show`.
-    result = cli.run(project=project, args=['pull', 'element.bst'])
+    result = cli.run(project=project, args=['artifact', 'pull', 'element.bst'])
     result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA, "specify one")