-
Notifications
You must be signed in to change notification settings - Fork 35
Fetch latest image from clouds #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetch latest image from clouds #204
Conversation
lucasmoura
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we should define how the handle the released_images method. On GCP and Azure that method was basically using the daily_image method, so we should be fine. But on AWS, there might be a difference, even though I couldn't find the right owner id for the released images.
So I think we can discuss on how we should support that distinction, daily vs released for AWS.
ec27cab to
18ff0ca
Compare
TheRealFalcon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, but maybe let one more person review.
pycloudlib/cloud.py
Outdated
|
|
||
| GENERIC = "generic" | ||
| PRO = "PRO" | ||
| PRO_FIPS = "FIPS PRO" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the words in the value are reversed compared to the key. Also, up 2 lines, 'generic' is lowercase whereas the rest of the values are uppercase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch on reversed name, but the uppercase is just because we usually refer to PRO instances using all letters in uppercase. And since we will surface that name on the Exceptions, I have kept that it just for consistency. But I can update that if necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should standardize on "Pro" and "Pro FIPS". That is how they're marketed. E.g. https://aws.amazon.com/marketplace/pp/prodview-pfsgbblavhjc4
|
I'm going to try using this in some bootspeed jobs and submit my review, but by reading the code it LGTM. |
|
One issue I see is that with this change pycloudlib is unable to find AMIs for the devel release: |
|
Good point, I will double check if we have a specific owner for launching the kinetic image on AWS |
|
@paride @TheRealFalcon code updated |
|
@lucasmoura are you sure you pushed the latest changes? I still see 18ff0ca on the tip of your branch. |
18ff0ca to
fe17ce2
Compare
|
I have pushed to the wrong branch 🤦 |
fe17ce2 to
be14641
Compare
|
I think I found two more issues:
|
|
@paride okay, just addressing the points you made:
https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html We could map
Also, I realized that the PS: I have pushed the new daily name filter on this PR, so you can check the Xenial issue I have described. |
|
@lucasmoura apparently the image serial is exposed via the image If that's stable (let's ask CPC?) maybe we can extract the serial from there. |
|
On the arch name (amd64 vs x86_64): I am not sure. From one side I see pycloudlib as Ubuntu-centric, so I'd like too keep the Ubuntu arch names. OTOH the |
|
On while for a daily image: so maybe the trick is to search for images by |
|
@paride I have updated the code for ec2 to fetch released images directly from AWS while also fixing the |
paride
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! But it doesn't seem to be working yet for released images:
In [13]: ec2 = pycloudlib.EC2(tag='foo', region='us-east-1')
In [14]: ec2.released_image('focal')
Out[14]: 'ami-031cf125b681ca3e0'
In [15]: ec2.image_serial('ami-031cf125b681ca3e0')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-15-3b7825534dd7> in <module>
----> 1 ec2.image_serial('ami-031cf125b681ca3e0')
~/ubuntu/git/pycloudlib/pycloudlib/ec2/cloud.py in image_serial(self, image_id)
241 )
242 filters = ["id=%s" % image_id]
--> 243 image_info = self._streams_query(filters, daily=True)
244 if not image_info:
245 image_info = self._streams_query(filters, daily=False)
~/ubuntu/git/pycloudlib/pycloudlib/cloud.py in _streams_query(filters, daily)
219 result = stream.query(filters)
220 if not result:
--> 221 raise ValueError(f"No images found matching filters: {filters}")
222
223 return result
ValueError: No images found matching filters: ['id=ami-031cf125b681ca3e0']
For this AMI the serial is there:
$ aws --profile cloud-init --region us-east-1 ec2 describe-images --image-id ami-031cf125b681ca3e0
[...]
"Name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20220615",
|
Also: can you please rebase on main? The change that just landed there will make it easier to test your branch with the bootspeed jobs. Thanks! |
e0bf197 to
8e48360
Compare
8e48360 to
289f2c7
Compare
|
@paride I forgot one last bit 🤦, but it is fixed now. |
paride
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, also tested in Jenkins with the bootspeed jobs and it works fine. We don't have image_serial() for non-EC2 clouds, but I think that's fine for now, we can add it if/once needed. Thanks for addressing all the review comments!
|
@lucasmoura , is there anything else to do here? |
|
@TheRealFalcon I was just waiting for a review from someone on the UA team for the PRO machines. But I think we can merge and if we find a bug I can come up with a follow up PR |
orndorffgrant
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nitpick on the naming: We should standardize on "Pro" and "Pro FIPS". That is how they're marketed. E.g. https://aws.amazon.com/marketplace/pp/prodview-pfsgbblavhjc4
|
@orndorffgrant done |
orndorffgrant
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lucasmoura and sorry for the nitpick :)
|
@orndorffgrant no worries at all |
paride
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, +1 again!
|
@lucasmoura do you think this is good to land? |
|
Yes, merging it right now |
Add logic to fetch daily images directly from the clouds and not through
simplestreams.Right now we are only supporting this behavior for
AWS,AzureandGCP.Additionally, we are also adding support for launching
PROandFIPS PROtests for those clouds.PS: We should still add tests for the new methods here, but first I think we need a fixture that is able to create the cloud instances.
However, I think we can add this into a separate PR.