Rename codeberg references to git.mcintire.me
Some checks failed
Production Deployment / Run ExUnit Tests (push) Has been cancelled
Production Deployment / Build and Push Docker Image (push) Has been cancelled

This commit is contained in:
Graham McIntire 2026-07-25 09:57:46 -05:00
parent b5512f2579
commit 443fcf997c
2 changed files with 9 additions and 9 deletions

View file

@ -1,6 +1,6 @@
defmodule Towerops.Agents.ReleaseChecker do
@moduledoc """
Fetches latest release info from the Codeberg (Forgejo) Releases API for the
Fetches latest release info from the git.mcintire.me (Forgejo) Releases API for the
towerops-agent repo.
Caches results for 5 minutes to avoid excessive API calls.
@ -8,7 +8,7 @@ defmodule Towerops.Agents.ReleaseChecker do
require Logger
@codeberg_repo "towerops-agent/towerops-agent"
@agent_repo "towerops-agent/towerops-agent"
@cache_ttl_ms to_timeout(minute: 5)
@arch_map %{
@ -18,7 +18,7 @@ defmodule Towerops.Agents.ReleaseChecker do
@doc """
Clears the cached release info so the next call to `get_latest_release/0`
fetches fresh data from Codeberg.
fetches fresh data from git.mcintire.me.
"""
@spec invalidate_cache() :: :ok
def invalidate_cache do
@ -29,7 +29,7 @@ defmodule Towerops.Agents.ReleaseChecker do
end
@doc """
Returns the latest release info from Codeberg.
Returns the latest release info from git.mcintire.me.
Returns `{:ok, %{version: String.t(), assets: [asset]}}` where each asset
has `name`, `url`, and `checksum` fields.
@ -77,7 +77,7 @@ defmodule Towerops.Agents.ReleaseChecker do
end
defp fetch_and_cache do
url = "https://git.mcintire.me/api/v1/repos/#{@codeberg_repo}/releases/latest"
url = "https://git.mcintire.me/api/v1/repos/#{@agent_repo}/releases/latest"
case req_get(url, headers: [{"accept", "application/json"}], retry: false) do
{:ok, %Req.Response{status: 200, body: body}} ->
@ -86,11 +86,11 @@ defmodule Towerops.Agents.ReleaseChecker do
{:ok, release}
{:ok, %Req.Response{status: status}} ->
Logger.warning("Codeberg API returned status #{status} for latest release")
{:error, {:codeberg_api, status}}
Logger.warning("git.mcintire.me API returned status #{status} for latest release")
{:error, {:agent_api, status}}
{:error, reason} ->
Logger.warning("Failed to fetch latest release from Codeberg: #{inspect(reason)}")
Logger.warning("Failed to fetch latest release from git.mcintire.me: #{inspect(reason)}")
{:error, reason}
end
end

View file

@ -55,7 +55,7 @@ defmodule Towerops.Agents.ReleaseCheckerTest do
Plug.Conn.send_resp(conn, 503, "")
end)
assert {:error, {:codeberg_api, 503}} = ReleaseChecker.get_latest_release()
assert {:error, {:agent_api, 503}} = ReleaseChecker.get_latest_release()
end
test "uses cached release info until invalidated" do