Skip to content

Commit

Permalink
[Backport 6.x] Update gradle publish library to handle invokeType (#…
Browse files Browse the repository at this point in the history
…424)

Signed-off-by: Prudhvi Godithi <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 2a3ae60 commit 316ade9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jacocoTestReport {
}
}

String version = '6.4.5'
String version = '6.4.6'

task updateVersion {
doLast {
Expand Down
10 changes: 6 additions & 4 deletions vars/publishGradleCheckTestResults.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ void call(Map args = [:]) {
def buildDuration = currentBuild.duration
def buildResult = currentBuild.result
def buildStartTime = currentBuild.startTimeInMillis
def prString = isNullOrEmpty(args.prNumber.toString()) ? "post_merge_action" : "${args.prNumber}"
def prString = args.prNumber.toString()
def invokeType = args.invokeType.toString()
def prDescription = args.prDescription.toString()
def currentDate = new Date()
def formattedDate = new SimpleDateFormat("MM-yyyy").format(currentDate)

def indexName = "gradle-check-${formattedDate}"

def test_docs = getFailedTestRecords(buildNumber, prString, prDescription, buildResult, buildDuration, buildStartTime)
def test_docs = getFailedTestRecords(buildNumber, prString, invokeType, prDescription, buildResult, buildDuration, buildStartTime)

if (test_docs) {
for (doc in test_docs) {
Expand All @@ -49,7 +50,7 @@ void call(Map args = [:]) {
}
}

List<Map<String, String>> getFailedTestRecords(buildNumber, prString, prDescription, buildResult, buildDuration, buildStartTime) {
List<Map<String, String>> getFailedTestRecords(buildNumber, prString, invokeType, prDescription, buildResult, buildDuration, buildStartTime) {
def testResults = []
AbstractTestResultAction testResultAction = currentBuild.rawBuild.getAction(AbstractTestResultAction.class)
if (testResultAction != null) {
Expand All @@ -61,7 +62,7 @@ List<Map<String, String>> getFailedTestRecords(buildNumber, prString, prDescript

if (failedTests){
for (test in failedTests) {
def failDocument = ['build_number': buildNumber, 'pull_request': prString, 'pr_description': prDescription, 'test_class': test.getParent().getName(), 'test_name': test.fullName, 'test_status': 'FAILED', 'build_result': buildResult, 'test_fail_count': testsFailed, 'test_skipped_count': testsSkipped, 'test_passed_count': testsPassed, 'build_duration': buildDuration, 'build_start_time': buildStartTime]
def failDocument = ['build_number': buildNumber, 'pull_request': prString, 'invoke_type': invokeType, 'pr_description': prDescription, 'test_class': test.getParent().getName(), 'test_name': test.fullName, 'test_status': 'FAILED', 'build_result': buildResult, 'test_fail_count': testsFailed, 'test_skipped_count': testsSkipped, 'test_passed_count': testsPassed, 'build_duration': buildDuration, 'build_start_time': buildStartTime]
testResults.add(failDocument)
}
} else {
Expand Down Expand Up @@ -93,6 +94,7 @@ void indexFailedTestData() {
"properties": {
"build_number": { "type": "integer" },
"pull_request": { "type": "keyword" },
"invoke_type": { "type": "keyword" },
"pr_description": { "type": "text" },
"test_class": { "type": "keyword" },
"test_name": { "type": "keyword" },
Expand Down

0 comments on commit 316ade9

Please sign in to comment.