Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix(explorer): fetch latest version from env instead of github #1738

Merged
merged 4 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions explorer/.env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ MAX_BATCH_SIZE=268435456 # 256 MiB

# Time we wait for a batch to be verified before marking it stale
BATCH_TTL_MINUTES=5

# Latest aligned release that operators should be running
LATEST_RELEASE=v13.0.0
MarcosNicolau marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions explorer/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ TRACKER_API_URL=<tracker_api_url>

# Time we wait for a batch to be verified before marking it stale
BATCH_TTL_MINUTES=5

# Latest aligned release that operators should be running
LATEST_RELEASE=v13.0.0
MarcosNicolau marked this conversation as resolved.
Show resolved Hide resolved
35 changes: 1 addition & 34 deletions explorer/lib/explorer_web/live/releases_helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,6 @@ defmodule ReleasesHelper do
require Logger

def get_latest_release do
case do_fetch_latest_release() do
{:ok, tag} ->
tag

{:error, reason} ->
Logger.error("Failed to fetch latest release: #{reason}")
nil
end
end

defp do_fetch_latest_release do
with :ok <- fetch_tags(),
{:ok, tag} <- get_latest_tag() do
{:ok, tag}
end
end

defp fetch_tags do
case System.cmd("git", ["fetch", "--tags"]) do
{_, 0} -> :ok
{error, _} -> {:error, "Failed to fetch tags: #{error}"}
end
end

defp get_latest_tag do
case System.cmd("git", ["rev-list", "--tags", "--max-count=1"]) do
{sha, 0} ->
sha = String.trim(sha)
case System.cmd("git", ["describe", "--tags", sha]) do
{tag, 0} -> {:ok, String.trim(tag)}
{_, _} -> {:error, "Failed to describe tag"}
end
{_, _} -> {:error, "No tags found or not a git repository"}
end
System.get_env("LATEST_RELEASE")
end
end
1 change: 1 addition & 0 deletions explorer/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ env_vars=(
"TRACKER_API_URL"
"MAX_BATCH_SIZE"
"BATCH_TTL_MINUTES"
"LATEST_RELEASE"
)

for var in "${env_vars[@]}"; do
Expand Down