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

feat(CI): Add a new task to automatically assign a team label on a dependabot PR #21952

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

chouetz
Copy link
Member

@chouetz chouetz commented Jan 9, 2024

What does this PR do?

  • Add a new task to automatically assign a team label on a dependabot PR
  • Add an associated workflow to assign at PR creation

Motivation

Remove manual actions

Additional Notes

Possible Drawbacks / Trade-offs

Assignment is based on the occurrence of dependency found in repository files. This heuristic is basic and prevents the PR from being unassigned. It does not prevent a manual redirection.

Describe how to test/QA your changes

Reviewer's Checklist

  • If known, an appropriate milestone has been selected; otherwise the Triage milestone is set.
  • Use the major_change label if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote.
  • A release note has been added or the changelog/no-changelog label has been applied.
  • Changed code has automated tests for its functionality.
  • Adequate QA/testing plan information is provided. Except if the qa/skip-qa label, with required either qa/done or qa/no-code-change labels, are applied.
  • At least one team/.. label has been applied, indicating the team(s) that should QA this change.
  • If applicable, docs team has been notified or an issue has been opened on the documentation repo.
  • If applicable, the need-change/operator and need-change/helm labels have been applied.
  • If applicable, the k8s/<min-version> label, indicating the lowest Kubernetes version compatible with this feature.
  • If applicable, the config template has been updated.

@chouetz chouetz added changelog/no-changelog [deprecated] team/agent-platform [deprecated] qa/skip-qa - use other qa/ labels [DEPRECATED] Please use qa/done or qa/no-code-change to skip creating a QA card qa/no-code-change No code change in Agent code requiring validation labels Jan 9, 2024
@chouetz chouetz added this to the 7.52.0 milestone Jan 9, 2024
@chouetz chouetz requested review from a team as code owners January 9, 2024 13:19
.github/workflows/assign-dependabot.yml Show resolved Hide resolved
tasks/assign_pr.py Outdated Show resolved Hide resolved
tasks/assign_pr.py Show resolved Hide resolved
.github/workflows/assign-dependabot.yml Outdated Show resolved Hide resolved
tasks/assign_pr.py Outdated Show resolved Hide resolved
tasks/assign_pr.py Outdated Show resolved Hide resolved
tasks/assign_pr.py Outdated Show resolved Hide resolved
tasks/assign_pr.py Outdated Show resolved Hide resolved
@pr-commenter
Copy link

pr-commenter bot commented Jan 9, 2024

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: 5c711bb9-a956-444f-a30d-ceddf6933a80
Baseline: 51a1be1
Comparison: dfa84a5
Total CPUs: 7

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

No significant changes in experiment optimization goals

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI
file_tree memory utilization +0.09 [-0.02, +0.19]
idle memory utilization -0.07 [-0.10, -0.05]
file_to_blackhole % cpu utilization -0.51 [-7.02, +6.00]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
otel_to_otel_logs ingress throughput +1.18 [+0.44, +1.92]
tcp_syslog_to_blackhole ingress throughput +0.48 [+0.40, +0.55]
process_agent_standard_check memory utilization +0.37 [+0.31, +0.43]
file_tree memory utilization +0.09 [-0.02, +0.19]
tcp_dd_logs_filter_exclude ingress throughput +0.00 [-0.06, +0.06]
uds_dogstatsd_to_api ingress throughput -0.00 [-0.03, +0.03]
trace_agent_msgpack ingress throughput -0.03 [-0.05, -0.02]
trace_agent_json ingress throughput -0.03 [-0.06, -0.00]
process_agent_real_time_mode memory utilization -0.06 [-0.10, -0.02]
idle memory utilization -0.07 [-0.10, -0.05]
process_agent_standard_check_with_stats memory utilization -0.14 [-0.19, -0.10]
file_to_blackhole % cpu utilization -0.51 [-7.02, +6.00]

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

Copy link
Member

@pgimalac pgimalac left a comment

Choose a reason for hiding this comment

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

Wrote a few comments which came to my mind when reading the code, I understand this needs to handle different languages so having a single perfect implementation is impossible, but I'm not sure this is the best way to do it 😄

EDIT: in particular I think this job only makes sense for the root go.mod file, so the code could be way more specialized for that (only Go, only root module)

tasks/assign_pr.py Outdated Show resolved Hide resolved

# Find the responsible person for each file
owners = []
for root, _, files in os.walk(folder):
Copy link
Member

Choose a reason for hiding this comment

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

This will walk down the tree recursively, and will enter different Go modules.
You might want to add a break if there is a go.mod file in the (sub)directory

Copy link
Member Author

Choose a reason for hiding this comment

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

