From 965da0ad04af8649f48cfeffd90174e147052494 Mon Sep 17 00:00:00 2001 From: Tristan van Berkom Date: Tue, 1 Dec 2020 20:37:17 +0900 Subject: _artifact.py: Store additional metadata on the artifact This commit enriches the metadata we store on artifacts in the new detatched low/high diversity metadata files: * The SandboxConfig is now stored in the artifact, allowing one to perform activities such as launching sandboxes on artifacts downloaded via artifact name (without backing project data). * The environment variables is now stored in the artifact, similarly allowing one to shell into a downloaded artifacts which are unrelated to a loaded project. * The element variables are now stored in the artifact, allowing more flexibility in what the core can do with a downloaded ArtifactElement * The element's strict key All of these of course can additionally enhance traceability in the UI with commands such as `bst artifact show`. Summary of changes: * _artifact.py: - Store new data in the new proto digests. - Added new accessors to extract these new aspects from loaded artifacts. - Bump the proto version number for compatibility * _artifactcache.py: Adjusted to push and pull the new blobs and digests. * element.py: - Call Artifact.cache() with new parameters - Expect the strict key from Artifact.get_meta_keys() - Always specify the strict key when constructing an Artifact instance which will later be used to cache the artifact (i.e. the self.__artifact Artifact). * _versions.py: Bump the global artifact version number, as this breaks the artifact format. * tests/cachekey: Updated cache key test for new keys. --- src/buildstream/_artifactcache.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/buildstream/_artifactcache.py') diff --git a/src/buildstream/_artifactcache.py b/src/buildstream/_artifactcache.py index 5ccdf8fd8..c3d96166c 100644 --- a/src/buildstream/_artifactcache.py +++ b/src/buildstream/_artifactcache.py @@ -404,7 +404,7 @@ class ArtifactCache(AssetCache): except FileNotFoundError: pass - digests = [artifact_digest] + digests = [artifact_digest, artifact_proto.low_diversity_meta, artifact_proto.high_diversity_meta] if str(artifact_proto.public_data): digests.append(artifact_proto.public_data) @@ -470,7 +470,9 @@ class ArtifactCache(AssetCache): if artifact_proto.sources: referenced_directories.append(artifact_proto.sources) - referenced_blobs = [log_file.digest for log_file in artifact_proto.logs] + referenced_blobs = [artifact_proto.low_diversity_meta, artifact_proto.high_diversity_meta] + [ + log_file.digest for log_file in artifact_proto.logs + ] try: remote.push_blob( @@ -530,7 +532,7 @@ class ArtifactCache(AssetCache): if pull_buildtrees and str(artifact.buildtree): __pull_digest(artifact.buildtree) - digests = [] + digests = [artifact.low_diversity_meta, artifact.high_diversity_meta] if str(artifact.public_data): digests.append(artifact.public_data) -- cgit v1.2.1