-
Notifications
You must be signed in to change notification settings - Fork 779
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
feat: add --image flag in gator test|expand #2398
Conversation
138bf9c
to
294dce2
Compare
Codecov ReportBase: 53.52% // Head: 53.38% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #2398 +/- ##
==========================================
- Coverage 53.52% 53.38% -0.15%
==========================================
Files 117 115 -2
Lines 10281 10170 -111
==========================================
- Hits 5503 5429 -74
+ Misses 4354 4326 -28
+ Partials 424 415 -9
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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 for working on this 💯 ; left some nits and questions, nothing blocking from me
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 refactor!
Basically LGTM modulo some nits, and a more substantial comment that I think we might be able to consolidate Dockerfiles to have only one test image.
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.
some light nits, UX questions and string change callouts;
otherwise LGTM! Thanks for following up here.
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
9732f7a
to
b28c3af
Compare
@@ -116,6 +117,11 @@ test-e2e: | |||
.PHONY: test-gator | |||
test-gator: gator test-gator-verify test-gator-test test-gator-expand | |||
|
|||
.PHONY: test-gator-containerized | |||
test-gator-containerized: __test-image | |||
docker run --privileged -v $(shell pwd):/app -v /var/lib/docker \ |
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 is going to make artifacts created by this (like gator binary) owned by root. can we do this without privileged?
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.
The test needs to run docker-inside-docker in order to spin up a local container registry to push to test bundles to. Unfortunately, --privileged
is necessary to allow the inner container (the container registry) to be able to access the file system of the outer container (the test runner).
I'm not sure I understand why this would make the gator binary owned by root, as this privileged execution is just for a test image. Is there someway we can exclude it? Otherwise, if this is a problem, we might have to explore other methods of e2e testing this, like perhaps using an external public registry for the test images instead of spinning up a local one.
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.
@davis-haba overall LGTM, added a few comments and looks like there are merge conflicts now
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 !! (modulo merge conflicts)
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Co-authored-by: alex <8968914+acpana@users.noreply.github.com> Signed-off-by: davis-haba <52938648+davis-haba@users.noreply.github.com>
Co-authored-by: alex <8968914+acpana@users.noreply.github.com> Signed-off-by: davis-haba <52938648+davis-haba@users.noreply.github.com>
Co-authored-by: alex <8968914+acpana@users.noreply.github.com> Signed-off-by: davis-haba <52938648+davis-haba@users.noreply.github.com>
Co-authored-by: alex <8968914+acpana@users.noreply.github.com> Signed-off-by: davis-haba <52938648+davis-haba@users.noreply.github.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
b28c3af
to
d06cd58
Compare
Co-authored-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com> Signed-off-by: davis-haba <52938648+davis-haba@users.noreply.github.com>
Co-authored-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com> Signed-off-by: davis-haba <52938648+davis-haba@users.noreply.github.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: davis-haba davishaba@google.com
Adds --image flag to
gator test|expand
, which supports pulling OCI Artifacts containing policy bundles for ingestion bygator
. #2333The flag is mixable with the existing
--filename
flag, as well as with stdin in the case ofgator test
. For example:The documentation has been updated with the new
--image
flag, as well as some information on creating OCI Artifacts with policy bundles.This PR also introduces duplicate-detection logic in
gator test|expand
, which will log a warning if resources with the same GKNN are found across any of the input methods (--filename
,--image
, orstdin
). In the case of duplicates, the command does not fail closed, and we cannot make any guarantees about which copy will be used.Some example warnings:
The gator tests have been updated to run in a container, which is executable via make test-gator-containerized`. The approach creates a "test runner" container to run the tests, and another container inside the test runner to act as the image registry.
The Gator CLI code has also been refactored such that code for each command has its own package, and common code is in
gator/reader
andgator/
. #1779