Skip to content

Commit

Permalink
OpenSearch Project Build Publish
Browse files Browse the repository at this point in the history
Signed-off-by: Prudhvi Godithi <[email protected]>
  • Loading branch information
prudhvigodithi committed Jul 22, 2024
2 parents 955cafa + 96cf7bf commit 4aff3de
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jacocoTestReport {
}
}

String version = '6.6.2'
String version = '6.7.0'

task updateVersion {
doLast {
Expand Down
1 change: 0 additions & 1 deletion vars/publishDistributionBuildResults.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* @param args.rcNumber <required> - The RC number against which the integration test is executed.
* @param args.failureMessages <required> - Failure message retrieved from buildFailureMessage() method.
* @param args.passMessages <required> - Passing message retrieved from buildFailureMessage() method. Used to get the passed components list.
* @param args.distribution <required> - The distribution of the integration test build. Used to get the failed components list.
* @param args.componentCategory <required> - The OpenSearch or OpenSearch Dashboards plugin
* @param args.inputManifestPath <required> - Path to input manifest.
*/
Expand Down
18 changes: 16 additions & 2 deletions vars/publishIntegTestResults.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

/** Library to fetch the failing Integration test details at the end of Integration Test Jenkins build and index the results to OpenSearch Metrics cluster.
*
* @param Map args = [:] args A map of the following parameters.
* @param args.version <required> - The version against which the integration test is executed.
* @param args.distributionBuildNumber <required> - The jenkins distribution build number.
Expand All @@ -20,14 +19,26 @@
* @param args.architecture <required> - The architecture of the integration test build.
* @param args.distribution <required> - The distribution of the integration test build.
* @param args.testReportManifestYml <required> - The generated test report YAML file using test report workflow.
*/

import groovy.json.JsonOutput
import java.text.SimpleDateFormat
import java.util.Date

void call(Map args = [:]) {


// To ensure the test TestOpenSearchIntegTest from opensearch-build repo passes.
def isNullOrEmpty = { str ->
str == null || (str instanceof String && str.trim().isEmpty())
}
if (isNullOrEmpty(args.version) || isNullOrEmpty(args.distributionBuildNumber) || isNullOrEmpty(args.distributionBuildUrl) ||
isNullOrEmpty(args.rcNumber) || isNullOrEmpty(args.rc) || isNullOrEmpty(args.platform) ||
isNullOrEmpty(args.architecture) || isNullOrEmpty(args.distribution) || isNullOrEmpty(args.testReportManifestYml)) {
return null
}


def version = args.version.toString()
def integTestBuildNumber = currentBuild.number
def integTestBuildUrl = env.RUN_DISPLAY_URL
Expand Down Expand Up @@ -76,6 +87,8 @@ void call(Map args = [:]) {
indexFailedTestData(indexName, "test-records.json")
}

boolean argCheck(String str) { return (str == null || str.allWhitespace || str.isEmpty()) }

void indexFailedTestData(indexName, testRecordsFile) {
withCredentials([
string(credentialsId: 'jenkins-health-metrics-account-number', variable: 'METRICS_HOST_ACCOUNT'),
Expand Down Expand Up @@ -217,3 +230,4 @@ def generateJson(component, version, integTestBuildNumber, integTestBuildUrl, di
]
return JsonOutput.toJson(json)
}

7 changes: 6 additions & 1 deletion vars/uploadMinSnapshotsToS3.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,16 @@ void call(Map args = [:]) {

echo("Start copying files: version-${version} architecture-${architecture} platform-${platform} buildid-${id} distribution-${distribution} extension-${extension}")

String sedCmd = "sed"
if (platform == "darwin") {
sedCmd = "gsed"
}

sh """
cp -v ${srcDir}/${baseName}.${extension} ${srcDir}/${baseName}-latest.${extension}
cp -v ${srcDir}/${baseName}.${extension}.sha512 ${srcDir}/${baseName}-latest.${extension}.sha512
cp -v ${srcDir}/../manifest.yml ${srcDir}/${baseName}-latest.${extension}.build-manifest.yml
sed -i "s/.${extension}/-latest.${extension}/g" ${srcDir}/${baseName}-latest.${extension}.sha512
${sedCmd} -i "s/.${extension}/-latest.${extension}/g" ${srcDir}/${baseName}-latest.${extension}.sha512
"""
withCredentials([
string(credentialsId: 'jenkins-artifact-promotion-role', variable: 'ARTIFACT_PROMOTION_ROLE_NAME'),
Expand Down

0 comments on commit 4aff3de

Please sign in to comment.