mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +00:00
curl error handling in entrypoint.sh (#159)
This commit is contained in:
parent
75999800e7
commit
a013298955
2 changed files with 12 additions and 4 deletions
|
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed issue where we crash on startup if the install / upgrade PostHog event fails to send. ([#159](https://github.com/sourcebot-dev/sourcebot/pull/159))
|
||||||
|
|
||||||
## [2.7.0] - 2025-01-10
|
## [2.7.0] - 2025-01-10
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,16 @@ if [ ! -f "$FIRST_RUN_FILE" ]; then
|
||||||
# If this is our first run, send a `install` event to PostHog
|
# If this is our first run, send a `install` event to PostHog
|
||||||
# (if telemetry is enabled)
|
# (if telemetry is enabled)
|
||||||
if [ -z "$SOURCEBOT_TELEMETRY_DISABLED" ]; then
|
if [ -z "$SOURCEBOT_TELEMETRY_DISABLED" ]; then
|
||||||
curl -L -s --header "Content-Type: application/json" -d '{
|
if ! ( curl -L --output /dev/null --silent --fail --header "Content-Type: application/json" -d '{
|
||||||
"api_key": "'"$POSTHOG_PAPIK"'",
|
"api_key": "'"$POSTHOG_PAPIK"'",
|
||||||
"event": "install",
|
"event": "install",
|
||||||
"distinct_id": "'"$SOURCEBOT_INSTALL_ID"'",
|
"distinct_id": "'"$SOURCEBOT_INSTALL_ID"'",
|
||||||
"properties": {
|
"properties": {
|
||||||
"sourcebot_version": "'"$SOURCEBOT_VERSION"'"
|
"sourcebot_version": "'"$SOURCEBOT_VERSION"'"
|
||||||
}
|
}
|
||||||
}' https://us.i.posthog.com/capture/ > /dev/null
|
}' https://us.i.posthog.com/capture/ ) then
|
||||||
|
echo -e "\e[33m[Warning] Failed to send install event.\e[0m"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
export SOURCEBOT_INSTALL_ID=$(cat "$FIRST_RUN_FILE" | jq -r '.install_id')
|
export SOURCEBOT_INSTALL_ID=$(cat "$FIRST_RUN_FILE" | jq -r '.install_id')
|
||||||
|
|
@ -48,7 +50,7 @@ else
|
||||||
echo -e "\e[34m[Info] Upgraded from version $PREVIOUS_VERSION to $SOURCEBOT_VERSION\e[0m"
|
echo -e "\e[34m[Info] Upgraded from version $PREVIOUS_VERSION to $SOURCEBOT_VERSION\e[0m"
|
||||||
|
|
||||||
if [ -z "$SOURCEBOT_TELEMETRY_DISABLED" ]; then
|
if [ -z "$SOURCEBOT_TELEMETRY_DISABLED" ]; then
|
||||||
curl -L -s --header "Content-Type: application/json" -d '{
|
if ! ( curl -L --output /dev/null --silent --fail --header "Content-Type: application/json" -d '{
|
||||||
"api_key": "'"$POSTHOG_PAPIK"'",
|
"api_key": "'"$POSTHOG_PAPIK"'",
|
||||||
"event": "upgrade",
|
"event": "upgrade",
|
||||||
"distinct_id": "'"$SOURCEBOT_INSTALL_ID"'",
|
"distinct_id": "'"$SOURCEBOT_INSTALL_ID"'",
|
||||||
|
|
@ -56,7 +58,9 @@ else
|
||||||
"from_version": "'"$PREVIOUS_VERSION"'",
|
"from_version": "'"$PREVIOUS_VERSION"'",
|
||||||
"to_version": "'"$SOURCEBOT_VERSION"'"
|
"to_version": "'"$SOURCEBOT_VERSION"'"
|
||||||
}
|
}
|
||||||
}' https://us.i.posthog.com/capture/ > /dev/null
|
}' https://us.i.posthog.com/capture/ ) then
|
||||||
|
echo -e "\e[33m[Warning] Failed to send upgrade event.\e[0m"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue