Skip to content

Commit

Permalink
normalize DD_API_KEY and DD_TAGS
Browse files Browse the repository at this point in the history
  • Loading branch information
nhulston committed Mar 3, 2025
1 parent 6b61f6f commit ebc63db
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
36 changes: 29 additions & 7 deletions integration_tests/correct_forwarder_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@
],
"Environment": {
"Variables": {
"DD_API_KEY": "***",
"DD_SITE": "datadoghq.com",
"DD_LOG_LEVEL": "info",
"DD_FLUSH_TO_LOG": true,
Expand All @@ -490,6 +491,7 @@
"DD_LOGS_INJECTION": true,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TAGS": "git.commit.sha:XXXXXXXXXXXXXXXX,git.repository_url:github.com/OWNER/REPO.git",
"DD_LAMBDA_HANDLER": "py_handler.hello"
}
},
Expand Down Expand Up @@ -537,6 +539,7 @@
],
"Environment": {
"Variables": {
"DD_API_KEY": "***",
"DD_SITE": "datadoghq.com",
"DD_LOG_LEVEL": "info",
"DD_FLUSH_TO_LOG": true,
Expand All @@ -545,6 +548,7 @@
"DD_LOGS_INJECTION": true,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TAGS": "git.commit.sha:XXXXXXXXXXXXXXXX,git.repository_url:github.com/OWNER/REPO.git",
"DD_LAMBDA_HANDLER": "py_handler.hello"
}
},
Expand Down Expand Up @@ -592,6 +596,7 @@
],
"Environment": {
"Variables": {
"DD_API_KEY": "***",
"DD_SITE": "datadoghq.com",
"DD_LOG_LEVEL": "info",
"DD_FLUSH_TO_LOG": true,
Expand All @@ -600,6 +605,7 @@
"DD_LOGS_INJECTION": true,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TAGS": "git.commit.sha:XXXXXXXXXXXXXXXX,git.repository_url:github.com/OWNER/REPO.git",
"DD_LAMBDA_HANDLER": "py_handler.hello"
}
},
Expand Down Expand Up @@ -647,6 +653,7 @@
],
"Environment": {
"Variables": {
"DD_API_KEY": "***",
"DD_SITE": "datadoghq.com",
"DD_LOG_LEVEL": "info",
"DD_FLUSH_TO_LOG": true,
Expand All @@ -655,6 +662,7 @@
"DD_LOGS_INJECTION": true,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TAGS": "git.commit.sha:XXXXXXXXXXXXXXXX,git.repository_url:github.com/OWNER/REPO.git",
"DD_LAMBDA_HANDLER": "js_handler.hello"
}
},
Expand Down Expand Up @@ -702,6 +710,7 @@
],
"Environment": {
"Variables": {
"DD_API_KEY": "***",
"DD_SITE": "datadoghq.com",
"DD_LOG_LEVEL": "info",
"DD_FLUSH_TO_LOG": true,
Expand All @@ -710,6 +719,7 @@
"DD_LOGS_INJECTION": true,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TAGS": "git.commit.sha:XXXXXXXXXXXXXXXX,git.repository_url:github.com/OWNER/REPO.git",
"DD_LAMBDA_HANDLER": "js_handler.hello"
}
},
Expand Down Expand Up @@ -807,6 +817,7 @@
],
"Environment": {
"Variables": {
"DD_API_KEY": "***",
"DD_SITE": "datadoghq.com",
"DD_LOG_LEVEL": "info",
"DD_FLUSH_TO_LOG": true,
Expand All @@ -815,7 +826,8 @@
"DD_LOGS_INJECTION": true,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper"
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_TAGS": "git.commit.sha:XXXXXXXXXXXXXXXX,git.repository_url:github.com/OWNER/REPO.git"
}
},
"Role": {
Expand Down Expand Up @@ -859,6 +871,7 @@
],
"Environment": {
"Variables": {
"DD_API_KEY": "***",
"DD_SITE": "datadoghq.com",
"DD_LOG_LEVEL": "info",
"DD_FLUSH_TO_LOG": true,
Expand All @@ -867,7 +880,8 @@
"DD_LOGS_INJECTION": true,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper"
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_TAGS": "git.commit.sha:XXXXXXXXXXXXXXXX,git.repository_url:github.com/OWNER/REPO.git"
}
},
"Role": {
Expand Down Expand Up @@ -911,6 +925,7 @@
],
"Environment": {
"Variables": {
"DD_API_KEY": "***",
"DD_SITE": "datadoghq.com",
"DD_LOG_LEVEL": "info",
"DD_FLUSH_TO_LOG": true,
Expand All @@ -919,7 +934,8 @@
"DD_LOGS_INJECTION": true,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper"
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_TAGS": "git.commit.sha:XXXXXXXXXXXXXXXX,git.repository_url:github.com/OWNER/REPO.git"
}
},
"Role": {
Expand Down Expand Up @@ -963,6 +979,7 @@
],
"Environment": {
"Variables": {
"DD_API_KEY": "***",
"DD_SITE": "datadoghq.com",
"DD_LOG_LEVEL": "info",
"DD_FLUSH_TO_LOG": true,
Expand All @@ -971,7 +988,8 @@
"DD_LOGS_INJECTION": true,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper"
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_TAGS": "git.commit.sha:XXXXXXXXXXXXXXXX,git.repository_url:github.com/OWNER/REPO.git"
}
},
"Role": {
Expand Down Expand Up @@ -1015,14 +1033,16 @@
],
"Environment": {
"Variables": {
"DD_API_KEY": "***",
"DD_SITE": "datadoghq.com",
"DD_LOG_LEVEL": "info",
"DD_FLUSH_TO_LOG": true,
"DD_TRACE_ENABLED": true,
"DD_MERGE_XRAY_TRACES": false,
"DD_LOGS_INJECTION": true,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TAGS": "git.commit.sha:XXXXXXXXXXXXXXXX,git.repository_url:github.com/OWNER/REPO.git"
}
},
"Role": {
Expand Down Expand Up @@ -1066,14 +1086,16 @@
],
"Environment": {
"Variables": {
"DD_API_KEY": "***",
"DD_SITE": "datadoghq.com",
"DD_LOG_LEVEL": "info",
"DD_FLUSH_TO_LOG": true,
"DD_TRACE_ENABLED": true,
"DD_MERGE_XRAY_TRACES": false,
"DD_LOGS_INJECTION": true,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TAGS": "git.commit.sha:XXXXXXXXXXXXXXXX,git.repository_url:github.com/OWNER/REPO.git"
}
},
"Role": {
Expand Down Expand Up @@ -2533,4 +2555,4 @@
}
}
}
}
}
6 changes: 6 additions & 0 deletions scripts/run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ for ((i = 0; i < ${#SERVERLESS_CONFIGS[@]}; i++)); do
# Normalize layer timestamps
perl -p -i -e 's/("serverless\/dd-sls-plugin-integration-test\/dev\/.*\/ProviderLevelLayer.zip")/"serverless\/dd-sls-plugin-integration-test\/dev\/XXXXXXXXXXXXX-XXXX-XX-XXXXX:XX:XX.XXXX\/ProviderLevelLayer.zip"/g' ${RAW_CFN_TEMPLATE}
perl -p -i -e 's/("serverless\/dd-sls-plugin-integration-test\/dev\/.*\/FunctionLevelLayer.zip")/"serverless\/dd-sls-plugin-integration-test\/dev\/XXXXXXXXXXXXX-XXXX-XX-XXXXX:XX:XX.XXXX\/FunctionLevelLayer.zip"/g' ${RAW_CFN_TEMPLATE}
# Normalize DD_API_KEY (replace actual API key with placeholder)
perl -p -i -e 's/("DD_API_KEY": ").*?(")/"DD_API_KEY": "***"/g' ${RAW_CFN_TEMPLATE}
# Normalize git commit SHA in DD_TAGS
perl -p -i -e 's/("DD_TAGS": "git.commit.sha:)[a-f0-9]+(\b)/"DD_TAGS": "git.commit.sha:XXXXXXXXXXXXXXXX$2/g' ${RAW_CFN_TEMPLATE}
# Normalize git repository URL in DD_TAGS
perl -p -i -e 's/(github.com\/[^\/]+\/[^\.]+)\.git/github.com\/OWNER\/REPO.git/g' ${RAW_CFN_TEMPLATE}
cp ${RAW_CFN_TEMPLATE} ${TEST_SNAPSHOTS[i]}
echo "===================================="
if [ "$UPDATE_SNAPSHOTS" = "true" ]; then
Expand Down

0 comments on commit ebc63db

Please sign in to comment.