Skip to content

Commit

Permalink
[chore] Create issue when nightly tests fail (#776)
Browse files Browse the repository at this point in the history
* create issue when nightly tests fail

Signed-off-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>

* rebase artifacts

Signed-off-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>

* Update .github/workflows/base-package-tests.yaml

Co-authored-by: Yang Song <songy23@users.noreply.github.com>

---------

Signed-off-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>
Co-authored-by: Yang Song <songy23@users.noreply.github.com>
  • Loading branch information
mowies and songy23 authored Dec 20, 2024
1 parent c6273e0 commit a7fea79
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/base-package-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
distribution:
required: true
type: string
issue-on-failure:
required: false
type: boolean
default: false
description: "Set to true if a GH issue should be generated upon failure"

jobs:
package-tests:
Expand All @@ -28,3 +33,29 @@ jobs:

- name: Test ${{ matrix.type }} package
run: ./scripts/package-tests/package-tests.sh ./otelcol*-SNAPSHOT-*_linux_amd64.${{ matrix.type }} ${{ inputs.distribution }}

create-issue:
name: Create GitHub Issue
runs-on: ubuntu-22.04
needs: [package-tests]
if: failure() && inputs.issue-on-failure == 'true'
steps:
- name: Formulate issue
id: formulate_issue
run: |
# create a markdown file that contains details about the failure
echo "The nightly linux package tests failed in the following GitHub actions run." > nightly-test-failure.md
echo "* Link to run: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> nightly-test-failure.md
echo "* Triggered by: Nightly scheduled build" >> nightly-test-failure.md
echo "" >> nightly-test-failure.md
echo "Note: This issue was auto-generated from [base-package-tests.yaml](https://github.com/open-telemetry/opentelemetry-collector-releases/blob/main/.github/workflows/base-package-tests.yaml)" >> nightly-test-failure.md
- name: Create issue on failure
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
run: |
gh issue create \
--repo open-telemetry/opentelemetry-collector-contrib \
--title "Nightly Linux Package Tests Failed" \
--body-file nightly-test-failure.md \
--label "release:blocker"
1 change: 1 addition & 0 deletions .github/workflows/package-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ jobs:
with:
distribution: otelcol-contrib
type: '[ "deb", "rpm" ]'
issue-on-failure: true

0 comments on commit a7fea79

Please sign in to comment.