Skip to content

Commit

Permalink
move logic around in runBenchmarkTestScript
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Oviedo <[email protected]>
  • Loading branch information
OVI3D0 committed Aug 8, 2024
1 parent f2cfc50 commit d990de2
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions vars/runBenchmarkTestScript.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -48,33 +48,33 @@
*/
void call(Map args = [:]) {

def command
lib = library(identifier: 'jenkins@main', retriever: legacySCM(scm))
def buildManifest = null

if(args.command == 'execute-test') {
if (!isNullOrEmpty(args.bundleManifest as String)){
buildManifest = lib.jenkins.BuildManifest.new(readYaml(file: args.bundleManifest))
}

lib = library(identifier: 'jenkins@main', retriever: legacySCM(scm))
def buildManifest = null
config_name = isNullOrEmpty(args.config) ? 'config.yml' : args.config
benchmark_config = 'benchmark.ini'
withCredentials([string(credentialsId: 'jenkins-aws-account-public', variable: 'AWS_ACCOUNT_PUBLIC'),
string(credentialsId: 'jenkins-artifact-bucket-name', variable: 'ARTIFACT_BUCKET_NAME')]) {
withAWS(role: 'opensearch-test', roleAccount: "${AWS_ACCOUNT_PUBLIC}", duration: 900, roleSessionName: 'jenkins-session') {
if(isNullOrEmpty(args.endpoint) && args.command == 'execute-test') {
s3Download(file: 'config.yml', bucket: "${ARTIFACT_BUCKET_NAME}", path: "${BENCHMARK_TEST_CONFIG_LOCATION}/${config_name}", force: true)
}
s3Download(file: 'benchmark.ini', bucket: "${ARTIFACT_BUCKET_NAME}", path: "${BENCHMARK_TEST_CONFIG_LOCATION}/${benchmark_config}", force: true)

if (!isNullOrEmpty(args.bundleManifest as String)){
buildManifest = lib.jenkins.BuildManifest.new(readYaml(file: args.bundleManifest))
/*Added sleep to let the file get downloaded first before write happens. Without the sleep the write is
happening in parallel to download resulting in file not found error. To avoid pip install conflict errors
when runnin with and without security run in parallel add enough gap between execution.
*/
}
}

config_name = isNullOrEmpty(args.config) ? 'config.yml' : args.config
benchmark_config = 'benchmark.ini'
withCredentials([string(credentialsId: 'jenkins-aws-account-public', variable: 'AWS_ACCOUNT_PUBLIC'),
string(credentialsId: 'jenkins-artifact-bucket-name', variable: 'ARTIFACT_BUCKET_NAME')]) {
withAWS(role: 'opensearch-test', roleAccount: "${AWS_ACCOUNT_PUBLIC}", duration: 900, roleSessionName: 'jenkins-session') {
if(isNullOrEmpty(args.endpoint) || args.command == 'execute-test') {
s3Download(file: 'config.yml', bucket: "${ARTIFACT_BUCKET_NAME}", path: "${BENCHMARK_TEST_CONFIG_LOCATION}/${config_name}", force: true)
}
s3Download(file: 'benchmark.ini', bucket: "${ARTIFACT_BUCKET_NAME}", path: "${BENCHMARK_TEST_CONFIG_LOCATION}/${benchmark_config}", force: true)

/*Added sleep to let the file get downloaded first before write happens. Without the sleep the write is
happening in parallel to download resulting in file not found error. To avoid pip install conflict errors
when runnin with and without security run in parallel add enough gap between execution.
*/
}
}
def command

if(args.command == 'execute-test') {

if (args.insecure.toBoolean()) {
sleep(5)
Expand Down

0 comments on commit d990de2

Please sign in to comment.