Skip running DD on non-master branches so that PRs can run successfully

This commit is contained in:
David Dworken 2023-09-08 09:59:55 -07:00
parent 37c06a31db
commit cc10689d09
No known key found for this signature in database
2 changed files with 4 additions and 1 deletions

View File

@ -49,11 +49,14 @@ jobs:
colima start colima start
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
- name: Set up Datadog - name: Set up Datadog
if: github.ref == 'refs/heads/master'
uses: datadog/agent-github-action@v1.3 uses: datadog/agent-github-action@v1.3
with: with:
api_key: ${{ secrets.DD_API_KEY }} api_key: ${{ secrets.DD_API_KEY }}
- name: Go test - name: Go test
if: ${{ !startsWith(github.event.head_commit.message, 'Release') }} if: ${{ !startsWith(github.event.head_commit.message, 'Release') }}
env:
DD_API_KEY: ${{ secrets.DD_API_KEY }}
run: | run: |
make retrying-test make retrying-test
# - name: Setup tmate session # - name: Setup tmate session

View File

@ -55,7 +55,7 @@ func TestMain(m *testing.M) {
} }
// Configure the integration to export test failures to datadog for better monitoring // Configure the integration to export test failures to datadog for better monitoring
if testutils.IsGithubAction() { if _, has_dd_api_key := os.LookupEnv("DD_API_KEY"); testutils.IsGithubAction() && has_dd_api_key {
ddStats, err := statsd.New("localhost:8125") ddStats, err := statsd.New("localhost:8125")
if err != nil { if err != nil {
panic(fmt.Errorf("Failed to start DataDog statsd: %w\n", err)) panic(fmt.Errorf("Failed to start DataDog statsd: %w\n", err))