Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jenkins Library update for Gradle Check Publish Optimization #427

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.6'
String version = '6.4.7'

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

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

def test_docs = getFailedTestRecords(buildNumber, prString, invokeType, prDescription, buildResult, buildDuration, buildStartTime)
def test_docs = getFailedTestRecords(buildNumber, prNumber, invokeType, prOwner, prTitle, gitReference, buildResult, buildDuration, buildStartTime)

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

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

if (failedTests){
for (test in failedTests) {
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]
def failDocument = ['build_number': buildNumber, 'pull_request': prNumber, 'pull_request_owner': prOwner , 'invoke_type': invokeType, 'pull_request_title': prTitle, 'git_reference': gitReference, '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 @@ -94,8 +96,10 @@ void indexFailedTestData() {
"properties": {
"build_number": { "type": "integer" },
"pull_request": { "type": "keyword" },
"pull_request_owner": { "type": "keyword" },
"invoke_type": { "type": "keyword" },
"pr_description": { "type": "text" },
"pull_request_title": { "type": "text" },
"git_reference": { "type": "text" },
"test_class": { "type": "keyword" },
"test_name": { "type": "keyword" },
"test_status": { "type": "keyword" },
Expand Down
Loading