Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions start-mongodb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ API_URL="https://agent.api.stepsecurity.io/v1/github/$GITHUB_REPOSITORY/actions/

# Set a timeout for the curl command (3 seconds)
RESPONSE=$(curl --max-time 3 -s -w "%{http_code}" "$API_URL" -o /dev/null) || true
CURL_EXIT_CODE=${?}

# Check if the response code is not 200
if [ $CURL_EXIT_CODE -ne 0 ] || [ "$RESPONSE" != "200" ]; then
if [ -z "$RESPONSE" ] || [ "$RESPONSE" == "000" ] || [ $CURL_EXIT_CODE -ne 0 ]; then
echo "Timeout or API not reachable. Continuing to next step."
else
echo "Subscription is not valid. Reach out to support@stepsecurity.io"
exit 1
fi
CURL_EXIT_CODE=$?

# Decide based on curl exit code and HTTP status
if [ $CURL_EXIT_CODE -ne 0 ]; then
echo "Timeout or API not reachable. Continuing to next step."
elif [ "$RESPONSE" = "200" ]; then
:
elif [ "$RESPONSE" = "403" ]; then
echo "Subscription is not valid. Reach out to support@stepsecurity.io"
exit 1
else
echo "Timeout or API not reachable. Continuing to next step."
fi

# `mongosh` is used starting from MongoDB 5.x
Expand Down
Loading