Skip to content

Commit 22485d5

Browse files
authored
Merge pull request #2049 from apache/jbilleter/sandbox-config
Fix artifact metadata for `remote-apis-socket`
2 parents 2a63e96 + 8b90e27 commit 22485d5

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/buildstream/sandbox/_config.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ def __init__(
7676
# Returns:
7777
# A dictionary representation of this SandboxConfig
7878
#
79-
def to_dict(self) -> Dict[str, Union[str, int, bool]]:
79+
def to_dict(self) -> Dict[str, Union[str, int, Dict]]:
8080

8181
# Assign mandatory portions of the sandbox configuration
8282
#
8383
# /!\ No additional mandatory members can ever be added to
8484
# the sandbox configuration, as that would result in
8585
# breaking cache key stability.
8686
#
87-
sandbox_dict: Dict[str, Union[str, int, bool]] = {"build-os": self.build_os, "build-arch": self.build_arch}
87+
sandbox_dict: Dict[str, Union[str, int, Dict]] = {"build-os": self.build_os, "build-arch": self.build_arch}
8888

8989
# Assign optional portions of the sandbox configuration
9090
#
@@ -98,9 +98,10 @@ def to_dict(self) -> Dict[str, Union[str, int, bool]]:
9898
sandbox_dict["build-gid"] = self.build_gid
9999

100100
if self.remote_apis_socket_path is not None:
101-
sandbox_dict["remote-apis-socket-path"] = self.remote_apis_socket_path
101+
reapi_socket_dict: Dict[str, Union[str, bool]] = {"path": self.remote_apis_socket_path}
102102
if self.remote_apis_socket_action_cache_enable_update:
103-
sandbox_dict["remote-apis-socket-action-cache-enable-update"] = True
103+
reapi_socket_dict["action-cache-enable-update"] = True
104+
sandbox_dict["remote-apis-socket"] = reapi_socket_dict
104105

105106
return sandbox_dict
106107

tests/integration/sandbox.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ def test_remote_apis_socket(cli, datafiles):
6161
result = cli.run(project=project, args=["build", element_name])
6262
assert result.exit_code == 0
6363

64+
# Verify that loading the artifact succeeds
65+
artifact_name = cli.get_artifact_name(project, "test", element_name)
66+
result = cli.run(project=project, args=["artifact", "show", artifact_name])
67+
assert result.exit_code == 0
68+
6469

6570
# Test configuration with remote action cache for nested REAPI.
6671
@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox")
@@ -103,6 +108,11 @@ def test_remote_apis_socket_with_action_cache_update(cli, tmpdir, datafiles):
103108
result = cli.run(project=project, args=["build", element_name])
104109
assert result.exit_code == 0
105110

111+
# Verify that loading the artifact succeeds
112+
artifact_name = cli.get_artifact_name(project, "test", element_name)
113+
result = cli.run(project=project, args=["artifact", "show", artifact_name])
114+
assert result.exit_code == 0
115+
106116

107117
# Test configuration with cache storage-service and remote action cache for nested REAPI.
108118
@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox")

0 commit comments

Comments
 (0)