-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci:upload test results to datadog (#17206)
* WIP * ci:upload test results to datadog * fix use of envvar in expression * getting correct permission in reusable-unit.yml * getting correct permission in reusable-unit.yml * fixing DATADOG_API_KEY envvar expresssion * pass datadog-api-key * removing type from datadog-api-key
- Loading branch information
Showing
4 changed files
with
247 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,13 +42,16 @@ on: | |
required: true | ||
consul-license: | ||
required: true | ||
datadog-api-key: | ||
required: true | ||
env: | ||
TEST_RESULTS: /tmp/test-results | ||
GOTESTSUM_VERSION: 1.8.2 | ||
GOARCH: ${{inputs.go-arch}} | ||
TOTAL_RUNNERS: ${{inputs.runner-count}} | ||
CONSUL_LICENSE: ${{secrets.consul-license}} | ||
GOTAGS: ${{ inputs.go-tags}} | ||
DATADOG_API_KEY: ${{secrets.datadog-api-key}} | ||
|
||
jobs: | ||
set-test-package-matrix: | ||
|
@@ -128,6 +131,36 @@ jobs: | |
-tags="${{env.GOTAGS}}" -p 2 \ | ||
${GO_TEST_FLAGS-} \ | ||
-cover -coverprofile=coverage.txt | ||
# NOTE: ENT specific step as we store secrets in Vault. | ||
- name: Authenticate to Vault | ||
if: ${{ endsWith(github.repository, '-enterprise') }} | ||
id: vault-auth | ||
run: vault-auth | ||
|
||
# NOTE: ENT specific step as we store secrets in Vault. | ||
- name: Fetch Secrets | ||
if: ${{ endsWith(github.repository, '-enterprise') }} | ||
id: secrets | ||
uses: hashicorp/[email protected] | ||
with: | ||
url: ${{ steps.vault-auth.outputs.addr }} | ||
caCertificate: ${{ steps.vault-auth.outputs.ca_certificate }} | ||
token: ${{ steps.vault-auth.outputs.token }} | ||
secrets: | | ||
kv/data/github/${{ github.repository }}/datadog apikey | DATADOG_API_KEY; | ||
- name: prepare datadog-ci | ||
if: ${{ !endsWith(github.repository, '-enterprise') }} | ||
run: | | ||
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 | ||
- name: upload coverage | ||
env: | ||
DD_ENV: ci | ||
run: datadog-ci junit upload --service "$GITHUB_REPOSITORY" ${{env.TEST_RESULTS}}/gotestsum-report.xml | ||
|
||
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # [email protected] | ||
with: | ||
name: test-results | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,12 +38,15 @@ on: | |
required: true | ||
consul-license: | ||
required: true | ||
datadog-api-key: | ||
required: true | ||
env: | ||
TEST_RESULTS: /tmp/test-results | ||
GOTESTSUM_VERSION: 1.8.2 | ||
GOARCH: ${{inputs.go-arch}} | ||
CONSUL_LICENSE: ${{secrets.consul-license}} | ||
GOTAGS: ${{ inputs.go-tags}} | ||
DATADOG_API_KEY: ${{secrets.datadog-api-key}} | ||
|
||
jobs: | ||
go-test: | ||
|
@@ -96,6 +99,36 @@ jobs: | |
-tags="${{env.GOTAGS}}" \ | ||
${GO_TEST_FLAGS-} \ | ||
-cover -coverprofile=coverage.txt | ||
# NOTE: ENT specific step as we store secrets in Vault. | ||
- name: Authenticate to Vault | ||
if: ${{ endsWith(github.repository, '-enterprise') }} | ||
id: vault-auth | ||
run: vault-auth | ||
|
||
# NOTE: ENT specific step as we store secrets in Vault. | ||
- name: Fetch Secrets | ||
if: ${{ endsWith(github.repository, '-enterprise') }} | ||
id: secrets | ||
uses: hashicorp/[email protected] | ||
with: | ||
url: ${{ steps.vault-auth.outputs.addr }} | ||
caCertificate: ${{ steps.vault-auth.outputs.ca_certificate }} | ||
token: ${{ steps.vault-auth.outputs.token }} | ||
secrets: | | ||
kv/data/github/${{ github.repository }}/datadog apikey | DATADOG_API_KEY; | ||
- name: prepare datadog-ci | ||
if: ${{ !endsWith(github.repository, '-enterprise') }} | ||
run: | | ||
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 | ||
- name: upload coverage | ||
env: | ||
DD_ENV: ci | ||
run: datadog-ci junit upload --service "$GITHUB_REPOSITORY" ${{env.TEST_RESULTS}}/gotestsum-report.xml | ||
|
||
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # [email protected] | ||
with: | ||
name: test-results | ||
|
Oops, something went wrong.