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(secret): Prevent useless usage of Gitlab token #29950

Merged
merged 2 commits into from
Oct 16, 2024

Conversation

chouetz
Copy link
Member

@chouetz chouetz commented Oct 8, 2024

What does this PR do?

Prevent usage of Gitlab token when it's not necessary

Motivation

Less usage of secrets

Describe how to test/QA your changes

inv testwasher.generate-flake-finder-pipeline -g
mkdir artifacts
inv -e gitlab.compute-gitlab-ci-config --before-file artifacts/before.gitlab-ci.yml --after-file artifacts/after.gitlab-ci.yml --diff-file artifacts/diff.gitlab-ci.yml
inv testwasher.generate-flake-finder-pipeline

The compare the generated content. Some spurious - are removed with the new behaviour, and the execution of the testwasher generation is instantaneous.

Possible Drawbacks / Trade-offs

I had to add the - !reference [.on_deploy_nightly_repo_branch] condition to generate the compute_gitlab_ci_config when it's necessary for the generate_testwasher job.

Additional Notes

@chouetz chouetz added changelog/no-changelog qa/no-code-change No code change in Agent code requiring validation labels Oct 8, 2024
Copy link

cit-pr-commenter bot commented Oct 8, 2024

Regression Detector

Regression Detector Results

Run ID: 5959fd20-9d08-42b8-99df-7a93807fb6b3 Metrics dashboard Target profiles

Baseline: 19c2807
Comparison: 6dcdc38

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.

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
pycheck_lots_of_tags % cpu utilization +2.78 [+0.18, +5.38] 1 Logs
uds_dogstatsd_to_api_cpu % cpu utilization +1.67 [+0.93, +2.40] 1 Logs
basic_py_check % cpu utilization +0.84 [-1.87, +3.55] 1 Logs
tcp_dd_logs_filter_exclude ingress throughput -0.00 [-0.01, +0.01] 1 Logs
file_to_blackhole_0ms_latency egress throughput -0.01 [-0.35, +0.33] 1 Logs
file_to_blackhole_500ms_latency egress throughput -0.01 [-0.26, +0.24] 1 Logs
uds_dogstatsd_to_api ingress throughput -0.01 [-0.11, +0.08] 1 Logs
file_to_blackhole_100ms_latency egress throughput -0.05 [-0.28, +0.18] 1 Logs
file_to_blackhole_300ms_latency egress throughput -0.10 [-0.28, +0.08] 1 Logs
file_to_blackhole_1000ms_latency egress throughput -0.41 [-0.88, +0.07] 1 Logs
file_tree memory utilization -0.44 [-0.56, -0.31] 1 Logs
idle_all_features memory utilization -0.45 [-0.55, -0.34] 1 Logs bounds checks dashboard
idle memory utilization -0.69 [-0.75, -0.62] 1 Logs bounds checks dashboard
tcp_syslog_to_blackhole ingress throughput -0.86 [-0.95, -0.77] 1 Logs
otel_to_otel_logs ingress throughput -1.06 [-1.86, -0.26] 1 Logs

Bounds Checks

perf experiment bounds_check_name replicates_passed
idle memory_usage 7/10
file_to_blackhole_0ms_latency memory_usage 10/10
file_to_blackhole_1000ms_latency memory_usage 10/10
file_to_blackhole_100ms_latency memory_usage 10/10
file_to_blackhole_300ms_latency memory_usage 10/10
file_to_blackhole_500ms_latency memory_usage 10/10
idle_all_features memory_usage 10/10

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".

@chouetz chouetz force-pushed the nschweitzer/no_token branch from 52b4c2a to 59b7898 Compare October 9, 2024 11:33
@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Oct 9, 2024

Gitlab CI Configuration Changes

Modified Jobs

generate-flakes-finder-pipeline
  generate-flakes-finder-pipeline:
    artifacts:
      paths:
      - $CI_PROJECT_DIR/flake-finder-gitlab-ci.yml
    image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES
    needs:
+   - compute_gitlab_ci_config
    - deploy_deb_testing-a7_arm64
    - deploy_deb_testing-a7_x64
    - deploy_rpm_testing-a7_arm64
    - deploy_rpm_testing-a7_x64
    - deploy_suse_rpm_testing_arm64-a7
    - deploy_suse_rpm_testing_x64-a7
    - deploy_windows_testing-a7
    - qa_installer_oci
    - qa_agent_oci
    - qa_cws_instrumentation
    - qa_dca
    - qa_dogstatsd
    - qa_agent
    - qa_agent_ot
    rules:
    - if: $RUN_E2E_TESTS == "off"
      when: never
    - if: $BUCKET_BRANCH != "nightly" && $BUCKET_BRANCH != "oldnightly" && $BUCKET_BRANCH
        != "dev"
      when: never
    - if: $DEPLOY_AGENT == "true" || $DDR_WORKFLOW_ID != null
    - if: $CI_COMMIT_BRANCH =~ /^mq-working-branch-/
      when: never
    - allow_failure: true
      when: manual
    script:
-   - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_FULL_API_TOKEN)
-     || exit $?; export GITLAB_TOKEN
    - inv -e testwasher.generate-flake-finder-pipeline
    stage: e2e
    tags:
    - arch:amd64

Changes Summary

Removed Modified Added Renamed
0 1 0 0

ℹ️ Diff available in the job log.

@chouetz chouetz force-pushed the nschweitzer/no_token branch from 59b7898 to 2f1cabd Compare October 9, 2024 11:48
@chouetz
Copy link
Member Author

chouetz commented Oct 9, 2024

/trigger-ci --variable RUN_ALL_BUILDS=true --variable RUN_KITCHEN_TESTS=true --variable RUN_E2E_TESTS=on --variable DEPLOY_AGENT=true --variable RUN_UNIT_TESTS=on --variable RUN_KMT_TESTS=on

@dd-devflow
Copy link

dd-devflow bot commented Oct 9, 2024

🚂 Gitlab pipeline started

Started pipeline #46160737

@chouetz chouetz marked this pull request as ready for review October 9, 2024 16:59
@chouetz chouetz requested review from a team as code owners October 9, 2024 16:59
@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Oct 9, 2024

[Fast Unit Tests Report]

On pipeline 46704794 (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-devx-help

@@ -174,13 +175,21 @@ def get_tests_family(self, test_name_list):


@task
def generate_flake_finder_pipeline(ctx, n=3):
def generate_flake_finder_pipeline(ctx, n=3, generate_config=False):
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ question
Should we require all jobs calling the test washer to depend on the gitlab config generation artifact? Otherwise we should default to true to keep the behavior as is

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 we should, so that we don't need to use a gitlab secret in the test washer related jobs. That's normally what I did there

@chouetz chouetz force-pushed the nschweitzer/no_token branch 2 times, most recently from 899fcd7 to 6dcdc38 Compare October 16, 2024 11:35
@chouetz
Copy link
Member Author

chouetz commented Oct 16, 2024

/merge

@dd-devflow
Copy link

dd-devflow bot commented Oct 16, 2024

🚂 MergeQueue: pull request added to the queue

The median merge time in main is 25m.

Use /merge -c to cancel this operation!

@dd-mergequeue dd-mergequeue bot merged commit 2002543 into main Oct 16, 2024
214 checks passed
@dd-mergequeue dd-mergequeue bot deleted the nschweitzer/no_token branch October 16, 2024 14:30
@github-actions github-actions bot added this to the 7.60.0 milestone Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/no-changelog qa/no-code-change No code change in Agent code requiring validation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants