Conversation
|
@doanac That's a draft to give you a heads up. |
doanac
left a comment
There was a problem hiding this comment.
still looking closely, but here's some initial things i see
| if len(target) != 1: | ||
| raise Exception('Got invalid Targets from TUF server: ' + str(targets)) | ||
|
|
||
| target_name = next(iter(target)) |
There was a problem hiding this comment.
this took me a minute to understand. get_targets_from_api is returning a List. You are then coping with the fact that each item in the list is a single entry dict. Seem like get_targets_from_api could return a dict of target-name->target items and then you could just iterate over a dictiionary like: for target_name, target in get_targets_from_api().items(): ?
| image_url = os.path.join(base_uri, 'runs', image_machine, target_image_file) | ||
| logger.info('Fetching ' + image_url) | ||
| image_resp = requests.get(image_url, headers={'OSF-TOKEN': token}) | ||
| image_resp.raise_for_status() |
There was a problem hiding this comment.
I found raise_for_status is pretty lacking. You wind up just getting a stack trace that has the http status code. Its tedious, but I've found to make this debuggable you need something like:
if resp.status_code != 200:
sys.exit("Unable to get %s: HTTP_%d\n%s" % (r.url, r.status_code, r.text))
There was a problem hiding this comment.
add better handling for this error and then i think its good to merge.
| target_image_file = '{}-{}.wic.gz'.format(image_name, image_machine) | ||
| image_url = os.path.join(base_uri, 'runs', image_machine, target_image_file) | ||
| logger.info('Fetching ' + image_url) | ||
| image_resp = requests.get(image_url, headers={'OSF-TOKEN': token}) |
There was a problem hiding this comment.
I think you need "stream=True" here to accomplish what you want with the chunking below: https://requests.readthedocs.io/en/master/user/advanced/#body-content-workflow
|
|
||
| app_image_tar_src = os.path.join(args.app_image_dir, containers_sha, '{}-{}.tar'. | ||
| format(containers_sha, containers_arch)) | ||
| app_image_tar_dst = wic_image + ':2/ostree/deploy/lmp/var/sota/import/' |
There was a problem hiding this comment.
so we wind up copying the tarfile to /var/sota/import/. i guess we then do something with that on first boot?
There was a problem hiding this comment.
yes, still considering options here, either untar it on the first boot (aklite when it imports 'installed_versions' on the first boot) or actually try to put into the wic image all untared files, the issue here is that the wic tool doesn't want to copy folder.
464e3c8 to
e10f66e
Compare
|
@doanac updating according to the comments |
ec3152e to
c1be860
Compare
|
This is how it looks in action https://ci.foundries.io/projects/msul-dev01/lmp/builds/301/ |
|
@doanac Is it good to go? |
| try: | ||
| targets = get_targets_from_api(args.factory, args.build_num, args.token) | ||
| if len(targets) == 0: | ||
| logger.warning('No any Targets found; Factory: {}, Version/Build Number: {}'.format(args.factory, args.build_num)) |
There was a problem hiding this comment.
and there's still this grammar issue.
| image_url = os.path.join(base_uri, 'runs', image_machine, target_image_file) | ||
| logger.info('Fetching ' + image_url) | ||
| image_resp = requests.get(image_url, headers={'OSF-TOKEN': token}) | ||
| image_resp.raise_for_status() |
There was a problem hiding this comment.
add better handling for this error and then i think its good to merge.
c1be860 to
a7b0637
Compare
Add two additional attributes to Target is being built by the lmp build at "Target customization" phase: - 'arch' - an architecture of Target - 'image-file' - a filename of a system/WIC image These attributes are required by the container build run for assembling a new system image with pre-loaded container images. Signed-off-by: Mike Sul <[email protected]>
Fecth a system image (WIC) of each Target being built during a container build, inject corresponding container images into it and produces a new system image. Signed-off-by: Mike Sul <[email protected]>
a7b0637 to
9a8c973
Compare
Add container images of Compose Apps to the corresponding system image during container build.