James Ennis pushed to branch jennis/migrate_pull_push_commands at BuildStream / buildstream
Commits:
-
266ef97f
by James Ennis at 2019-01-08T09:46:29Z
11 changed files:
- buildstream/_frontend/cli.py
- tests/artifactcache/config.py
- tests/artifactcache/junctions.py
- tests/completions/completions.py
- tests/frontend/help.py
- tests/frontend/pull.py
- tests/frontend/push.py
- tests/frontend/workspace.py
- tests/integration/build-tree.py
- tests/integration/pullbuildtrees.py
- tests/sandboxes/remote-exec-config.py
Changes:
| ... | ... | @@ -355,78 +355,6 @@ def build(app, elements, all_, track_, track_save, track_all, track_except, trac |
| 355 | 355 |
build_all=all_)
|
| 356 | 356 |
|
| 357 | 357 |
|
| 358 |
-##################################################################
|
|
| 359 |
-# Pull Command #
|
|
| 360 |
-##################################################################
|
|
| 361 |
-@cli.command(short_help="Pull a built artifact")
|
|
| 362 |
-@click.option('--deps', '-d', default='none',
|
|
| 363 |
- type=click.Choice(['none', 'all']),
|
|
| 364 |
- help='The dependency artifacts to pull (default: none)')
|
|
| 365 |
-@click.option('--remote', '-r',
|
|
| 366 |
- help="The URL of the remote cache (defaults to the first configured cache)")
|
|
| 367 |
-@click.argument('elements', nargs=-1,
|
|
| 368 |
- type=click.Path(readable=False))
|
|
| 369 |
-@click.pass_obj
|
|
| 370 |
-def pull(app, elements, deps, remote):
|
|
| 371 |
- """Pull a built artifact from the configured remote artifact cache.
|
|
| 372 |
- |
|
| 373 |
- By default the artifact will be pulled one of the configured caches
|
|
| 374 |
- if possible, following the usual priority order. If the `--remote` flag
|
|
| 375 |
- is given, only the specified cache will be queried.
|
|
| 376 |
- |
|
| 377 |
- Specify `--deps` to control which artifacts to pull:
|
|
| 378 |
- |
|
| 379 |
- \b
|
|
| 380 |
- none: No dependencies, just the element itself
|
|
| 381 |
- all: All dependencies
|
|
| 382 |
- """
|
|
| 383 |
- |
|
| 384 |
- with app.initialized(session_name="Pull"):
|
|
| 385 |
- if not elements:
|
|
| 386 |
- guessed_target = app.context.guess_element()
|
|
| 387 |
- if guessed_target:
|
|
| 388 |
- elements = (guessed_target,)
|
|
| 389 |
- |
|
| 390 |
- app.stream.pull(elements, selection=deps, remote=remote)
|
|
| 391 |
- |
|
| 392 |
- |
|
| 393 |
-##################################################################
|
|
| 394 |
-# Push Command #
|
|
| 395 |
-##################################################################
|
|
| 396 |
-@cli.command(short_help="Push a built artifact")
|
|
| 397 |
-@click.option('--deps', '-d', default='none',
|
|
| 398 |
- type=click.Choice(['none', 'all']),
|
|
| 399 |
- help='The dependencies to push (default: none)')
|
|
| 400 |
-@click.option('--remote', '-r', default=None,
|
|
| 401 |
- help="The URL of the remote cache (defaults to the first configured cache)")
|
|
| 402 |
-@click.argument('elements', nargs=-1,
|
|
| 403 |
- type=click.Path(readable=False))
|
|
| 404 |
-@click.pass_obj
|
|
| 405 |
-def push(app, elements, deps, remote):
|
|
| 406 |
- """Push a built artifact to a remote artifact cache.
|
|
| 407 |
- |
|
| 408 |
- The default destination is the highest priority configured cache. You can
|
|
| 409 |
- override this by passing a different cache URL with the `--remote` flag.
|
|
| 410 |
- |
|
| 411 |
- If bst has been configured to include build trees on artifact pulls,
|
|
| 412 |
- an attempt will be made to pull any required build trees to avoid the
|
|
| 413 |
- skipping of partial artifacts being pushed.
|
|
| 414 |
- |
|
| 415 |
- Specify `--deps` to control which artifacts to push:
|
|
| 416 |
- |
|
| 417 |
- \b
|
|
| 418 |
- none: No dependencies, just the element itself
|
|
| 419 |
- all: All dependencies
|
|
| 420 |
- """
|
|
| 421 |
- with app.initialized(session_name="Push"):
|
|
| 422 |
- if not elements:
|
|
| 423 |
- guessed_target = app.context.guess_element()
|
|
| 424 |
- if guessed_target:
|
|
| 425 |
- elements = (guessed_target,)
|
|
| 426 |
- |
|
| 427 |
- app.stream.push(elements, selection=deps, remote=remote)
|
|
| 428 |
- |
|
| 429 |
- |
|
| 430 | 358 |
##################################################################
|
| 431 | 359 |
# Show Command #
|
| 432 | 360 |
##################################################################
|
| ... | ... | @@ -1008,6 +936,69 @@ def _classify_artifacts(names, cas, project_directory): |
| 1008 | 936 |
@cli.group(short_help="Manipulate cached artifacts")
|
| 1009 | 937 |
def artifact():
|
| 1010 | 938 |
"""Manipulate cached artifacts"""
|
| 939 |
+ pass
|
|
| 940 |
+ |
|
| 941 |
+ |
|
| 942 |
+################################################################
|
|
| 943 |
+# Artifact Pull Command #
|
|
| 944 |
+################################################################
|
|
| 945 |
+@artifact.command(name="pull", short_help="Pull a built artifact")
|
|
| 946 |
+@click.option('--deps', '-d', default='none',
|
|
| 947 |
+ type=click.Choice(['none', 'all']),
|
|
| 948 |
+ help='The dependency artifacts to pull (default: none)')
|
|
| 949 |
+@click.option('--remote', '-r',
|
|
| 950 |
+ help="The URL of the remote cache (defaults to the first configured cache)")
|
|
| 951 |
+@click.argument('elements', nargs=-1,
|
|
| 952 |
+ type=click.Path(readable=False))
|
|
| 953 |
+@click.pass_obj
|
|
| 954 |
+def pull(app, elements, deps, remote):
|
|
| 955 |
+ """Pull a built artifact from the configured remote artifact cache.
|
|
| 956 |
+ |
|
| 957 |
+ By default the artifact will be pulled one of the configured caches
|
|
| 958 |
+ if possible, following the usual priority order. If the `--remote` flag
|
|
| 959 |
+ is given, only the specified cache will be queried.
|
|
| 960 |
+ |
|
| 961 |
+ Specify `--deps` to control which artifacts to pull:
|
|
| 962 |
+ |
|
| 963 |
+ \b
|
|
| 964 |
+ none: No dependencies, just the element itself
|
|
| 965 |
+ all: All dependencies
|
|
| 966 |
+ """
|
|
| 967 |
+ |
|
| 968 |
+ with app.initialized(session_name="Pull"):
|
|
| 969 |
+ app.stream.pull(elements, selection=deps, remote=remote)
|
|
| 970 |
+ |
|
| 971 |
+ |
|
| 972 |
+##################################################################
|
|
| 973 |
+# Push Command #
|
|
| 974 |
+##################################################################
|
|
| 975 |
+@artifact.command(name="push", short_help="Push a built artifact")
|
|
| 976 |
+@click.option('--deps', '-d', default='none',
|
|
| 977 |
+ type=click.Choice(['none', 'all']),
|
|
| 978 |
+ help='The dependencies to push (default: none)')
|
|
| 979 |
+@click.option('--remote', '-r', default=None,
|
|
| 980 |
+ help="The URL of the remote cache (defaults to the first configured cache)")
|
|
| 981 |
+@click.argument('elements', nargs=-1,
|
|
| 982 |
+ type=click.Path(readable=False))
|
|
| 983 |
+@click.pass_obj
|
|
| 984 |
+def push(app, elements, deps, remote):
|
|
| 985 |
+ """Push a built artifact to a remote artifact cache.
|
|
| 986 |
+ |
|
| 987 |
+ The default destination is the highest priority configured cache. You can
|
|
| 988 |
+ override this by passing a different cache URL with the `--remote` flag.
|
|
| 989 |
+ |
|
| 990 |
+ If bst has been configured to include build trees on artifact pulls,
|
|
| 991 |
+ an attempt will be made to pull any required build trees to avoid the
|
|
| 992 |
+ skipping of partial artifacts being pushed.
|
|
| 993 |
+ |
|
| 994 |
+ Specify `--deps` to control which artifacts to push:
|
|
| 995 |
+ |
|
| 996 |
+ \b
|
|
| 997 |
+ none: No dependencies, just the element itself
|
|
| 998 |
+ all: All dependencies
|
|
| 999 |
+ """
|
|
| 1000 |
+ with app.initialized(session_name="Push"):
|
|
| 1001 |
+ app.stream.push(elements, selection=deps, remote=remote)
|
|
| 1011 | 1002 |
|
| 1012 | 1003 |
|
| 1013 | 1004 |
################################################################
|
| ... | ... | @@ -1116,3 +1107,37 @@ def fetch(app, elements, deps, track_, except_, track_cross_junctions): |
| 1116 | 1107 |
def track(app, elements, deps, except_, cross_junctions):
|
| 1117 | 1108 |
click.echo("This command is now obsolete. Use `bst source track` instead.", err=True)
|
| 1118 | 1109 |
sys.exit(1)
|
| 1110 |
+ |
|
| 1111 |
+ |
|
| 1112 |
+################################################################
|
|
| 1113 |
+# Pull Command #
|
|
| 1114 |
+################################################################
|
|
| 1115 |
+@cli.command(short_help="Pull a built artifact")
|
|
| 1116 |
+@click.option('--deps', '-d', default='none',
|
|
| 1117 |
+ type=click.Choice(['none', 'all']),
|
|
| 1118 |
+ help='The dependency artifacts to pull (default: none)')
|
|
| 1119 |
+@click.option('--remote', '-r',
|
|
| 1120 |
+ help="The URL of the remote cache (defaults to the first configured cache)")
|
|
| 1121 |
+@click.argument('elements', nargs=-1,
|
|
| 1122 |
+ type=click.Path(readable=False))
|
|
| 1123 |
+@click.pass_obj
|
|
| 1124 |
+def pull(app, elements, deps, remote):
|
|
| 1125 |
+ click.echo("This command is now obsolete. Use `bst artifact pull` instead.", err=True)
|
|
| 1126 |
+ sys.exit(1)
|
|
| 1127 |
+ |
|
| 1128 |
+ |
|
| 1129 |
+##################################################################
|
|
| 1130 |
+# Push Command #
|
|
| 1131 |
+##################################################################
|
|
| 1132 |
+@cli.command(short_help="Push a built artifact")
|
|
| 1133 |
+@click.option('--deps', '-d', default='none',
|
|
| 1134 |
+ type=click.Choice(['none', 'all']),
|
|
| 1135 |
+ help='The dependencies to push (default: none)')
|
|
| 1136 |
+@click.option('--remote', '-r', default=None,
|
|
| 1137 |
+ help="The URL of the remote cache (defaults to the first configured cache)")
|
|
| 1138 |
+@click.argument('elements', nargs=-1,
|
|
| 1139 |
+ type=click.Path(readable=False))
|
|
| 1140 |
+@click.pass_obj
|
|
| 1141 |
+def push(app, elements, deps, remote):
|
|
| 1142 |
+ click.echo("This command is now obsolete. Use `bst artifact push` instead.", err=True)
|
|
| 1143 |
+ sys.exit(1)
|
| ... | ... | @@ -138,5 +138,5 @@ def test_missing_certs(cli, datafiles, config_key, config_value): |
| 138 | 138 |
# Use `pull` here to ensure we try to initialize the remotes, triggering the error
|
| 139 | 139 |
#
|
| 140 | 140 |
# This does not happen for a simple `bst show`.
|
| 141 |
- result = cli.run(project=project, args=['pull', 'element.bst'])
|
|
| 141 |
+ result = cli.run(project=project, args=['artifact', 'pull', 'element.bst'])
|
|
| 142 | 142 |
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)
|
| ... | ... | @@ -58,7 +58,7 @@ def test_push_pull(cli, tmpdir, datafiles): |
| 58 | 58 |
project_set_artifacts(base_project, base_share.repo)
|
| 59 | 59 |
|
| 60 | 60 |
# Now try bst push
|
| 61 |
- result = cli.run(project=project, args=['push', '--deps', 'all', 'target.bst'])
|
|
| 61 |
+ result = cli.run(project=project, args=['artifact', 'push', '--deps', 'all', 'target.bst'])
|
|
| 62 | 62 |
assert result.exit_code == 0
|
| 63 | 63 |
|
| 64 | 64 |
# And finally assert that the artifacts are in the right shares
|
| ... | ... | @@ -78,7 +78,7 @@ def test_push_pull(cli, tmpdir, datafiles): |
| 78 | 78 |
assert state != 'cached'
|
| 79 | 79 |
|
| 80 | 80 |
# Now try bst pull
|
| 81 |
- result = cli.run(project=project, args=['pull', '--deps', 'all', 'target.bst'])
|
|
| 81 |
+ result = cli.run(project=project, args=['artifact', 'pull', '--deps', 'all', 'target.bst'])
|
|
| 82 | 82 |
assert result.exit_code == 0
|
| 83 | 83 |
|
| 84 | 84 |
# And assert that they are again in the local cache, without having built
|
| ... | ... | @@ -11,8 +11,6 @@ MAIN_COMMANDS = [ |
| 11 | 11 |
'checkout ',
|
| 12 | 12 |
'help ',
|
| 13 | 13 |
'init ',
|
| 14 |
- 'pull ',
|
|
| 15 |
- 'push ',
|
|
| 16 | 14 |
'shell ',
|
| 17 | 15 |
'show ',
|
| 18 | 16 |
'source ',
|
| ... | ... | @@ -54,6 +52,12 @@ SOURCE_COMMANDS = [ |
| 54 | 52 |
'track ',
|
| 55 | 53 |
]
|
| 56 | 54 |
|
| 55 |
+ARTIFACT_COMMANDS = [
|
|
| 56 |
+ 'push ',
|
|
| 57 |
+ 'pull ',
|
|
| 58 |
+ 'log ',
|
|
| 59 |
+]
|
|
| 60 |
+ |
|
| 57 | 61 |
WORKSPACE_COMMANDS = [
|
| 58 | 62 |
'close ',
|
| 59 | 63 |
'list ',
|
| ... | ... | @@ -117,8 +121,7 @@ def assert_completion_failed(cli, cmd, word_idx, expected, cwd=None): |
| 117 | 121 |
@pytest.mark.parametrize("cmd,word_idx,expected", [
|
| 118 | 122 |
('bst', 0, []),
|
| 119 | 123 |
('bst ', 1, MAIN_COMMANDS),
|
| 120 |
- ('bst pu', 1, ['pull ', 'push ']),
|
|
| 121 |
- ('bst pul', 1, ['pull ']),
|
|
| 124 |
+ ('bst artifact', 2, ARTIFACT_COMMANDS),
|
|
| 122 | 125 |
('bst source ', 2, SOURCE_COMMANDS),
|
| 123 | 126 |
('bst w ', 1, ['workspace ']),
|
| 124 | 127 |
('bst workspace ', 2, WORKSPACE_COMMANDS),
|
| ... | ... | @@ -272,9 +275,8 @@ def test_argument_element_invalid(datafiles, cli, project, cmd, word_idx, expect |
| 272 | 275 |
@pytest.mark.parametrize("cmd,word_idx,expected", [
|
| 273 | 276 |
('bst he', 1, ['help ']),
|
| 274 | 277 |
('bst help ', 2, MAIN_COMMANDS),
|
| 278 |
+ ('bst help artifact', 2, ARTIFACT_COMMANDS),
|
|
| 275 | 279 |
('bst help in', 2, ['init ']),
|
| 276 |
- ('bst help p', 2, ['pull ', 'push ']),
|
|
| 277 |
- ('bst help p', 2, ['pull ', 'push ']),
|
|
| 278 | 280 |
('bst help source ', 3, SOURCE_COMMANDS),
|
| 279 | 281 |
('bst help w', 2, ['workspace ']),
|
| 280 | 282 |
('bst help workspace ', 3, WORKSPACE_COMMANDS),
|
| ... | ... | @@ -18,10 +18,9 @@ def test_help_main(cli): |
| 18 | 18 |
|
| 19 | 19 |
|
| 20 | 20 |
@pytest.mark.parametrize("command", [
|
| 21 |
+ ('artifact'),
|
|
| 21 | 22 |
('build'),
|
| 22 | 23 |
('checkout'),
|
| 23 |
- ('pull'),
|
|
| 24 |
- ('push'),
|
|
| 25 | 24 |
('shell'),
|
| 26 | 25 |
('show'),
|
| 27 | 26 |
('source'),
|
| ... | ... | @@ -70,7 +70,7 @@ def test_push_pull_all(cli, tmpdir, datafiles): |
| 70 | 70 |
assert cli.get_element_state(project, element_name) != 'cached'
|
| 71 | 71 |
|
| 72 | 72 |
# Now try bst pull
|
| 73 |
- result = cli.run(project=project, args=['pull', '--deps', 'all', 'target.bst'])
|
|
| 73 |
+ result = cli.run(project=project, args=['artifact', 'pull', '--deps', 'all', 'target.bst'])
|
|
| 74 | 74 |
result.assert_success()
|
| 75 | 75 |
|
| 76 | 76 |
# 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): |
| 111 | 111 |
assert cli.get_element_state(project, 'target.bst') != 'cached'
|
| 112 | 112 |
|
| 113 | 113 |
# Now try bst pull
|
| 114 |
- result = cli.run(project=project, args=['pull', 'target.bst'])
|
|
| 114 |
+ result = cli.run(project=project, args=['artifact', 'pull', 'target.bst'])
|
|
| 115 | 115 |
result.assert_success()
|
| 116 | 116 |
|
| 117 | 117 |
# 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): |
| 146 | 146 |
|
| 147 | 147 |
# Now try `bst push` to the good_share.
|
| 148 | 148 |
result = cli.run(project=project, args=[
|
| 149 |
- 'push', 'target.bst', '--remote', good_share.repo
|
|
| 149 |
+ 'artifact', 'push', 'target.bst', '--remote', good_share.repo
|
|
| 150 | 150 |
])
|
| 151 | 151 |
result.assert_success()
|
| 152 | 152 |
|
| ... | ... | @@ -161,7 +161,7 @@ def test_push_pull_specific_remote(cli, tmpdir, datafiles): |
| 161 | 161 |
artifacts = os.path.join(cli.directory, 'artifacts')
|
| 162 | 162 |
shutil.rmtree(artifacts)
|
| 163 | 163 |
|
| 164 |
- result = cli.run(project=project, args=['pull', 'target.bst', '--remote',
|
|
| 164 |
+ result = cli.run(project=project, args=['artifact', 'pull', 'target.bst', '--remote',
|
|
| 165 | 165 |
good_share.repo])
|
| 166 | 166 |
result.assert_success()
|
| 167 | 167 |
|
| ... | ... | @@ -216,7 +216,7 @@ def test_push_pull_non_strict(cli, tmpdir, datafiles): |
| 216 | 216 |
assert cli.get_element_state(project, 'target.bst') == 'waiting'
|
| 217 | 217 |
|
| 218 | 218 |
# Now try bst pull
|
| 219 |
- result = cli.run(project=project, args=['pull', '--deps', 'all', 'target.bst'])
|
|
| 219 |
+ result = cli.run(project=project, args=['artifact', 'pull', '--deps', 'all', 'target.bst'])
|
|
| 220 | 220 |
result.assert_success()
|
| 221 | 221 |
|
| 222 | 222 |
# 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): |
| 291 | 291 |
assert cli.get_element_state(project, 'junction.bst:import-etc.bst') == 'buildable'
|
| 292 | 292 |
|
| 293 | 293 |
# Now try bst pull
|
| 294 |
- result = cli.run(project=project, args=['pull', 'junction.bst:import-etc.bst'])
|
|
| 294 |
+ result = cli.run(project=project, args=['artifact', 'pull', 'junction.bst:import-etc.bst'])
|
|
| 295 | 295 |
result.assert_success()
|
| 296 | 296 |
|
| 297 | 297 |
# And assert that it's again in the local cache, without having built
|
| ... | ... | @@ -82,7 +82,7 @@ def test_push(cli, tmpdir, datafiles): |
| 82 | 82 |
with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare2')) as share2:
|
| 83 | 83 |
|
| 84 | 84 |
# Try pushing with no remotes configured. This should fail.
|
| 85 |
- result = cli.run(project=project, args=['push', 'target.bst'])
|
|
| 85 |
+ result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
|
|
| 86 | 86 |
result.assert_main_error(ErrorDomain.STREAM, None)
|
| 87 | 87 |
|
| 88 | 88 |
# Configure bst to pull but not push from a cache and run `bst push`.
|
| ... | ... | @@ -90,7 +90,7 @@ def test_push(cli, tmpdir, datafiles): |
| 90 | 90 |
cli.configure({
|
| 91 | 91 |
'artifacts': {'url': share1.repo, 'push': False},
|
| 92 | 92 |
})
|
| 93 |
- result = cli.run(project=project, args=['push', 'target.bst'])
|
|
| 93 |
+ result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
|
|
| 94 | 94 |
result.assert_main_error(ErrorDomain.STREAM, None)
|
| 95 | 95 |
|
| 96 | 96 |
# 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): |
| 100 | 100 |
{'url': share2.repo, 'push': True},
|
| 101 | 101 |
]
|
| 102 | 102 |
})
|
| 103 |
- result = cli.run(project=project, args=['push', 'target.bst'])
|
|
| 103 |
+ result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
|
|
| 104 | 104 |
|
| 105 | 105 |
assert_not_shared(cli, share1, project, 'target.bst')
|
| 106 | 106 |
assert_shared(cli, share2, project, 'target.bst')
|
| ... | ... | @@ -114,7 +114,7 @@ def test_push(cli, tmpdir, datafiles): |
| 114 | 114 |
{'url': share2.repo, 'push': True},
|
| 115 | 115 |
]
|
| 116 | 116 |
})
|
| 117 |
- result = cli.run(project=project, args=['push', 'target.bst'])
|
|
| 117 |
+ result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
|
|
| 118 | 118 |
|
| 119 | 119 |
assert_shared(cli, share1, project, 'target.bst')
|
| 120 | 120 |
assert_shared(cli, share2, project, 'target.bst')
|
| ... | ... | @@ -156,7 +156,7 @@ def test_push_all(cli, tmpdir, datafiles): |
| 156 | 156 |
|
| 157 | 157 |
# Now try bst push all the deps
|
| 158 | 158 |
result = cli.run(project=project, args=[
|
| 159 |
- 'push', 'target.bst',
|
|
| 159 |
+ 'artifact', 'push', 'target.bst',
|
|
| 160 | 160 |
'--deps', 'all'
|
| 161 | 161 |
])
|
| 162 | 162 |
result.assert_success()
|
| ... | ... | @@ -346,7 +346,7 @@ def test_recently_pulled_artifact_does_not_expire(cli, datafiles, tmpdir): |
| 346 | 346 |
assert cli.get_element_state(project, 'element1.bst') != 'cached'
|
| 347 | 347 |
|
| 348 | 348 |
# Pull the element1 from the remote cache (this should update its mtime)
|
| 349 |
- result = cli.run(project=project, args=['pull', 'element1.bst', '--remote',
|
|
| 349 |
+ result = cli.run(project=project, args=['artifact', 'pull', 'element1.bst', '--remote',
|
|
| 350 | 350 |
share.repo])
|
| 351 | 351 |
result.assert_success()
|
| 352 | 352 |
|
| ... | ... | @@ -386,7 +386,7 @@ def test_push_cross_junction(cli, tmpdir, datafiles): |
| 386 | 386 |
cli.configure({
|
| 387 | 387 |
'artifacts': {'url': share.repo, 'push': True},
|
| 388 | 388 |
})
|
| 389 |
- result = cli.run(project=project, args=['push', 'junction.bst:import-etc.bst'])
|
|
| 389 |
+ result = cli.run(project=project, args=['artifact', 'push', 'junction.bst:import-etc.bst'])
|
|
| 390 | 390 |
|
| 391 | 391 |
cache_key = cli.get_element_key(project, 'junction.bst:import-etc.bst')
|
| 392 | 392 |
assert share.has_artifact('subtest', 'import-etc.bst', cache_key)
|
| ... | ... | @@ -407,7 +407,7 @@ def test_push_already_cached(caplog, cli, tmpdir, datafiles): |
| 407 | 407 |
result.assert_success()
|
| 408 | 408 |
assert "SKIPPED Push" not in result.stderr
|
| 409 | 409 |
|
| 410 |
- result = cli.run(project=project, args=['push', 'target.bst'])
|
|
| 410 |
+ result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
|
|
| 411 | 411 |
|
| 412 | 412 |
result.assert_success()
|
| 413 | 413 |
assert not result.get_pushed_elements(), "No elements should have been pushed since the cache was populated"
|
| ... | ... | @@ -1105,10 +1105,10 @@ def test_external_push_pull(cli, datafiles, tmpdir_factory, guess_element): |
| 1105 | 1105 |
'artifacts': {'url': share.repo, 'push': True}
|
| 1106 | 1106 |
})
|
| 1107 | 1107 |
|
| 1108 |
- result = cli.run(project=project, args=['-C', workspace, 'push'] + arg_elm)
|
|
| 1108 |
+ result = cli.run(project=project, args=['-C', workspace, 'artifact', 'push'] + arg_elm)
|
|
| 1109 | 1109 |
result.assert_success()
|
| 1110 | 1110 |
|
| 1111 |
- result = cli.run(project=project, args=['-C', workspace, 'pull', '--deps', 'all'] + arg_elm)
|
|
| 1111 |
+ result = cli.run(project=project, args=['-C', workspace, 'artifact', 'pull', '--deps', 'all'] + arg_elm)
|
|
| 1112 | 1112 |
result.assert_success()
|
| 1113 | 1113 |
|
| 1114 | 1114 |
|
| ... | ... | @@ -130,7 +130,7 @@ def test_buildtree_pulled(cli, tmpdir, datafiles): |
| 130 | 130 |
assert cli.get_element_state(project, element_name) != 'cached'
|
| 131 | 131 |
|
| 132 | 132 |
# Pull from cache, ensuring cli options is set to pull the buildtree
|
| 133 |
- result = cli.run(project=project, args=['--pull-buildtrees', 'pull', '--deps', 'all', element_name])
|
|
| 133 |
+ result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', '--deps', 'all', element_name])
|
|
| 134 | 134 |
result.assert_success()
|
| 135 | 135 |
|
| 136 | 136 |
# Check it's using the cached build tree
|
| ... | ... | @@ -164,7 +164,7 @@ def test_buildtree_options(cli, tmpdir, datafiles): |
| 164 | 164 |
assert cli.get_element_state(project, element_name) != 'cached'
|
| 165 | 165 |
|
| 166 | 166 |
# Pull from cache, but do not include buildtrees.
|
| 167 |
- result = cli.run(project=project, args=['pull', '--deps', 'all', element_name])
|
|
| 167 |
+ result = cli.run(project=project, args=['artifact', 'pull', '--deps', 'all', element_name])
|
|
| 168 | 168 |
result.assert_success()
|
| 169 | 169 |
|
| 170 | 170 |
# The above is the simplest way I know to create a local cache without any buildtrees.
|
| ... | ... | @@ -55,12 +55,12 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache): |
| 55 | 55 |
# Pull artifact with default config, assert that pulling again
|
| 56 | 56 |
# doesn't create a pull job, then assert with buildtrees user
|
| 57 | 57 |
# config set creates a pull job.
|
| 58 |
- result = cli.run(project=project, args=['pull', element_name])
|
|
| 58 |
+ result = cli.run(project=project, args=['artifact', 'pull', element_name])
|
|
| 59 | 59 |
assert element_name in result.get_pulled_elements()
|
| 60 |
- result = cli.run(project=project, args=['pull', element_name])
|
|
| 60 |
+ result = cli.run(project=project, args=['artifact', 'pull', element_name])
|
|
| 61 | 61 |
assert element_name not in result.get_pulled_elements()
|
| 62 | 62 |
cli.configure({'cache': {'pull-buildtrees': True}})
|
| 63 |
- result = cli.run(project=project, args=['pull', element_name])
|
|
| 63 |
+ result = cli.run(project=project, args=['artifact', 'pull', element_name])
|
|
| 64 | 64 |
assert element_name in result.get_pulled_elements()
|
| 65 | 65 |
default_state(cli, tmpdir, share1)
|
| 66 | 66 |
|
| ... | ... | @@ -68,13 +68,13 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache): |
| 68 | 68 |
# with buildtrees cli flag set creates a pull job.
|
| 69 | 69 |
# Also assert that the buildtree is added to the artifact's
|
| 70 | 70 |
# extract dir
|
| 71 |
- result = cli.run(project=project, args=['pull', element_name])
|
|
| 71 |
+ result = cli.run(project=project, args=['artifact', 'pull', element_name])
|
|
| 72 | 72 |
assert element_name in result.get_pulled_elements()
|
| 73 | 73 |
elementdigest = share1.has_artifact('test', element_name, cli.get_element_key(project, element_name))
|
| 74 | 74 |
buildtreedir = os.path.join(str(tmpdir), 'artifacts', 'extract', 'test', 'autotools-amhello',
|
| 75 | 75 |
elementdigest.hash, 'buildtree')
|
| 76 | 76 |
assert not os.path.isdir(buildtreedir)
|
| 77 |
- result = cli.run(project=project, args=['--pull-buildtrees', 'pull', element_name])
|
|
| 77 |
+ result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
|
|
| 78 | 78 |
assert element_name in result.get_pulled_elements()
|
| 79 | 79 |
assert os.path.isdir(buildtreedir)
|
| 80 | 80 |
default_state(cli, tmpdir, share1)
|
| ... | ... | @@ -83,21 +83,21 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache): |
| 83 | 83 |
# that pulling with the same user config doesn't creates a pull job,
|
| 84 | 84 |
# or when buildtrees cli flag is set.
|
| 85 | 85 |
cli.configure({'cache': {'pull-buildtrees': True}})
|
| 86 |
- result = cli.run(project=project, args=['pull', element_name])
|
|
| 86 |
+ result = cli.run(project=project, args=['artifact', 'pull', element_name])
|
|
| 87 | 87 |
assert element_name in result.get_pulled_elements()
|
| 88 |
- result = cli.run(project=project, args=['pull', element_name])
|
|
| 88 |
+ result = cli.run(project=project, args=['artifact', 'pull', element_name])
|
|
| 89 | 89 |
assert element_name not in result.get_pulled_elements()
|
| 90 |
- result = cli.run(project=project, args=['--pull-buildtrees', 'pull', element_name])
|
|
| 90 |
+ result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
|
|
| 91 | 91 |
assert element_name not in result.get_pulled_elements()
|
| 92 | 92 |
default_state(cli, tmpdir, share1)
|
| 93 | 93 |
|
| 94 | 94 |
# Pull artifact with default config and buildtrees cli flag set, then assert
|
| 95 | 95 |
# that pulling with pullbuildtrees set in user config doesn't create a pull
|
| 96 | 96 |
# job.
|
| 97 |
- result = cli.run(project=project, args=['--pull-buildtrees', 'pull', element_name])
|
|
| 97 |
+ result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
|
|
| 98 | 98 |
assert element_name in result.get_pulled_elements()
|
| 99 | 99 |
cli.configure({'cache': {'pull-buildtrees': True}})
|
| 100 |
- result = cli.run(project=project, args=['pull', element_name])
|
|
| 100 |
+ result = cli.run(project=project, args=['artifact', 'pull', element_name])
|
|
| 101 | 101 |
assert element_name not in result.get_pulled_elements()
|
| 102 | 102 |
default_state(cli, tmpdir, share1)
|
| 103 | 103 |
|
| ... | ... | @@ -105,10 +105,10 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache): |
| 105 | 105 |
# can't be pushed to an artifact share, then assert that a complete build element
|
| 106 | 106 |
# can be. This will attempt a partial pull from share1 and then a partial push
|
| 107 | 107 |
# to share2
|
| 108 |
- result = cli.run(project=project, args=['pull', element_name])
|
|
| 108 |
+ result = cli.run(project=project, args=['artifact', 'pull', element_name])
|
|
| 109 | 109 |
assert element_name in result.get_pulled_elements()
|
| 110 | 110 |
cli.configure({'artifacts': {'url': share2.repo, 'push': True}})
|
| 111 |
- result = cli.run(project=project, args=['push', element_name])
|
|
| 111 |
+ result = cli.run(project=project, args=['artifact', 'push', element_name])
|
|
| 112 | 112 |
assert element_name not in result.get_pushed_elements()
|
| 113 | 113 |
assert not share2.has_artifact('test', element_name, cli.get_element_key(project, element_name))
|
| 114 | 114 |
|
| ... | ... | @@ -116,10 +116,10 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache): |
| 116 | 116 |
# successfully pushed to the remote. This will attempt to pull the buildtree
|
| 117 | 117 |
# from share1 and then a 'complete' push to share2
|
| 118 | 118 |
cli.configure({'artifacts': {'url': share1.repo, 'push': False}})
|
| 119 |
- result = cli.run(project=project, args=['--pull-buildtrees', 'pull', element_name])
|
|
| 119 |
+ result = cli.run(project=project, args=['--pull-buildtrees','artifact', 'pull', element_name])
|
|
| 120 | 120 |
assert element_name in result.get_pulled_elements()
|
| 121 | 121 |
cli.configure({'artifacts': {'url': share2.repo, 'push': True}})
|
| 122 |
- result = cli.run(project=project, args=['push', element_name])
|
|
| 122 |
+ result = cli.run(project=project, args=['artifact', 'push', element_name])
|
|
| 123 | 123 |
assert element_name in result.get_pushed_elements()
|
| 124 | 124 |
assert share2.has_artifact('test', element_name, cli.get_element_key(project, element_name))
|
| 125 | 125 |
default_state(cli, tmpdir, share1)
|
| ... | ... | @@ -128,10 +128,10 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache): |
| 128 | 128 |
# if pull-buildtrees is set, however as share3 is the only defined remote and is empty,
|
| 129 | 129 |
# assert that no element artifact buildtrees are pulled (no available remote buildtree) and thus the
|
| 130 | 130 |
# artifact cannot be pushed.
|
| 131 |
- result = cli.run(project=project, args=['pull', element_name])
|
|
| 131 |
+ result = cli.run(project=project, args=['artifact', 'pull', element_name])
|
|
| 132 | 132 |
assert element_name in result.get_pulled_elements()
|
| 133 | 133 |
cli.configure({'artifacts': {'url': share3.repo, 'push': True}})
|
| 134 |
- result = cli.run(project=project, args=['--pull-buildtrees', 'push', element_name])
|
|
| 134 |
+ result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'push', element_name])
|
|
| 135 | 135 |
assert "Attempting to fetch missing artifact buildtrees" in result.stderr
|
| 136 | 136 |
assert element_name not in result.get_pulled_elements()
|
| 137 | 137 |
assert not os.path.isdir(buildtreedir)
|
| ... | ... | @@ -143,7 +143,7 @@ def test_pullbuildtrees(cli, tmpdir, datafiles, integration_cache): |
| 143 | 143 |
# to the empty share3. This gives the ability to attempt push currently partial artifacts to a remote,
|
| 144 | 144 |
# without exlipictly requiring a bst pull.
|
| 145 | 145 |
cli.configure({'artifacts': [{'url': share1.repo, 'push': False}, {'url': share3.repo, 'push': True}]})
|
| 146 |
- result = cli.run(project=project, args=['--pull-buildtrees', 'push', element_name])
|
|
| 146 |
+ result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'push', element_name])
|
|
| 147 | 147 |
assert "Attempting to fetch missing artifact buildtrees" in result.stderr
|
| 148 | 148 |
assert element_name in result.get_pulled_elements()
|
| 149 | 149 |
assert os.path.isdir(buildtreedir)
|
| ... | ... | @@ -42,7 +42,7 @@ def test_old_and_new_configs(cli, datafiles): |
| 42 | 42 |
# Use `pull` here to ensure we try to initialize the remotes, triggering the error
|
| 43 | 43 |
#
|
| 44 | 44 |
# This does not happen for a simple `bst show`.
|
| 45 |
- result = cli.run(project=project, args=['pull', 'element.bst'])
|
|
| 45 |
+ result = cli.run(project=project, args=['artifact', 'pull', 'element.bst'])
|
|
| 46 | 46 |
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA, "specify one")
|
| 47 | 47 |
|
| 48 | 48 |
|
| ... | ... | @@ -97,5 +97,5 @@ def test_empty_config(cli, datafiles): |
| 97 | 97 |
# Use `pull` here to ensure we try to initialize the remotes, triggering the error
|
| 98 | 98 |
#
|
| 99 | 99 |
# This does not happen for a simple `bst show`.
|
| 100 |
- result = cli.run(project=project, args=['pull', 'element.bst'])
|
|
| 100 |
+ result = cli.run(project=project, args=['artifact', 'pull', 'element.bst'])
|
|
| 101 | 101 |
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA, "specify one")
|
