fix: set zarf version in the user-agent field of oci-client - #5227
fix: set zarf version in the user-agent field of oci-client#5227samayer12 wants to merge 3 commits into
user-agent field of oci-client#5227Conversation
✅ Deploy Preview for zarf-docs canceled.
|
Signed-off-by: Sam Mayer <samayer12@gmail.com>
Signed-off-by: Sam Mayer <samayer12@gmail.com>
c1931a4 to
7dfc2f7
Compare
|
Hmm.. Something looks funky on the netlify actions. @samayer12 could you merge the latest changes from main into this branch? |
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
|
@brandtkeller updated from |
|
@samayer12 Thanks for the find! It seems this is a bug in defenseunicorns/pkg/oci. Could you instead add this fix there? I wouldn't be surprised if this bug was also affecting uds-cli. |
|
@AustinAbro321 sure thing, I'll close this PR and open one over there instead |
|
@samayer12 Wait! I think our friend @Racer159 is already fixing this in defenseunicorns/pkg#202, which I'm reviewing now. Awesome timing hahaha |
|
@samayer12 please review defenseunicorns/pkg#202 first as I believe it fixes this issue? |
|
Another timing coincidence @brandtkeller !! |
|
Yep, this looks great. Specifically, this test case on the |
Summary
Fix Zarf OCI remote setup so registry requests include the expected
User-Agent: zarf/<CLI version>header.zoci.NewRemote()previously passed the user-agent as a modifier intooci.NewOrasRemote(), but the underlying OCI wrapper replaces the ORAS auth client during repository setup. That replacement dropped the configured header, so UDS Registry observed Go's defaultGo-http-client/2.0instead of the Zarf version.This change applies the Zarf user-agent after
oci.NewOrasRemote()returns, ensuring it is set on the final client used for publish, pull, copy, and related OCI operations.See https://github.com/defenseunicorns/uds-registry/pull/3206 for the original PR that discovered this bug.
Fixes #5226
Changes
oci.WithUserAgent("zarf/" + config.CLIVersion)afteroci.NewOrasRemote()returns inzoci.NewRemote().User-Agent: zarf/<CLI version>.Validation
Post-fix Evidence
Successful post-fix metric showing the client family and version were detected by UDS Registry metrics:
{ "metric": { "client_family": "zarf", "client_version": "0.82.x", "result": "accepted" }, "value": [ 1786721539.717, "1" ] }