Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions apps/target_apps_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ def _fetch_apps(self, target, apps_shortlist=None, force=False):
with tarfile.open(fileobj=BIO(app_blob)) as t:
t.extract('docker-compose.yml', app_dir)

if 'annotations' in manifest['layers'][0] and \
'org.foundries.app.bundle.index.digest' in manifest['layers'][0]['annotations']:
app_index_digest = manifest['layers'][0]['annotations']['org.foundries.app.bundle.index.digest']
app_index_hash = app_index_digest[len('sha256:'):]
app_index = self._registry_client.pull_layer(uri, app_index_digest)
with open(os.path.join(blobs_dir, app_index_hash), 'wb') as f:
f.write(app_index)

# Download and store the layers' manifest that contains a list of all layers that app's images are based on.
# It's needed for aklite to calculate an update size in an offline update case.
for lm in manifest.get('manifests', []):
Expand Down Expand Up @@ -183,8 +191,9 @@ def fetch_image(self, target_name: str, arch: str, image: str, dst_root_dir: str
image_dir = os.path.join(dst_root_dir, uri.host, uri.name, uri.hash)
os.makedirs(image_dir, exist_ok=True)
subprocess.check_call(['skopeo', '--insecure-policy', '--override-arch', arch, 'copy',
'--retry-times', '3', '--format', 'v2s2', '--dest-shared-blob-dir',
self.blobs_dir(target_name), 'docker://' + image, 'oci:' + image_dir])
'--preserve-digests', '--retry-times', '3', '--format', 'v2s2',
'--dest-shared-blob-dir', self.blobs_dir(target_name),
'docker://' + image, 'oci:' + image_dir])

# Store the image manifest in the blob directory, as result it contains all blobs/nodes of
# the app's merkle tree. It allows to check app integrity on devices with preloaded apps and
Expand Down