From 7a84c42669bc0d5b0f206e180623fe9daf0057fc Mon Sep 17 00:00:00 2001 From: Rishabh Singh Date: Mon, 11 Nov 2024 15:05:58 -0800 Subject: [PATCH] add ci-group arg for OSD integ tests Signed-off-by: Rishabh Singh --- vars/processAndRunOsdIntegTest.groovy | 53 +++++++++++++++++++++++++++ vars/runIntegTestScript.groovy | 4 +- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 vars/processAndRunOsdIntegTest.groovy diff --git a/vars/processAndRunOsdIntegTest.groovy b/vars/processAndRunOsdIntegTest.groovy new file mode 100644 index 00000000..ab063a0f --- /dev/null +++ b/vars/processAndRunOsdIntegTest.groovy @@ -0,0 +1,53 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ +void call(Map args = [:]) { + lib = library(identifier: 'jenkins@main', retriever: legacySCM(scm)) + + unstash "integtest-opensearch-dashboards-${BUILD_NUMBER}" + + if (env.platform == 'windows') { + echo "On Windows Platform, unstash repository and download the artifacts" + echo "Downloading from S3: ${artifactPathOpenSearch}" + downloadFromS3( + assumedRoleName: 'opensearch-bundle', + roleAccountNumberCred: 'jenkins-aws-account-public', + downloadPath: "${artifactPathOpenSearch}/", + bucketName: "${ARTIFACT_BUCKET_NAME}", + localPath: "${WORKSPACE}/artifacts", + force: true + ) + sh("cp -a ${WORKSPACE}/artifacts/${artifactPathOpenSearch} ${WORKSPACE}") + + 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("cp -a ${WORKSPACE}/artifacts/${artifactPath} ${WORKSPACE}") + sh("rm -rf ${WORKSPACE}/artifacts") + } + 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}", + ciGroup: args.ciGroup + ) +} diff --git a/vars/runIntegTestScript.groovy b/vars/runIntegTestScript.groovy index 8e55883a..dc98e8ba 100644 --- a/vars/runIntegTestScript.groovy +++ b/vars/runIntegTestScript.groovy @@ -62,7 +62,7 @@ void call(Map args = [:]) { 'integ-test', "${args.testManifest}", "--component ${component}", - "--ci-group ${args.ciGroup}", + isNullOrEmpty(args.ciGroup.toString()) ? "" : "--ci-group ${args.ciGroup}", "--test-run-id ${env.BUILD_NUMBER}", "--paths ${paths}", "--base-path ${basePath}", @@ -98,3 +98,5 @@ String generatePaths(buildManifest, artifactRootUrl, localPath) { String generateBasePaths(buildManifest) { return ["${env.PUBLIC_ARTIFACT_URL}", "${env.JOB_NAME}", buildManifest.build.version, buildManifest.build.id, buildManifest.build.platform, buildManifest.build.architecture, buildManifest.build.distribution].join("/") } + +boolean isNullOrEmpty(String str) { return (str == null || str.allWhitespace || str.isEmpty()) }