Skip to content
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

[cmd/builder] ocb gomod version is ignored when using import #9988

Closed
danelson opened this issue Apr 17, 2024 · 2 comments
Closed

[cmd/builder] ocb gomod version is ignored when using import #9988

danelson opened this issue Apr 17, 2024 · 2 comments
Labels
area:builder bug Something isn't working

Comments

@danelson
Copy link

Describe the bug

When a version is specified in the builder config for gomod, it does not seem to be respected by import.

Consider a config that looks something like the following:

A possible breaking config

dist:
  name: "otelcol-dev"
  description: "Working example"
  otelcol_version: "0.96.0"
exporters:
  - gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/myexporter v0.96.0"
    path: "./exporter/myexporter"
extensions:
  - gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage v0.96.0"
    import: "github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/filestorage"

vs.

A good config

dist:
  name: "otelcol-dev"
  description: "Working example"
  otelcol_version: "0.96.0"
exporters:
  - gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/myexporter v0.96.0"
    path: "./exporter/myexporter"
extensions:
  - gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/filestorage v0.96.0"

Steps to reproduce

I wasn't sure I could explain this well so I created a reproduction at https://github.com/danelson/ocb_version_issue.
I think this can break anytime a release is made with a breaking change to an API that you consume in a custom component while still referencing that lower version.

What did you expect to see?
I expect both configs to act the same (I am not sure the semantics are the same tho).

What did you see instead?
Bad config pulls in latest API version and build fails.

What version did you use?
v0.96.0

@danelson danelson added the bug Something isn't working label Apr 17, 2024
@danelson
Copy link
Author

After updating to v0.99.0 I get the following error when using the "broken" config, e.g.

- gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage v0.96.0"
  import: "github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/filestorage"

Error: component dependency not found in go mod file: 'github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage'. Use --skip-strict-versioning to temporarily disable this check. This flag will be removed in a future minor version

Possibly related to the change for #9896? In which case perhaps this can be closed as it will not be possible to have the "breaking" config once --skip-strict-versioning is removed?

@mx-psi
Copy link
Member

mx-psi commented Apr 26, 2024

@danelson Indeed,

  1. The error your are getting now is related to the strict check done in OTel Collector Builder: strict versioning support #9896
  2. The correct config is your 'good config' since extension/storage/filestorage is a module itself https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/extension/storage/filestorage/go.mod, so your old config was only working accidentally

I think we can therefore close this: as you say you need to use the the 'good config' in future versions of the builder or it won't work.

@mx-psi mx-psi closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:builder bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants