Can the requirement for DATADOG_API_KEY be removed if doing a --dry-run?
In local & CI environments when not releasing, we run datadog-ci sourcemaps upload --dry-run for validation & consistency.
When doing a --dry-run, we have to conditionally set the DATADOG_API_KEY to some value (e.g. unknown) for it to run.
Describe what you expected
DATADOG_API_KEY to be ignored.
Steps to reproduce the issue
$ datadog-ci sourcemaps upload --dry-run ...
⚠️ DRY-RUN MODE ENABLED. WILL NOT UPLOAD SOURCEMAPS
Starting upload with concurrency 20.
Will look for sourcemaps in js
Will match JS files for errors on files starting with js
version: d646b861b9 service: admin project path: ./
Internal Error: DATADOG_API_KEY environment variable not set
at new DataDogReporter (/Users/eric.clemmons/Development/external-web/node_modules/datadog-metrics/lib/reporters.js:32:15)
at new BufferedMetricsLogger (/Users/eric.clemmons/Development/external-web/node_modules/datadog-metrics/lib/loggers.js:41:38)
at getMetricsLogger (/Users/eric.clemmons/Development/external-web/node_modules/@datadog/datadog-ci/dist/helpers/metrics.js:21:20)
at UploadCommand.<anonymous> (/Users/eric.clemmons/Development/external-web/node_modules/@datadog/datadog-ci/dist/commands/sourcemaps/upload.js:163:66)
at Generator.next (<anonymous>)
at /Users/eric.clemmons/Development/external-web/node_modules/@datadog/datadog-ci/dist/commands/sourcemaps/upload.js:31:71
at new Promise (<anonymous>)
at __awaiter (/Users/eric.clemmons/Development/external-web/node_modules/@datadog/datadog-ci/dist/commands/sourcemaps/upload.js:27:12)
at UploadCommand.execute (/Users/eric.clemmons/Development/external-web/node_modules/@datadog/datadog-ci/dist/commands/sourcemaps/upload.js:142:16)
at UploadCommand.validateAndExecute (/Users/eric.clemmons/Development/external-web/node_modules/@datadog/datadog-ci/node_modules/clipanion/lib/advanced/Command.js:73:37)
error Command failed with exit code 1.
Indeed, when running upload commands with the dry-run flags, metrics are still reported.
We could probably avoid to report those which would allow your use case.
Bug description
Can the requirement for
DATADOG_API_KEY
be removed if doing a--dry-run
?In local & CI environments when not releasing, we run
datadog-ci sourcemaps upload --dry-run
for validation & consistency.When doing a
--dry-run
, we have to conditionally set theDATADOG_API_KEY
to some value (e.g.unknown
) for it to run.Describe what you expected
DATADOG_API_KEY
to be ignored.Steps to reproduce the issue
Additional context
Command
sourcemaps