Skip to content

Commit

Permalink
Add publishIntegTestResults
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
1 parent 5124b1a commit 86684b5
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 102 deletions.
16 changes: 15 additions & 1 deletion jenkins/opensearch-dashboards/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* compatible open source license.
*/

lib = library(identifier: 'jenkins@6.5.0', retriever: modernSCM([
lib = library(identifier: 'jenkins@6.7.0', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))
Expand Down Expand Up @@ -60,6 +60,11 @@ pipeline {
defaultValue: 'linux windows',
trim: true
)
string(
name: 'RC_NUMBER',
description: 'The RC build count. Default is 0 which means its not an RC build.',
defaultValue: '0'
)
string( // Note: need to update 'verify-parameters' entries if you add new distribution(s)
name: 'BUILD_DISTRIBUTION',
description: 'Build selected distribution related artifacts, choices include tar, rpm, deb, zip. Can combine multiple distributions with space in between (docker is only available on tar)',
Expand Down Expand Up @@ -948,6 +953,15 @@ pipeline {
inputManifestPath: "manifests/$INPUT_MANIFEST"
)
}
def rc = (params.RC_NUMBER.toInteger() > 0)
publishDistributionBuildResults(
failureMessages: buildMessage(search: 'Error building'),
passMessages: buildMessage(search: 'Successfully built'),
inputManifestPath: "manifests/$INPUT_MANIFEST",
rc: rc,
rcNumber: env.RC_NUMBER,
componentCategory: "OpenSearch Dashboards"
)
postCleanup()
}
}
Expand Down
24 changes: 22 additions & 2 deletions jenkins/opensearch-dashboards/integ-test.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* compatible open source license.
*/

lib = library(identifier: '[email protected]', retriever: modernSCM([

lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))
Expand Down Expand Up @@ -72,6 +71,11 @@ pipeline {
description: 'If true results will create / update / close github issues',
defaultValue: false
)
string(
name: 'RC_NUMBER',
description: 'The RC build count. Default is 0 which means its not an RC build.',
defaultValue: '0'
)
booleanParam(
name: 'VALIDATE_ARTIFACTS',
description: 'If true the provided artifacts are validated before triggering integ-tests else skip the validation stage',
Expand Down Expand Up @@ -356,10 +360,26 @@ pipeline {
componentName: "${COMPONENT_NAME}",
)
echo("Download report manifest from https://ci.opensearch.org/ci/dbc/integ-test/${env.version}/${env.buildId}/${env.platform}/${env.architecture}/${env.distribution}/test-results/${env.BUILD_NUMBER}/integ-test/test-report.yml")
stash includes: 'test-report.yml', name: "test-report-$BUILD_NUMBER"
archiveArtifacts artifacts: 'test-report.yml'
}
}
}
node(agent_nodes['linux_x64']) {
unstash "test-report-$BUILD_NUMBER"
def rc = (params.RC_NUMBER.toInteger() > 0)
publishIntegTestResults(
version: env.version,
distributionBuildNumber: env.buildId,
distributionBuildUrl: "https://build.ci.opensearch.org/blue/organizations/jenkins/${env.BUILD_JOB_NAME}/detail/${env.BUILD_JOB_NAME}/${env.buildId}/pipeline",
rc: rc,
rcNumber: env.RC_NUMBER,
platform: env.platform,
architecture: env.architecture,
distribution: env.distribution,
testReportManifestYml: "test-report.yml"
)
}
}
postCleanup()
}
Expand Down
18 changes: 17 additions & 1 deletion jenkins/opensearch/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* compatible open source license.
*/

