From 681c2222873489616b12c0ac6cfc80064c23257d Mon Sep 17 00:00:00 2001 From: lukeses Date: Tue, 10 Oct 2023 23:30:26 +0200 Subject: [PATCH 01/15] Bump alpine versions (#176) --- lib/bob/job/docker_checker.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bob/job/docker_checker.ex b/lib/bob/job/docker_checker.ex index 0619e86..447a989 100644 --- a/lib/bob/job/docker_checker.ex +++ b/lib/bob/job/docker_checker.ex @@ -8,9 +8,9 @@ defmodule Bob.Job.DockerChecker do @builds %{ "alpine" => [ - "3.16.6", - "3.17.4", - "3.18.2" + "3.16.7", + "3.17.5", + "3.18.4" ], "ubuntu" => [ # 22.04 From b2df0df1f734253dbc054c0445178f89abb4f655 Mon Sep 17 00:00:00 2001 From: Rudolf Date: Thu, 26 Oct 2023 01:17:31 -0700 Subject: [PATCH 02/15] Update ubuntu versions (#175) --- lib/bob/job/docker_checker.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bob/job/docker_checker.ex b/lib/bob/job/docker_checker.ex index 447a989..fafbda1 100644 --- a/lib/bob/job/docker_checker.ex +++ b/lib/bob/job/docker_checker.ex @@ -14,11 +14,11 @@ defmodule Bob.Job.DockerChecker do ], "ubuntu" => [ # 22.04 - "jammy-20230126", + "jammy-20230804", # 20.04 - "focal-20230126", + "focal-20230801", # 18.04 - "bionic-20230126" + "bionic-20230530" ], "debian" => [ # 12 From 8086fcd89969ab169222820e108660e290237dde Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Thu, 26 Oct 2023 04:17:46 -0400 Subject: [PATCH 03/15] Update Debian image versions to 20230904 (#177) --- lib/bob/job/docker_checker.ex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/bob/job/docker_checker.ex b/lib/bob/job/docker_checker.ex index fafbda1..769fe12 100644 --- a/lib/bob/job/docker_checker.ex +++ b/lib/bob/job/docker_checker.ex @@ -22,14 +22,14 @@ defmodule Bob.Job.DockerChecker do ], "debian" => [ # 12 - "bookworm-20230612", - "bookworm-20230612-slim", + "bookworm-20230904", + "bookworm-20230904-slim", # 11 - "bullseye-20230612", - "bullseye-20230612-slim", + "bullseye-20230904", + "bullseye-20230904-slim", # 10 - "buster-20230612", - "buster-20230612-slim" + "buster-20230904", + "buster-20230904-slim" ] } From 756a5586afc212eaebf019144addc84511f99ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?= Date: Thu, 26 Oct 2023 10:21:10 +0200 Subject: [PATCH 04/15] Update docker OS versions --- lib/bob/job/docker_checker.ex | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/bob/job/docker_checker.ex b/lib/bob/job/docker_checker.ex index 769fe12..7bcee5b 100644 --- a/lib/bob/job/docker_checker.ex +++ b/lib/bob/job/docker_checker.ex @@ -14,22 +14,22 @@ defmodule Bob.Job.DockerChecker do ], "ubuntu" => [ # 22.04 - "jammy-20230804", + "jammy-20231004", # 20.04 - "focal-20230801", + "focal-20231003", # 18.04 "bionic-20230530" ], "debian" => [ # 12 - "bookworm-20230904", - "bookworm-20230904-slim", + "bookworm-20231009", + "bookworm-20231009-slim", # 11 - "bullseye-20230904", - "bullseye-20230904-slim", + "bullseye-20231009", + "bullseye-20231009-slim", # 10 - "buster-20230904", - "buster-20230904-slim" + "buster-20231009", + "buster-20231009-slim" ] } From cd7db612053f371a6e62dc03060b1ccd3b661a2e Mon Sep 17 00:00:00 2001 From: Thanabodee Charoenpiriyakij Date: Thu, 26 Oct 2023 15:58:05 +0700 Subject: [PATCH 05/15] Remove main from build_ref?/1 (#125) --- lib/bob/job/elixir_checker.ex | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/bob/job/elixir_checker.ex b/lib/bob/job/elixir_checker.ex index 11f65f3..ef4eb22 100644 --- a/lib/bob/job/elixir_checker.ex +++ b/lib/bob/job/elixir_checker.ex @@ -13,7 +13,6 @@ defmodule Bob.Job.ElixirChecker do def weight(), do: 1 def concurrency(), do: :shared - defp build_ref?("main"), do: true defp build_ref?("v0." <> _), do: false defp build_ref?("v" <> version) do From 64f3a52f7f8692673bf61a835b0fa59fa9048ab1 Mon Sep 17 00:00:00 2001 From: Roger Gailland Date: Tue, 6 Feb 2024 09:38:00 -0300 Subject: [PATCH 06/15] Bump Alpine, Ubuntu and Debian versions (#183) --- lib/bob/job/docker_checker.ex | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/bob/job/docker_checker.ex b/lib/bob/job/docker_checker.ex index 7bcee5b..d975a74 100644 --- a/lib/bob/job/docker_checker.ex +++ b/lib/bob/job/docker_checker.ex @@ -8,28 +8,29 @@ defmodule Bob.Job.DockerChecker do @builds %{ "alpine" => [ - "3.16.7", - "3.17.5", - "3.18.4" + "3.16.8", + "3.17.6", + "3.18.5", + "3.19.0" ], "ubuntu" => [ # 22.04 - "jammy-20231004", + "jammy-20231128", # 20.04 - "focal-20231003", + "focal-20231128", # 18.04 "bionic-20230530" ], "debian" => [ # 12 - "bookworm-20231009", - "bookworm-20231009-slim", + "bookworm-20231120", + "bookworm-20231120-slim", # 11 - "bullseye-20231009", - "bullseye-20231009-slim", + "bullseye-20231120", + "bullseye-20231120-slim", # 10 - "buster-20231009", - "buster-20231009-slim" + "buster-20231120", + "buster-20231120-slim" ] } From fa082f8285f5bb064610004fb7beb0f4322c7df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?= Date: Wed, 7 Feb 2024 12:08:46 +0100 Subject: [PATCH 07/15] Update versions, remove EOLs --- lib/bob/job/docker_checker.ex | 26 ++++++----- lib/bob/job/otp_checker.ex | 2 +- priv/scripts/otp/otp-ubuntu-14.04.dockerfile | 45 -------------------- priv/scripts/otp/otp-ubuntu-16.04.dockerfile | 45 -------------------- priv/scripts/otp/otp-ubuntu-18.04.dockerfile | 34 --------------- 5 files changed, 13 insertions(+), 139 deletions(-) delete mode 100644 priv/scripts/otp/otp-ubuntu-14.04.dockerfile delete mode 100644 priv/scripts/otp/otp-ubuntu-16.04.dockerfile delete mode 100644 priv/scripts/otp/otp-ubuntu-18.04.dockerfile diff --git a/lib/bob/job/docker_checker.ex b/lib/bob/job/docker_checker.ex index d975a74..1229b53 100644 --- a/lib/bob/job/docker_checker.ex +++ b/lib/bob/job/docker_checker.ex @@ -8,29 +8,27 @@ defmodule Bob.Job.DockerChecker do @builds %{ "alpine" => [ - "3.16.8", - "3.17.6", - "3.18.5", - "3.19.0" + "3.19.1", + "3.18.6", + "3.17.7", + "3.16.9" ], "ubuntu" => [ # 22.04 - "jammy-20231128", + "jammy-20240125", # 20.04 - "focal-20231128", - # 18.04 - "bionic-20230530" + "focal-20240123", ], "debian" => [ # 12 - "bookworm-20231120", - "bookworm-20231120-slim", + "bookworm-20240130", + "bookworm-20240130-slim", # 11 - "bullseye-20231120", - "bullseye-20231120-slim", + "bullseye-20240130", + "bullseye-20240130-slim", # 10 - "buster-20231120", - "buster-20231120-slim" + "buster-20240130", + "buster-20240130-slim" ] } diff --git a/lib/bob/job/otp_checker.ex b/lib/bob/job/otp_checker.ex index fc99d6a..93327d8 100644 --- a/lib/bob/job/otp_checker.ex +++ b/lib/bob/job/otp_checker.ex @@ -1,6 +1,6 @@ defmodule Bob.Job.OTPChecker do @repo "erlang/otp" - @linuxes ["ubuntu-18.04", "ubuntu-20.04", "ubuntu-22.04"] + @linuxes ["ubuntu-20.04", "ubuntu-22.04"] def run(_type) do for linux <- @linuxes, diff --git a/priv/scripts/otp/otp-ubuntu-14.04.dockerfile b/priv/scripts/otp/otp-ubuntu-14.04.dockerfile deleted file mode 100644 index 01f916e..0000000 --- a/priv/scripts/otp/otp-ubuntu-14.04.dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -FROM ubuntu:14.04 - -ENV UBUNTU_VERSION=14.04 - -ARG PIE_CFLAGS="-fpie" -ARG CFLAGS="-g -O2 ${PIE_CFLAGS}" -ARG CPPFLAGS="-D_FORTIFY_SOURCE=2" - -ARG PIE_LDFLAGS="-pie" -ARG LDFLAGS="-Wl,-z,relro,-z,now ${PIE_LDFLAGS}" - -RUN apt-get update - -RUN apt-get install -y \ - wget \ - ca-certificates \ - gcc \ - g++ \ - make \ - automake \ - autoconf \ - libwxgtk2.8-dev \ - libgl1-mesa-dev \ - libglu1-mesa-dev \ - libpng3 \ - libreadline-dev \ - libncurses-dev \ - libssl-dev \ - libxslt-dev \ - libffi-dev \ - libtool \ - unixodbc-dev \ - fop \ - xsltproc - -RUN mkdir -p /home/build/out -WORKDIR /home/build - -ENV CFLAGS=$CFLAGS -ENV CPPFLAGS=$CPPFLAGS -ENV LDFLAGS=$LDFLAGS - -COPY otp/build_otp_ubuntu.sh /home/build/build.sh -RUN chmod +x /home/build/build.sh -CMD ./build.sh diff --git a/priv/scripts/otp/otp-ubuntu-16.04.dockerfile b/priv/scripts/otp/otp-ubuntu-16.04.dockerfile deleted file mode 100644 index b57e0d3..0000000 --- a/priv/scripts/otp/otp-ubuntu-16.04.dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -FROM ubuntu:16.04 - -ENV UBUNTU_VERSION=16.04 - -ARG PIE_CFLAGS="-fpie" -ARG CFLAGS="-g -O2 ${PIE_CFLAGS}" -ARG CPPFLAGS="-D_FORTIFY_SOURCE=2" - -ARG PIE_LDFLAGS="-pie" -ARG LDFLAGS="-Wl,-z,relro,-z,now ${PIE_LDFLAGS}" - -RUN apt-get update - -RUN apt-get install -y \ - wget \ - ca-certificates \ - gcc \ - g++ \ - make \ - automake \ - autoconf \ - libwxgtk3.0-dev \ - libgl1-mesa-dev \ - libglu1-mesa-dev \ - libpng-dev \ - libreadline-dev \ - libncurses-dev \ - libssl-dev \ - libxslt-dev \ - libffi-dev \ - libtool \ - unixodbc-dev \ - fop \ - xsltproc - -RUN mkdir -p /home/build/out -WORKDIR /home/build - -ENV CFLAGS=$CFLAGS -ENV CPPFLAGS=$CPPFLAGS -ENV LDFLAGS=$LDFLAGS - -COPY otp/build_otp_ubuntu.sh /home/build/build.sh -RUN chmod +x /home/build/build.sh -CMD ./build.sh diff --git a/priv/scripts/otp/otp-ubuntu-18.04.dockerfile b/priv/scripts/otp/otp-ubuntu-18.04.dockerfile deleted file mode 100644 index 696010b..0000000 --- a/priv/scripts/otp/otp-ubuntu-18.04.dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -FROM ubuntu:18.04 - -ENV UBUNTU_VERSION=18.04 -ARG OTP_REF - -RUN apt-get update -RUN apt-get install -y \ - wget \ - ca-certificates \ - gcc \ - g++ \ - make \ - automake \ - autoconf \ - libwxgtk3.0-gtk3-dev \ - libgl1-mesa-dev \ - libglu1-mesa-dev \ - libpng-dev \ - libreadline-dev \ - libncurses-dev \ - $(bash -c 'if [ "${OTP_REF:0:5}" = "OTP-1" ]; then echo "libssl1.0-dev"; else echo "libssl-dev"; fi') \ - libxslt-dev \ - libffi-dev \ - libtool \ - unixodbc-dev \ - fop \ - xsltproc - -RUN mkdir -p /home/build/out -WORKDIR /home/build - -COPY otp/build_otp_ubuntu.sh /home/build/build.sh -RUN chmod +x /home/build/build.sh -CMD ./build.sh From 2175c134527e3ccad429c850d92f7d19939db2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?= Date: Wed, 7 Feb 2024 14:28:01 +0100 Subject: [PATCH 08/15] Format --- lib/bob/job/docker_checker.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bob/job/docker_checker.ex b/lib/bob/job/docker_checker.ex index 1229b53..a4ec62b 100644 --- a/lib/bob/job/docker_checker.ex +++ b/lib/bob/job/docker_checker.ex @@ -17,7 +17,7 @@ defmodule Bob.Job.DockerChecker do # 22.04 "jammy-20240125", # 20.04 - "focal-20240123", + "focal-20240123" ], "debian" => [ # 12 From 95ef75dca789c40a8d41ac6472339e83f44e7b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?= Date: Fri, 9 Feb 2024 17:18:56 +0100 Subject: [PATCH 09/15] Clean docker at higher rate Should help against running out of disk space. --- config/config.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.exs b/config/config.exs index 482b4d5..830965e 100644 --- a/config/config.exs +++ b/config/config.exs @@ -37,7 +37,7 @@ config :bob, agent_schedule: [ [ module: Bob.Job.Clean, - period: {24, :hour}, + period: {1, :hour}, queue: true ] ] From c3faee931cf97348b09579bf32414f0cd243d3cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?= Date: Sun, 10 Mar 2024 13:05:31 +0100 Subject: [PATCH 10/15] Lower dockerhub auth refresh time --- lib/bob/docker_hub/auth.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bob/docker_hub/auth.ex b/lib/bob/docker_hub/auth.ex index 45f634c..266fb67 100644 --- a/lib/bob/docker_hub/auth.ex +++ b/lib/bob/docker_hub/auth.ex @@ -1,7 +1,7 @@ defmodule Bob.DockerHub.Auth do use GenServer - @timeout 24 * 60 * 60 * 1000 + @timeout 60 * 60 * 1000 def start_link([]) do GenServer.start_link(__MODULE__, []) From ec867822c3d6dec5e365bc5fc7f78edf2ef9f152 Mon Sep 17 00:00:00 2001 From: Aaron Tinio Date: Sun, 31 Mar 2024 05:59:44 +0800 Subject: [PATCH 11/15] Automate picking the OS versions (#182) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Eric Meadows-Jönsson --- lib/bob/docker_hub.ex | 5 ++ lib/bob/job/docker_checker.ex | 91 +++++++++++++++++++++++------------ 2 files changed, 64 insertions(+), 32 deletions(-) diff --git a/lib/bob/docker_hub.ex b/lib/bob/docker_hub.ex index 5f79234..49bf68b 100644 --- a/lib/bob/docker_hub.ex +++ b/lib/bob/docker_hub.ex @@ -17,6 +17,11 @@ defmodule Bob.DockerHub do end def fetch_repo_tags(repo) do + (@dockerhub_url <> "v2/repositories/#{repo}/tags?page=${page}&page_size=100") + |> dockerhub_request() + end + + def fetch_repo_tags_from_cache(repo) do Bob.DockerHub.Cache.lookup(repo, fn -> (@dockerhub_url <> "v2/repositories/#{repo}/tags?page=${page}&page_size=100") |> dockerhub_request() diff --git a/lib/bob/job/docker_checker.ex b/lib/bob/job/docker_checker.ex index a4ec62b..ff2225f 100644 --- a/lib/bob/job/docker_checker.ex +++ b/lib/bob/job/docker_checker.ex @@ -4,33 +4,59 @@ defmodule Bob.Job.DockerChecker do @archs ["amd64", "arm64"] - # TODO: Automate picking the OS versions - - @builds %{ - "alpine" => [ - "3.19.1", - "3.18.6", - "3.17.7", - "3.16.9" - ], - "ubuntu" => [ - # 22.04 - "jammy-20240125", - # 20.04 - "focal-20240123" - ], - "debian" => [ - # 12 - "bookworm-20240130", - "bookworm-20240130-slim", - # 11 - "bullseye-20240130", - "bullseye-20240130-slim", - # 10 - "buster-20240130", - "buster-20240130-slim" + def builds() do + [ + {"alpine", + [ + ~r/^3\.19\.\d+$/, + ~r/^3\.18\.\d+$/, + ~r/^3\.17\.\d+$/, + ~r/^3\.16\.\d+$/ + ]}, + {"ubuntu", + [ + # 24.04 + ~r/^noble-\d{8}$/, + # 22.04 + ~r/^jammy-\d{8}$/, + # 20.04 + ~r/^focal-\d{8}$/ + ]}, + {"debian", + [ + # 12 + ~r/^bookworm-\d{8}$/, + ~r/^bookworm-\d{8}-slim$/, + # 11 + ~r/^bullseye-\d{8}$/, + ~r/^bullseye-\d{8}-slim$/, + # 10 + ~r/^buster-\d{8}$/, + ~r/^buster-\d{8}-slim$/ + ]} ] - } + |> Task.async_stream( + fn {repo, regexes} -> + {repo, tags(repo, regexes)} + end, + ordered: false, + timeout: 300_000 + ) + |> Enum.map(fn {:ok, repo_and_tags} -> repo_and_tags end) + |> Map.new() + end + + defp tags(repo, regexes) do + tags = + ("library/" <> repo) + |> Bob.DockerHub.fetch_repo_tags() + |> Enum.map(&elem(&1, 0)) + |> Enum.sort(&(&1 >= &2)) + + Enum.map(regexes, fn regex -> + Enum.find(tags, &(&1 =~ regex)) + end) + end def run() do erlang() @@ -58,7 +84,7 @@ defmodule Bob.Job.DockerChecker do def expected_erlang_tags() do refs = erlang_refs() - Stream.flat_map(@builds, fn {os, os_versions} -> + Stream.flat_map(builds(), fn {os, os_versions} -> Stream.flat_map(refs, fn ref -> if build_erlang_ref?(os, ref) do Stream.flat_map(os_versions, fn os_version -> @@ -206,7 +232,7 @@ defmodule Bob.Job.DockerChecker do def erlang_tags(arch) do "hexpm/erlang-#{arch}" - |> Bob.DockerHub.fetch_repo_tags() + |> Bob.DockerHub.fetch_repo_tags_from_cache() |> Stream.map(fn {tag, [^arch]} -> [erlang, os, os_version] = Regex.run(@erlang_tag_regex, tag, capture: :all_but_first) {erlang, os, os_version, arch} @@ -223,10 +249,11 @@ defmodule Bob.Job.DockerChecker do end def expected_elixir_tags() do + builds = builds() refs = elixir_builds() Stream.flat_map(erlang_tags(), fn {erlang, os, os_version, erlang_arch} -> - if not skip_elixir_for_erlang?(erlang) and os_version in @builds[os] do + if not skip_elixir_for_erlang?(erlang) and os_version in builds[os] do Stream.flat_map(refs, fn {"v" <> elixir, otp_major} -> if not skip_elixir?(elixir) and compatible_elixir_and_erlang?(otp_major, erlang) do [{elixir, erlang, os, os_version, erlang_arch}] @@ -279,7 +306,7 @@ defmodule Bob.Job.DockerChecker do def elixir_tags(arch) do "hexpm/elixir-#{arch}" - |> Bob.DockerHub.fetch_repo_tags() + |> Bob.DockerHub.fetch_repo_tags_from_cache() |> Enum.map(fn {tag, [^arch]} -> [elixir, erlang, os, os_version] = Regex.run(@elixir_tag_regex, tag, capture: :all_but_first) @@ -355,7 +382,7 @@ defmodule Bob.Job.DockerChecker do def erlang_manifest_tags() do "hexpm/erlang" - |> Bob.DockerHub.fetch_repo_tags() + |> Bob.DockerHub.fetch_repo_tags_from_cache() |> Map.new(fn {tag, archs} -> [erlang, os, os_version] = Regex.run(@erlang_tag_regex, tag, capture: :all_but_first) {{erlang, os, os_version}, archs} @@ -364,7 +391,7 @@ defmodule Bob.Job.DockerChecker do def elixir_manifest_tags() do "hexpm/elixir" - |> Bob.DockerHub.fetch_repo_tags() + |> Bob.DockerHub.fetch_repo_tags_from_cache() |> Map.new(fn {tag, archs} -> [elixir, erlang, os, os_version] = Regex.run(@elixir_tag_regex, tag, capture: :all_but_first) From bc0c95a6b4f7fb63affb436e328103081764af64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?= Date: Sun, 31 Mar 2024 09:58:40 +0200 Subject: [PATCH 12/15] Constrain Ubuntu Noble builds --- lib/bob/job/docker_checker.ex | 3 ++ ...kerfile => erlang-ubuntu-noble.dockerfile} | 41 ++++++++++++------- priv/scripts/docker/erlang.sh | 1 + 3 files changed, 30 insertions(+), 15 deletions(-) rename priv/scripts/docker/{erlang-ubuntu-bionic.dockerfile => erlang-ubuntu-noble.dockerfile} (63%) diff --git a/lib/bob/job/docker_checker.ex b/lib/bob/job/docker_checker.ex index ff2225f..9766e6f 100644 --- a/lib/bob/job/docker_checker.ex +++ b/lib/bob/job/docker_checker.ex @@ -129,6 +129,9 @@ defmodule Bob.Job.DockerChecker do defp build_erlang_ref?("ubuntu", "jammy-" <> _, "OTP-" <> version), do: build_openssl_3?(version) + defp build_erlang_ref?("ubuntu", "noble-" <> _, "OTP-" <> version), + do: build_openssl_3?(version) + defp build_erlang_ref?(_os, _os_version, _ref), do: true defp build_erlang_ref?("arm64", "ubuntu", "trusty-" <> _, "OTP-17" <> _), do: false diff --git a/priv/scripts/docker/erlang-ubuntu-bionic.dockerfile b/priv/scripts/docker/erlang-ubuntu-noble.dockerfile similarity index 63% rename from priv/scripts/docker/erlang-ubuntu-bionic.dockerfile rename to priv/scripts/docker/erlang-ubuntu-noble.dockerfile index 323f44b..f2d94d7 100644 --- a/priv/scripts/docker/erlang-ubuntu-bionic.dockerfile +++ b/priv/scripts/docker/erlang-ubuntu-noble.dockerfile @@ -2,8 +2,6 @@ ARG OS_VERSION FROM ubuntu:${OS_VERSION} AS build -ARG ERLANG - RUN apt-get update RUN apt-get -y --no-install-recommends install \ autoconf \ @@ -13,12 +11,14 @@ RUN apt-get -y --no-install-recommends install \ make \ libncurses-dev \ unixodbc-dev \ - $(bash -c 'if [ "${ERLANG:0:1}" = "1" ]; then echo "libssl1.0-dev"; else echo "libssl-dev"; fi') \ + libssl-dev \ libsctp-dev \ wget \ ca-certificates \ pax-utils +ARG ERLANG + RUN mkdir -p /OTP/subdir RUN wget -nv "https://github.com/erlang/otp/archive/OTP-${ERLANG}.tar.gz" && tar -zxf "OTP-${ERLANG}.tar.gz" -C /OTP/subdir --strip-components=1 WORKDIR /OTP/subdir @@ -26,8 +26,8 @@ RUN ./otp_build autoconf RUN ./configure --with-ssl --enable-dirty-schedulers RUN make -j$(getconf _NPROCESSORS_ONLN) RUN make -j$(getconf _NPROCESSORS_ONLN) install -RUN bash -c 'if [ "${ERLANG:0:2}" -ge "23" ]; then make -j$(getconf _NPROCESSORS_ONLN) docs DOC_TARGETS=chunks; else true; fi' -RUN bash -c 'if [ "${ERLANG:0:2}" -ge "23" ]; then make -j$(getconf _NPROCESSORS_ONLN) install-docs DOC_TARGETS=chunks; else true; fi' +RUN make -j$(getconf _NPROCESSORS_ONLN) docs DOC_TARGETS=chunks +RUN make -j$(getconf _NPROCESSORS_ONLN) install-docs DOC_TARGETS=chunks RUN find /usr/local -regex '/usr/local/lib/erlang/\(lib/\|erts-\).*/\(man\|obj\|c_src\|emacs\|info\|examples\)' | xargs rm -rf RUN find /usr/local -name src | xargs -r find | grep -v '\.hrl$' | xargs rm -v || true RUN find /usr/local -name src | xargs -r find | xargs rmdir -vp || true @@ -36,16 +36,27 @@ RUN scanelf --nobanner -E ET_DYN -BF '%F' --recursive /usr/local | xargs -r stri FROM ubuntu:${OS_VERSION} AS final -ARG ERLANG - -RUN apt-get update && \ - apt-get -y --no-install-recommends install \ - ca-certificates \ - libodbc1 \ - $(bash -c 'if [ "${ERLANG:0:1}" = "1" ]; then echo "libssl1.0.0"; else echo "libssl1.1"; fi') \ - libsctp1 && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* +ARG ARCH + +RUN if [ "${ARCH}" = "amd64" ]; then \ + apt-get update; \ + apt-get -y --no-install-recommends install \ + ca-certificates \ + libodbc2 \ + libssl3t \ + libsctp1; \ + apt-get clean; \ + rm -rf /var/lib/apt/lists/*; \ + elif [ "${ARCH}" = "arm64" ]; then \ + apt-get update; \ + apt-get -y --no-install-recommends install \ + ca-certificates \ + libodbc2 \ + libssl3t64 \ + libsctp1; \ + apt-get clean; \ + rm -rf /var/lib/apt/lists/*; \ + fi COPY --from=build /usr/local /usr/local ENV LANG=C.UTF-8 diff --git a/priv/scripts/docker/erlang.sh b/priv/scripts/docker/erlang.sh index 305ad73..9f5d750 100755 --- a/priv/scripts/docker/erlang.sh +++ b/priv/scripts/docker/erlang.sh @@ -40,6 +40,7 @@ fi docker build \ --ulimit nofile=1024:1024 \ -t hexpm/erlang-${arch}:${tag} \ + --build-arg ARCH=${arch} \ --build-arg ERLANG=${erlang} \ --build-arg OS_VERSION=${os_version} \ --build-arg PIE_CFLAGS=${pie_cflags} \ From 356b516153c75aed812f1393d661388676173fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?= Date: Thu, 25 Apr 2024 22:15:30 +0100 Subject: [PATCH 13/15] Build Ubuntu 24.04 (#186) --- lib/bob/job/otp_checker.ex | 4 ++- priv/scripts/otp/otp-ubuntu-24.04.dockerfile | 35 ++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 priv/scripts/otp/otp-ubuntu-24.04.dockerfile diff --git a/lib/bob/job/otp_checker.ex b/lib/bob/job/otp_checker.ex index 93327d8..fc395c1 100644 --- a/lib/bob/job/otp_checker.ex +++ b/lib/bob/job/otp_checker.ex @@ -1,6 +1,6 @@ defmodule Bob.Job.OTPChecker do @repo "erlang/otp" - @linuxes ["ubuntu-20.04", "ubuntu-22.04"] + @linuxes ["ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04"] def run(_type) do for linux <- @linuxes, @@ -19,6 +19,8 @@ defmodule Bob.Job.OTPChecker do defp build_ref?("ubuntu-20.04", "maint-" <> version), do: build_ubuntu_20?(version) defp build_ref?("ubuntu-22.04", "OTP-" <> version), do: build_ubuntu_22?(version) defp build_ref?("ubuntu-22.04", "maint-" <> version), do: build_ubuntu_22?(version) + defp build_ref?("ubuntu-24.04", "OTP-" <> version), do: build_ubuntu_22?(version) + defp build_ref?("ubuntu-24.04", "maint-" <> version), do: build_ubuntu_22?(version) defp build_ref?(_linux, "OTP-" <> _), do: true defp build_ref?(_linux, "maint" <> _), do: true defp build_ref?(_linux, "master" <> _), do: true diff --git a/priv/scripts/otp/otp-ubuntu-24.04.dockerfile b/priv/scripts/otp/otp-ubuntu-24.04.dockerfile new file mode 100644 index 0000000..adb05ae --- /dev/null +++ b/priv/scripts/otp/otp-ubuntu-24.04.dockerfile @@ -0,0 +1,35 @@ +FROM ubuntu:24.04 + +ARG DEBIAN_FRONTEND=noninteractive +ENV UBUNTU_VERSION=24.04 + +RUN apt-get update + +RUN apt-get install -y \ + wget \ + ca-certificates \ + gcc \ + g++ \ + make \ + automake \ + autoconf \ + libwxgtk3.2-dev \ + libgl1-mesa-dev \ + libglu1-mesa-dev \ + libpng-dev \ + libreadline-dev \ + libncurses-dev \ + libssl-dev \ + libxslt-dev \ + libffi-dev \ + libtool \ + unixodbc-dev \ + fop \ + xsltproc + +RUN mkdir -p /home/build/out +WORKDIR /home/build + +COPY otp/build_otp_ubuntu.sh /home/build/build.sh +RUN chmod +x /home/build/build.sh +CMD ./build.sh From 6624fe37fdeaa1ffff6a75b0c7fe43776baacfe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?= Date: Fri, 3 May 2024 18:17:51 +0200 Subject: [PATCH 14/15] Fix warnings --- lib/bob/http.ex | 4 ++-- lib/bob/plugs/forwarded.ex | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bob/http.ex b/lib/bob/http.ex index a26914d..f60d18b 100644 --- a/lib/bob/http.ex +++ b/lib/bob/http.ex @@ -12,7 +12,7 @@ defmodule Bob.HTTP do defp retry(name, fun, times) do case fun.() do {:error, reason} -> - Logger.warn("#{name} ERROR: #{inspect(reason)}") + Logger.warning("#{name} ERROR: #{inspect(reason)}") if times + 1 < @max_retry_times do sleep = trunc(:math.pow(3, times) * @error_sleep_time) @@ -23,7 +23,7 @@ defmodule Bob.HTTP do end {:ok, 429, _headers, _body} = result -> - Logger.warn("#{name} RATE LIMIT") + Logger.warning("#{name} RATE LIMIT") if times + 1 < @max_retry_times do sleep = trunc(:math.pow(3, times) * @rate_limit_sleep_time) diff --git a/lib/bob/plugs/forwarded.ex b/lib/bob/plugs/forwarded.ex index 494a5d4..092323b 100644 --- a/lib/bob/plugs/forwarded.ex +++ b/lib/bob/plugs/forwarded.ex @@ -22,7 +22,7 @@ defmodule Bob.Plug.Forwarded do parts = Enum.map(parts, &elem(&1, 0)) List.to_tuple(parts) else - Logger.warn("Invalid IP: #{inspect(ip)}") + Logger.warning("Invalid IP: #{inspect(ip)}") nil end end From d7ac6109e979dce3e7b223ec3cbed9447b1e0fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?= Date: Fri, 3 May 2024 18:19:13 +0200 Subject: [PATCH 15/15] Only use base tags with our expected archs --- lib/bob/docker_hub.ex | 16 ++++++++++++++++ lib/bob/job/docker_checker.ex | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/bob/docker_hub.ex b/lib/bob/docker_hub.ex index 49bf68b..0c620d7 100644 --- a/lib/bob/docker_hub.ex +++ b/lib/bob/docker_hub.ex @@ -49,6 +49,22 @@ defmodule Bob.DockerHub do end end + def delete_tag(repo, tag) do + url = @dockerhub_url <> "v2/repositories/#{repo}/tags/#{tag}" + headers = headers() + opts = [:with_body, recv_timeout: 20_000] + + result = + Bob.HTTP.retry("DockerHub #{url}", fn -> + :hackney.request(:delete, url, headers, "", opts) + end) + + case result do + {:ok, 204, _headers, _body} -> :ok + {:ok, 404, _headers, _body} -> :ok + end + end + def headers() do if token = Application.get_env(:bob, :dockerhub_token) do [{"authorization", "JWT #{token}"}] diff --git a/lib/bob/job/docker_checker.ex b/lib/bob/job/docker_checker.ex index 9766e6f..7d603d6 100644 --- a/lib/bob/job/docker_checker.ex +++ b/lib/bob/job/docker_checker.ex @@ -50,7 +50,8 @@ defmodule Bob.Job.DockerChecker do tags = ("library/" <> repo) |> Bob.DockerHub.fetch_repo_tags() - |> Enum.map(&elem(&1, 0)) + |> Enum.filter(fn {_tag, archs} -> Enum.all?(@archs, &(&1 in archs)) end) + |> Enum.map(fn {tag, _archs} -> tag end) |> Enum.sort(&(&1 >= &2)) Enum.map(regexes, fn regex ->