summaryrefslogtreecommitdiff
path: root/src/buildstream/_artifactcache.py
diff options
context:
space:
mode:
authorTristan van Berkom <tristan@codethink.co.uk>2020-12-01 20:37:17 +0900
committerTristan van Berkom <tristan@codethink.co.uk>2020-12-07 17:51:46 +0900
commit965da0ad04af8649f48cfeffd90174e147052494 (patch)
tree411fc37d0f8aa5b8a2fa92ee2e170d0496c301d6 /src/buildstream/_artifactcache.py
parent548b23d767e11f4ea49f4934a5d9d99ce41342f3 (diff)
downloadbuildstream-965da0ad04af8649f48cfeffd90174e147052494.tar.gz
_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.
Diffstat (limited to 'src/buildstream/_artifactcache.py')
-rw-r--r--src/buildstream/_artifactcache.py8
1 files changed, 5 insertions, 3 deletions
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)