lib = library(identifier: 'jenkins@6.5.0', retriever: modernSCM([
lib = library(identifier: 'jenkins@6.7.0', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))
Expand Down Expand Up @@ -59,6 +59,11 @@ pipeline {
defaultValue: 'linux macos windows',
trim: true
)
string(
name: 'RC_NUMBER',
description: 'The RC build count. Default is 0 which means its not an RC build.',
defaultValue: '0'
)
choice(
name: 'BUILD_DOCKER',
description: 'Build docker image or not with options.',
Expand Down Expand Up @@ -666,6 +671,7 @@ pipeline {
expression {
params.BUILD_PLATFORM.contains('linux')
}

}
agent { label AGENT_LINUX_ARM64 }
stages {
Expand Down Expand Up @@ -892,8 +898,18 @@ pipeline {
inputManifestPath: "manifests/$INPUT_MANIFEST"
)
}
def rc = (params.RC_NUMBER.toInteger() > 0)
publishDistributionBuildResults(
failureMessages: buildMessage(search: 'Error building'),
passMessages: buildMessage(search: 'Successfully built'),
inputManifestPath: "manifests/$INPUT_MANIFEST",
rc: rc,
rcNumber: env.RC_NUMBER,
componentCategory: "OpenSearch"
)
postCleanup()
}

}
}
success {
Expand Down
24 changes: 22 additions & 2 deletions jenkins/opensearch/integ-test.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* compatible open source license.
*/

lib = library(identifier: '[email protected]', retriever: modernSCM([

lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))
Expand Down Expand Up @@ -72,6 +71,11 @@ pipeline {
description: 'If true results will create / update / close github issues',
defaultValue: false
)
string(
name: 'RC_NUMBER',
description: 'The RC build count. Default is 0 which means its not an RC build.',
defaultValue: '0'
)
booleanParam(
name: 'VALIDATE_ARTIFACTS',
description: 'If true the provided artifacts are validated before triggering integ-tests else skip the validation stage',
Expand Down Expand Up @@ -307,10 +311,26 @@ pipeline {
componentName: "${COMPONENT_NAME}",
)
echo("Download report manifest from https://ci.opensearch.org/ci/dbc/integ-test/${env.version}/${env.buildId}/${env.platform}/${env.architecture}/${env.distribution}/test-results/${env.BUILD_NUMBER}/integ-test/test-report.yml")
stash includes: 'test-report.yml', name: "test-report-$BUILD_NUMBER"
archiveArtifacts artifacts: 'test-report.yml'
}
}
}
node(agent_nodes['linux_x64']) {
unstash "test-report-$BUILD_NUMBER"
def rc = (params.RC_NUMBER.toInteger() > 0)
publishIntegTestResults(
version: env.version,
distributionBuildNumber: env.buildId,
distributionBuildUrl: "https://build.ci.opensearch.org/blue/organizations/jenkins/${env.BUILD_JOB_NAME}/detail/${env.BUILD_JOB_NAME}/${env.buildId}/pipeline",
rc: rc,
rcNumber: env.RC_NUMBER,
platform: env.platform,
architecture: env.architecture,
distribution: env.distribution,
testReportManifestYml: "test-report.yml"
)
}
}
postCleanup()
}
Expand Down
5 changes: 4 additions & 1 deletion tests/jenkins/TestOpenSearchDashboardsIntegTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TestOpenSearchDashboardsIntegTest extends BuildPipelineTest {

helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('6.5.0')
.defaultVersion('6.7.0')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
Expand Down Expand Up @@ -70,6 +70,7 @@ class TestOpenSearchDashboardsIntegTest extends BuildPipelineTest {
binding.setVariable('distribution', 'tar' )
binding.setVariable('COMPONENT_NAME', '' )
binding.getVariable('currentBuild').upstreamBuilds = [[fullProjectName: jobName]]
binding.setVariable('RC_NUMBER', '0')
def env = binding.getVariable('env')
env['DOCKER_AGENT'] = [image:'opensearchstaging/opensearchstaging/ci-runner:ci-runner-almallinux8-opensearch-dashboards-integtest-v1', args:'-e JAVA_HOME=/opt/java/openjdk-11']
env['PUBLIC_ARTIFACT_URL'] = 'DUMMY_PUBLIC_ARTIFACT_URL'
Expand Down Expand Up @@ -100,6 +101,7 @@ class TestOpenSearchDashboardsIntegTest extends BuildPipelineTest {
helper.registerAllowedMethod('unstash', [String.class], null)
}

///
@Test
void integTests_runs_for_all_components() {
super.testPipeline('jenkins/opensearch-dashboards/integ-test.jenkinsfile',
Expand All @@ -113,6 +115,7 @@ class TestOpenSearchDashboardsIntegTest extends BuildPipelineTest {
'env PATH=$PATH ./test.sh integ-test manifests/tests/jenkins/data/opensearch-dashboards-3.0.0-test.yml --component observabilityDashboards --test-run-id 215 --paths opensearch=/tmp/workspace/tar opensearch-dashboards=/tmp/workspace/tar --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/3.0.0/215/linux/x64/tar '.toString()
))
assertThat(getCommandExecutions('sh', 'report.sh'), hasItems('./report.sh manifests/tests/jenkins/data/opensearch-dashboards-3.0.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/3.0.0/215/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/3.0.0/215/linux/x64/tar --test-run-id 215 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/3.0.0/215/linux/x64/tar '))
assertCallStack().contains('{version=3.0.0, distributionBuildNumber=215, distributionBuildUrl=https://build.ci.opensearch.org/blue/organizations/jenkins/distribution-build-opensearch-dashboards/detail/distribution-build-opensearch-dashboards/215/pipeline, rc=false, rcNumber=null, platform=linux, architecture=x64, distribution=tar, testReportManifestYml=test-report.yml}')
}

@Test
Expand Down
4 changes: 3 additions & 1 deletion tests/jenkins/TestOpenSearchIntegTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TestOpenSearchIntegTest extends BuildPipelineTest {

helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('6.5.0')
.defaultVersion('6.7.0')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
Expand Down Expand Up @@ -62,6 +62,7 @@ class TestOpenSearchIntegTest extends BuildPipelineTest {
binding.setVariable('RUN_DISPLAY_URL', 'https://some/url/redirect')
binding.setVariable('distribution', 'tar' )
binding.setVariable('COMPONENT_NAME', '' )
binding.setVariable('RC_NUMBER', '0')
binding.getVariable('currentBuild').upstreamBuilds = [[fullProjectName: jobName]]
helper.registerAllowedMethod("s3Download", [Map])
helper.registerAllowedMethod("withAWS", [Map, Closure], { args, closure ->
Expand Down Expand Up @@ -94,6 +95,7 @@ class TestOpenSearchIntegTest extends BuildPipelineTest {
assertThat(getCommandExecutions('sh', 'test.sh'), hasItem('env PATH=$PATH JAVA_HOME=/opt/java/openjdk-17 ./test.sh integ-test manifests/tests/jenkins/data/opensearch-3.0.0-test.yml --component k-NN --test-run-id 234 --paths opensearch=/tmp/workspace/tar --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/3.0.0/9010/linux/x64/tar '))
assertThat(getCommandExecutions('sh', 'report.sh'), hasItem('./report.sh manifests/tests/jenkins/data/opensearch-3.0.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/3.0.0/9010/linux/x64/tar --test-run-id 234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/3.0.0/9010/linux/x64/tar '))
assertThat(getCommandExecutions('echo', 'Testing'), hasItem('Testing components: [ml-commons, anomaly-detection, neural-search, security-analytics, security, k-NN, notifications]'))
assertCallStack().contains('{version=3.0.0, distributionBuildNumber=9010, distributionBuildUrl=https://build.ci.opensearch.org/blue/organizations/jenkins/distribution-build-opensearch/detail/distribution-build-opensearch/9010/pipeline, rc=false, rcNumber=null, platform=linux, architecture=x64, distribution=tar, testReportManifestYml=test-report.yml}')
}

@Test
Expand Down
Loading

0 comments on commit 86684b5

Please sign in to comment.