Skip to content
Closed
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
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ It can help you investigate and mitigate performance problems and test failures
The action has the following parameters:

| Name | Description | Required | Default |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------- |
|--------------------------------| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------- |
| languages | List of languages to be instrumented. Can be either "all" or any of "java", "js", "python", "dotnet", "ruby", "go" (multiple languages can be specified as a space-separated list). | true | |
| api_key | Datadog API key. Can be found at https://app.datadoghq.com/organization-settings/api-keys | true | |
| site | Datadog site. See https://docs.datadoghq.com/getting_started/site for more information about sites. | false | datadoghq.com |
| service | The name of the service or library being tested. | false | |
| cache | Enable caching of Datadog tracers and dependencies to speed up workflow runs. | false | true |
| force-cache-refresh | Force refresh the cache by ignoring any existing cache entries. Useful when cache contains incorrect data. | false | false |
| cache-key | Custom cache key to use for caching. If not provided, a default key will be generated based on the languages and tracer versions. | false | |
| dotnet-tracer-version | The version of Datadog .NET tracer to use. Defaults to the latest release. | false | |
| java-tracer-version | The version of Datadog Java tracer to use. Defaults to the latest release. | false | |
| js-tracer-version | The version of Datadog JS tracer to use. Defaults to the latest release. | false | |
Expand All @@ -49,6 +52,36 @@ The action has the following parameters:
| go-tracer-version | The version of Orchestrion to use. Defaults to the latest release. | false | |
| java-instrumented-build-system | If provided, only the specified build systems will be instrumented (allowed values are `gradle`,`maven`,`sbt`,`ant`,`all`). `all` is a special value that instruments every Java process. If this property is not provided, all known build systems will be instrumented (Gradle, Maven, SBT, Ant). | false | |

### Caching

The action supports caching of Datadog tracers and dependencies to speed up workflow runs. Caching is enabled by default but can be disabled by setting `cache: false`. The cache key is automatically generated based on the languages and tracer versions, but you can provide a custom cache key using the `cache-key` parameter.

Example with custom cache key:
```yaml
steps:
- name: Configure Datadog Test Optimization
uses: datadog/test-visibility-github-action@v2
with:
languages: java
api_key: ${{ secrets.DD_API_KEY }}
cache: true
cache-key: my-custom-cache-key
```

#### Cache Cleaning

If you encounter issues with cached data, you can use the `force-cache-refresh` parameter to ignore existing cache entries and create a fresh cache:

```yaml
steps:
- name: Configure Datadog Test Optimization
uses: datadog/test-visibility-github-action@v2
with:
languages: java
api_key: ${{ secrets.DD_API_KEY }}
force-cache-refresh: true
```

### Additional configuration

Any [additional configuration values](https://docs.datadoghq.com/tracing/trace_collection/library_config/) can be added directly to the step that runs your tests:
Expand Down
28 changes: 28 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ inputs:
service:
description: 'The name of the service or library being tested.'
required: false
cache:
description: 'Enable caching of Datadog tracers and dependencies to speed up workflow runs.'
required: false
default: 'true'
force-cache-refresh:
description: 'Force refresh the cache by ignoring any existing cache entries. Useful when cache contains incorrect data.'
required: false
default: 'false'
cache-key:
description: 'Custom cache key to use for caching. If not provided, a default key will be generated based on the languages and tracer versions.'
required: false
dotnet-tracer-version:
description: 'The version of Datadog .NET tracer to use (optional). Defaults to the latest release.'
required: false
Expand Down Expand Up @@ -57,8 +68,25 @@ runs:
env:
GITHUB_ACTION_PATH: ${{ github.action_path }}

- name: Set up cache
if: ${{ inputs.cache == 'true' && inputs.force-cache-refresh != 'true' }}
uses: actions/cache@v3
id: cache
with:
path: ${{ github.workspace }}/.datadog
key: ${{ inputs.cache-key || format('dd-test-visibility-{0}-{1}-{2}-{3}-{4}-{5}', inputs.languages, inputs.dotnet-tracer-version, inputs.java-tracer-version, inputs.js-tracer-version, inputs.python-tracer-version, inputs.ruby-tracer-version) }}
restore-keys: |
dd-test-visibility-${{ inputs.languages }}-

- name: Clean cache directory if force refresh
if: ${{ inputs.force-cache-refresh == 'true' }}
run: |
rm -rf $GITHUB_WORKSPACE/.datadog
shell: bash

- name: Download and run configuration script
id: run-configuration-script
if: ${{ steps.cache.outputs.cache-hit != 'true' || inputs.cache != 'true' || inputs.force-cache-refresh == 'true' }}
run: |
mkdir -p $GITHUB_WORKSPACE/.datadog

Expand Down
Loading