Skip to content

Commit fc9ce13

Browse files
committed
apps: Fetch app bundle index
Fetch app bundle index if it is reference is found in an app manifest. It allows checking app bundle integrity during offline update. Signed-off-by: Mike Sul <mike.sul@foundries.io>
1 parent f0dee42 commit fc9ce13

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

apps/target_apps_fetcher.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ def _fetch_apps(self, target, apps_shortlist=None, force=False):
143143
with tarfile.open(fileobj=BIO(app_blob)) as t:
144144
t.extract('docker-compose.yml', app_dir)
145145

146+
if 'annotations' in manifest['layers'][0] and \
147+
'org.foundries.app.bundle.index.digest' in manifest['layers'][0]['annotations']:
148+
app_index_digest = manifest['layers'][0]['annotations']['org.foundries.app.bundle.index.digest']
149+
app_index_hash = app_index_digest[len('sha256:'):]
150+
app_index = self._registry_client.pull_layer(uri, app_index_digest)
151+
with open(os.path.join(blobs_dir, app_index_hash), 'wb') as f:
152+
f.write(app_index)
153+
146154
# Download and store the layers' manifest that contains a list of all layers that app's images are based on.
147155
# It's needed for aklite to calculate an update size in an offline update case.
148156
for lm in manifest.get('manifests', []):

0 commit comments

Comments
 (0)