Skip to content

Commit

Permalink
Test Gradle test failures.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Nov 17, 2022
1 parent 059b614 commit 4f9bed7
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 523 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/auto-release.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/backport.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/changelog_verifier.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/code-hygiene.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/create-documentation-issue.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/delete_backport_branch.yml

This file was deleted.

63 changes: 0 additions & 63 deletions .github/workflows/dependabot_pr.yml

This file was deleted.

104 changes: 19 additions & 85 deletions .github/workflows/gradle-check.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,10 @@
name: Gradle Check (Jenkins)
on:
push:
branches-ignore:
- 'backport/**'
- 'create-pull-request/**'
- 'dependabot/**'
pull_request_target:
types: [opened, synchronize, reopened]
name: Gradle Check (Jenkins) Test
on: pull_request

jobs:
gradle-check:
runs-on: ubuntu-latest
timeout-minutes: 130
steps:
- name: Checkout OpenSearch repo
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup environment variables (PR)
if: github.event_name == 'pull_request_target'
run: |
echo "pr_from_sha=$(jq --raw-output .pull_request.head.sha $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
echo "pr_from_clone_url=$(jq --raw-output .pull_request.head.repo.clone_url $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
echo "pr_to_clone_url=$(jq --raw-output .pull_request.base.repo.clone_url $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
echo "pr_title=$(jq --raw-output .pull_request.title $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
echo "pr_number=$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
- name: Setup environment variables (Push)
if: github.event_name == 'push'
run: |
Expand All @@ -39,82 +17,38 @@ jobs:
echo "pr_title=Push trigger $branch_name $ref_id $repo_url" >> $GITHUB_ENV
echo "pr_number=Null" >> $GITHUB_ENV
- name: Checkout opensearch-build repo
uses: actions/checkout@v2
with:
repository: opensearch-project/opensearch-build
ref: main
path: opensearch-build

- name: Trigger jenkins workflow to run gradle check
run: |
set -e
set -o pipefail
bash opensearch-build/scripts/gradle/gradle-check.sh ${{ secrets.JENKINS_GRADLE_CHECK_GENERIC_WEBHOOK_TOKEN }} | tee -a gradle-check.log
- name: Setup Result Status
if: always()
run: |
WORKFLOW_URL=`cat gradle-check.log | grep 'WORKFLOW_URL' | awk '{print $2}'`
RESULT=`cat gradle-check.log | grep 'Result:' | awk '{print $2}'`
WORKFLOW_URL=https://build.ci.opensearch.org/job/gradle-check/6939/
RESULT=FAILURE
echo "workflow_url=$WORKFLOW_URL" >> $GITHUB_ENV
echo "result=$RESULT" >> $GITHUB_ENV
- name: Upload Coverage Report
if: success()
uses: codecov/codecov-action@v2
with:
files: ./codeCoverage.xml

- name: Create Comment Success
if: ${{ github.event_name == 'pull_request_target' && success() && env.result == 'SUCCESS' }}
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ env.pr_number }}
body: |
### Gradle Check (Jenkins) Run Completed with:
* **RESULT:** ${{ env.result }} :white_check_mark:
* **URL:** ${{ env.workflow_url }}
* **CommitID:** ${{ env.pr_from_sha }}
- name: Extract Test Failure
if: ${{ github.event_name == 'pull_request_target' && env.result != 'SUCCESS' }}
if: ${{ github.event_name == 'pull_request' }}
run: |
TEST_FAILURES=`curl -s "${{ env.workflow_url }}/testReport/api/json?tree=suites\[cases\[status,className,name\]\]" | jq -r '.. | objects | select(.status=="FAILED",.status=="REGRESSION") | (.className + "." + .name)' | uniq -c | sort -n -r | head -n 10`
echo "test_failures<<EOF" >> $GITHUB_ENV
echo "$TEST_FAILURES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create Comment Flaky
if: ${{ github.event_name == 'pull_request_target' && success() && env.result != 'SUCCESS' }}
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ env.pr_number }}
body: |
### Gradle Check (Jenkins) Run Completed with:
* **RESULT:** ${{ env.result }} :grey_exclamation:
* **FLAKY TEST FAILURES:**
The following tests failed but succeeded upon retry:
```
${{ env.test_failures }}
```
* **URL:** ${{ env.workflow_url }}
* **CommitID:** ${{ env.pr_from_sha }}
Please examine the workflow log, locate, and copy-paste the failure below, then iterate to green.
Is the failure [a flaky test](https://github.com/opensearch-project/OpenSearch/blob/main/DEVELOPER_GUIDE.md#flaky-tests) unrelated to your change?
echo $TEST_FAILURES
if [[ "$TEST_FAILURES" != "\n" ]]
then
echo "test_failures<<EOF" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "* **FAILURES:**" >> $GITHUB_ENV
echo '```' >> $GITHUB_ENV
echo "$TEST_FAILURES" >> $GITHUB_ENV
echo '```' >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
fi
- name: Create Comment Failure
if: ${{ github.event_name == 'pull_request_target' && failure() }}
if: ${{ github.event_name == 'pull_request' }}
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ env.pr_number }}
issue-number: 113
body: |
### Gradle Check (Jenkins) Run Completed with:
* **RESULT:** ${{ env.result }} :x:
* **FAILURES:**
```
${{ env.test_failures }}
```
* **RESULT:** ${{ env.result }} :x: ${{ env.test_failures }}
* **URL:** ${{ env.workflow_url }}
* **CommitID:** ${{ env.pr_from_sha }}
Please examine the workflow log, locate, and copy-paste the failure below, then iterate to green.
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/links.yml

This file was deleted.

Loading

0 comments on commit 4f9bed7

Please sign in to comment.