Skip to content

Commit

Permalink
Merge pull request #225 from ocurrent/alpine-3.21
Browse files Browse the repository at this point in the history
Add Alpine 3.21, deprecate Alpine 3.20
  • Loading branch information
mtelvers authored Dec 8, 2024
2 parents dc5ab75 + 6c56d27 commit 4a26fcc
Show file tree
Hide file tree
Showing 12 changed files with 479 additions and 430 deletions.
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
profile = conventional
version = 0.26.2
version = 0.27.0
ocaml-version = 4.08
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
unreleased
----------

- Add Alpine 3.21, deprecate Alpine 3.20. (@MisterDA, #225)

v8.2.4 2024-11-18
-----------------

Expand Down
12 changes: 6 additions & 6 deletions src-cmd/dockerfile_cmd.mli
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
(** Command invocation library to help with Docker builds.
This module primarily exposes utility functions to glue together
Docker-based scripts for (e.g.) continuous integration systems
like the ocaml-ci. The interface is fairly domain-specific and
does not expose all the functionality of the underlying tools.
Feel free to contribute more functions if you need them. *)
Docker-based scripts for (e.g.) continuous integration systems like the
ocaml-ci. The interface is fairly domain-specific and does not expose all
the functionality of the underlying tools. Feel free to contribute more
functions if you need them. *)

