Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/buildstream/_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def shell(
elements = self.load_selection(
(target,),
selection=selection,
connect_artifact_cache=True,
connect_artifact_cache=pull_,
connect_source_cache=True,
artifact_remotes=artifact_remotes,
source_remotes=source_remotes,
Expand Down Expand Up @@ -670,7 +670,7 @@ def checkout(
selection=selection,
load_artifacts=True,
attempt_artifact_metadata=True,
connect_artifact_cache=True,
connect_artifact_cache=pull,
artifact_remotes=artifact_remotes,
ignore_project_artifact_remotes=ignore_project_artifact_remotes,
)
Expand All @@ -685,7 +685,7 @@ def checkout(

self.query_cache(elements)

uncached_elts = [elt for elt in elements if not elt._cached()]
uncached_elts = [elt for elt in elements if elt._pull_pending()]
if uncached_elts and pull:
self._context.messenger.info("Attempting to fetch missing or incomplete artifact")
self._reset()
Expand Down
21 changes: 21 additions & 0 deletions tests/frontend/buildcheckout.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,27 @@ def test_non_strict_pull_build_strict_checkout(datafiles, cli, tmpdir):
assert os.path.exists(filename)


# Regression test for https://github.com/apache/buildstream/issues/1469
# Test that artifact checkout without pull doesn't trigger a BUG in non-strict mode.
@pytest.mark.datafiles(DATA_DIR)
def test_non_strict_checkout_uncached(datafiles, cli, tmpdir):
project = str(datafiles)
checkout = os.path.join(cli.directory, "checkout")

element_name = "target.bst"

with create_artifact_share(os.path.join(str(tmpdir), "artifactshare")) as share:

cli.configure({"artifacts": {"servers": [{"url": share.repo}]}})

# Attempt to checkout an uncached artifact with remote artifact server
# configured but pull disabled.
result = cli.run(
project=project, args=["--no-strict", "artifact", "checkout", element_name, "--directory", checkout]
)
result.assert_main_error(ErrorDomain.STREAM, "uncached-checkout-attempt")


@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("strict,hardlinks", [("non-strict", "hardlinks"),])
def test_build_invalid_suffix(datafiles, cli, strict, hardlinks):
Expand Down