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

internal: check for new majors in v2 #3078

Open
wants to merge 4 commits into
base: v2-dev
Choose a base branch
from

Conversation

quinna-h
Copy link
Contributor

@quinna-h quinna-h commented Jan 10, 2025

What does this PR do?

Checks for new major versions on github in v2

Motivation

In the original PR, we used a hardcoded, manual integration_go.mod to detect if new major versions (corresponding to new packages) have been released. However, in v2 each package will be treated as its own contrib with its own corresponding go.mod. We want to parse these go.mod files to check the current latest major, and output if a new major is available.

This will write output to latests.txt and output if a new major package is available.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.
  • For internal contributors, a matching PR should be created to the v2-dev branch and reviewed by @DataDog/apm-go.

Unsure? Have a question? Request a review!

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jan 10, 2025

Datadog Report

Branch report: quinna.halim/v2-output-new-major-versions
Commit report: 3295bf8
Test service: dd-trace-go

✅ 0 Failed, 4056 Passed, 64 Skipped, 2m 49.37s Total Time

@pr-commenter
Copy link

pr-commenter bot commented Jan 10, 2025

Benchmarks

Benchmark execution time: 2025-01-13 19:12:02

Comparing candidate commit 0b4fcd0 in PR branch quinna.halim/v2-output-new-major-versions with baseline commit 89bfc59 in branch v2-dev.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 51 metrics, 2 unstable metrics.

new_latest_majors.go Outdated Show resolved Hide resolved
@quinna-h quinna-h requested a review from rarguelloF January 10, 2025 18:36
@quinna-h quinna-h marked this pull request as ready for review January 13, 2025 18:32
@quinna-h quinna-h requested review from a team as code owners January 13, 2025 18:32
return "", fmt.Errorf("no valid versions found")
}

// // walk through contrib directory
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO(quinna): remove these before merge.
leaving comments for clarity for reviewers.

@@ -804,6 +804,10 @@ var packages = map[Package]PackageInfo{
},
}

func GetPackages() map[Package]PackageInfo {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

}

func main() {

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

Comment on lines +182 to +184
// ValidateRepository checks if the repository string starts with "github.com" and ends with a version suffix.
// Returns true if the repository is valid, false otherwise.
func ValidateRepository(repo string) bool {
Copy link
Member

Choose a reason for hiding this comment

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

nit: as this is a CLI tool, you don't need to export functions. Usually, in these cases, you would do validateRepository and the same for the other functions that start with uppercase.

continue
}

fmt.Printf("Base repo: %s\n", baseRepo)
Copy link
Member

Choose a reason for hiding this comment

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

nit: if we can use log instead of fmt it would be cleaner and allow to parse a bit the output.

Comment on lines +185 to +188
const prefix = "github.com/"
if !strings.HasPrefix(repo, prefix) {
return false
}
Copy link
Member

Choose a reason for hiding this comment

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

Not all packages have a github.com prefix: cloud.google.com/go/pubsub.v1 is an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants