From 953d1a2b24d5fb371551659a403caba3259e33b1 Mon Sep 17 00:00:00 2001 From: Steffen Deusch Date: Thu, 11 Jul 2024 10:42:30 +0200 Subject: [PATCH 1/3] update debian to bookworm --- lib/mix/tasks/phx.gen.release.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mix/tasks/phx.gen.release.ex b/lib/mix/tasks/phx.gen.release.ex index 79b1580a10..74f5a969e9 100644 --- a/lib/mix/tasks/phx.gen.release.ex +++ b/lib/mix/tasks/phx.gen.release.ex @@ -195,7 +195,7 @@ defmodule Mix.Tasks.Phx.Gen.Release do |> map_size() > 0 end - @debian "bullseye" + @debian "bookworm" defp elixir_and_debian_vsn(elixir_vsn, otp_vsn) do url = "https://hub.docker.com/v2/namespaces/hexpm/repositories/elixir/tags?name=#{elixir_vsn}-erlang-#{otp_vsn}-debian-#{@debian}-" From d7419b88f8045ab9e16963a3242f541748d45cec Mon Sep 17 00:00:00 2001 From: Steffen Deusch Date: Mon, 19 Aug 2024 20:47:23 +0200 Subject: [PATCH 2/3] only use bookworm on OTP >= 24 --- lib/mix/tasks/phx.gen.release.ex | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/mix/tasks/phx.gen.release.ex b/lib/mix/tasks/phx.gen.release.ex index 74f5a969e9..d4387e5eae 100644 --- a/lib/mix/tasks/phx.gen.release.ex +++ b/lib/mix/tasks/phx.gen.release.ex @@ -195,10 +195,9 @@ defmodule Mix.Tasks.Phx.Gen.Release do |> map_size() > 0 end - @debian "bookworm" - defp elixir_and_debian_vsn(elixir_vsn, otp_vsn) do + defp elixir_and_debian_vsn(elixir_vsn, otp_vsn, debian) do url = - "https://hub.docker.com/v2/namespaces/hexpm/repositories/elixir/tags?name=#{elixir_vsn}-erlang-#{otp_vsn}-debian-#{@debian}-" + "https://hub.docker.com/v2/namespaces/hexpm/repositories/elixir/tags?name=#{elixir_vsn}-erlang-#{otp_vsn}-debian-#{debian}-" fetch_body!(url) |> Phoenix.json_library().decode!() @@ -206,7 +205,7 @@ defmodule Mix.Tasks.Phx.Gen.Release do |> Enum.find_value(:error, fn %{"name" => name} -> if String.ends_with?(name, "-slim") do elixir_vsn = name |> String.split("-") |> List.first() - %{"vsn" => vsn} = Regex.named_captures(~r/.*debian-#{@debian}-(?.*)-slim/, name) + %{"vsn" => vsn} = Regex.named_captures(~r/.*debian-#{debian}-(?.*)-slim/, name) {:ok, elixir_vsn, vsn} end end) @@ -221,13 +220,17 @@ defmodule Mix.Tasks.Phx.Gen.Release do otp_vsn = otp_vsn() + # hex bob only builds on bookworm for erlang >= 24 + otp_major_vsn = :erlang.system_info(:otp_release) |> List.to_integer() + debian = if otp_major_vsn >= 24, do: "bookworm", else: "bullseye" + vsns = - case elixir_and_debian_vsn(wanted_elixir_vsn, otp_vsn) do + case elixir_and_debian_vsn(wanted_elixir_vsn, otp_vsn, debian) do {:ok, elixir_vsn, debian_vsn} -> {:ok, elixir_vsn, debian_vsn} :error -> - case elixir_and_debian_vsn("", otp_vsn) do + case elixir_and_debian_vsn("", otp_vsn, debian) do {:ok, elixir_vsn, debian_vsn} -> Logger.warning( "Docker image for Elixir #{wanted_elixir_vsn} not found, defaulting to Elixir #{elixir_vsn}" @@ -244,7 +247,7 @@ defmodule Mix.Tasks.Phx.Gen.Release do {:ok, elixir_vsn, debian_vsn} -> binding = Keyword.merge(binding, - debian: @debian, + debian: debian, debian_vsn: debian_vsn, elixir_vsn: elixir_vsn, otp_vsn: otp_vsn From e2e7fead3944a840748d6e31d6142c20f87ffbca Mon Sep 17 00:00:00 2001 From: Steffen Deusch Date: Mon, 19 Aug 2024 20:59:02 +0200 Subject: [PATCH 3/3] only test on OTP >= 24 --- .github/workflows/ci.yml | 8 ++++---- lib/mix/tasks/phx.gen.release.ex | 17 +++++++---------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea07f335ac..dc08e02056 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,16 +14,16 @@ jobs: matrix: include: - elixir: 1.11.4 - otp: 22.3 + otp: 24.3 - elixir: 1.12.3 - otp: 23.3 + otp: 24.3 - elixir: 1.14.5 otp: 25.3.2.9 - - elixir: 1.16.2 - otp: 26.2 + - elixir: 1.17.2 + otp: 27.0 lint: true installer: true diff --git a/lib/mix/tasks/phx.gen.release.ex b/lib/mix/tasks/phx.gen.release.ex index d4387e5eae..74f5a969e9 100644 --- a/lib/mix/tasks/phx.gen.release.ex +++ b/lib/mix/tasks/phx.gen.release.ex @@ -195,9 +195,10 @@ defmodule Mix.Tasks.Phx.Gen.Release do |> map_size() > 0 end - defp elixir_and_debian_vsn(elixir_vsn, otp_vsn, debian) do + @debian "bookworm" + defp elixir_and_debian_vsn(elixir_vsn, otp_vsn) do url = - "https://hub.docker.com/v2/namespaces/hexpm/repositories/elixir/tags?name=#{elixir_vsn}-erlang-#{otp_vsn}-debian-#{debian}-" + "https://hub.docker.com/v2/namespaces/hexpm/repositories/elixir/tags?name=#{elixir_vsn}-erlang-#{otp_vsn}-debian-#{@debian}-" fetch_body!(url) |> Phoenix.json_library().decode!() @@ -205,7 +206,7 @@ defmodule Mix.Tasks.Phx.Gen.Release do |> Enum.find_value(:error, fn %{"name" => name} -> if String.ends_with?(name, "-slim") do elixir_vsn = name |> String.split("-") |> List.first() - %{"vsn" => vsn} = Regex.named_captures(~r/.*debian-#{debian}-(?.*)-slim/, name) + %{"vsn" => vsn} = Regex.named_captures(~r/.*debian-#{@debian}-(?.*)-slim/, name) {:ok, elixir_vsn, vsn} end end) @@ -220,17 +221,13 @@ defmodule Mix.Tasks.Phx.Gen.Release do otp_vsn = otp_vsn() - # hex bob only builds on bookworm for erlang >= 24 - otp_major_vsn = :erlang.system_info(:otp_release) |> List.to_integer() - debian = if otp_major_vsn >= 24, do: "bookworm", else: "bullseye" - vsns = - case elixir_and_debian_vsn(wanted_elixir_vsn, otp_vsn, debian) do + case elixir_and_debian_vsn(wanted_elixir_vsn, otp_vsn) do {:ok, elixir_vsn, debian_vsn} -> {:ok, elixir_vsn, debian_vsn} :error -> - case elixir_and_debian_vsn("", otp_vsn, debian) do + case elixir_and_debian_vsn("", otp_vsn) do {:ok, elixir_vsn, debian_vsn} -> Logger.warning( "Docker image for Elixir #{wanted_elixir_vsn} not found, defaulting to Elixir #{elixir_vsn}" @@ -247,7 +244,7 @@ defmodule Mix.Tasks.Phx.Gen.Release do {:ok, elixir_vsn, debian_vsn} -> binding = Keyword.merge(binding, - debian: debian, + debian: @debian, debian_vsn: debian_vsn, elixir_vsn: elixir_vsn, otp_vsn: otp_vsn