datadog-ci icon indicating copy to clipboard operation
datadog-ci copied to clipboard

Keep env vars consistent

Open TophrC-dd opened this issue 1 year ago • 1 comments

What and why?

Currently datadog-ci currently looks between two variable for the datadog site. DATADOG_SITE and DD_SITE except it doesn't always look at DD_SITE for some commands. This can be frustrating especially where most documentation states to use DD_SITE which is heavily documented on the serverless documentation. This PR is an attempt to be consistent in configuring the site so no matter which variable is used it will work across every command.

How?

I have made modifications to the helper api module that implements a new exported constant function called getDatadogSite which check both DATADOG_SITE and DD_SITE. I also ensured that this order is kept if a customer preferred DATADOG_SITE that would be the first variable used. However If neither environment variables are set then the default shall be DATADOG_SITE_US1 which is datadoghq.com.

I have also made updates to the commands to use this new export whereas before it would try to read either DATADOG_SITE or DD_SITE and sometimes both.

Review checklist

Because this make a change across all commands the current tests will validate that it is working properly.

  • [x] Feature or bugfix MUST have appropriate tests (unit, integration)

TophrC-dd avatar Feb 15 '24 19:02 TophrC-dd

Datadog Report

Branch report: keep-envvars-consistent Commit report: 1524fb2 Test service: datadog-ci-tests

:white_check_mark: 0 Failed, 1972 Passed, 0 Skipped, 2m 18.08s Total duration (37.75s time saved)