Skip to content

Commit b99b49f

Browse files
committed
cmd-prune: don't prune blob refs from non-existant builds
If the oci manifest doesn't exist locally it's probably because we buildfetched (which pulls the builds.json for all builds in the stream) and then did a local build (which happens to be the workflow we use in the pipeline). Let's just skip it in that case. Fixes fd9b7da
1 parent b13524b commit b99b49f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/cmd-prune

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,12 @@ if os.path.exists('tmp/repo'):
190190
for build in builds.get_builds():
191191
meta = builds.get_build_meta(build['id'])
192192
build_dir = builds.get_build_dir(build['id'])
193-
with open(os.path.join(build_dir, meta['images']['oci-manifest']['path'])) as f:
194-
oci_manifest = json.load(f)
195-
referenced_blobs.update([prefix + layer['digest'].replace(':', '_3A_')
196-
for layer in oci_manifest['layers']])
193+
oci_manifest = os.path.join(build_dir, meta['images']['oci-manifest']['path'])
194+
if os.path.exists(oci_manifest):
195+
with open(oci_manifest) as f:
196+
oci_manifest = json.load(f)
197+
referenced_blobs.update([prefix + layer['digest'].replace(':', '_3A_')
198+
for layer in oci_manifest['layers']])
197199
blobs = set(subprocess.check_output(['ostree', 'refs', '--repo=tmp/repo',
198200
'--list', 'ostree/container/blob'],
199201
encoding='utf-8').splitlines())

0 commit comments

Comments
 (0)