Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
  • Loading branch information
gaiksaya committed Jan 13, 2024
1 parent c8288c0 commit b639d5f
Showing 1 changed file with 103 additions and 103 deletions.
206 changes: 103 additions & 103 deletions jenkins/opensearch/integ-test.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -138,122 +138,122 @@ pipeline {

for (component_check in componentList) {
if (!componentDefaultList.contains(component_check)) {
error("${component_check} is not present in the test manifest: ${TEST_MANIFEST}, exit 1")
error("${component_check} is not present in the test manifest: ${TEST_MANIFEST}")
}
if (!componentsInBuildManifest.contains(component_check)) {
error("${component_check} is not present in the provided build manifest: ${BUILD_MANIFEST}")
}
}

// if (env.platform != 'windows') {
// echo "Not on Windows, stash repository+artifacts"
// echo "Downloading from S3: ${artifactPath}"
// downloadFromS3(
// assumedRoleName: 'opensearch-bundle',
// roleAccountNumberCred: 'jenkins-aws-account-public',
// downloadPath: "${artifactPath}/",
// bucketName: "${ARTIFACT_BUCKET_NAME}",
// localPath: "${WORKSPACE}/artifacts",
// force: true
// )
// sh("rm -rf $WORKSPACE/$distribution && mv -v $WORKSPACE/artifacts/${artifactPath} $WORKSPACE")
// }
// else {
// echo "On Windows Platform, stash repository only"
// }
if (env.platform != 'windows') {
echo "Not on Windows, stash repository+artifacts"
echo "Downloading from S3: ${artifactPath}"
downloadFromS3(
assumedRoleName: 'opensearch-bundle',
roleAccountNumberCred: 'jenkins-aws-account-public',
downloadPath: "${artifactPath}/",
bucketName: "${ARTIFACT_BUCKET_NAME}",
localPath: "${WORKSPACE}/artifacts",
force: true
)
sh("rm -rf $WORKSPACE/$distribution && mv -v $WORKSPACE/artifacts/${artifactPath} $WORKSPACE")
}
else {
echo "On Windows Platform, stash repository only"
}

// Stash the current working directory files, aka opensearch-build repo
// Unstash later in each triggered stage to run integTest
// stash includes: "**", name: "integtest-opensearch-$BUILD_NUMBER"
stash includes: "**", name: "integtest-opensearch-$BUILD_NUMBER"

// componentTests = [:]
componentTests = [:]

// for (component in componentList) {
// // Must use local variable due to groovy for loop and closure scope
// // Or the stage will be fixed to the last item in return when new stages are triggered here
// // https://web.archive.org/web/20181121065904/http://blog.freeside.co/2013/03/29/groovy-gotcha-for-loops-and-closure-scope/
// def local_component = component.trim()
// def local_component_index = componentList.indexOf(local_component)
// def wait_seconds = local_component_index * 20
for (component in componentList) {
// Must use local variable due to groovy for loop and closure scope
// Or the stage will be fixed to the last item in return when new stages are triggered here
// https://web.archive.org/web/20181121065904/http://blog.freeside.co/2013/03/29/groovy-gotcha-for-loops-and-closure-scope/
def local_component = component.trim()
def local_component_index = componentList.indexOf(local_component)
def wait_seconds = local_component_index * 20

// echo "Add Component: ${local_component}"
// componentTests["Run Integtest ${local_component}"] = {
// // Using scripted pipelines to trigger dynamic parallel stages
// timeout(time: 2, unit: 'HOURS') {
// node(AGENT_LABEL) {
// docker.withRegistry('https://public.ecr.aws/') {
// docker.image(docker_images["$distribution"]).inside(docker_args["$distribution"]) {
// try {
// stage("${local_component}") {
// // Jenkins tend to not clean up workspace at times even though ws clean is called
// // Docker is mounting the agent directory so it can communicate with the agent
// // this sometimes causes the workspace to retain last run test-results and ends with build failures
// // https://github.com/opensearch-project/opensearch-build/blob/6ed1ce3c583233eae4fe1027969d778cfc7660f7/src/test_workflow/test_recorder/test_recorder.py#L99
// sh("echo ${local_component} with index ${local_component_index} will sleep ${wait_seconds} seconds to reduce load && sleep ${wait_seconds}")
// unstash "integtest-opensearch-$BUILD_NUMBER"
// if (env.platform == 'windows') {
// echo "On Windows Platform, unstash repository and download the artifacts"
// echo "Downloading from S3: ${artifactPath}"
// downloadFromS3(
// assumedRoleName: 'opensearch-bundle',
// roleAccountNumberCred: 'jenkins-aws-account-public',
// downloadPath: "${artifactPath}/",
// bucketName: "${ARTIFACT_BUCKET_NAME}",
// localPath: "${WORKSPACE}/artifacts",
// force: true
// )
// sh("rm -rf $WORKSPACE/$distribution && mv -v $WORKSPACE/artifacts/${artifactPath} $WORKSPACE")
// }
// else {
// echo "Not on Windows, unstash repository+artifacts"
// }
echo "Add Component: ${local_component}"
componentTests["Run Integtest ${local_component}"] = {
// Using scripted pipelines to trigger dynamic parallel stages
timeout(time: 2, unit: 'HOURS') {
node(AGENT_LABEL) {
docker.withRegistry('https://public.ecr.aws/') {
docker.image(docker_images["$distribution"]).inside(docker_args["$distribution"]) {
try {
stage("${local_component}") {
// Jenkins tend to not clean up workspace at times even though ws clean is called
// Docker is mounting the agent directory so it can communicate with the agent
// this sometimes causes the workspace to retain last run test-results and ends with build failures
// https://github.com/opensearch-project/opensearch-build/blob/6ed1ce3c583233eae4fe1027969d778cfc7660f7/src/test_workflow/test_recorder/test_recorder.py#L99
sh("echo ${local_component} with index ${local_component_index} will sleep ${wait_seconds} seconds to reduce load && sleep ${wait_seconds}")
unstash "integtest-opensearch-$BUILD_NUMBER"
if (env.platform == 'windows') {
echo "On Windows Platform, unstash repository and download the artifacts"
echo "Downloading from S3: ${artifactPath}"
downloadFromS3(
assumedRoleName: 'opensearch-bundle',
roleAccountNumberCred: 'jenkins-aws-account-public',
downloadPath: "${artifactPath}/",
bucketName: "${ARTIFACT_BUCKET_NAME}",
localPath: "${WORKSPACE}/artifacts",
force: true
)
sh("rm -rf $WORKSPACE/$distribution && mv -v $WORKSPACE/artifacts/${artifactPath} $WORKSPACE")
}
else {
echo "Not on Windows, unstash repository+artifacts"
}

// sh('rm -rf test-results')
// runIntegTestScript(
// jobName: "$BUILD_JOB_NAME",
// componentName: "${local_component}",
// buildManifest: "$BUILD_MANIFEST",
// testManifest: "manifests/${TEST_MANIFEST}",
// localPath: "${WORKSPACE}/${distribution}",
// switchUserNonRoot: "${switch_user_non_root}"
// )
// String closeCommentMessage = "Closing the issue as the Integration Test passed for ${local_component}<br>Version: ${version}<br>Distribution: ${distribution}<br>Architecture: ${architecture}<br>Platform: ${platform}<br><br>Please check the logs: ${RUN_DISPLAY_URL}<br><br> *"
// if (env.updateGithubIssues) {
// closeGithubIssue(
// repoUrl: buildManifestObj.getRepo("${local_component}"),
// issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version} ${distribution} distribution",
// closeComment: closeCommentMessage,
// label: "autocut,v${version},integ-test-failure"
// )
// }
// }
// } catch (e) {
// echo "Error running integtest for component ${local_component}, creating Github issue"
// String issueBodyMessage = "The integration test failed at distribution level for component ${local_component}<br>Version: ${version}<br>Distribution: ${distribution}<br>Architecture: ${architecture}<br>Platform: ${platform}<br><br>Please check the logs: ${RUN_DISPLAY_URL}<br><br> * Test-report manifest:*<br> - https://ci.opensearch.org/ci/dbc/${JOB_NAME}/${version}/${buildId}/${platform}/${architecture}/${distribution}/test-results/${BUILD_NUMBER}/integ-test/test-report.yml <br><br> _Note: Steps to reproduce, additional logs and other files can be found within the above test-report manifest. <br>Instructions of this test-report manifest can be found [here](https://github.com/opensearch-project/opensearch-build/tree/main/src/report_workflow#guide-on-test-report-manifest-from-ci)._"
// if (env.updateGithubIssues) {
// createGithubIssue(
// repoUrl: buildManifestObj.getRepo("${local_component}"),
// issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version} ${distribution} distribution",
// issueBody: issueBodyMessage,
// label: "autocut,v${version},integ-test-failure"
// )
// }
// throw new Exception("Error running integtest for component ${local_component}", e)
// } finally {
// echo "Completed running integtest for component ${local_component}"
// uploadTestResults(
// buildManifestFileName: BUILD_MANIFEST,
// jobName: JOB_NAME
// )
// postCleanup()
// }
// }
// }
// }
// }
// }
// }
// parallel componentTests
sh('rm -rf test-results')
runIntegTestScript(
jobName: "$BUILD_JOB_NAME",
componentName: "${local_component}",
buildManifest: "$BUILD_MANIFEST",
testManifest: "manifests/${TEST_MANIFEST}",
localPath: "${WORKSPACE}/${distribution}",
switchUserNonRoot: "${switch_user_non_root}"
)
String closeCommentMessage = "Closing the issue as the Integration Test passed for ${local_component}<br>Version: ${version}<br>Distribution: ${distribution}<br>Architecture: ${architecture}<br>Platform: ${platform}<br><br>Please check the logs: ${RUN_DISPLAY_URL}<br><br> *"
if (env.updateGithubIssues) {
closeGithubIssue(
repoUrl: buildManifestObj.getRepo("${local_component}"),
issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version} ${distribution} distribution",
closeComment: closeCommentMessage,
label: "autocut,v${version},integ-test-failure"
)
}
}
} catch (e) {
echo "Error running integtest for component ${local_component}, creating Github issue"
String issueBodyMessage = "The integration test failed at distribution level for component ${local_component}<br>Version: ${version}<br>Distribution: ${distribution}<br>Architecture: ${architecture}<br>Platform: ${platform}<br><br>Please check the logs: ${RUN_DISPLAY_URL}<br><br> * Test-report manifest:*<br> - https://ci.opensearch.org/ci/dbc/${JOB_NAME}/${version}/${buildId}/${platform}/${architecture}/${distribution}/test-results/${BUILD_NUMBER}/integ-test/test-report.yml <br><br> _Note: Steps to reproduce, additional logs and other files can be found within the above test-report manifest. <br>Instructions of this test-report manifest can be found [here](https://github.com/opensearch-project/opensearch-build/tree/main/src/report_workflow#guide-on-test-report-manifest-from-ci)._"
if (env.updateGithubIssues) {
createGithubIssue(
repoUrl: buildManifestObj.getRepo("${local_component}"),
issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version} ${distribution} distribution",
issueBody: issueBodyMessage,
label: "autocut,v${version},integ-test-failure"
)
}
throw new Exception("Error running integtest for component ${local_component}", e)
} finally {
echo "Completed running integtest for component ${local_component}"
uploadTestResults(
buildManifestFileName: BUILD_MANIFEST,
jobName: JOB_NAME
)
postCleanup()
}
}
}
}
}
}
}
parallel componentTests
}
}
post {
Expand Down

0 comments on commit b639d5f

Please sign in to comment.