Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions scripts/deploy/upload-source-maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ function uploadToDatadog(
sites: string[]
): void {
for (const site of sites) {
if (!site) {
printLog(`No source maps upload configured for ${site}, skipping...`)
const apiKey = getTelemetryOrgApiKey(site)

if (!apiKey) {
printLog(`No API key configured for ${site}, skipping...`)
continue
}

printLog(`Uploading ${packageName} source maps with prefix ${prefix} for ${site}...`)

command`
Expand All @@ -103,7 +106,7 @@ function uploadToDatadog(
--repository-url https://www.github.com/datadog/browser-sdk
`
.withEnvironment({
DATADOG_API_KEY: getTelemetryOrgApiKey(site),
DATADOG_API_KEY: apiKey,
DATADOG_SITE: site,
})
.run()
Expand Down
16 changes: 12 additions & 4 deletions scripts/lib/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,22 @@ export function getOrg2AppKey(): string {
return getSecretKey('ci.browser-sdk.datadog_ci_application_key')
}

export function getTelemetryOrgApiKey(site: string): string {
export function getTelemetryOrgApiKey(site: string): string | undefined {
const normalizedSite = site.replaceAll('.', '-')
return getSecretKey(`ci.browser-sdk.source-maps.${normalizedSite}.ci_api_key`)
try {
return getSecretKey(`ci.browser-sdk.source-maps.${normalizedSite}.ci_api_key`)
} catch {
return
}
}

export function getTelemetryOrgApplicationKey(site: string): string {
export function getTelemetryOrgApplicationKey(site: string): string | undefined {
const normalizedSite = site.replaceAll('.', '-')
return getSecretKey(`ci.browser-sdk.telemetry.${normalizedSite}.ci_app_key`)
try {
return getSecretKey(`ci.browser-sdk.telemetry.${normalizedSite}.ci_app_key`)
} catch {
return
}
}

export function getNpmToken(): string {
Expand Down