### Install Dependencies for Development Source: https://github.com/datadog/datadog-ci/blob/master/CONTRIBUTING.md Run this command once to install all necessary dependencies when setting up the development environment. ```bash yarn install ``` -------------------------------- ### Complete Global Configuration Example Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md An example of a comprehensive global configuration file for Datadog CI, including various test overrides and proxy settings. ```json { "apiKey": "", "appKey": "", "batchTimeout": 1800000, "datadogSite": "datadoghq.com", "defaultTestOverrides": { "allowInsecureCertificates": true, "basicAuth": {"username": "test", "password": "test"}, "body": "{\"fakeContent\":true}", "bodyType": "application/json", "cookies": "name1=value1;name2=value2;", "setCookies": "name1=value1 \n name2=value2; Domain=example.com \n name3=value3; Secure; HttpOnly", "defaultStepTimeout": 15, "deviceIds": ["chrome.laptop_large"], "executionRule": "skipped", "followRedirects": true, "headers": {"NEW_HEADER": "NEW VALUE"}, "locations": ["aws:us-east-1"], "mobileApplicationVersion": "01234567-8888-9999-abcd-efffffffffff", "mobileApplicationVersionFilePath": "path/to/application.apk", "resourceUrlSubstitutionRegexes": ["(https://www\.)(.*)|$1staging-$2"], "retry": {"count": 2, "interval": 300}, "startUrl": "{{URL}}?static_hash={{STATIC_HASH}}", "startUrlSubstitutionRegex": "s/(https://www\.)(.*)/$1extra-$2/", "testTimeout": 300, "variables": {"NEW_VARIABLE": "NEW VARIABLE"} }, "failOnCriticalErrors": true, "failOnMissingTests": true, "failOnTimeout": true, "files": ["{,!(node_modules)/**/}*.synthetics.json"], "proxy": { "auth": { "username": "login", "password": "pwd" }, "host": "127.0.0.1", "port": 3128, "protocol": "http" }, "subdomain": "subdomainname", "tunnel": true } ``` -------------------------------- ### Install Datadog Synthetics Plugin Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Install the Synthetics plugin for the Datadog CI package. ```bash datadog-ci plugin install synthetics ``` -------------------------------- ### jUnit Upload Example Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-junit/README.md Example of how to upload jUnit XML reports with specified service and tags. The paths indicate where the reports are located. ```bash datadog-ci junit upload --service my-service --tags key1:value1 --tags key2:value2 unit-tests/junit-reports acceptance-tests/junit-reports e2e-tests/single-report.xml ``` -------------------------------- ### Install Datadog CI CLI Globally or One-Shot Source: https://github.com/datadog/datadog-ci/blob/master/packages/datadog-ci/README.md Install the datadog-ci CLI globally for system-wide access or use npx/yarn dlx for one-shot execution without global installation. ```sh # Install globally with NPM npm install -g @datadog/datadog-ci ``` ```sh # ...or with Yarn 1 (Classic) yarn global add @datadog/datadog-ci ``` ```sh # ...or run a one-shot install with NPM npx @datadog/datadog-ci@v5 [scope] ``` ```sh # or with Yarn yarn dlx @datadog/datadog-ci@v5 [scope] ``` -------------------------------- ### Install Datadog CI CLI Globally Source: https://github.com/datadog/datadog-ci/blob/master/README.md Install the datadog-ci CLI globally for system-wide access. ```sh # Install globally with NPM npm install -g @datadog/datadog-ci ``` ```sh # ...or with Yarn 1 (Classic) yarn global add @datadog/datadog-ci ``` -------------------------------- ### Install datadog-ci on Linux x64 Source: https://github.com/datadog/datadog-ci/blob/master/packages/datadog-ci/README.md Installs the datadog-ci standalone binary for Linux x64 architecture. Ensures the binary is executable. ```sh # Linux x64 curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-x64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci ``` -------------------------------- ### End-to-end testing trace command Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/trace/README.md Example setup for verifying the trace command functionality in a CI environment. ```bash export DD_API_KEY='' export CIRCLECI=true yarn launch trace --name "Say Hello" echo "Hello World" ``` -------------------------------- ### Command Output Example Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/git-metadata/README.md Expected console output upon a successful metadata upload. ```text Reporting commit fceed94376fc50dea8ba6d6310002dcf1efcc06e from repository git@github.com:DataDog/datadog-ci.git. 180 tracked file paths will be reported. ✅ Uploaded in 0.736 seconds. ✨ Done in 4.27s ``` -------------------------------- ### List Available Plugins Source: https://github.com/datadog/datadog-ci/blob/master/packages/datadog-ci/README.md Use this command to see all plugins that can be installed with datadog-ci. ```bash datadog-ci plugin list ``` -------------------------------- ### End-to-End Testing Process Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/tag/README.md Example of setting up environment variables and running the tag command to verify functionality. ```bash export DD_API_KEY='' export BUILDKITE=true export BUILDKITE_BUILD_ID=uuid yarn launch tag --level pipeline --tags foo:bar ``` -------------------------------- ### Install datadog-ci on Windows x64 Source: https://github.com/datadog/datadog-ci/blob/master/packages/datadog-ci/README.md Downloads the datadog-ci standalone binary for Windows x64 architecture. ```powershell # Windows x64 Invoke-WebRequest -Uri "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_win-x64" -OutFile "datadog-ci.exe" ``` -------------------------------- ### Install datadog-ci on Alpine x64 Source: https://github.com/datadog/datadog-ci/blob/master/packages/datadog-ci/README.md Installs the datadog-ci standalone binary for Alpine Linux x64 architecture. Ensures the binary is executable. ```sh # Alpine x64 curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_alpine-x64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci ``` -------------------------------- ### Install datadog-ci on Linux arm64 Source: https://github.com/datadog/datadog-ci/blob/master/packages/datadog-ci/README.md Installs the datadog-ci standalone binary for Linux arm64 architecture. Ensures the binary is executable. ```sh # Linux arm64 curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-arm64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci ``` -------------------------------- ### Trace command example Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/trace/README.md Example of tracing a simple echo command with a custom span name. ```bash datadog-ci trace --name "Say Hello" -- echo "Hello World" ``` -------------------------------- ### Install datadog-ci on Alpine arm64 Source: https://github.com/datadog/datadog-ci/blob/master/packages/datadog-ci/README.md Installs the datadog-ci standalone binary for Alpine Linux arm64 architecture. Ensures the binary is executable. ```sh # Alpine arm64 curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_alpine-arm64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci ``` -------------------------------- ### Install Datadog CI CLI with NPM Source: https://github.com/datadog/datadog-ci/blob/master/README.md Install the datadog-ci NPM package as a development dependency. ```sh # NPM npm install --save-dev @datadog/datadog-ci ``` -------------------------------- ### Install datadog-ci on MacOS x64 Source: https://github.com/datadog/datadog-ci/blob/master/packages/datadog-ci/README.md Installs the datadog-ci standalone binary for MacOS x64 architecture. Ensures the binary is executable. ```sh # MacOS x64 curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_darwin-x64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci ``` -------------------------------- ### Tag Command Example Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/tag/README.md Example of applying a job-level tag using a shell command for the value. ```bash datadog-ci tag --level job --tags "go.version:`go version`" ``` -------------------------------- ### Verify datadog-ci installation Source: https://github.com/datadog/datadog-ci/blob/master/packages/datadog-ci/README.md Checks the installed version of the datadog-ci CLI. ```sh datadog-ci version ``` -------------------------------- ### Example dry-run output Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-dora/README.md Sample output generated when running the deployment command in dry-run mode. ```text ⚠️ --git-repository-url or --git-commit-sha not provided. Assuming deployment of the current HEAD commit: git@github.com:DataDog/datadog-ci.git 400beb0f276d923846cf778b9dbe9cf101306e41 This warning can be disabled with --skip-git but git data is required for Change Lead Time. [DRYRUN] Sending DORA deployment event for service: dora-api data: { "service": "dora-api", "startedAt": "2023-11-14T17:14:16.000Z", "finishedAt": "2023-11-14T17:14:18.574Z", "git": { "repoURL": "git@github.com:DataDog/datadog-ci.git", "commitSHA": "400beb0f276d923846cf778b9dbe9cf101306e41" } } ``` -------------------------------- ### Install datadog-ci on MacOS arm64 Source: https://github.com/datadog/datadog-ci/blob/master/packages/datadog-ci/README.md Installs the datadog-ci standalone binary for MacOS arm64 architecture. Ensures the binary is executable. ```sh # MacOS arm64 curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_darwin-arm64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci ``` -------------------------------- ### Run Datadog CI CLI with NPX Source: https://github.com/datadog/datadog-ci/blob/master/README.md Execute a one-shot install and run of the datadog-ci CLI using NPX. ```sh # ...or run a one-shot install with NPM npx @datadog/datadog-ci@v5 [scope] ``` -------------------------------- ### Configure startUrlSubstitutionRegex with pipe syntax Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Use the pipe-based syntax for `startUrlSubstitutionRegex` to avoid conflicts with '/' characters in URLs. This example transforms a URL. ```string "startUrlSubstitutionRegex": "https://example.com(.*)|http://subdomain.example.com$1" ``` -------------------------------- ### Install Datadog CI CLI with Yarn Source: https://github.com/datadog/datadog-ci/blob/master/README.md Install the datadog-ci package as a development dependency using Yarn. ```sh # Yarn yarn add --dev @datadog/datadog-ci ``` -------------------------------- ### Install a Datadog CI Plugin Source: https://github.com/datadog/datadog-ci/blob/master/packages/datadog-ci/README.md Installs a specific plugin for datadog-ci. Plugins extend the functionality of the core datadog-ci package. ```bash datadog-ci plugin install ``` -------------------------------- ### Deployment Gate Configuration File Example Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-deployment/README.md This JSON structure defines rules for a Datadog Deployment Gate. It can be used with the `--config` option to specify inline rules. ```json { "dryRun": false, "rules": [ { "type": "monitor", "name": "error rate monitors", "options": { "query": "service:payments-backend env:prod", "duration": 300 } } ] } ``` -------------------------------- ### Datadog CI Coverage Upload Example Usage Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-coverage/README.md Example of uploading coverage reports with specific flags for type and JVM version. Supports multiple paths and repeatable flags. ```bash datadog-ci coverage upload --flags type:unit-tests --flags jvm-21 unit-tests/coverage-reports acceptance-tests/coverage-reports e2e-tests/coverage-report.xml ``` -------------------------------- ### Example Upload Output Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/dsyms/README.md Expected console output upon a successful dSYM upload operation. ```text Starting upload with concurrency 20. Will look for dSYMs in /Users/mert.buran/Library/Developer/Xcode/DerivedData Uploading dSYM with 00000-11111-00000-11111 from /path/to/dsym/file1.dSYM Uploading dSYM with 00000-22222-00000-22222 from /path/to/dsym/file2.dSYM Uploading dSYM with 00000-33333-00000-33333 from /path/to/dsym/file3.dSYM ... Command summary: ✅ Uploaded 5 dSYMs in 8.281 seconds. ✨ Done in 10.71s. ``` -------------------------------- ### Install Datadog CI CLI with NPM or Yarn Source: https://github.com/datadog/datadog-ci/blob/master/packages/datadog-ci/README.md Install the datadog-ci CLI as a development dependency in your project using NPM or Yarn. ```sh # NPM npm install --save-dev @datadog/datadog-ci ``` ```sh # Yarn yarn add --dev @datadog/datadog-ci ``` -------------------------------- ### Configure startUrlSubstitutionRegex with slash syntax Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Use the slash syntax for `startUrlSubstitutionRegex` to support modifiers. This example transforms a URL by adding an extra subdomain part. ```string "startUrlSubstitutionRegex": "s/(https://www.)(.*)/$1extra-$2/" ``` -------------------------------- ### End-to-End Test for Measure Command Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/measure/README.md This example demonstrates how to set up environment variables and run the measure command for end-to-end testing. It verifies the command returns 0 upon successful execution. ```bash export DD_API_KEY='' export BUILDKITE=true export BUILDKITE_BUILD_ID=uuid yarn launch measure --level pipeline --measures foo:1 ``` ```bash Measures sent ``` -------------------------------- ### Example test run output Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Displays the expected console output after a successful synthetic test execution. ```bash [abc-def-ghi] Trigger test "Check on testing.website" [abc-def-ghi] Waiting results for "Check on testing.website" === REPORT === Took 11546ms ✓ [abc-def-ghi] | Check on testing.website ✓ location: Frankfurt (AWS) ⎋ total duration: 28.9 ms - result url: https://app.datadoghq.com/synthetics/details/abc-def-ghi?resultId=123456789123456789 ✓ GET - https://testing.website ``` -------------------------------- ### Run Datadog CI CLI with Yarn DLX Source: https://github.com/datadog/datadog-ci/blob/master/README.md Execute a one-shot install and run of the datadog-ci CLI using Yarn DLX. ```sh # or with Yarn yarn dlx @datadog/datadog-ci@v5 [scope] ``` -------------------------------- ### Datadog CI Dry Run Output Example Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-coverage/README.md Example of the expected output when running the `datadog-ci coverage upload` command with the `--dry-run` flag. Confirms dry-run mode and successful report processing. ```bash ⚠️ DRY-RUN MODE ENABLED. WILL NOT UPLOAD COVERAGE REPORT Starting upload. Will upload code coverage report file packages/plugin-coverage/src/__tests__/fixtures/jacoco-report.xml [DRYRUN] Uploading code coverage report file in packages/plugin-coverage/src/__tests__/fixtures/jacoco-report.xml ✅ Uploaded 1 files in 0 seconds. ``` -------------------------------- ### Install, Build, and Run Datadog CI Commands Source: https://github.com/datadog/datadog-ci/blob/master/AGENTS.md Common Yarn commands for managing the Datadog CI tool, including dependency installation, code compilation, running commands in development, and testing. ```sh yarn install # install dependencies yarn build # compile TypeScript yarn launch [args] # run a command in dev (no build needed) yarn test # run all tests yarn test # run tests for a specific package/file yarn lint # lint (fails on errors) yarn format # lint + auto-fix ``` -------------------------------- ### Expected output for upload command Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/react-native/README.md Example of the console output generated after a successful sourcemap upload. ```bash Starting upload. Upload of /var/folders/34/_7q54_lx4nl1cvkjwr3_k4lw0000gq/T/tmp.x0vecv3yFT/fake.js.map for bundle /var/folders/34/_7q54_lx4nl1cvkjwr3_k4lw0000gq/T/tmp.x0vecv3yFT/fake.js on platform ios with project path /Users/me/datadog-ci version: 0.0.1 service: com.company.app ⚠️ No tracked files found for sources contained in /var/folders/34/_7q54_lx4nl1cvkjwr3_k4lw0000gq/T/tmp.x0vecv3yFT/fake.js.map Uploading sourcemap /var/folders/34/_7q54_lx4nl1cvkjwr3_k4lw0000gq/T/tmp.x0vecv3yFT/fake.js.map for JS file available at /var/folders/34/_7q54_lx4nl1cvkjwr3_k4lw0000gq/T/tmp.x0vecv3yFT/fake.js Command summary: ✅ Uploaded 1 sourcemap in 0.698 seconds. ✨ Done in 2.50s. ``` -------------------------------- ### Datadog CI Coverage Upload Dry Run Example Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-coverage/README.md Demonstrates how to perform a dry run of the coverage upload command to verify functionality without sending data. Requires setting the DD_API_KEY environment variable. ```bash export DD_API_KEY='' yarn launch coverage upload --dry-run ./packages/plugin-coverage/src/__tests__/fixtures/jacoco-report.xml ``` -------------------------------- ### Measure Command with Measures File Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/measure/README.md Example of using the `--measures-file` option to provide measures from a JSON file. The JSON file should contain flat key-value pairs with numeric values. ```json { "image.size": 5000, "another_measure": 123 } ``` -------------------------------- ### Datadog CI Upload Successful Output Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/sourcemaps/README.md This is an example of the expected successful output when uploading source maps using Datadog CI. ```bash Starting upload with concurrency 20. Will look for sourcemaps in /var/folders/s_/ds1hc9g54k7ct8x7p3kwsq1h0000gn/T/tmp.fqWhNgGdn6/ Will match JS files for errors on files starting with https://fake.website version: 0.0.1 service: test_datadog-ci project path: Uploading sourcemap /var/folders/s_/ds1hc9g54k7ct8x7p3kwsq1h0000gn/T/tmp.fqWhNgGdn6/fake.js.map for JS file available at https://fake.website/fake.js ✅ Uploaded 1 files in 0.68 seconds. ``` -------------------------------- ### Get More Information with datadog-ci Command Source: https://github.com/datadog/datadog-ci/blob/master/CONTRIBUTING.md Utilize the datadog-ci command-line tool to retrieve more detailed information about packages, specifically plugins. ```sh yarn launch plugin list --all ``` -------------------------------- ### Expected dry-run output Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-junit/README.md Example of the console output generated when running the upload command in dry-run mode. ```bash ⚠️ DRY-RUN MODE ENABLED. WILL NOT UPLOAD JUNIT XML Starting upload with concurrency 20. Will upload jUnit XML file src/__tests__/fixtures/java-report.xml service: example-upload [DRYRUN] Uploading jUnit XML test report file in src/__tests__/fixtures/java-report.xml ✅ Uploaded 1 files in 0 seconds. ``` -------------------------------- ### Implement Command Logic in Plugin Source: https://github.com/datadog/datadog-ci/blob/master/CONTRIBUTING.md Extends a command defined in the base package to implement its specific logic within a plugin. This example shows a simple 'Hello world!' implementation. ```typescript import {FooBarCommand} from '@datadog/datadog-ci-base/commands/foo/bar' export class PluginCommand extends FooBarCommand { // Implement your command's logic here public async execute() { console.log('Hello world!') return 0 } } ``` -------------------------------- ### Configure Datadog Site Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/flutter-symbols/README.md Set the DD_SITE environment variable to specify your Datadog site. Use this if you are not using the default Datadog US1 site. Example shown for US5. ```bash # Example environment setup for US5 export DD_SITE="us5.datadoghq.com" ``` -------------------------------- ### Enable Git Metadata Uploading Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-container-app/README.md Enable uploading of Git metadata as part of the source code integration. This is required if the Datadog GitHub integration is not installed. ```bash --upload-git-metadata ``` -------------------------------- ### Configuration Priority Order Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Illustrates the hierarchy for configuration settings: Global Config < Environment variables < CLI parameters. ```yaml Global Config < Environment variables < CLI parameters ``` -------------------------------- ### Execute command with global configuration Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Runs the upload-application command using a specified configuration file. ```bash datadog-ci synthetics upload-application --config global-config.json ``` -------------------------------- ### Basic Usage of Deployment Gate Command Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-deployment/README.md Use this command to evaluate a Datadog Deployment Gate. Ensure you provide the required `--service` and `--env` arguments. ```bash datadog-ci deployment gate --service payments-backend --env prod ``` -------------------------------- ### Override Start URL Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Override the start URL for API and browser tests. Local and global variables in the URL are replaced during test execution. ```APIDOC ## Override Start URL ### Description Override the start URL for API and browser tests. Local and [global variables][11] specified in the URL (for example, `{{ URL }}`) are replaced when the test is run. You can combine this with the `variables` override to override both the start URL and the variable values. For example: ```bash --override startUrl="{{ URL }}?static_hash={{ STATIC_HASH }}" --override variables.STATIC_HASH=abcdef ``` ### Configuration Options * **Global/Test Config**: `"startUrl": "{{ URL }}?static_hash={{ STATIC_HASH }}"` * **ENV variable**: `DATADOG_SYNTHETICS_OVERRIDE_START_URL="{{ URL }}?static_hash={{ STATIC_HASH }}"` * **CLI param**: `--override startUrl="{{ URL }}?static_hash={{ STATIC_HASH }}"` ``` -------------------------------- ### Configure Datadog Keys via Environment Variables Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Configure Datadog API and application keys using environment variables. ```bash export DD_API_KEY="" export DD_APP_KEY="" ``` -------------------------------- ### Run Tests with Search Query Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Select tests to run using a search query via CLI or configuration files. ```bash datadog-ci synthetics run-tests --search 'team:unicorn tag:e2e-tests tag:"managedBy:terraform"' ``` ```json "testSearchQuery": "tag:e2e-tests" ``` ```bash DATADOG_SYNTHETICS_TEST_SEARCH_QUERY="tag:e2e-tests" ``` ```bash -s "tag:e2e-tests" / --search "tag:e2e-tests" ``` -------------------------------- ### Local development test command Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-terraform/README.md Use this command for local testing of the Terraform upload functionality. It requires yarn to be installed. ```bash yarn launch terraform upload plan /path/to/terraform-plan.json ``` -------------------------------- ### Configure SARIF Upload with Environment Variables Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-sarif/README.md Configure SARIF command settings using environment variables. `DD_API_KEY` is required for authentication. `DD_TAGS` sets global tags, and `DD_SITE` specifies the Datadog site. ```bash export DATADOG_API_KEY='' ``` -------------------------------- ### Set Version Tag for Container App Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-container-app/README.md Assign a version tag to correlate performance metrics with specific application versions. For example, `1.0.0`. ```bash --version 1.0.0 ``` -------------------------------- ### Set Environment Tag for Container App Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-container-app/README.md Assign an environment tag to differentiate between deployment environments like staging or production. For example, `prod`. ```bash --env prod ``` -------------------------------- ### Configure Test Overrides in JSON Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Example of a .synthetics.json file used to override specific test settings like authentication, headers, and variables. ```jsonc // myTest.synthetics.json { "tests": [ { "id": "", "testOverrides": { "allowInsecureCertificates": true, "basicAuth": {"username": "test", "password": "test"}, "body": "{\"fakeContent\":true}", "bodyType": "application/json", "cookies": "name1=value1;name2=value2;", "defaultStepTimeout": 15, "deviceIds": ["chrome.laptop_large"], "executionRule": "skipped", "followRedirects": true, "headers": {"NEW_HEADER": "NEW VALUE"}, "locations": ["aws:us-east-1"], "mobileApplicationVersion": "01234567-8888-9999-abcd-efffffffffff", "mobileApplicationVersionFilePath": "path/to/application.apk", "resourceUrlSubstitutionRegexes": ["(https://www.)(.*)|$1staging-$2"], "retry": {"count": 2, "interval": 300}, "startUrl": "{{URL}}?static_hash={{STATIC_HASH}}", "startUrlSubstitutionRegex": "s/(https://www.)(.*)/$1extra-$2/", "testTimeout": 300, "variables": {"MY_VARIABLE": "new title"} } }, { "id": "", "testOverrides": { "allowInsecureCertificates": true, // ... "variables": {"MY_VARIABLE": "new title"} } } ] } ``` -------------------------------- ### Verify upload command with test files Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/react-native/README.md Creates temporary files and executes the upload command to verify successful sourcemap processing. ```bash export DD_API_KEY='' TEMP_DIR=$(mktemp -d) echo '{}' > $TEMP_DIR/fake.js echo '{"version":3,"file":"out.js","sourceRoot":"","sources":["fake.js"],"names":["src"],"mappings":"AAgBC"}' > $TEMP_DIR/fake.js.map yarn launch react-native upload --platform ios --service com.company.app --bundle $TEMP_DIR/fake.js --sourcemap $TEMP_DIR/fake.js.map --release-version 0.0.1 --build-version 000001 rm -rf $TEMP_DIR ``` -------------------------------- ### Configure Proxy Settings Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Set the proxy for outgoing connections using environment variables. ```bash HTTPS_PROXY=http://login:pwd@127.0.0.1:3128 ``` -------------------------------- ### Global configuration file structure Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Defines configuration options in a JSON file for use with datadog-ci commands. ```json { "apiKey": "", "appKey": "", "mobileApplicationVersionFilePath": "example_path/example_app.apk", "mobileApplicationId": "example-abc", "versionName": "example", "latest": true } ``` -------------------------------- ### Basic Container App Instrumentation Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-container-app/README.md Use this command for basic instrumentation of your Azure Container App. Ensure DD_API_KEY and DD_SITE environment variables are set. ```bash export DD_API_KEY= export DD_SITE=datadoghq.com datadog-ci container-app instrument \ --subscription-id 12345678-1234-1234-1234-123456789012 \ --resource-group my-resource-group \ --name my-container-app ``` -------------------------------- ### Successful Dry Run Output Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-sarif/README.md Example output of a successful dry run for the SARIF upload command, indicating that the process is simulated and no files will be uploaded. ```bash ⚠️ DRY-RUN MODE ENABLED. WILL NOT UPLOAD SARIF REPORT Starting upload with concurrency 20. Will upload SARIF report file packages/plugin-sarif/src/__tests__/fixtures/valid-results.sarif [DRYRUN] Uploading SARIF report in packages/plugin-sarif/src/__tests__/fixtures/valid-results.sarif ✅ Uploaded 1 files in 0 seconds. ``` -------------------------------- ### Successful Dry Run Output Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-gate/README.md Example of successful output when running the GATE command in dry run mode, indicating rule evaluation parameters. ```bash ℹ️ Evaluating rules matching the following information: Repository: git@github.com:DataDog/datadog-ci.git Branch: master team: backend Dry run mode is enabled. Not evaluating the rules. ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/dsyms/README.md Set the required API key and optional site endpoint for the datadog-ci tool. ```bash # Environment setup export DD_API_KEY="" ``` ```bash # Example environment setup for US5 export DD_SITE="us5.datadoghq.com" ``` -------------------------------- ### Upload multiple files with verbose logging Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-terraform/README.md Enable verbose logging for the Terraform upload command to get detailed output during the process. This can aid in debugging. ```bash datadog-ci terraform upload plan ./plan1.json ./plan2.json --verbose ``` -------------------------------- ### Add Extra Tags to Container App Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-container-app/README.md Include additional tags for the Container App in a comma-separated key:value format. For example, `key1:value1,key2:value2`. ```bash --extra-tags key1:value1,key2:value2 ``` -------------------------------- ### Enable Beta Commands Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/pe-symbols/README.md Enable beta commands, including `pe-symbols upload`, by setting the DD_BETA_COMMANDS_ENABLED environment variable to 1. ```bash DD_BETA_COMMANDS_ENABLED=1 ``` -------------------------------- ### Launch SBOM upload for development Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-sbom/README.md Executes the SBOM upload command during the development process using yarn. ```bash yarn launch sbom upload /path/to/sbom.json ``` -------------------------------- ### Configure Proxy for Datadog-CI Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Set the CA certificate for proxy trust and define proxy settings via environment variables or configuration files. ```bash export NODE_EXTRA_CA_CERTS=/path/to/your-ca-cert.pem ``` ```jsonc { // ... "proxy": { "auth": { "username": "login", "password": "pwd" }, "host": "127.0.0.1", "port": 3128, "protocol": "http" }, // ... } ``` ```bash export HTTPS_PROXY=http://login:pwd@127.0.0.1:3128 ``` ```bash DEBUG=proxy-agent yarn datadog-ci synthetics run-tests ``` -------------------------------- ### Build and link local datadog-ci package Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/react-native/README.md Commands to build the local package and link it for development purposes. ```bash yarn build yarn link ``` ```bash yarn link @datadog/datadog-ci ``` -------------------------------- ### Update Files Option Syntax Source: https://github.com/datadog/datadog-ci/blob/master/MIGRATING.md The `files` option in the global configuration file now requires an array of strings. Use this format to specify glob patterns for your synthetic test files. ```json "files": ["{,!(node_modules)/**/}*.synthetics.json"] ``` -------------------------------- ### Enable FIPS Support via CLI Source: https://github.com/datadog/datadog-ci/blob/master/README.md Enables FIPS support for datadog-ci. This option requires a FIPS-validated OpenSSL provider to be installed on the host system. If not available, and Node.js version is below 17, an error may occur. ```sh --fips ``` -------------------------------- ### Run DORA deployment command Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-dora/README.md Basic command structure for reporting a deployment event with required and optional flags. ```bash $ datadog-ci dora deployment [--service #0] [--env #0] [--dry-run] ``` ```bash datadog-ci dora deployment --service my-service --env prod \ --started-at 1699960648 --finished-at 1699961048 \ --git-repository-url https://github.com/my-organization/my-repository \ --git-commit-sha 102836a25f5477e571c73d489b3f0f183687068e ``` -------------------------------- ### Correlate GitOps deployment with CI pipeline Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-deployment/README.md The `correlate` command connects a GitOps deployment with its CI pipeline. This allows visibility into which pipeline triggered a deployment. Note: This command is superseded by `correlate-image` and may not work for all setups. ```bash datadog-ci deployment correlate --provider argocd ``` -------------------------------- ### jUnit Upload Command Syntax Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-junit/README.md This is the general syntax for the jUnit upload command. Use it to understand the available options. ```bash datadog-ci junit upload [--service] [--max-concurrency] [--dry-run] [--tags] ``` -------------------------------- ### Enable FIPS Support via Environment Variable Source: https://github.com/datadog/datadog-ci/blob/master/README.md Enables FIPS support for datadog-ci using an environment variable. This option requires a FIPS-validated OpenSSL provider to be installed on the host system. If not available, and Node.js version is below 17, an error may occur. ```sh DATADOG_FIPS=true ``` -------------------------------- ### Migrate Logger Level in Command Source: https://github.com/datadog/datadog-ci/blob/master/plans/json-logging-migration.md This example demonstrates how to update an existing command to use the shared logger's level setting instead of re-instantiating the logger. It replaces the conditional logger re-instantiation with a call to `this.logger.setLogLevel(LogLevel.DEBUG)` when verbose mode is enabled. ```typescript if (this.verbose) { this.logger.setLogLevel(LogLevel.DEBUG) } ``` -------------------------------- ### Set Datadog Site via Environment Variable Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Configure the Datadog site using an environment variable. This setting can be overridden by CLI parameters. ```bash export DATADOG_SITE=datadoghq.com ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/elf-symbols/README.md Set the required API key for Datadog CI operations. ```bash # Environment setup export DD_API_KEY="" ``` -------------------------------- ### Configure datadog-ci.json Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/elf-symbols/README.md Store configuration in a JSON file at the project root for persistent settings. ```json { "apiKey": "", "datadogSite": "" } ``` -------------------------------- ### Instrument Azure Container App with Configuration Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-container-app/README.md Instrument a Container App and specify custom configuration parameters such as service name, environment, and version for Datadog monitoring. ```bash # Instrument with configuration datadog-ci container-app instrument \ --subscription-id \ --resource-group \ --name \ --service my-service \ --env prod \ --version 1.0.0 ``` -------------------------------- ### Upload JavaScript Sourcemaps Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/sourcemaps/README.md Upload sourcemaps and their corresponding JavaScript bundles from a specified directory to Datadog. Required arguments include the directory, service name, minified path prefix, and release version. The folder structure of the uploaded files should match the served static files. ```bash datadog-ci sourcemaps upload ./build --service my-service --minified-path-prefix https://static.datadog.com --release-version 1.234 ``` -------------------------------- ### Upload SBOM file Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-sbom/README.md Uploads an SBOM file to the Datadog intake endpoint using the CLI. ```bash datadog-ci sbom upload [--env] [--no-ci-tags] [--git-repository] [--debug] ``` -------------------------------- ### Upload mobile application via CLI Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-synthetics/README.md Uploads a new version of a mobile application using CLI flags. ```bash datadog-ci synthetics upload-application \ --mobileApplicationId '123-123-123' \ --mobileApplicationVersionFilePath example/test.apk \ --versionName 'example 1.0' \ --latest ``` -------------------------------- ### CLI Command: dora deployment Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-dora/README.md Sends deployment details to Datadog to track DORA metrics. Requires an API key and service identification. ```APIDOC ## CLI Command: dora deployment ### Description Sends details to Datadog about a deployment of a service to enable DORA metrics tracking. ### Parameters #### Options - **--service** (string) - Required - The name of the service that was deployed (or set via DD_SERVICE env var). - **--env** (string) - Optional - The environment targeted by the deployment (or set via DD_ENV env var). - **--started-at** (string/number) - Required - Timestamp in Unix seconds or ISO8601 when the deployment started. - **--finished-at** (string/number) - Optional - Timestamp in Unix seconds or ISO8601 when the deployment finished (defaults to current time). - **--git-repository-url** (string) - Optional - The repository URL for the deployed service. - **--git-commit-sha** (string) - Optional - The git commit SHA that has been deployed. - **--version** (string) - Optional - The version associated with the deployment. - **--team** (string) - Optional - The team associated with the deployment. - **--custom-tags** (array) - Optional - Custom tags in key:value format (max 100). - **--skip-git** (boolean) - Optional - Disables sending git URL and SHA. - **--dry-run** (boolean) - Optional - Runs the command without sending the event. ### Environment Variables - **DD_API_KEY** (string) - Required - API key used to authenticate the requests. - **DD_SITE** (string) - Optional - Datadog site (e.g., datadoghq.com). ### Request Example ```bash datadog-ci dora deployment --service my-service --env prod --started-at 1699960648 --finished-at 1699961048 --git-repository-url https://github.com/my-org/my-repo --git-commit-sha 102836a25f5477e571c73d489b3f0f183687068e ``` ``` -------------------------------- ### CLI Command: pe-symbols upload Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/pe-symbols/README.md Uploads Windows PE debug info files to Datadog to enable profile symbolication. ```APIDOC ## CLI Command: pe-symbols upload ### Description Uploads debug info from Windows PE files to Datadog. This command is currently in beta and requires `DD_BETA_COMMANDS_ENABLED=1` to be set. ### Parameters #### Command Arguments - **path** (string) - Required - The file path or directory path containing PE files to process. #### Options - **--dry-run** (boolean) - Optional - Performs all checks without executing the final upload. - **--max-concurrency** (number) - Optional - Number of concurrent uploads. Defaults to 20. - **--disable-git** (boolean) - Optional - Prevents Git data collection (hash, remote URL, paths). - **--repository-url** (string) - Optional - Overrides the remote repository URL. - **--replace-existing** (boolean) - Optional - Forces replacement of existing symbol information with the same build ID. ### Request Example DD_BETA_COMMANDS_ENABLED=1 datadog-ci pe-symbols upload ~/your/build/bin/ --max-concurrency 10 ``` -------------------------------- ### Container App Instrumentation with Custom Logging Source: https://github.com/datadog/datadog-ci/blob/master/packages/plugin-container-app/README.md Configure custom log paths for your container app instrumentation. Ensure DD_API_KEY is set. ```bash export DD_API_KEY= datadog-ci container-app instrument \ --subscription-id 12345678-1234-1234-1234-123456789012 \ --resource-group my-resource-group \ --name my-container-app \ --log-path /home/LogFiles/myapp/*.log \ ``` -------------------------------- ### Trace command syntax Source: https://github.com/datadog/datadog-ci/blob/master/packages/base/src/commands/trace/README.md Basic usage pattern for the trace command. ```bash datadog-ci trace [--name ] [--tags] [--measures] [--no-fail] [--dry-run] -- ```