-
Notifications
You must be signed in to change notification settings - Fork 27
Add images verify cmd #18
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
Conversation
/cc @akrejcir |
28911f1
to
86d7f7d
Compare
21097ee
to
caa7c30
Compare
@rmohr Can you please have a look again? I addressed your comments. |
This prevents a segfault when an unexpected error occurs, which cannot be unwrapped (e.g. tls verification error on insecure registry). Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Do not always log 'Pushing' and let the user know what is really happening instead. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
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.
Overall pretty nice, I have one conceptual question.
This moves the worker logic for image cmds into a separate file, so it can be used in multiple image cmds. The logic was also refactored, so it is easier to use, supports contexts and duplicated code during use is prevented. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This moves the PushImage function into the repository package to make it available for use in other image cmds. Also use the uniform identifier 'imgRef' for images. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
The function tarball.LayerFromReader internally uses iotuil.ReadAll, which buffers all data in memory and can lead to problems with large files. Replace it with tarball.LayerFromOpener and implement a StreamLayerOpener, that does not return an error chan and can be opened multiple times. Thanks to akrejcir for the idea and proposal. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
The methods for creating example VM definitons are added to the artifact interface so correct definitions for each type of guest can be created. This also allows to test the example definitions in another command (e.g. images verify). Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
The removed code added the main version of the CentOS Stream artifact to AdditionalUniqueTags which is not an additional unique tag. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
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.
Pretty close. Not sure if you agree, but looks much simpler now than before to me. One recommendation regarding to the result handing which I would love to see.
@rmohr I agree, it is simpler now. The commit changing to OCIv1 could be useful in the future perhaps. I addressed your change request. Does it look good now? |
@rmohr I just noticed I could move the |
sounds good. 👍 |
Flags that can be shared by image cmds are refactored into ImagesOptions and moved to imagesCmd. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
With this change the 'images push' command writes a results file after building and pushing containerdisks. The results file contains all built images, their sha256 sum and the pushed tags. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This adds the cmd 'images verify', which verifies that previously built and pushed containerdisks are bootable and that guests are working. The example definitions of the docs are used to test containerdisks by creating VMs with the respective containerdisk set as the boot source. After waiting for a VM to become ready, a defined set of tests is run on the corresponding VMI. If all tests succeed, the verified value of the containerdisk is set to 'true' in the results file. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
The test checks if the agent is running on the guest by attempting to get the guest os info from the agent. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
The test checks if ssh is working on the guest by attempting to use the credentials generated by images verify to login into the guest and to run a simple command (e.g. 'echo hello'). Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
@rmohr Mind giving it a look again? |
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
/approve
I think this is good enough to take it in. If we want to improve stuff or detect issues we can follow up on it.
Great work!
PrivateKey interface{} | ||
} | ||
|
||
type ArtifactResult struct { |
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.
Since we kind of build a pipeline with the new commands, we probably want to add an indicator if something should have been created/verified but failed. We can do that in a follow up.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rmohr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
This adds the cmd 'images verify', which verifies that previously built
and pushed containerdisks are bootable and that guests are working.
The example definitions of the docs are used to test containerdisks by
creating VMs with the respective containerdisk set as the boot source.
After waiting for a VM to become ready, a defined set of tests is run on
the corresponding VMI. If all tests succeed, the value of the containerdisk
annotation 'verified' is set to 'true' and the updated image manifest is
pushed to the registry.
Which issue(s) this PR fixes:
Fixes #2
Special notes for your reviewer:
Merge after #17
Release note: