Skip to content

Commit 2c86033

Browse files
Adding 1.1 test-report.yml support to Jenkins lib (#470)
Signed-off-by: Peter Zhu <[email protected]> (cherry picked from commit 571310e) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 230e60a commit 2c86033

7 files changed

+57
-38
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jacocoTestReport {
127127
}
128128
}
129129

130-
String version = '6.8.2'
130+
String version = '6.8.3'
131131

132132
task updateVersion {
133133
doLast {

tests/jenkins/TestCreateUploadTestReportManifest.groovy

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ class TestCreateUploadTestReportManifest extends BuildPipelineTest {
3030
)
3131
super.setUp()
3232
super.testPipeline("tests/jenkins/jobs/CreateUploadTestReportManifest_Jenkinsfile")
33-
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 '))
34-
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 '))
33+
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 '))
34+
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 '))
35+
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 '))
3536
}
3637

3738
def getShellCommands(methodName, searchString) {

tests/jenkins/TestPublishIntegTestResults.groovy

+3-17
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,9 @@ class TestPublishIntegTestResults extends BuildPipelineTest {
258258
void testCallWithMissingArgs() {
259259
def script = loadScript('vars/publishIntegTestResults.groovy')
260260
def args = [
261-
version: "1.0",
262-
distributionBuildNumber: null, // Missing required argument
263261
distributionBuildUrl: "http://example.com/distribution/456",
264-
rc: "rc1",
265-
rcNumber: "1",
266-
platform: "linux",
267-
architecture: "x64",
268-
distribution: "tar",
269262
testReportManifestYml: "path/to/testReportManifest.yml",
270-
jobName: "test-job"
263+
//jobName: "test-job" // Missing required argument
271264
]
272265

273266
def result = script.call(args)
@@ -279,16 +272,9 @@ class TestPublishIntegTestResults extends BuildPipelineTest {
279272
void testCallWithEmptyArgs() {
280273
def script = loadScript('vars/publishIntegTestResults.groovy')
281274
def args = [
282-
version: "1.0",
283-
distributionBuildNumber: "", // Empty required argument
284275
distributionBuildUrl: "http://example.com/distribution/456",
285-
rc: "rc1",
286-
rcNumber: "1",
287-
platform: "linux",
288-
architecture: "x64",
289-
distribution: "tar",
290276
testReportManifestYml: "path/to/testReportManifest.yml",
291-
jobName: "test-job"
277+
jobName: "" // Empty required argument
292278
]
293279

294280
def result = script.call(args)
@@ -299,4 +285,4 @@ class TestPublishIntegTestResults extends BuildPipelineTest {
299285
def normalizeString(String str) {
300286
return str.replaceAll(/\s+/, " ").trim()
301287
}
302-
}
288+
}

tests/jenkins/jobs/CreateUploadTestReportManifest_Jenkinsfile

+8
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ pipeline {
2626
testRunID: "1234",
2727
testType: "integ-test",
2828
)
29+
createUploadTestReportManifest(
30+
testManifest: "tests/data/opensearch-dashboards-1.3.0-test.yml",
31+
buildManifest: "tests/data/opensearch-1.3.0-build.yml",
32+
dashboardsBuildManifest: "tests/data/opensearch-dashboards-build-1.3.0.yml",
33+
testRunID: "1234",
34+
testType: "integ-test",
35+
rcNumber: "100",
36+
)
2937
}
3038
}
3139
}

tests/jenkins/jobs/CreateUploadTestReportManifest_Jenkinsfile.txt

+31-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
createUploadTestReportManifest.echo(Paths: opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar)
1818
createUploadTestReportManifest.echo(Base Path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/29/linux/x64/tar)
1919
createUploadTestReportManifest.echo(Component: null)
20-
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 )
21-
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 )
20+
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 )
21+
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 )
2222
createUploadTestReportManifest.echo(Build Id: 29)
2323
BuildManifest.getArtifactRoot(dummy_integ_test, 29)
2424
createUploadTestReportManifest.string({credentialsId=jenkins-artifact-bucket-name, variable=ARTIFACT_BUCKET_NAME})
@@ -44,8 +44,35 @@
4444
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)
4545
createUploadTestReportManifest.echo(Base Path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar)
4646
createUploadTestReportManifest.echo(Component: null)
47-
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 )
48-
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 )
47+
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 )
48+
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 )
49+
createUploadTestReportManifest.echo(Build Id: 25b38c278cdd45efa583765d8ba76346)
50+
BuildManifest.getArtifactRoot(dummy_integ_test, 25b38c278cdd45efa583765d8ba76346)
51+
createUploadTestReportManifest.string({credentialsId=jenkins-artifact-bucket-name, variable=ARTIFACT_BUCKET_NAME})
52+
createUploadTestReportManifest.string({credentialsId=jenkins-aws-account-public, variable=AWS_ACCOUNT_PUBLIC})
53+
createUploadTestReportManifest.withCredentials([ARTIFACT_BUCKET_NAME, AWS_ACCOUNT_PUBLIC], groovy.lang.Closure)
54+
createUploadTestReportManifest.echo(Uploading to s3://dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar/test-results/1234/integ-test/test-report.yml)
55+
createUploadTestReportManifest.withAWS({role=opensearch-test, roleAccount=AWS_ACCOUNT_PUBLIC, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure)
56+
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})
57+
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})
58+
createUploadTestReportManifest.legacySCM(groovy.lang.Closure)
59+
createUploadTestReportManifest.library({identifier=jenkins@main, retriever=null})
60+
createUploadTestReportManifest.readYaml({file=tests/data/opensearch-dashboards-1.3.0-test.yml})
61+
TestManifest.asBoolean()
62+
createUploadTestReportManifest.readYaml({file=tests/data/opensearch-1.3.0-build.yml})
63+
BuildManifest.asBoolean()
64+
createUploadTestReportManifest.readYaml({file=tests/data/opensearch-dashboards-build-1.3.0.yml})
65+
BuildManifest.asBoolean()
66+
BuildManifest.getDistribution()
67+
createUploadTestReportManifest.echo(Start Reporting workflow for test type: tar)
68+
BuildManifest.getArtifactRootUrl(distribution-build-opensearch, 29)
69+
BuildManifest.getArtifactRootUrl(distribution-build-opensearch-dashboards, 25b38c278cdd45efa583765d8ba76346)
70+
createUploadTestReportManifest.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/29/linux/x64/tar)
71+
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)
72+
createUploadTestReportManifest.echo(Base Path DUMMY_PUBLIC_ARTIFACT_URL/dummy_integ_test/1.3.0/25b38c278cdd45efa583765d8ba76346/linux/x64/tar)
73+
createUploadTestReportManifest.echo(Component: null)
74+
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 )
75+
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 )
4976
createUploadTestReportManifest.echo(Build Id: 25b38c278cdd45efa583765d8ba76346)
5077
BuildManifest.getArtifactRoot(dummy_integ_test, 25b38c278cdd45efa583765d8ba76346)
5178
createUploadTestReportManifest.string({credentialsId=jenkins-artifact-bucket-name, variable=ARTIFACT_BUCKET_NAME})

