-
Notifications
You must be signed in to change notification settings - Fork 402
Replace sigstore/rekor/pkg/client with a manually-created client #2873
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
@mtrmac code wise I just rebased your PR. And I won't pretend I understand most of this sigstore/rekor code so I could be missing something obvious but the basic test seems to work. Not sure what other test cases I could add? Also the thing I wasn't sure about should I setup the podman containers from the go test like it is right now or would it be better to require the test infra to set it up outside of |
Thanks! Just a very minimal skim for now:
I’d rather prefer for ordinary So, from that point of view, I think the new test should either be in a separate integration test directory (which makes it hard to use (Cc: @lsm5 in case TMT meant more things to consider.) |
Well technically assuming you have podman with a working machine it should work cross platform I suppose. But yeah we still modify the global state. My main issue with the external setup is that at some point the CI setup changes, and then the test is kipped so nobody notices that we loose coverage unless there is someone reading all skip messages in the CI logs which from past experience is not happing (or at least not something I can count on). But I agree it is a bit much for a go unit test setup. I will rework it so the CI setup spin up the containers beforehand |
64s is not to bad I suppose so I guess we don't need to worry about the CI time here to much. The skopeo task is still much slower so this would not hold up total time to merge. |
ACK, that’s perfectly fine. |
I’m not too worried — if a new build tag enables a test, we can outright fail in that test if the server is not running, with no auto-skipping. (It’s also possible to over-engineer this, with the integration test writing a “yes, I really did run” marker file, and the Cirrus runner verifying that the file was created, to rule out typos in the tag name or something like that. I don’t think that’s really necessary.) |
Moved rekor setup into the CI script, CI logs show it running
Not sure how important it is but since the test run rootless I some
lines in the log now so I wonder if you are aware of it? (Of course outside of this PR discussion) Do we need to run unit tests as root as well? |
The history of that is #2147 (comment) , and, again, the unit tests somewhat prioritize usability during ~interactive development.
IIRC some of them don’t succeed as root, so it would require a bit more fine-tuning. (Also we don’t need to run most of them twice.) Nice to have, and help would be appreciated, but perhaps not a top priority for anyone. |
I did a quick pass over it #2878, maybe that is good enough. |
(I just rebased) |
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! The added tests and automation all LGTM, just some non-blocking nits.
Dropping the …rekor_stub
build tag could also happen later.
This removes 4.728 MB from a macOS Skopeo binary and similar saving can be seen in Podman and Buildah. The costs are: - A few dozen lines of new code - A major loss of flexibility. All the removed layers had many options, this code hard-codes the choices we were making. Reintroducing the options could be pretty costly in extra code. - We lose the ability to debug Rekor API accesses via environment variables (something I had no idea exists; so there’s that.) - The previous code was able to decode responses in many formats, e.g. YAML, based on the Content-Type: header in the response. This one asks for JSON and expects JSON. A proper test against a real rekor server is added in the next commit. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Setup a local rekor server using podman to test against. With that we can verify that our custom client code works against a real server. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Ok I checked in the log the test did run properly so this should be good 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.
Thanks!
This removes 4.728 MB from a macOS Skopeo binary and similar saving can
be seen in Podman and Buildah.
The costs are:
this code hard-codes the choices we were making. Reintroducing the
options could be pretty costly in extra code.
variables (something I had no idea exists; so there’s that.)
YAML, based on the Content-Type: header in the response. This one
asks for JSON and expects JSON.