type cmd_log = {
command : string;
Expand All @@ -39,8 +39,8 @@ val run_log :
string ->
Bos.Cmd.t ->
(unit, [> `Msg of string ]) result
(** [runlog log_dir name cmd] will run [cmd] with label [name]
and log the results in [<log_dir>/<name>.sxp]. *)
(** [runlog log_dir name cmd] will run [cmd] with label [name] and log the
results in [<log_dir>/<name>.sxp]. *)

(** Docker command invocation *)
module Docker : sig
Expand Down
28 changes: 14 additions & 14 deletions src-cmd/gen.mli
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ val generate_dockerfile :
Fpath.t ->
Dockerfile.t ->
(unit, [> `Msg of string ]) result
(** [generate_dockerfile output_dir docker] will output Dockerfile inside
the [output_dir] subdirectory.
(** [generate_dockerfile output_dir docker] will output Dockerfile inside the
[output_dir] subdirectory.
The [crunch] argument defaults to true and applies the {!Dockerfile.crunch}
optimisation to reduce the number of layers; disable it if you really want
Expand All @@ -35,9 +35,9 @@ val generate_dockerfiles :
Fpath.t ->
(string * Dockerfile.t) list ->
(unit, [> `Msg of string ]) result
(** [generate_dockerfiles output_dir (name * docker)] will
output a list of Dockerfiles inside the [output_dir/] subdirectory,
with each Dockerfile named as [Dockerfile.<release>].
(** [generate_dockerfiles output_dir (name * docker)] will output a list of
Dockerfiles inside the [output_dir/] subdirectory, with each Dockerfile
named as [Dockerfile.<release>].
The [crunch] argument defaults to true and applies the {!Dockerfile.crunch}
optimisation to reduce the number of layers; disable it if you really want
Expand All @@ -48,9 +48,9 @@ val generate_dockerfiles_in_directories :
Fpath.t ->
(string * Dockerfile.t) list ->
(unit, [> `Msg of string ]) result
(** [generate_dockerfiles_in_directories output_dir (name * docker)] will
output a list of Dockerfiles inside the [output_dir/name] subdirectory,
with each directory containing the Dockerfile specified by [docker].
(** [generate_dockerfiles_in_directories output_dir (name * docker)] will output
a list of Dockerfiles inside the [output_dir/name] subdirectory, with each
directory containing the Dockerfile specified by [docker].
The [crunch] argument defaults to true and applies the {!Dockerfile.crunch}
optimisation to reduce the number of layers; disable it if you really want
Expand All @@ -63,12 +63,12 @@ val generate_dockerfiles_in_git_branches :
(string * Dockerfile.t) list ->
(unit, [> `Msg of string ]) result
(** [generate_dockerfiles_in_git_branches output_dir (name * docker)] will
output a set of git branches in the [output_dir] Git repository.
Each branch will be named [name] and contain a single [docker] file.
The contents of these branches will be reset, so this should be
only be used on an [output_dir] that is a dedicated Git repository
for this purpose. If [readme] is specified, the contents will be
written to [README.md] in that branch.
output a set of git branches in the [output_dir] Git repository. Each branch
will be named [name] and contain a single [docker] file. The contents of
these branches will be reset, so this should be only be used on an
[output_dir] that is a dedicated Git repository for this purpose. If
[readme] is specified, the contents will be written to [README.md] in that
branch.
The [crunch] argument defaults to true and applies the {!Dockerfile.crunch}
optimisation to reduce the number of layers; disable it if you really want
Expand Down
23 changes: 16 additions & 7 deletions src-opam/distro.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ type distro =
| `V3_17
| `V3_18
| `V3_19
| `V3_20 ]
| `V3_20
| `V3_21 ]
| `Archlinux of [ `Latest ]
| `CentOS of [ `V6 | `V7 | `V8 ]
| `Debian of [ `V12 | `V11 | `V10 | `V9 | `V8 | `V7 | `Testing | `Unstable ]
Expand Down Expand Up @@ -126,6 +127,7 @@ type t =
| `V3_18
| `V3_19
| `V3_20
| `V3_21
| `Latest ]
| `Archlinux of [ `Latest ]
| `CentOS of [ `V6 | `V7 | `V8 | `Latest ]
Expand Down Expand Up @@ -252,6 +254,7 @@ let distros : t list =
`Alpine `V3_18;
`Alpine `V3_19;
`Alpine `V3_20;
`Alpine `V3_21;
`Alpine `Latest;
`Archlinux `Latest;
`CentOS `V6;
Expand Down Expand Up @@ -343,7 +346,7 @@ let distros : t list =

let resolve_alias (d : t) : distro =
match d with
| `Alpine `Latest -> `Alpine `V3_20
| `Alpine `Latest -> `Alpine `V3_21
| `CentOS `Latest -> `CentOS `V7
| `Debian `Stable -> `Debian `V12
| `Fedora `Latest -> `Fedora `V41
Expand All @@ -357,7 +360,7 @@ let resolve_alias (d : t) : distro =
| ( `Alpine
( `V3_3 | `V3_4 | `V3_5 | `V3_6 | `V3_7 | `V3_8 | `V3_9 | `V3_10
| `V3_11 | `V3_12 | `V3_13 | `V3_14 | `V3_15 | `V3_16 | `V3_17 | `V3_18
| `V3_19 | `V3_20 )
| `V3_19 | `V3_20 | `V3_21 )
| `Archlinux `Latest
| `CentOS (`V6 | `V7 | `V8)
| `Debian (`V7 | `V8 | `V9 | `V10 | `V11 | `V12 | `Testing | `Unstable)
Expand Down Expand Up @@ -387,9 +390,9 @@ let distro_status (d : t) : status =
| `Alpine
( `V3_3 | `V3_4 | `V3_5 | `V3_6 | `V3_7 | `V3_8 | `V3_9 | `V3_10
| `V3_11 | `V3_12 | `V3_13 | `V3_14 | `V3_15 | `V3_16 | `V3_17 | `V3_18
| `V3_19 ) ->
| `V3_19 | `V3_20 ) ->
`Deprecated
| `Alpine `V3_20 -> `Active `Tier1
| `Alpine `V3_21 -> `Active `Tier1
| `Archlinux `Latest -> `Active `Tier3
| `CentOS `V7 -> `Active `Tier3
| `CentOS (`V6 | `V8) -> `Deprecated
Expand Down Expand Up @@ -462,7 +465,8 @@ let distro_arches ov (d : t) =
[ `I386; `X86_64; `Aarch64; `Aarch32 ]
| ( `Alpine
( `V3_6 | `V3_7 | `V3_8 | `V3_9 | `V3_10 | `V3_11 | `V3_12 | `V3_13
| `V3_14 | `V3_15 | `V3_16 | `V3_17 | `V3_18 | `V3_19 | `V3_20 ),
| `V3_14 | `V3_15 | `V3_16 | `V3_17 | `V3_18 | `V3_19 | `V3_20 | `V3_21
),
ov )
when OV.(compare Releases.v4_05_0 ov) = -1 ->
[ `X86_64; `Aarch64 ]
Expand Down Expand Up @@ -576,6 +580,7 @@ let builtin_ocaml_of_distro (d : t) : string option =
| `Alpine `V3_18 -> Some "4.14.1"
| `Alpine `V3_19 -> Some "4.14.1"
| `Alpine `V3_20 -> Some "4.14.2"
| `Alpine `V3_21 -> Some "4.14.2"
| `Archlinux `Latest -> Some "5.1.0"
| `Fedora `V21 -> Some "4.01.0"
| `Fedora `V22 -> Some "4.02.0"
Expand Down Expand Up @@ -704,6 +709,7 @@ let tag_of_distro (d : t) =
| `Alpine `V3_18 -> "alpine-3.18"
| `Alpine `V3_19 -> "alpine-3.19"
| `Alpine `V3_20 -> "alpine-3.20"
| `Alpine `V3_21 -> "alpine-3.21"
| `Alpine `Latest -> "alpine"
| `Archlinux `Latest -> "archlinux"
| `OpenSUSE `V42_1 -> "opensuse-42.1"
Expand Down Expand Up @@ -920,6 +926,7 @@ let human_readable_string_of_distro (d : t) =
| `Alpine `V3_18 -> "Alpine 3.18"
| `Alpine `V3_19 -> "Alpine 3.19"
| `Alpine `V3_20 -> "Alpine 3.20"
| `Alpine `V3_21 -> "Alpine 3.21"
| `Archlinux `Latest -> "Archlinux"
| `OpenSUSE `V42_1 -> "OpenSUSE 42.1"
| `OpenSUSE `V42_2 -> "OpenSUSE 42.2"
Expand Down Expand Up @@ -1071,7 +1078,8 @@ let bubblewrap_version (t : t) =
| `Alpine `V3_17 -> Some (0, 7, 0)
| `Alpine `V3_18 -> Some (0, 8, 0)
| `Alpine `V3_19 -> Some (0, 8, 0)
| `Alpine `V3_20 -> Some (0, 9, 0)
| `Alpine `V3_20 -> Some (0, 10, 0)
| `Alpine `V3_21 -> Some (0, 11, 0)
| `Archlinux `Latest -> Some (0, 8, 0)
| `OpenSUSE `V42_1 -> None (* Not actually checked *)
| `OpenSUSE `V42_2 -> None (* Not actually checked *)
Expand Down Expand Up @@ -1111,6 +1119,7 @@ let base_distro_tag ?(arch = `X86_64) d =
| `V3_18 -> "3.18"
| `V3_19 -> "3.19"
| `V3_20 -> "3.20"
| `V3_21 -> "3.21"
in
match arch with `I386 -> ("i386/alpine", tag) | _ -> ("alpine", tag))
| `Archlinux `Latest -> ("archlinux", "latest")
Expand Down
110 changes: 53 additions & 57 deletions src-opam/distro.mli
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
*
*)

(** Run Opam commands across a matrix of Docker containers.
Each of these containers represents a different version of
OCaml, Opam and an OS distribution (such as Debian or Alpine).
*)
(** Run Opam commands across a matrix of Docker containers. Each of these
containers represents a different version of OCaml, Opam and an OS
distribution (such as Debian or Alpine). *)

(** {2 Known distributions and OCaml variants} *)

Expand All @@ -41,7 +40,8 @@ type distro =
| `V3_17
| `V3_18
| `V3_19
| `V3_20 ]
| `V3_20
| `V3_21 ]
| `Archlinux of [ `Latest ]
| `CentOS of [ `V6 | `V7 | `V8 ]
| `Debian of [ `V12 | `V11 | `V10 | `V9 | `V8 | `V7 | `Testing | `Unstable ]
Expand Down Expand Up @@ -128,6 +128,7 @@ type t =
| `V3_18
| `V3_19
| `V3_20
| `V3_21
| `Latest ]
| `Archlinux of [ `Latest ]
| `CentOS of [ `V6 | `V7 | `V8 | `Latest ]
Expand Down Expand Up @@ -207,20 +208,19 @@ val os_family_of_distro : t -> os_family
(** [os_family_of_distro t] returns the OS family of the distro. *)

val os_family_to_string : os_family -> string
(** [os_family_to_string os] returns a string representing the OS
family. *)
(** [os_family_to_string os] returns a string representing the OS family. *)

val opam_repository : os_family -> string
(** [opam_repository os_family] returns the git URL to the default
Opam repository. *)
(** [opam_repository os_family] returns the git URL to the default Opam
repository. *)

val personality : os_family -> Ocaml_version.arch -> string option
(** [personality os_family arch] returns the personality associated to
the architecture, if [os_family] is [`Linux]. *)
(** [personality os_family arch] returns the personality associated to the
architecture, if [os_family] is [`Linux]. *)

val is_same_distro : t -> t -> bool
(** [is_same_distro d1 d2] returns whether [d1] is the same distro as
[d2], regardless of their respective versions. *)
(** [is_same_distro d1 d2] returns whether [d1] is the same distro as [d2],
regardless of their respective versions. *)

val compare : t -> t -> int
(** [compare a b] is a lexical comparison function for {!t}. *)
Expand All @@ -236,21 +236,20 @@ val latest_distros : t list
(** Enumeration of the latest stable (ideally LTS) supported distributions. *)

val master_distro : t
(** The distribution that is the top-level alias for the [latest] tag
in the [ocaml/opam2] Docker Hub build. *)
(** The distribution that is the top-level alias for the [latest] tag in the
[ocaml/opam2] Docker Hub build. *)

val builtin_ocaml_of_distro : t -> string option
(** [builtin_ocaml_of_distro t] will return the OCaml version
supplied with the distribution packaging, and [None] if there
is no supported version. *)
(** [builtin_ocaml_of_distro t] will return the OCaml version supplied with the
distribution packaging, and [None] if there is no supported version. *)

val human_readable_string_of_distro : t -> string
(** [human_readable_string_of_distro t] returns a human readable
version of the distribution tag, including version information. *)
(** [human_readable_string_of_distro t] returns a human readable version of the
distribution tag, including version information. *)

val human_readable_short_string_of_distro : t -> string
(** [human_readable_short_string_of_distro t] returns a human readable
short version of the distribution tag, excluding version information. *)
(** [human_readable_short_string_of_distro t] returns a human readable short
version of the distribution tag, excluding version information. *)

type package_manager =
[ `Apk (** Alpine Apk *)
Expand Down Expand Up @@ -278,59 +277,56 @@ val tag_of_distro : t -> string
(** [tag_of_distro t] convert a distribution [t] to a Docker Hub tag. *)

val distro_of_tag : string -> t option
(** [distro_of_tag s] parses [s] into a {!t} distribution, and
[None] otherwise. *)
(** [distro_of_tag s] parses [s] into a {!t} distribution, and [None] otherwise.
*)

val latest_tag_of_distro : t -> string
(** [latest_tag_of_distro distro] will generate a Docker Hub
tag that is a convenient short form for the latest stable
release of a particular distribution. This tag will be
regularly rewritten to point to any new releases of the
distribution. *)
(** [latest_tag_of_distro distro] will generate a Docker Hub tag that is a
convenient short form for the latest stable release of a particular
distribution. This tag will be regularly rewritten to point to any new
releases of the distribution. *)

val base_distro_tag : ?arch:Ocaml_version.arch -> t -> string * string
(** [base_distro_tag ?arch t] will return a tuple of a Docker Hub
user/repository and tag for which the base image of a distribution
can be found (e.g. [opensuse/leap],[15.0] which maps to [opensuse/leap:15.0]
on the Docker Hub). This base image is in turn can be used to generate opam
and other OCaml tool Dockerfiles. [arch] defaults to [x86_64] and can vary
the base user/repository since some architecture are built elsewhere. *)
user/repository and tag for which the base image of a distribution can be
found (e.g. [opensuse/leap],[15.0] which maps to [opensuse/leap:15.0] on the
Docker Hub). This base image is in turn can be used to generate opam and
other OCaml tool Dockerfiles. [arch] defaults to [x86_64] and can vary the
base user/repository since some architecture are built elsewhere. *)

(** {2 CPU architectures} *)

val distro_arches : Ocaml_version.t -> t -> Ocaml_version.arch list
(** [distro_arches ov t] returns the list of architectures that
distribution [t] is supported on for OCaml compiler version [ov] *)
(** [distro_arches ov t] returns the list of architectures that distribution [t]
is supported on for OCaml compiler version [ov] *)

val distro_supported_on : Ocaml_version.arch -> Ocaml_version.t -> t -> bool
(** [distro_supported_on arch ov distro] returns [true] if the
combination of CPU [arch], compiler version [ov] is available
on the distribution [distro]. *)
(** [distro_supported_on arch ov distro] returns [true] if the combination of
CPU [arch], compiler version [ov] is available on the distribution [distro].
*)

(** {2 Opam build infrastructure support} *)

val active_distros : Ocaml_version.arch -> t list
(** [active_distros arch] returns the list of currently supported
distributions in the opam build infrastructure. Distributions
that are end-of-life upstream will rotate out of this list
regularly. *)
(** [active_distros arch] returns the list of currently supported distributions
in the opam build infrastructure. Distributions that are end-of-life
upstream will rotate out of this list regularly. *)

val active_tier1_distros : Ocaml_version.arch -> t list
(** Tier 1 distributions are those supported for the full matrix
of compiler versions in the opam build infrastructure.
The {{:https://github.com/ocurrent/docker-base-images}Docker base images}
will compile a base image for every OCaml version, so this
list should be added to sparingly. *)
(** Tier 1 distributions are those supported for the full matrix of compiler
versions in the opam build infrastructure. The
{{:https://github.com/ocurrent/docker-base-images}Docker base images} will
compile a base image for every OCaml version, so this list should be added
to sparingly. *)

val active_tier2_distros : Ocaml_version.arch -> t list
(** Tier 2 distributions are those supported for a limited set
of compiler versions in the opam build infrastructure. The
distros in this list are also tested for packages in the
opam repository. *)
(** Tier 2 distributions are those supported for a limited set of compiler
versions in the opam build infrastructure. The distros in this list are also
tested for packages in the opam repository. *)

val active_tier3_distros : Ocaml_version.arch -> t list
(** Tier 3 distributions are those supported for a limited set
of compiler versions in the opam build infrastructure. While
these distros will have base images compiled for them, they
are not widely tested. Distros maybe here as they are on the
way to being deprecated, or new and still experimental. *)
(** Tier 3 distributions are those supported for a limited set of compiler
versions in the opam build infrastructure. While these distros will have
base images compiled for them, they are not widely tested. Distros maybe
here as they are on the way to being deprecated, or new and still
experimental. *)
4 changes: 2 additions & 2 deletions src-opam/dockerfile_opam.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

(** Rules for generating Dockerfiles involving OPAM.
These are deployed at {{:https://hub.docker.com/r/ocaml/opam}ocaml/opam}
on the Docker Hub. The interfaces here may change as the production deployments
These are deployed at {{:https://hub.docker.com/r/ocaml/opam}ocaml/opam} on
the Docker Hub. The interfaces here may change as the production deployments
there change, so please contact [[email protected]] if you depend on these
functions for your own infrastructure. *)

Expand Down
Loading

0 comments on commit 4a26fcc

Please sign in to comment.