vars/createUploadTestReportManifest.groovy

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
@param args.dashboardsBuildManifest <optional> - The path of the build manifest of OpenSearch Dashboards
1515
@param args.testRunID <required> - Test run id of the test workflow being reported.
1616
@param args.testType <required> - Type of the test workflow being reported.
17+
@param args.rcNumber <Optional> - The RC Number of the distribution in test workflow being reported.
1718
@param args.componentName <Optional> - Components that workflow runs on.
1819
*/
1920

@@ -24,6 +25,7 @@ def call(Map args = [:]) {
2425

2526
def testRunID = args.testRunID;
2627
def testType = args.testType;
28+
def rcNumber = args.rcNumber
2729

2830
def testManifest = lib.jenkins.TestManifest.new(readYaml(file: args.testManifest))
2931
def buildManifest = lib.jenkins.BuildManifest.new(readYaml(file: args.buildManifest))
@@ -50,6 +52,7 @@ def call(Map args = [:]) {
5052
"--test-run-id ${testRunID}",
5153
"--test-type ${testType}",
5254
"--base-path ${basePath}",
55+
isNullOrEmpty(rcNumber) ? "" : "--release-candidate ${rcNumber}",
5356
isNullOrEmpty(component) ? "" : "--component ${component}",
5457
].join(' ')
5558

vars/publishIntegTestResults.groovy

+8-14
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@
1010
/** Library to fetch the failing Integration test details at the end of Integration Test Jenkins build and index the results to OpenSearch Metrics cluster.
1111
*
1212
* @param Map args = [:] args A map of the following parameters.
13-
* @param args.version <required> - The version against which the integration test is executed.
14-
* @param args.distributionBuildNumber <required> - The jenkins distribution build number.
1513
* @param args.distributionBuildUrl <required> - The jenkins distribution build number.
16-
* @param args.rc <required> - If the integration tests are running on an RC.
17-
* @param args.rcNumber <required> - The RC number against which the integration test is executed.
18-
* @param args.platform <required> - The platform of the integration test build.
19-
* @param args.architecture <required> - The architecture of the integration test build.
20-
* @param args.distribution <required> - The distribution of the integration test build.
2114
* @param args.testReportManifestYml <required> - The generated test report YAML file using test report workflow.
2215
* @param args.jobName <required> - The integ test job name, used in `testReportManifestYmlUrl`.
2316
*/
@@ -39,26 +32,27 @@ void call(Map args = [:]) {
3932
return null
4033
}
4134

42-
def version = args.version.toString()
4335
def integTestBuildNumber = currentBuild.number
4436
def integTestBuildUrl = env.RUN_DISPLAY_URL
45-
def distributionBuildNumber = args.distributionBuildNumber
4637
def distributionBuildUrl = args.distributionBuildUrl
4738
def buildStartTime = currentBuild.startTimeInMillis
4839
def currentDate = new Date()
4940
def formattedDate = new SimpleDateFormat("MM-yyyy").format(currentDate)
50-
def rc = args.rc
51-
def rcNumber = args.rcNumber.toInteger()
52-
def platform = args.platform
53-
def architecture = args.architecture
54-
def distribution = args.distribution
5541
def testReportManifestYml = args.testReportManifestYml
5642
def jobName = args.jobName
5743
def testReportManifestYmlUrl = "https://ci.opensearch.org/ci/dbc/${jobName}/${version}/${distributionBuildNumber}/${platform}/${architecture}/${distribution}/test-results/${integTestBuildNumber}/integ-test/test-report.yml"
5844
def manifestFile = readFile testReportManifestYml
5945
def manifest = readYaml text: manifestFile
6046
def indexName = "opensearch-integration-test-results-${formattedDate}"
6147
def finalJsonDoc = ""
48+
def version = manifest.version.toString()
49+
def distributionBuildNumber = manifest.id
50+
def rcNumber = manifest.rc.toInteger()
51+
def rc = (rcNumber > 0)
52+
def platform = manifest.platform
53+
def architecture = manifest.architecture
54+
def distribution = manifest.distribution
55+
6256
manifest.components.each { component ->
6357
def componentName = component.name
6458
def componentCategory = manifest.name

0 commit comments

Comments
 (0)