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
16 changes: 12 additions & 4 deletions .github/actions/push_to_test_optim/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,27 @@ runs:
run: echo "Skipping TestOptim push for dependabot PRs"

- name: Install datadog-ci
if: github.event.pull_request.user.login != 'dependabot[bot]' && inputs.datadog_api_key != ''
if: github.event.pull_request.user.login != 'dependabot[bot]'
shell: bash
run: npm install -g @datadog/datadog-ci || sleep 60 && npm install -g @datadog/datadog-ci

- name: checkout owner repo
if: github.event.pull_request.user.login != 'dependabot[bot]' && inputs.datadog_api_key != ''
if: github.event.pull_request.user.login != 'dependabot[bot]'
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
with:
path: repo

- name: Get Datadog credentials
id: dd-sts
if: github.event.pull_request.user.login != 'dependabot[bot]'
continue-on-error: true
uses: DataDog/dd-sts-action@2e8187910199bd93129520183c093e19aa585c75 # v1.0.0
with:
policy: system-tests

# https://docs.datadoghq.com/tests/setup/junit_xml/?tab=linux
- name: Push results
if: github.event.pull_request.user.login != 'dependabot[bot]' && inputs.datadog_api_key != ''
if: github.event.pull_request.user.login != 'dependabot[bot]'
shell: bash
run: |
cd repo
Expand All @@ -43,5 +51,5 @@ runs:
--xpath-tag "test.codeowners=/testcase/properties/property[@name='test.codeowners']"
env:
DATADOG_SITE: ${{ inputs.datadog_site }}
DATADOG_API_KEY: ${{ inputs.datadog_api_key }}
DATADOG_API_KEY: ${{ inputs.datadog_api_key != '' && inputs.datadog_api_key || steps.dd-sts.outputs.api_key }}
DD_TAGS: ${{ inputs.ci_environment != '' && format('test.configuration.ci_environment:{0}', inputs.ci_environment) || '' }}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
uses: ./.github/workflows/system-tests.yml
permissions:
contents: read
packages: write
id-token: write
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ jobs:
if: needs.compute_parameters.outputs.parametric_enable == 'true'
uses: ./.github/workflows/run-parametric.yml
secrets: inherit
permissions:
id-token: write
with:
library: ${{ inputs.library }}
ref: ${{ inputs.ref }}
Expand Down Expand Up @@ -261,6 +263,8 @@ jobs:
fail-fast: false
uses: ./.github/workflows/run-end-to-end.yml
secrets: inherit
permissions:
id-token: write
Comment thread
nccatoni marked this conversation as resolved.
with:
runs_on: ${{ matrix.job.runs_on }}
library: ${{ matrix.job.library }}
Expand Down
14 changes: 12 additions & 2 deletions docs/CI/github-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
secrets: inherit
permissions:
contents: read
id-token: write
with:
library: java
binaries_artifact: binaries
Expand All @@ -52,13 +53,22 @@ jobs:
| `force_execute` | Comma-separated list of tests to run even if they are skipped by manifest or decorators | string | false | *empty* |
| `library` | Library to test | string | true | — |
| `parametric_job_count` | How many jobs should be used to run PARAMETRIC scenario | number | false | 1 |
| `push_to_test_optimization` | Push tests results to DataDog Test Optimization. Requires TEST_OPTIMIZATION_API_KEY secrets | boolean | false | false |
| `push_to_test_optimization` | Push tests results to DataDog Test Optimization. Uses `TEST_OPTIMIZATION_API_KEY` secret if set, otherwise fetches credentials automatically via dd-sts (recommended) | boolean | false | false |
| `test_optimization_datadog_site` | DataDog site to use for test optimization | string | false | datadoghq.com |
| `ref` | system-tests ref to run the tests on (can be any valid branch, tag or SHA in system-tests repo) | string | false | main |
| `scenarios` | Comma-separated list scenarios to run | string | false | DEFAULT |
| `scenarios_groups` | Comma-separated list of scenarios groups to run | string | false | *empty* |
| `skip_empty_scenarios` | Skip scenarios that contain only xfail or irrelevant tests | boolean | false | false |

## Permissions

The following permissions are always required:

| Permission | Reason |
| ---------------- | ----------------------------------------------------------- |
| `contents: read` | Checkout the repository |
| `id-token: write` | Required by downstream workflows to fetch Datadog credentials via dd-sts. GitHub validates this upfront, so it must be granted even if test optimization is disabled |

## Secrets

For some purposes, secrets are used in the workflow:
Expand All @@ -73,7 +83,7 @@ For some purposes, secrets are used in the workflow:
| DD_API_KEY_3 |
| DD_APP_KEY_3 |
| DOCKERHUB_USERNAME and DOCKERHUB_TOKEN | If both are set, all docker pull are authenticated, which offer higher rate limit
| TEST_OPTIMIZATION_API_KEY | The DD_API_KEY to use to push tests runs to DataDog Test Optimization
| TEST_OPTIMIZATION_API_KEY | The DD_API_KEY to use to push tests runs to DataDog Test Optimization. **Deprecated**: prefer not setting this and letting dd-sts fetch credentials automatically


You can sends them ,either by using `secrets: inherit` ([doc](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idsecretsinherit)), or [use explicit secret ids](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idsecretssecret_id)
Expand Down
Loading