Skip to content

Commit

Permalink
fix: removed changes to stop sending logs to logdna
Browse files Browse the repository at this point in the history
  • Loading branch information
imprateeksh committed Oct 18, 2024
1 parent 08b6169 commit 6ef0226
Showing 1 changed file with 4 additions and 55 deletions.
59 changes: 4 additions & 55 deletions module-assets/ci/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,61 +147,10 @@ if [ ${IS_PR} == true ]; then
test_arg=${pr_test_file}
fi
test_cmd="go test ${test_arg} -count=1 -v -timeout=600m -parallel=10"
if [[ "$MZ_INGESTION_KEY" ]] ; then
# Assign location to be observed by logdna-agent
if [ -z "$MZ_LOG_DIRS" ]; then
export MZ_LOG_DIRS="/tmp"
fi
#lookback strategy determines how the agent handles existing files on agent startup
if [ -z "$LOGDNA_LOOKBACK" ]; then
export LOGDNA_LOOKBACK="smallfiles"
fi
# This is required to send logs to logdna-agent instance
if [ -z "$MZ_HOST" ]; then
export MZ_HOST="logs.us-south.logging.cloud.ibm.com"
fi
log_location="$MZ_LOG_DIRS/test.log"
# Assign tags
export MZ_TAGS="${REPO_NAME}-PR${PR_NUM},commit-${COMMIT_ID},pipeline-${PIPELINE_ID},env-${ENV_TAG}"
# Exclude extra logs
export MZ_EXCLUSION_REGEX_RULES="/var/log/*"

## Retry running logdna if fails to run and adding more logs

MAX_RETRY_LOGDNA=3
LOGDNA_RUN_ATTEMPT=1

while [ "$LOGDNA_RUN_ATTEMPT" -le "$MAX_RETRY_LOGDNA" ]; do
echo "Starting logdna-agent: [$LOGDNA_RUN_ATTEMPT/$MAX_RETRY_LOGDNA]"
set +e
systemctl start logdna-agent
RESULT_LOGDNA_START=$?
set -e

if [ $RESULT_LOGDNA_START -eq 0 ]; then
echo "Logdna-agent started successfully"
break
else
echo "Logdna-agent start command exit status: $RESULT_LOGDNA_START"
echo "Logdna-agent Tag added: $MZ_TAGS"
set +e
echo "Logdna-agent Status: $(systemctl status logdna-agent)"
LOGDNA_RUN_ATTEMPT=$((LOGDNA_RUN_ATTEMPT+1))
echo "=================================================== Logdna-agent: Service Log ==================================================="
tail -n 20 /var/log/journal/logdna-agent.service.log
echo "================================================================================================================================="
if [ $LOGDNA_RUN_ATTEMPT -le $MAX_RETRY_LOGDNA ]; then
echo "Retrying..."
fi
set -e
fi
done

$test_cmd 2>&1 | tee "$log_location"

else
$test_cmd
fi
# Assign tags
export ICL_TAGS="${REPO_NAME}-PR${PR_NUM},commit-${COMMIT_ID},pipeline-${PIPELINE_ID},env-${ENV_TAG}"
echo "$ICL_TAGS" # Keeping this for now as this information will be required when using ICL
$test_cmd
cd ..
else
echo "No file changes detected to trigger tests"
Expand Down

0 comments on commit 6ef0226

Please sign in to comment.