I currently assign to the "most retrieved owner" so parsing all the repo was on purpose. But you are right we might want more reviewers assigned teams (even if I'm not 100% sure in case of dependency issue, if we want it to be ignored we should tell it to dependabot in its configuration)

Copy link
Member

Choose a reason for hiding this comment

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

I think for Go dependencies, for non-root modules you should just use the Codeowner of the go.mod file.
The root module doesn't have a Codeowner on purpose so I understand it doesn't work, but all other modules should have a narrower scope and be owned by (a) specific team(s)

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I prefer to stick with the ownership where the dependency is effectively imported, and I understand your point. Assigning to the owner of the go.mod would mean we should not have a different ownership in the module, and I don't know if this is always true, wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

I gave it a quick look and it seems to me the single module for which it's not the case is test/new-e2e.
All other modules (ignoring the root one) have a narrow scope and a specific owner.

tasks/assign_pr.py Outdated Show resolved Hide resolved
except StopIteration:
label = "team/agent-platform"
ctx.run(f"gh pr edit {pr_id} --remove-label \"team/triage\"")
ctx.run(f"gh pr edit {pr_id} --add-label \"{label}\"")
Copy link
Member

Choose a reason for hiding this comment

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

You might want to request review from those teams too ?
I know I usually don't look at PRs with my team's label (except just before freeze) but I do look at all PRs my team is assigned on

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently the role said we just have to assign a label to the correct team. We might want to clarify the process and responsabilities here as I've seen we have "just" 200+ dependabot PR opened which is a mess

tasks/assign_pr.py Outdated Show resolved Hide resolved
tasks/assign_pr.py Outdated Show resolved Hide resolved
with open(file_path, "r") as f:
try:
for line in f:
if is_go_module(dependency):
Copy link
Member

Choose a reason for hiding this comment

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

I think a better way to check if it's a go module is to check if the PR edits a go.mod file.
You should probably add a check that the file is a go or go.mod file for this if block

Copy link
Member Author

Choose a reason for hiding this comment

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

CF comment above. Either I consider only the go.mod file and I think it's not correct in terms of ownership, or I consider everything and so a pattern in the dependency looked like an acceptable approximation (knowing there is another match in the else)

tasks/assign_pr.py Show resolved Hide resolved

# Find the responsible person for each file
owners = []
for root, _, files in os.walk(folder):
Copy link
Member

Choose a reason for hiding this comment

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

If you don't want a super specific implementation you might want to just use a grep command to list files containing a given string, it would simplify this whole function
https://stackoverflow.com/a/16957078/10556221

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree I use calls to gh, meanwhile I'm not a super fan of python code calling too many external tools..

Copy link
Member

Choose a reason for hiding this comment

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

I think calling grep is pretty trivial, it doesn't have side effects or anything, it's just a very convenient tool
But up to you :)

@chouetz
Copy link
Member Author

chouetz commented Jan 9, 2024

Wrote a few comments which came to my mind when reading the code, I understand this needs to handle different languages so having a single perfect implementation is impossible, but I'm not sure this is the best way to do it 😄

EDIT: in particular I think this job only makes sense for the root go.mod file, so the code could be way more specialized for that (only Go, only root module)

dependabot updates all version of various dependencies. As a consequence it works also for github actions updates for instance

@pgimalac
Copy link
Member

pgimalac commented Jan 9, 2024

dependabot updates all version of various dependencies. As a consequence it works also for github actions updates for instance

@chouetz yes but workflows are owned by a specific team, so the PR will already be owned by that team.
The root go mod file is the only source of dependencies which doesn't have an owner and whose scope is broader in terms of teams.

@chouetz
Copy link
Member Author

chouetz commented Jan 9, 2024

dependabot updates all version of various dependencies. As a consequence it works also for github actions updates for instance

@chouetz yes but workflows are owned by a specific team, so the PR will already be owned by that team. The root go mod file is the only source of dependencies which doesn't have an owner and whose scope is broader in terms of teams.

Yes the objective would also to rely only on CODEOWNERS as ownership definition. You can see in this PR dependabot set team/agent-platform, and my script would rather infer team/serverless.
I think we could be more accurate if we have file ownership on a single place (I'm not confident about our capacity to maintain accurate ownerships on dependabot.yml and in CODEOWNERS ;) )

@pgimalac
Copy link
Member

pgimalac commented Jan 9, 2024

Oh ok I assumed for this kind of situation we just didn't set a label in the dependabot config and let the real code owner set its own team label, but I think I understand better what the goal of the PR is now

@kacper-murzyn kacper-murzyn modified the milestones: 7.52.0, 7.53.0 Feb 18, 2024
@kacper-murzyn kacper-murzyn modified the milestones: 7.53.0, 7.54.0 Mar 25, 2024
@chouetz chouetz marked this pull request as draft March 25, 2024 09:12
@chouetz chouetz marked this pull request as ready for review March 25, 2024 09:13
@chouetz chouetz requested review from a team as code owners March 25, 2024 09:13
@kacper-murzyn kacper-murzyn removed this from the 7.54.0 milestone Jun 10, 2024
@chouetz chouetz force-pushed the nschweitzer/APL-1717/dependabot branch from dfa84a5 to c8be832 Compare June 20, 2024 08:00
@agent-platform-auto-pr
Copy link
Contributor

[Fast Unit Tests Report]

On pipeline 37148540 (CI Visibility). The following jobs did not run any unit tests:

Jobs:
  • tests_deb-arm64-py3
  • tests_deb-x64-py3
  • tests_flavor_dogstatsd_deb-x64
  • tests_flavor_heroku_deb-x64
  • tests_flavor_iot_deb-x64
  • tests_rpm-arm64-py3
  • tests_rpm-x64-py3
  • tests_windows-x64

If you modified Go files and expected unit tests to run in these jobs, please double check the job logs. If you think tests should have been executed reach out to #agent-developer-experience

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7.52.0-drop 7.53.0-drop changelog/no-changelog [deprecated] qa/skip-qa - use other qa/ labels [DEPRECATED] Please use qa/done or qa/no-code-change to skip creating a QA card qa/no-code-change No code change in Agent code requiring validation team/agent-ci-experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants