Tom Pollard pushed to branch tpollard/829 at BuildStream / buildstream
Commits:
-
5df4105a
by Angelos Evripiotis at 2019-01-28T10:13:40Z
-
9c981eff
by Angelos Evripiotis at 2019-01-28T10:17:57Z
-
bef80291
by Angelos Evripiotis at 2019-01-28T10:19:17Z
-
564cb245
by Angelos Evripiotis at 2019-01-28T11:36:16Z
-
a3e2cdd2
by Tom Pollard at 2019-01-28T12:14:40Z
-
805baf7d
by Tom Pollard at 2019-01-28T12:14:40Z
16 changed files:
- NEWS
- buildstream/_frontend/cli.py
- buildstream/_gitsourcebase.py
- buildstream/_loader/loader.py
- buildstream/_pipeline.py
- buildstream/_stream.py
- buildstream/plugins/elements/junction.py
- buildstream/plugins/sources/bzr.py
- buildstream/plugins/sources/deb.py
- buildstream/plugins/sources/git.py
- buildstream/plugins/sources/remote.py
- buildstream/plugins/sources/tar.py
- buildstream/plugins/sources/zip.py
- doc/source/format_project_refs.rst
- tests/frontend/completions.py
- tests/integration/build-tree.py
Changes:
... | ... | @@ -20,7 +20,7 @@ buildstream 1.3.1 |
20 | 20 |
an element's sources and generated build scripts you can do the command
|
21 | 21 |
`bst source-checkout --include-build-scripts --tar foo.bst some-file.tar`
|
22 | 22 |
|
23 |
- o BREAKING CHANGE: `bst track` and `bst fetch` commands are now osbolete.
|
|
23 |
+ o BREAKING CHANGE: `bst track` and `bst fetch` commands are now obsolete.
|
|
24 | 24 |
Their functionality is provided by `bst source track` and
|
25 | 25 |
`bst source fetch` respectively.
|
26 | 26 |
|
... | ... | @@ -526,7 +526,7 @@ def shell(app, element, sysroot, mount, isolate, build_, cli_buildtree, command) |
526 | 526 |
else:
|
527 | 527 |
scope = Scope.RUN
|
528 | 528 |
|
529 |
- use_buildtree = False
|
|
529 |
+ use_buildtree = None
|
|
530 | 530 |
|
531 | 531 |
with app.initialized():
|
532 | 532 |
if not element:
|
... | ... | @@ -534,7 +534,8 @@ def shell(app, element, sysroot, mount, isolate, build_, cli_buildtree, command) |
534 | 534 |
if not element:
|
535 | 535 |
raise AppError('Missing argument "ELEMENT".')
|
536 | 536 |
|
537 |
- dependencies = app.stream.load_selection((element,), selection=PipelineSelection.NONE)
|
|
537 |
+ dependencies = app.stream.load_selection((element,), selection=PipelineSelection.NONE,
|
|
538 |
+ use_artifact_config=True)
|
|
538 | 539 |
element = dependencies[0]
|
539 | 540 |
prompt = app.shell_prompt(element)
|
540 | 541 |
mounts = [
|
... | ... | @@ -543,20 +544,31 @@ def shell(app, element, sysroot, mount, isolate, build_, cli_buildtree, command) |
543 | 544 |
]
|
544 | 545 |
|
545 | 546 |
cached = element._cached_buildtree()
|
546 |
- if cli_buildtree == "always":
|
|
547 |
- if cached:
|
|
548 |
- use_buildtree = True
|
|
549 |
- else:
|
|
550 |
- raise AppError("No buildtree is cached but the use buildtree option was specified")
|
|
551 |
- elif cli_buildtree == "never":
|
|
552 |
- pass
|
|
553 |
- elif cli_buildtree == "try":
|
|
554 |
- use_buildtree = cached
|
|
547 |
+ if cli_buildtree in ("always", "try"):
|
|
548 |
+ use_buildtree = cli_buildtree
|
|
549 |
+ if not cached and use_buildtree == "always":
|
|
550 |
+ click.echo("WARNING: buildtree is not cached locally, will attempt to pull from available remotes",
|
|
551 |
+ err=True)
|
|
555 | 552 |
else:
|
556 |
- if app.interactive and cached:
|
|
557 |
- use_buildtree = bool(click.confirm('Do you want to use the cached buildtree?'))
|
|
553 |
+ # If the value has defaulted to ask and in non interactive mode, don't consider the buildtree, this
|
|
554 |
+ # being the default behaviour of the command
|
|
555 |
+ if app.interactive and cli_buildtree == "ask":
|
|
556 |
+ if cached and bool(click.confirm('Do you want to use the cached buildtree?')):
|
|
557 |
+ use_buildtree = "always"
|
|
558 |
+ elif not cached:
|
|
559 |
+ try:
|
|
560 |
+ choice = click.prompt("Do you want to pull & use a cached buildtree?",
|
|
561 |
+ type=click.Choice(['try', 'always', 'never']),
|
|
562 |
+ err=True, show_choices=True)
|
|
563 |
+ except click.Abort:
|
|
564 |
+ click.echo('Aborting', err=True)
|
|
565 |
+ sys.exit(-1)
|
|
566 |
+ |
|
567 |
+ if choice != "never":
|
|
568 |
+ use_buildtree = choice
|
|
569 |
+ |
|
558 | 570 |
if use_buildtree and not element._cached_success():
|
559 |
- click.echo("Warning: using a buildtree from a failed build.")
|
|
571 |
+ click.echo("WARNING: using a buildtree from a failed build.", err=True)
|
|
560 | 572 |
|
561 | 573 |
try:
|
562 | 574 |
exitcode = app.stream.shell(element, scope, prompt,
|
... | ... | @@ -605,7 +605,7 @@ class _GitSourceBase(Source): |
605 | 605 |
detail = "The ref provided for the element does not exist locally " + \
|
606 | 606 |
"in the provided track branch / tag '{}'.\n".format(self.tracking) + \
|
607 | 607 |
"You may wish to track the element to update the ref from '{}' ".format(self.tracking) + \
|
608 |
- "with `bst track`,\n" + \
|
|
608 |
+ "with `bst source track`,\n" + \
|
|
609 | 609 |
"or examine the upstream at '{}' for the specific ref.".format(self.mirror.url)
|
610 | 610 |
|
611 | 611 |
self.warn("{}: expected ref '{}' was not found in given track '{}' for staged repository: '{}'\n"
|
... | ... | @@ -557,7 +557,7 @@ class Loader(): |
557 | 557 |
ticker(filename, 'Fetching subproject from {} source'.format(source.get_kind()))
|
558 | 558 |
source._fetch(sources[0:idx])
|
559 | 559 |
else:
|
560 |
- detail = "Try fetching the project with `bst fetch {}`".format(filename)
|
|
560 |
+ detail = "Try fetching the project with `bst source fetch {}`".format(filename)
|
|
561 | 561 |
raise LoadError(LoadErrorReason.SUBPROJECT_FETCH_NEEDED,
|
562 | 562 |
"Subproject fetch needed for junction: {}".format(filename),
|
563 | 563 |
detail=detail)
|
... | ... | @@ -565,7 +565,7 @@ class Loader(): |
565 | 565 |
# Handle the case where a subproject has no ref
|
566 | 566 |
#
|
567 | 567 |
elif source.get_consistency() == Consistency.INCONSISTENT:
|
568 |
- detail = "Try tracking the junction element with `bst track {}`".format(filename)
|
|
568 |
+ detail = "Try tracking the junction element with `bst source track {}`".format(filename)
|
|
569 | 569 |
raise LoadError(LoadErrorReason.SUBPROJECT_INCONSISTENT,
|
570 | 570 |
"Subproject has no ref for junction: {}".format(filename),
|
571 | 571 |
detail=detail)
|
... | ... | @@ -373,7 +373,7 @@ class Pipeline(): |
373 | 373 |
if source._get_consistency() == Consistency.INCONSISTENT:
|
374 | 374 |
detail += " {} is missing ref\n".format(source)
|
375 | 375 |
detail += '\n'
|
376 |
- detail += "Try tracking these elements first with `bst track`\n"
|
|
376 |
+ detail += "Try tracking these elements first with `bst source track`\n"
|
|
377 | 377 |
|
378 | 378 |
raise PipelineError("Inconsistent pipeline", detail=detail, reason="inconsistent-pipeline")
|
379 | 379 |
|
... | ... | @@ -406,7 +406,7 @@ class Pipeline(): |
406 | 406 |
if source._get_consistency() != Consistency.CACHED:
|
407 | 407 |
detail += " {}\n".format(source)
|
408 | 408 |
detail += '\n'
|
409 |
- detail += "Try fetching these elements first with `bst fetch`,\n" + \
|
|
409 |
+ detail += "Try fetching these elements first with `bst source fetch`,\n" + \
|
|
410 | 410 |
"or run this command with `--fetch` option\n"
|
411 | 411 |
|
412 | 412 |
raise PipelineError("Uncached sources", detail=detail, reason="uncached-sources")
|
... | ... | @@ -101,19 +101,22 @@ class Stream(): |
101 | 101 |
# targets (list of str): Targets to pull
|
102 | 102 |
# selection (PipelineSelection): The selection mode for the specified targets
|
103 | 103 |
# except_targets (list of str): Specified targets to except from fetching
|
104 |
+ # use_artifact_config (bool): If artifact remote config should be loaded
|
|
104 | 105 |
#
|
105 | 106 |
# Returns:
|
106 | 107 |
# (list of Element): The selected elements
|
107 | 108 |
def load_selection(self, targets, *,
|
108 | 109 |
selection=PipelineSelection.NONE,
|
109 |
- except_targets=()):
|
|
110 |
+ except_targets=(),
|
|
111 |
+ use_artifact_config=False):
|
|
110 | 112 |
|
111 | 113 |
profile_start(Topics.LOAD_SELECTION, "_".join(t.replace(os.sep, '-') for t in targets))
|
112 | 114 |
|
113 | 115 |
elements, _ = self._load(targets, (),
|
114 | 116 |
selection=selection,
|
115 | 117 |
except_targets=except_targets,
|
116 |
- fetch_subprojects=False)
|
|
118 |
+ fetch_subprojects=False,
|
|
119 |
+ use_artifact_config=use_artifact_config)
|
|
117 | 120 |
|
118 | 121 |
profile_end(Topics.LOAD_SELECTION, "_".join(t.replace(os.sep, '-') for t in targets))
|
119 | 122 |
|
... | ... | @@ -131,7 +134,7 @@ class Stream(): |
131 | 134 |
# mounts (list of HostMount): Additional directories to mount into the sandbox
|
132 | 135 |
# isolate (bool): Whether to isolate the environment like we do in builds
|
133 | 136 |
# command (list): An argv to launch in the sandbox, or None
|
134 |
- # usebuildtree (bool): Wheather to use a buildtree as the source.
|
|
137 |
+ # usebuildtree (str): Whether to use a buildtree as the source, given cli option
|
|
135 | 138 |
#
|
136 | 139 |
# Returns:
|
137 | 140 |
# (int): The exit code of the launched shell
|
... | ... | @@ -141,7 +144,7 @@ class Stream(): |
141 | 144 |
mounts=None,
|
142 | 145 |
isolate=False,
|
143 | 146 |
command=None,
|
144 |
- usebuildtree=False):
|
|
147 |
+ usebuildtree=None):
|
|
145 | 148 |
|
146 | 149 |
# Assert we have everything we need built, unless the directory is specified
|
147 | 150 |
# in which case we just blindly trust the directory, using the element
|
... | ... | @@ -156,8 +159,31 @@ class Stream(): |
156 | 159 |
raise StreamError("Elements need to be built or downloaded before staging a shell environment",
|
157 | 160 |
detail="\n".join(missing_deps))
|
158 | 161 |
|
162 |
+ buildtree = False
|
|
163 |
+ # Check if we require a pull queue attempt, with given artifact state and context
|
|
164 |
+ if usebuildtree:
|
|
165 |
+ if not element._cached_buildtree():
|
|
166 |
+ require_buildtree = self._buildtree_pull_required([element])
|
|
167 |
+ # Attempt a pull queue for the given element if remote and context allow it
|
|
168 |
+ if require_buildtree:
|
|
169 |
+ self._message(MessageType.INFO, "Attempting to fetch missing artifact buildtree")
|
|
170 |
+ self._add_queue(PullQueue(self._scheduler))
|
|
171 |
+ self._enqueue_plan(require_buildtree)
|
|
172 |
+ self._run()
|
|
173 |
+ # Now check if the buildtree was successfully fetched
|
|
174 |
+ if element._cached_buildtree():
|
|
175 |
+ buildtree = True
|
|
176 |
+ if not buildtree:
|
|
177 |
+ if usebuildtree == "always":
|
|
178 |
+ raise StreamError("Buildtree is not cached locally or in available remotes")
|
|
179 |
+ else:
|
|
180 |
+ self._message(MessageType.INFO, """Buildtree is not cached locally or in available remotes,
|
|
181 |
+ shell will be loaded without it""")
|
|
182 |
+ else:
|
|
183 |
+ buildtree = True
|
|
184 |
+ |
|
159 | 185 |
return element._shell(scope, directory, mounts=mounts, isolate=isolate, prompt=prompt, command=command,
|
160 |
- usebuildtree=usebuildtree)
|
|
186 |
+ usebuildtree=buildtree)
|
|
161 | 187 |
|
162 | 188 |
# build()
|
163 | 189 |
#
|
... | ... | @@ -79,7 +79,7 @@ depend on a junction element itself. |
79 | 79 |
|
80 | 80 |
Therefore, if you require the most up-to-date version of a subproject,
|
81 | 81 |
you must explicitly track the junction element by invoking:
|
82 |
- `bst track JUNCTION_ELEMENT`.
|
|
82 |
+ `bst source track JUNCTION_ELEMENT`.
|
|
83 | 83 |
|
84 | 84 |
Furthermore, elements within the subproject are also not tracked by default.
|
85 | 85 |
For this, we must specify the `--track-cross-junctions` option. This option
|
... | ... | @@ -93,7 +93,7 @@ cached yet. However, they can be fetched explicitly: |
93 | 93 |
|
94 | 94 |
.. code::
|
95 | 95 |
|
96 |
- bst fetch junction.bst
|
|
96 |
+ bst source fetch junction.bst
|
|
97 | 97 |
|
98 | 98 |
Other commands such as ``bst build`` implicitly fetch junction sources.
|
99 | 99 |
|
... | ... | @@ -146,7 +146,7 @@ class JunctionElement(Element): |
146 | 146 |
|
147 | 147 |
def get_unique_key(self):
|
148 | 148 |
# Junctions do not produce artifacts. get_unique_key() implementation
|
149 |
- # is still required for `bst fetch`.
|
|
149 |
+ # is still required for `bst source fetch`.
|
|
150 | 150 |
return 1
|
151 | 151 |
|
152 | 152 |
def configure_sandbox(self, sandbox):
|
... | ... | @@ -46,7 +46,7 @@ bzr - stage files from a bazaar repository |
46 | 46 |
# but revisions on a branch are of the form
|
47 | 47 |
# <revision-branched-from>.<branch-number>.<revision-since-branching>
|
48 | 48 |
# e.g. 6622.1.6.
|
49 |
- # The ref must be specified to build, and 'bst track' will update the
|
|
49 |
+ # The ref must be specified to build, and 'bst source track' will update the
|
|
50 | 50 |
# revision number to the one on the tip of the branch specified in 'track'.
|
51 | 51 |
ref: 6622
|
52 | 52 |
|
... | ... | @@ -34,7 +34,7 @@ deb - stage files from .deb packages |
34 | 34 |
kind: deb
|
35 | 35 |
|
36 | 36 |
# Specify the deb url. Using an alias defined in your project
|
37 |
- # configuration is encouraged. 'bst track' will update the
|
|
37 |
+ # configuration is encouraged. 'bst source track' will update the
|
|
38 | 38 |
# sha256sum in 'ref' to the downloaded file's sha256sum.
|
39 | 39 |
url: upstream:foo.deb
|
40 | 40 |
|
... | ... | @@ -112,7 +112,7 @@ git - stage files from a git repository |
112 | 112 |
# o Enable `track-tags` feature
|
113 | 113 |
# o Set the `track` parameter to the desired commit sha which
|
114 | 114 |
# the current `ref` points to
|
115 |
- # o Run `bst track` for these elements, this will result in
|
|
115 |
+ # o Run `bst source track` for these elements, this will result in
|
|
116 | 116 |
# populating the `tags` portion of the refs without changing
|
117 | 117 |
# the refs
|
118 | 118 |
# o Restore the `track` parameter to the branches which you have
|
... | ... | @@ -37,7 +37,7 @@ remote - stage files from remote urls |
37 | 37 |
# executable: true
|
38 | 38 |
|
39 | 39 |
# Specify the url. Using an alias defined in your project
|
40 |
- # configuration is encouraged. 'bst track' will update the
|
|
40 |
+ # configuration is encouraged. 'bst source track' will update the
|
|
41 | 41 |
# sha256sum in 'ref' to the downloaded file's sha256sum.
|
42 | 42 |
url: upstream:foo
|
43 | 43 |
|
... | ... | @@ -33,7 +33,7 @@ tar - stage files from tar archives |
33 | 33 |
kind: tar
|
34 | 34 |
|
35 | 35 |
# Specify the tar url. Using an alias defined in your project
|
36 |
- # configuration is encouraged. 'bst track' will update the
|
|
36 |
+ # configuration is encouraged. 'bst source track' will update the
|
|
37 | 37 |
# sha256sum in 'ref' to the downloaded file's sha256sum.
|
38 | 38 |
url: upstream:foo.tar
|
39 | 39 |
|
... | ... | @@ -29,7 +29,7 @@ zip - stage files from zip archives |
29 | 29 |
kind: zip
|
30 | 30 |
|
31 | 31 |
# Specify the zip url. Using an alias defined in your project
|
32 |
- # configuration is encouraged. 'bst track' will update the
|
|
32 |
+ # configuration is encouraged. 'bst source track' will update the
|
|
33 | 33 |
# sha256sum in 'ref' to the downloaded file's sha256sum.
|
34 | 34 |
url: upstream:foo.zip
|
35 | 35 |
|
... | ... | @@ -21,9 +21,9 @@ When a ``project.refs`` file is in use, any source references found |
21 | 21 |
in the :ref:`inline source declarations <format_sources>` are considered
|
22 | 22 |
invalid and will be ignored, and a warning will be emitted for them.
|
23 | 23 |
|
24 |
-When ``bst track`` is run for your project, the ``project.refs`` file
|
|
24 |
+When ``bst source track`` is run for your project, the ``project.refs`` file
|
|
25 | 25 |
will be updated instead of the inline source declarations. In the absence
|
26 |
-of a ``project.refs`` file, ``bst track`` will create one automatically
|
|
26 |
+of a ``project.refs`` file, ``bst source track`` will create one automatically
|
|
27 | 27 |
with the tracking results.
|
28 | 28 |
|
29 | 29 |
An interesting property of ``project.refs`` is that it allows for
|
... | ... | @@ -160,7 +160,7 @@ def test_options(cli, cmd, word_idx, expected): |
160 | 160 |
('bst show --deps b', 3, ['build ']),
|
161 | 161 |
('bst show --deps=b', 2, ['build ']),
|
162 | 162 |
('bst show --deps r', 3, ['run ']),
|
163 |
- ('bst track --deps ', 3, ['all ', 'none ']),
|
|
163 |
+ ('bst source track --deps ', 4, ['all ', 'none ']),
|
|
164 | 164 |
])
|
165 | 165 |
def test_option_choice(cli, cmd, word_idx, expected):
|
166 | 166 |
assert_completion(cli, cmd, word_idx, expected)
|
... | ... | @@ -101,7 +101,7 @@ def test_buildtree_from_failure(cli_integration, tmpdir, datafiles): |
101 | 101 |
'shell', '--build', element_name, '--use-buildtree', 'always', '--', 'cat', 'test'
|
102 | 102 |
])
|
103 | 103 |
res.assert_success()
|
104 |
- assert "Warning: using a buildtree from a failed build" in res.output
|
|
104 |
+ assert "WARNING: using a buildtree from a failed build" in res.stderr
|
|
105 | 105 |
assert 'Hi' in res.output
|
106 | 106 |
|
107 | 107 |
|
... | ... | @@ -141,7 +141,7 @@ def test_buildtree_pulled(cli, tmpdir, datafiles): |
141 | 141 |
res.assert_success()
|
142 | 142 |
|
143 | 143 |
|
144 |
-# This test checks for correct behaviour if a buildtree is not present.
|
|
144 |
+# This test checks for correct behaviour if a buildtree is not present in the local cache.
|
|
145 | 145 |
@pytest.mark.datafiles(DATA_DIR)
|
146 | 146 |
@pytest.mark.skipif(IS_LINUX and not HAVE_BWRAP, reason='Only available with bubblewrap on Linux')
|
147 | 147 |
def test_buildtree_options(cli, tmpdir, datafiles):
|
... | ... | @@ -156,6 +156,7 @@ def test_buildtree_options(cli, tmpdir, datafiles): |
156 | 156 |
result = cli.run(project=project, args=['build', element_name])
|
157 | 157 |
result.assert_success()
|
158 | 158 |
assert cli.get_element_state(project, element_name) == 'cached'
|
159 |
+ assert share.has_artifact('test', element_name, cli.get_element_key(project, element_name))
|
|
159 | 160 |
|
160 | 161 |
# Discard the cache
|
161 | 162 |
cli.configure({
|
... | ... | @@ -168,8 +169,6 @@ def test_buildtree_options(cli, tmpdir, datafiles): |
168 | 169 |
result = cli.run(project=project, args=['artifact', 'pull', '--deps', 'all', element_name])
|
169 | 170 |
result.assert_success()
|
170 | 171 |
|
171 |
- # The above is the simplest way I know to create a local cache without any buildtrees.
|
|
172 |
- |
|
173 | 172 |
# Check it's not using the cached build tree
|
174 | 173 |
res = cli.run(project=project, args=[
|
175 | 174 |
'shell', '--build', element_name, '--use-buildtree', 'never', '--', 'cat', 'test'
|
... | ... | @@ -177,24 +176,51 @@ def test_buildtree_options(cli, tmpdir, datafiles): |
177 | 176 |
res.assert_shell_error()
|
178 | 177 |
assert 'Hi' not in res.output
|
179 | 178 |
|
180 |
- # Check it's not correctly handling the lack of buildtree
|
|
179 |
+ # Check it's not using the cached build tree, default is to ask, and fall back to not
|
|
180 |
+ # for non interactive behavior
|
|
181 | 181 |
res = cli.run(project=project, args=[
|
182 |
- 'shell', '--build', element_name, '--use-buildtree', 'try', '--', 'cat', 'test'
|
|
182 |
+ 'shell', '--build', element_name, '--', 'cat', 'test'
|
|
183 | 183 |
])
|
184 | 184 |
res.assert_shell_error()
|
185 | 185 |
assert 'Hi' not in res.output
|
186 | 186 |
|
187 |
- # Check it's not using the cached build tree, default is to ask, and fall back to not
|
|
188 |
- # for non interactive behavior
|
|
187 |
+ # Check correctly handling the lack of buildtree, with 'try' not attempting to
|
|
188 |
+ # pull the buildtree as the user context is by default set to not pull them
|
|
189 | 189 |
res = cli.run(project=project, args=[
|
190 |
- 'shell', '--build', element_name, '--', 'cat', 'test'
|
|
190 |
+ 'shell', '--build', element_name, '--use-buildtree', 'try', '--', 'cat', 'test'
|
|
191 | 191 |
])
|
192 |
- res.assert_shell_error()
|
|
193 | 192 |
assert 'Hi' not in res.output
|
193 |
+ assert 'Attempting to fetch missing artifact buildtrees' not in res.stderr
|
|
194 |
+ assert """Buildtree is not cached locally or in available remotes,
|
|
195 |
+ shell will be loaded without it"""
|
|
194 | 196 |
|
195 |
- # Check it's using the cached build tree
|
|
197 |
+ # Check correctly handling the lack of buildtree, with 'try' attempting and succeeding
|
|
198 |
+ # to pull the buildtree as the user context allow the pulling of buildtrees and it is
|
|
199 |
+ # available in the remote
|
|
200 |
+ res = cli.run(project=project, args=[
|
|
201 |
+ '--pull-buildtrees', 'shell', '--build', element_name, '--use-buildtree', 'try', '--', 'cat', 'test'
|
|
202 |
+ ])
|
|
203 |
+ assert 'Attempting to fetch missing artifact buildtree' in res.stderr
|
|
204 |
+ assert 'Hi' in res.output
|
|
205 |
+ shutil.rmtree(os.path.join(os.path.join(cli.directory, 'artifacts2')))
|
|
206 |
+ assert cli.get_element_state(project, element_name) != 'cached'
|
|
207 |
+ |
|
208 |
+ # Check it's not loading the shell at all with always set for the buildtree, when the
|
|
209 |
+ # user context does not allow for buildtree pulling
|
|
210 |
+ result = cli.run(project=project, args=['artifact', 'pull', '--deps', 'all', element_name])
|
|
211 |
+ result.assert_success()
|
|
196 | 212 |
res = cli.run(project=project, args=[
|
197 | 213 |
'shell', '--build', element_name, '--use-buildtree', 'always', '--', 'cat', 'test'
|
198 | 214 |
])
|
199 | 215 |
res.assert_main_error(ErrorDomain.PROG_NOT_FOUND, None)
|
216 |
+ assert 'Buildtree is not cached locally or in available remotes' in res.stderr
|
|
200 | 217 |
assert 'Hi' not in res.output
|
218 |
+ assert 'Attempting to fetch missing artifact buildtree' not in res.stderr
|
|
219 |
+ |
|
220 |
+ # Check that when user context is set to pull buildtrees and a remote has the buildtree,
|
|
221 |
+ # 'always' will attempt and succeed at pulling the missing buildtree.
|
|
222 |
+ res = cli.run(project=project, args=[
|
|
223 |
+ '--pull-buildtrees', 'shell', '--build', element_name, '--use-buildtree', 'always', '--', 'cat', 'test'
|
|
224 |
+ ])
|
|
225 |
+ assert 'Hi' in res.output
|
|
226 |
+ assert 'Attempting to fetch missing artifact buildtree' in res.stderr
|