-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[builder] Rewrite replace paths to be absolute in generated go.mod #12638
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
base: main
Are you sure you want to change the base?
Conversation
10e30a0
to
f41cd8f
Compare
Convert all relative paths to be absolute for `replace` directives the same way that is done for modules. This ensures that the `output_path` isn't tied to the location of the builder YAML config.
f41cd8f
to
5875a50
Compare
Codecov ReportAttention: Patch coverage is
❌ Your patch check has failed because the patch coverage (58.53%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #12638 +/- ##
==========================================
- Coverage 91.50% 91.46% -0.05%
==========================================
Files 480 480
Lines 26464 26499 +35
==========================================
+ Hits 24217 24238 +21
- Misses 1778 1788 +10
- Partials 469 473 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5c8074c
to
b75508d
Compare
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
RE: |
It's unclear if we would like to adopt this change. Please take a look at the checks CI failure - this is generating a path that is absolute and therefore no longer portable across machines. When would this approach make sense? You also need to add a changelog entry for this PR. |
Thanks for the reply!
Correct. I agree that behavior is not ideal, but fwiw it's the status quo: opentelemetry-collector/cmd/builder/internal/builder/config.go Lines 246 to 249 in e367eb1
Today, if you do: providers:
- gomod: example.com/module v1.0.0
path: ./mymodule The resulting However, if you do: replaces:
- example.com/other => ./myvendor The resulting In practice, this will break things:
When you run
However, the correct relative path would be Arguably, OCB could instead try to generate relative paths for the "dist" path based on the As a workaround, if you know the dist path will be a child, you can manually make the paths In particular, that breaks my CI build flow (in a Docker container):
Currently, I end up with a
ACK re: this + unit tests, will hold off for the moment until it's agreed that this makes sense in its current form -- I realize it's a pretty niche use case 😉 |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Description
Convert all relative paths to be absolute for
replace
directives the same way that is done for modules/components.This ensures that the
output_path
isn't tied to the location of the builder YAML config.For example:
OCB YAML -
/work/mycollector/builder.yaml
Build
cd /work/mycollector DIST_OUTPUT_PATH=/dist ocb --config ./builder.yaml
Before these changes
go.mod
's replace would end up resolving to/mylib
After these changes
go.mod
's replace resolves to/work/mylib
Link to tracking issue
n/a
Testing
Added unit test
Documentation
Copious comments in code, nothing user-facing