diff --git a/build.gradle b/build.gradle index 4ba5981b..5af7009d 100644 --- a/build.gradle +++ b/build.gradle @@ -127,7 +127,7 @@ jacocoTestReport { } } -String version = '6.8.2' +String version = '6.8.3' task updateVersion { doLast { diff --git a/tests/jenkins/TestCreateUploadTestReportManifest.groovy b/tests/jenkins/TestCreateUploadTestReportManifest.groovy index 88b773b8..e427d09f 100644 --- a/tests/jenkins/TestCreateUploadTestReportManifest.groovy +++ b/tests/jenkins/TestCreateUploadTestReportManifest.groovy @@ -30,8 +30,9 @@ class TestCreateUploadTestReportManifest extends BuildPipelineTest { ) super.setUp() super.testPipeline("tests/jenkins/jobs/CreateUploadTestReportManifest_Jenkinsfile") - assertThat(getShellCommands('sh', 'report.sh'), hasItems('./report.sh tests/data/opensearch-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/29/linux/x64/tar ')) - assertThat(getShellCommands('sh', 'report.sh'), hasItems('./report.sh tests/data/opensearch-dashboards-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar ')) + assertThat(getShellCommands('sh', 'report.sh'), hasItems('./report.sh tests/data/opensearch-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/29/linux/x64/tar ')) + assertThat(getShellCommands('sh', 'report.sh'), hasItems('./report.sh tests/data/opensearch-dashboards-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar ')) + assertThat(getShellCommands('sh', 'report.sh'), hasItems('./report.sh tests/data/opensearch-dashboards-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar --release-candidate 100 ')) } def getShellCommands(methodName, searchString) { diff --git a/tests/jenkins/TestPublishIntegTestResults.groovy b/tests/jenkins/TestPublishIntegTestResults.groovy index afd713ed..f8184678 100644 --- a/tests/jenkins/TestPublishIntegTestResults.groovy +++ b/tests/jenkins/TestPublishIntegTestResults.groovy @@ -258,16 +258,9 @@ class TestPublishIntegTestResults extends BuildPipelineTest { void testCallWithMissingArgs() { def script = loadScript('vars/publishIntegTestResults.groovy') def args = [ - version: "1.0", - distributionBuildNumber: null, // Missing required argument distributionBuildUrl: "http://example.com/distribution/456", - rc: "rc1", - rcNumber: "1", - platform: "linux", - architecture: "x64", - distribution: "tar", testReportManifestYml: "path/to/testReportManifest.yml", - jobName: "test-job" + //jobName: "test-job" // Missing required argument ] def result = script.call(args) @@ -279,16 +272,9 @@ class TestPublishIntegTestResults extends BuildPipelineTest { void testCallWithEmptyArgs() { def script = loadScript('vars/publishIntegTestResults.groovy') def args = [ - version: "1.0", - distributionBuildNumber: "", // Empty required argument distributionBuildUrl: "http://example.com/distribution/456", - rc: "rc1", - rcNumber: "1", - platform: "linux", - architecture: "x64", - distribution: "tar", testReportManifestYml: "path/to/testReportManifest.yml", - jobName: "test-job" + jobName: "" // Empty required argument ] def result = script.call(args) @@ -299,4 +285,4 @@ class TestPublishIntegTestResults extends BuildPipelineTest { def normalizeString(String str) { return str.replaceAll(/\s+/, " ").trim() } - } \ No newline at end of file + } diff --git a/tests/jenkins/jobs/CreateUploadTestReportManifest_Jenkinsfile b/tests/jenkins/jobs/CreateUploadTestReportManifest_Jenkinsfile index a7bc749a..dbfed676 100644 --- a/tests/jenkins/jobs/CreateUploadTestReportManifest_Jenkinsfile +++ b/tests/jenkins/jobs/CreateUploadTestReportManifest_Jenkinsfile @@ -26,6 +26,14 @@ pipeline { testRunID: "1234", testType: "integ-test", ) + createUploadTestReportManifest( + testManifest: "tests/data/opensearch-dashboards-1.3.0-test.yml", + buildManifest: "tests/data/opensearch-1.3.0-build.yml", + dashboardsBuildManifest: "tests/data/opensearch-dashboards-build-1.3.0.yml", + testRunID: "1234", + testType: "integ-test", + rcNumber: "100", + ) } } } diff --git a/tests/jenkins/jobs/CreateUploadTestReportManifest_Jenkinsfile.txt b/tests/jenkins/jobs/CreateUploadTestReportManifest_Jenkinsfile.txt index f6575b89..4dba09d3 100644 --- a/tests/jenkins/jobs/CreateUploadTestReportManifest_Jenkinsfile.txt +++ b/tests/jenkins/jobs/CreateUploadTestReportManifest_Jenkinsfile.txt @@ -17,8 +17,8 @@ createUploadTestReportManifest.echo(Paths: opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar) createUploadTestReportManifest.echo(Base Path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/29/linux/x64/tar) createUploadTestReportManifest.echo(Component: null) - createUploadTestReportManifest.echo(Run command: ./report.sh tests/data/opensearch-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/29/linux/x64/tar ) - createUploadTestReportManifest.sh(./report.sh tests/data/opensearch-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/29/linux/x64/tar ) + createUploadTestReportManifest.echo(Run command: ./report.sh tests/data/opensearch-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/29/linux/x64/tar ) + createUploadTestReportManifest.sh(./report.sh tests/data/opensearch-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/29/linux/x64/tar ) createUploadTestReportManifest.echo(Build Id: 29) BuildManifest.getArtifactRoot(dummy_integ_test, 29) createUploadTestReportManifest.string({credentialsId=jenkins-artifact-bucket-name, variable=ARTIFACT_BUCKET_NAME}) @@ -44,8 +44,35 @@ createUploadTestReportManifest.echo(Paths: opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar) createUploadTestReportManifest.echo(Base Path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar) createUploadTestReportManifest.echo(Component: null) - createUploadTestReportManifest.echo(Run command: ./report.sh tests/data/opensearch-dashboards-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar ) - createUploadTestReportManifest.sh(./report.sh tests/data/opensearch-dashboards-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar ) + createUploadTestReportManifest.echo(Run command: ./report.sh tests/data/opensearch-dashboards-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar ) + createUploadTestReportManifest.sh(./report.sh tests/data/opensearch-dashboards-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar ) + createUploadTestReportManifest.echo(Build Id: 25b38c278cdd45efa583765d8ba76346) + BuildManifest.getArtifactRoot(dummy_integ_test, 25b38c278cdd45efa583765d8ba76346) + createUploadTestReportManifest.string({credentialsId=jenkins-artifact-bucket-name, variable=ARTIFACT_BUCKET_NAME}) + createUploadTestReportManifest.string({credentialsId=jenkins-aws-account-public, variable=AWS_ACCOUNT_PUBLIC}) + createUploadTestReportManifest.withCredentials([ARTIFACT_BUCKET_NAME, AWS_ACCOUNT_PUBLIC], groovy.lang.Closure) + createUploadTestReportManifest.echo(Uploading to s3://dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar/test-results/1234/integ-test/test-report.yml) + createUploadTestReportManifest.withAWS({role=opensearch-test, roleAccount=AWS_ACCOUNT_PUBLIC, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure) + createUploadTestReportManifest.s3Upload({file=/tmp/workspace/test-report.yml, bucket=ARTIFACT_BUCKET_NAME, path=dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar/test-results/1234/integ-test/test-report.yml}) + CreateUploadTestReportManifest_Jenkinsfile.createUploadTestReportManifest({testManifest=tests/data/opensearch-dashboards-1.3.0-test.yml, buildManifest=tests/data/opensearch-1.3.0-build.yml, dashboardsBuildManifest=tests/data/opensearch-dashboards-build-1.3.0.yml, testRunID=1234, testType=integ-test, rcNumber=100}) + createUploadTestReportManifest.legacySCM(groovy.lang.Closure) + createUploadTestReportManifest.library({identifier=jenkins@main, retriever=null}) + createUploadTestReportManifest.readYaml({file=tests/data/opensearch-dashboards-1.3.0-test.yml}) + TestManifest.asBoolean() + createUploadTestReportManifest.readYaml({file=tests/data/opensearch-1.3.0-build.yml}) + BuildManifest.asBoolean() + createUploadTestReportManifest.readYaml({file=tests/data/opensearch-dashboards-build-1.3.0.yml}) + BuildManifest.asBoolean() + BuildManifest.getDistribution() + createUploadTestReportManifest.echo(Start Reporting workflow for test type: tar) + BuildManifest.getArtifactRootUrl(distribution-build-opensearch, 29) + BuildManifest.getArtifactRootUrl(distribution-build-opensearch-dashboards, 25b38c278cdd45efa583765d8ba76346) + createUploadTestReportManifest.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar) + createUploadTestReportManifest.echo(Paths: opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar) + createUploadTestReportManifest.echo(Base Path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar) + createUploadTestReportManifest.echo(Component: null) + createUploadTestReportManifest.echo(Run command: ./report.sh tests/data/opensearch-dashboards-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar --release-candidate 100 ) + createUploadTestReportManifest.sh(./report.sh tests/data/opensearch-dashboards-1.3.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar --test-run-id 1234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar --release-candidate 100 ) createUploadTestReportManifest.echo(Build Id: 25b38c278cdd45efa583765d8ba76346) BuildManifest.getArtifactRoot(dummy_integ_test, 25b38c278cdd45efa583765d8ba76346) createUploadTestReportManifest.string({credentialsId=jenkins-artifact-bucket-name, variable=ARTIFACT_BUCKET_NAME}) diff --git a/vars/createUploadTestReportManifest.groovy b/vars/createUploadTestReportManifest.groovy index 099b38c9..c32fcb58 100644 --- a/vars/createUploadTestReportManifest.groovy +++ b/vars/createUploadTestReportManifest.groovy @@ -14,6 +14,7 @@ @param args.dashboardsBuildManifest - The path of the build manifest of OpenSearch Dashboards @param args.testRunID - Test run id of the test workflow being reported. @param args.testType - Type of the test workflow being reported. + @param args.rcNumber - The RC Number of the distribution in test workflow being reported. @param args.componentName - Components that workflow runs on. */ @@ -24,6 +25,7 @@ def call(Map args = [:]) { def testRunID = args.testRunID; def testType = args.testType; + def rcNumber = args.rcNumber def testManifest = lib.jenkins.TestManifest.new(readYaml(file: args.testManifest)) def buildManifest = lib.jenkins.BuildManifest.new(readYaml(file: args.buildManifest)) @@ -50,6 +52,7 @@ def call(Map args = [:]) { "--test-run-id ${testRunID}", "--test-type ${testType}", "--base-path ${basePath}", + isNullOrEmpty(rcNumber) ? "" : "--release-candidate ${rcNumber}", isNullOrEmpty(component) ? "" : "--component ${component}", ].join(' ') diff --git a/vars/publishIntegTestResults.groovy b/vars/publishIntegTestResults.groovy index 55884682..bc93a861 100644 --- a/vars/publishIntegTestResults.groovy +++ b/vars/publishIntegTestResults.groovy @@ -10,14 +10,7 @@ /** 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 - The version against which the integration test is executed. - * @param args.distributionBuildNumber - The jenkins distribution build number. * @param args.distributionBuildUrl - The jenkins distribution build number. - * @param args.rc - If the integration tests are running on an RC. - * @param args.rcNumber - The RC number against which the integration test is executed. - * @param args.platform - The platform of the integration test build. - * @param args.architecture - The architecture of the integration test build. - * @param args.distribution - The distribution of the integration test build. * @param args.testReportManifestYml - The generated test report YAML file using test report workflow. * @param args.jobName - The integ test job name, used in `testReportManifestYmlUrl`. */ @@ -39,19 +32,12 @@ void call(Map args = [:]) { return null } - def version = args.version.toString() def integTestBuildNumber = currentBuild.number def integTestBuildUrl = env.RUN_DISPLAY_URL - def distributionBuildNumber = args.distributionBuildNumber def distributionBuildUrl = args.distributionBuildUrl def buildStartTime = currentBuild.startTimeInMillis def currentDate = new Date() def formattedDate = new SimpleDateFormat("MM-yyyy").format(currentDate) - def rc = args.rc - def rcNumber = args.rcNumber.toInteger() - def platform = args.platform - def architecture = args.architecture - def distribution = args.distribution def testReportManifestYml = args.testReportManifestYml def jobName = args.jobName def testReportManifestYmlUrl = "https://ci.opensearch.org/ci/dbc/${jobName}/${version}/${distributionBuildNumber}/${platform}/${architecture}/${distribution}/test-results/${integTestBuildNumber}/integ-test/test-report.yml" @@ -59,6 +45,14 @@ void call(Map args = [:]) { def manifest = readYaml text: manifestFile def indexName = "opensearch-integration-test-results-${formattedDate}" def finalJsonDoc = "" + def version = manifest.version.toString() + def distributionBuildNumber = manifest.id + def rcNumber = manifest.rc.toInteger() + def rc = (rcNumber > 0) + def platform = manifest.platform + def architecture = manifest.architecture + def distribution = manifest.distribution + manifest.components.each { component -> def componentName = component.name def componentCategory = manifest.name