From fb24c2ba73f440ffe707ab63bf0e6295037c74d8 Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Fri, 1 Nov 2024 12:00:22 -0700 Subject: [PATCH] Bash test on gradle agents Signed-off-by: Prudhvi Godithi --- vars/publishGradleCheckTestResults.groovy | 4 ++-- vars/publishIntegTestResults.groovy | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vars/publishGradleCheckTestResults.groovy b/vars/publishGradleCheckTestResults.groovy index d3eb4054..347c106f 100644 --- a/vars/publishGradleCheckTestResults.groovy +++ b/vars/publishGradleCheckTestResults.groovy @@ -173,7 +173,7 @@ void indexFailedTestData() { else echo "Index does not exist. Creating..." create_index_response=\$(curl -s -XPUT "${METRICS_HOST_URL}/\${INDEX_NAME}" --aws-sigv4 \"aws:amz:us-east-1:es\" --user \"${awsAccessKey}:${awsSecretKey}\" -H \"x-amz-security-token:${awsSessionToken}\" -H 'Content-Type: application/json' -d "\${INDEX_MAPPING}") - if [[ \$create_index_response == *'"acknowledged":true'* ]]; then + if [ \$create_index_response == *'"acknowledged":true'* ]; then echo "Index created successfully." echo "Updating alias..." update_alias_response=\$(curl -s -XPOST "${METRICS_HOST_URL}/_aliases" --aws-sigv4 \"aws:amz:us-east-1:es\" --user \"${awsAccessKey}:${awsSecretKey}\" -H \"x-amz-security-token:${awsSessionToken}\" -H "Content-Type: application/json" -d '{ @@ -186,7 +186,7 @@ void indexFailedTestData() { } ] }') - if [[ \$update_alias_response == *'"acknowledged":true'* ]]; then + if [ \$update_alias_response == *'"acknowledged":true'* ]; then echo "Alias updated successfully." else echo "Failed to update alias. Error message: \$update_alias_response" diff --git a/vars/publishIntegTestResults.groovy b/vars/publishIntegTestResults.groovy index 21c9c6e6..305c6d42 100644 --- a/vars/publishIntegTestResults.groovy +++ b/vars/publishIntegTestResults.groovy @@ -222,7 +222,7 @@ void indexTestFailuresData(testFailuresindexName, testFailuresFile) { else echo "Index does not exist. Creating..." create_index_response=\$(curl -s -XPUT "${METRICS_HOST_URL}/${testFailuresindexName}" --aws-sigv4 \"aws:amz:us-east-1:es\" --user \"${awsAccessKey}:${awsSecretKey}\" -H \"x-amz-security-token:${awsSessionToken}\" -H 'Content-Type: application/json' -d "\${INDEX_MAPPING}") - if [[ \$create_index_response == *'"acknowledged":true'* ]]; then + if echo "\$create_index_response" | grep -q '"acknowledged":true'; then echo "Index created successfully." echo "Updating alias..." update_alias_response=\$(curl -s -XPOST "${METRICS_HOST_URL}/_aliases" --aws-sigv4 "aws:amz:us-east-1:es" --user "${awsAccessKey}:${awsSecretKey}" -H "x-amz-security-token:${awsSessionToken}" -H "Content-Type: application/json" -d '{ @@ -235,7 +235,7 @@ void indexTestFailuresData(testFailuresindexName, testFailuresFile) { } ] }') - if [[ \$update_alias_response == *'"acknowledged":true'* ]]; then + if echo "\$update_alias_response" | grep -q '"acknowledged":true'; then echo "Alias updated successfully." else echo "Failed to update alias. Error message: \$update_alias_response"