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

[CI Visibility] Initial internal consts and utilities #2736

Merged

Conversation

tonyredondo
Copy link
Member

@tonyredondo tonyredondo commented Jun 11, 2024

What does this PR do?

This PR introduces the CI Visibility product in the repository with the following initial code:

  • Constants: constants used by the product on their integrations, most of the constants have a significant value at backend side.
  • Utilities: the utils packages contains base an utilities functions to:
    • Extract CI Providers data.
    • Extract the CODEOWNERS file information
    • Extract Git information
    • Expand the HOME "~" char.
    • Other small utilities.

Coverage is in the 94.2%

❯ go test ./... -cover   
?       gopkg.in/DataDog/dd-trace-go.v1/internal/civisibility/constants [no test files]
ok      gopkg.in/DataDog/dd-trace-go.v1/internal/civisibility/utils     0.495s  coverage: 94.2% of statements

Motivation

We are working on adding Go as a supported language on the CI Visibility product.

This is the first PR of an stacked series.

More info is available in the guild slack channel.

Stacked PRs

  1. [CI Visibility] Initial internal consts and utilities #2736 | [This one]
  2. [CI Visibility] Add support for CI Visibility mode in ddtrace #2739
  3. [CI Visibility] Manual Api and Go/Testing integration #2742

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.

Unsure? Have a question? Request a review!

@tonyredondo tonyredondo force-pushed the tony/civisibility-part1-consts-and-utils branch from 949de79 to c4340ef Compare June 11, 2024 14:26
internal/civisibility/constants/tags.go Outdated Show resolved Hide resolved
internal/civisibility/constants/tags.go Outdated Show resolved Hide resolved
internal/civisibility/constants/tags.go Outdated Show resolved Hide resolved
internal/civisibility/constants/tags.go Outdated Show resolved Hide resolved
internal/civisibility/utils/git.go Outdated Show resolved Hide resolved
internal/civisibility/utils/ci_providers_test.go Outdated Show resolved Hide resolved
internal/civisibility/utils/ci_providers.go Outdated Show resolved Hide resolved
internal/civisibility/utils/ci_providers.go Outdated Show resolved Hide resolved
internal/civisibility/utils/ci_providers.go Outdated Show resolved Hide resolved
internal/civisibility/utils/ci_providers.go Outdated Show resolved Hide resolved
@DataDog DataDog deleted a comment from github-actions bot Jun 11, 2024
@DataDog DataDog deleted a comment from github-actions bot Jun 11, 2024
@tonyredondo tonyredondo marked this pull request as ready for review June 11, 2024 15:06
@tonyredondo tonyredondo requested a review from a team as a code owner June 11, 2024 15:06
@pr-commenter
Copy link

pr-commenter bot commented Jun 11, 2024

Benchmarks

Benchmark execution time: 2024-07-08 09:54:59

Comparing candidate commit 1aba968 in PR branch tony/civisibility-part1-consts-and-utils with baseline commit 79237af in branch tony/civisibility-ddtrace.

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

scenario:BenchmarkHttpServeTrace-24

  • 🟩 execution_time [-769.877ns; -659.923ns] or [-4.447%; -3.812%]

Copy link
Contributor

@Julio-Guerra Julio-Guerra left a comment

Choose a reason for hiding this comment

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

Looks good overall.

You forgot to review all our .github workflows to search for internal/ and add internal/civisibility too to some of the go test commands we built-in there (we can't do go test ./... due to some contribs which require more or are incompatible between them)

@tonyredondo tonyredondo force-pushed the tony/civisibility-part1-consts-and-utils branch from 615ef86 to ccc1a39 Compare June 13, 2024 13:37
@tonyredondo
Copy link
Member Author

Looks good overall.

You forgot to review all our .github workflows to search for internal/ and add internal/civisibility too to some of the go test commands we built-in there (we can't do go test ./... due to some contribs which require more or are incompatible between them)

As talked offline, civisibility tests are running without any workflow modification.

Copy link
Contributor

@ManuelPalenzuelaDD ManuelPalenzuelaDD left a comment

Choose a reason for hiding this comment

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

LGTM

internal/civisibility/constants/env.go Outdated Show resolved Hide resolved
internal/civisibility/constants/tags.go Outdated Show resolved Hide resolved
internal/civisibility/utils/ci_providers.go Outdated Show resolved Hide resolved
internal/civisibility/utils/ci_providers_test.go Outdated Show resolved Hide resolved
internal/civisibility/utils/codeowners.go Show resolved Hide resolved
internal/civisibility/utils/codeowners.go Outdated Show resolved Hide resolved
internal/civisibility/utils/environmentTags.go Outdated Show resolved Hide resolved
internal/civisibility/utils/codeowners_test.go Outdated Show resolved Hide resolved
internal/civisibility/utils/ci_providers_test.go Outdated Show resolved Hide resolved
This test depends on a real file of the repo, so if there are any
unrelated changes to that file the test could fail. Most of the
functions this test "tests" are already covered by other tests.
@DataDog DataDog deleted a comment from github-actions bot Jun 28, 2024
@DataDog DataDog deleted a comment from github-actions bot Jun 28, 2024
Copy link
Member

@darccio darccio left a comment

Choose a reason for hiding this comment

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

@liashenko liashenko changed the base branch from main to tony/civisibility-ddtrace July 2, 2024 08:37
@liashenko liashenko requested a review from a team as a code owner July 8, 2024 09:32
@liashenko liashenko merged commit 7698a06 into tony/civisibility-ddtrace Jul 8, 2024
161 checks passed
@liashenko liashenko deleted the tony/civisibility-part1-consts-and-utils branch July 8, 2024 10:02
darccio added a commit that referenced this pull request Jul 8, 2024
Co-authored-by: Tony Redondo <[email protected]>
Co-authored-by: Manuel Palenzuela Merino <[email protected]>
Co-authored-by: Dario Castañé <[email protected]>
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.

5 participants