From a762cf04ca4fcb378458736a606b9ab74b3c2d93 Mon Sep 17 00:00:00 2001 From: Caleb Metz Date: Tue, 5 Nov 2024 13:41:19 -0500 Subject: [PATCH 1/5] Passing SMP 'Job Id' through ci using datadog-ci cli. Signed-off-by: Caleb Metz --- .gitlab/functional_test/regression_detector.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab/functional_test/regression_detector.yml b/.gitlab/functional_test/regression_detector.yml index 599082bebda50..e8fe63f65387d 100644 --- a/.gitlab/functional_test/regression_detector.yml +++ b/.gitlab/functional_test/regression_detector.yml @@ -130,6 +130,11 @@ single-machine-performance-regression_detector: # uploading JUnit XML, so the upload command below respects that convention. - DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$AGENT_API_KEY_ORG2" token)" || exit $?; export DATADOG_API_KEY - datadog-ci junit upload --service datadog-agent outputs/junit.xml + # Get the SMP Job Id from 'submission-metadata' and use 'datadog-ci' + # to tag the gitlab job seen in CI Visibility with the SMP Job Id. + - SMP_JOB_ID = jq -r '.jobId' submission-metadata + - echo "SMP Job Id is ${SMP_JOB_ID}" + - datadog-ci tag --level job --tags job_id:${SMP_JOB_ID} # Finally, exit 1 if the job signals a regression else 0. - RUST_LOG="${RUST_LOG}" ./smp --team-id ${SMP_AGENT_TEAM_ID} --api-base ${SMP_API} --aws-named-profile ${AWS_NAMED_PROFILE} job result From c4cd7e2cd47d1433346943a6f640174de76b788e Mon Sep 17 00:00:00 2001 From: Caleb Metz Date: Tue, 5 Nov 2024 16:21:34 -0500 Subject: [PATCH 2/5] Moved `datadog-ci tag` call to right after `smp submit` command. Signed-off-by: Caleb Metz --- .gitlab/functional_test/regression_detector.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitlab/functional_test/regression_detector.yml b/.gitlab/functional_test/regression_detector.yml index e8fe63f65387d..2619f53f6573c 100644 --- a/.gitlab/functional_test/regression_detector.yml +++ b/.gitlab/functional_test/regression_detector.yml @@ -109,6 +109,13 @@ single-machine-performance-regression_detector: --comparison-sha ${CI_COMMIT_SHA} --target-config-dir test/regression/ --submission-metadata submission_metadata + # `datadog-ci` relies on `DATADOG_API_KEY` so we get that here. + - DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$AGENT_API_KEY_ORG2" token)" || exit $?; export DATADOG_API_KEY + # Get the SMP Job Id from 'submission-metadata' and use 'datadog-ci' + # to tag the gitlab job seen in CI Visibility with the SMP Job Id. + - SMP_JOB_ID = jq -r '.jobId' submission-metadata + - echo "SMP Job Id is ${SMP_JOB_ID}" + - datadog-ci tag --level job --tags job_id:${SMP_JOB_ID} # Wait for job to complete. - RUST_LOG="${RUST_LOG}" ./smp --team-id ${SMP_AGENT_TEAM_ID} --api-base ${SMP_API} --aws-named-profile ${AWS_NAMED_PROFILE} job status @@ -128,13 +135,7 @@ single-machine-performance-regression_detector: # invoke task has additional logic that does not seem to apply well to SMP's # JUnit XML. Agent CI seems to use `datadog-agent` as the service name when # uploading JUnit XML, so the upload command below respects that convention. - - DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$AGENT_API_KEY_ORG2" token)" || exit $?; export DATADOG_API_KEY - datadog-ci junit upload --service datadog-agent outputs/junit.xml - # Get the SMP Job Id from 'submission-metadata' and use 'datadog-ci' - # to tag the gitlab job seen in CI Visibility with the SMP Job Id. - - SMP_JOB_ID = jq -r '.jobId' submission-metadata - - echo "SMP Job Id is ${SMP_JOB_ID}" - - datadog-ci tag --level job --tags job_id:${SMP_JOB_ID} # Finally, exit 1 if the job signals a regression else 0. - RUST_LOG="${RUST_LOG}" ./smp --team-id ${SMP_AGENT_TEAM_ID} --api-base ${SMP_API} --aws-named-profile ${AWS_NAMED_PROFILE} job result From 395e370d61900f7cf02305eda5c44eafd9562b04 Mon Sep 17 00:00:00 2001 From: Caleb Metz Date: Wed, 6 Nov 2024 13:24:01 -0500 Subject: [PATCH 3/5] Fixed command Signed-off-by: Caleb Metz --- .gitlab/functional_test/regression_detector.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/functional_test/regression_detector.yml b/.gitlab/functional_test/regression_detector.yml index 2619f53f6573c..8cfdf9bccdcf2 100644 --- a/.gitlab/functional_test/regression_detector.yml +++ b/.gitlab/functional_test/regression_detector.yml @@ -113,7 +113,7 @@ single-machine-performance-regression_detector: - DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$AGENT_API_KEY_ORG2" token)" || exit $?; export DATADOG_API_KEY # Get the SMP Job Id from 'submission-metadata' and use 'datadog-ci' # to tag the gitlab job seen in CI Visibility with the SMP Job Id. - - SMP_JOB_ID = jq -r '.jobId' submission-metadata + - SMP_JOB_ID=${jq -r '.jobId' submission-metadata} - echo "SMP Job Id is ${SMP_JOB_ID}" - datadog-ci tag --level job --tags job_id:${SMP_JOB_ID} # Wait for job to complete. From 76d6217a99e0c477b559f128cc012a0722088e97 Mon Sep 17 00:00:00 2001 From: Caleb Metz Date: Wed, 6 Nov 2024 14:51:10 -0500 Subject: [PATCH 4/5] Fixed format to execute command Signed-off-by: Caleb Metz --- .gitlab/functional_test/regression_detector.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/functional_test/regression_detector.yml b/.gitlab/functional_test/regression_detector.yml index 8cfdf9bccdcf2..f383b336c7a45 100644 --- a/.gitlab/functional_test/regression_detector.yml +++ b/.gitlab/functional_test/regression_detector.yml @@ -113,7 +113,7 @@ single-machine-performance-regression_detector: - DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$AGENT_API_KEY_ORG2" token)" || exit $?; export DATADOG_API_KEY # Get the SMP Job Id from 'submission-metadata' and use 'datadog-ci' # to tag the gitlab job seen in CI Visibility with the SMP Job Id. - - SMP_JOB_ID=${jq -r '.jobId' submission-metadata} + - SMP_JOB_ID=$(jq -r '.jobId' submission-metadata) - echo "SMP Job Id is ${SMP_JOB_ID}" - datadog-ci tag --level job --tags job_id:${SMP_JOB_ID} # Wait for job to complete. From 3fa933963940dfc3dcaa3248b7fc3cadcecc7d08 Mon Sep 17 00:00:00 2001 From: Caleb Metz Date: Wed, 6 Nov 2024 15:28:57 -0500 Subject: [PATCH 5/5] Fixed typo Signed-off-by: Caleb Metz --- .gitlab/functional_test/regression_detector.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/functional_test/regression_detector.yml b/.gitlab/functional_test/regression_detector.yml index f383b336c7a45..26d17a967dfbb 100644 --- a/.gitlab/functional_test/regression_detector.yml +++ b/.gitlab/functional_test/regression_detector.yml @@ -113,7 +113,7 @@ single-machine-performance-regression_detector: - DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$AGENT_API_KEY_ORG2" token)" || exit $?; export DATADOG_API_KEY # Get the SMP Job Id from 'submission-metadata' and use 'datadog-ci' # to tag the gitlab job seen in CI Visibility with the SMP Job Id. - - SMP_JOB_ID=$(jq -r '.jobId' submission-metadata) + - SMP_JOB_ID=$(jq -r '.jobId' submission_metadata) - echo "SMP Job Id is ${SMP_JOB_ID}" - datadog-ci tag --level job --tags job_id:${SMP_JOB_ID} # Wait for job to complete.