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

[builder] only compare major and minor versions from gomod #9997

Conversation

kristinapathak
Copy link
Contributor

@kristinapathak kristinapathak commented Apr 18, 2024

Description

When building from a commit hash, I got this error:

Error: mismatch in go.mod and builder configuration versions: core collector version calculated by component dependencies "v0.98.1-0.20240416174005-d0f15e2463f8" does not match configured version "v0.98.0". Use --skip-strict-versioning to temporarily disable this check. This flag will be removed in a future minor version

It may be more useful to only compare the major and minor versions

Link to tracking issue

#9896
Found in open-telemetry/opentelemetry-collector-contrib#32544

Testing

Documentation

updated readme

Copy link

codecov bot commented Apr 18, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 91.67%. Comparing base (dc48d0e) to head (b13a4cf).
Report is 4 commits behind head on main.

Files Patch % Lines
cmd/builder/internal/builder/main.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9997      +/-   ##
==========================================
- Coverage   91.77%   91.67%   -0.11%     
==========================================
  Files         360      360              
  Lines       16635    16639       +4     
==========================================
- Hits        15267    15253      -14     
- Misses       1041     1052      +11     
- Partials      327      334       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -167,7 +168,7 @@ func GetModules(cfg Config) error {
if !ok {
return fmt.Errorf("core collector %w: '%s'. %s", ErrDepNotFound, corePath, skipStrictMsg)
}
if coreDepVersion != coreVersion {
if semver.MajorMinor(coreDepVersion) != semver.MajorMinor(coreVersion) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be alright, but could we use semver.Compare here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semver.Compare includes the patch version in its comparison, but my goal is to allow patch versions to be different.

@kristinapathak kristinapathak deleted the builder-strict-versioning-ignore-patch branch April 19, 2024 16:20
@kristinapathak kristinapathak restored the builder-strict-versioning-ignore-patch branch April 19, 2024 18:18
@kristinapathak
Copy link
Contributor Author

Talked to @codeboten and I think we still need this 😅

@kristinapathak kristinapathak marked this pull request as ready for review April 19, 2024 19:39
@kristinapathak kristinapathak requested review from a team and djaglowski April 19, 2024 19:39
@codeboten codeboten added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Apr 19, 2024
@codeboten
Copy link
Contributor

Merging this will unblock updating contrib to the latest core deps.

@codeboten codeboten merged commit d1e631b into open-telemetry:main Apr 19, 2024
80 of 83 checks passed
@github-actions github-actions bot added this to the next release milestone Apr 19, 2024
@kristinapathak kristinapathak deleted the builder-strict-versioning-ignore-patch branch April 22, 2024 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants