Classify a build as monitoring build if mirage-monitoring is in the dependency cone
This commit is contained in:
parent
041f1d2640
commit
3914e718c3
1 changed files with 18 additions and 5 deletions
19
lib/model.ml
19
lib/model.ml
|
@ -248,12 +248,25 @@ let infer_section_and_synopsis artifacts =
|
||||||
| Some opam -> OpamFile.OPAM.synopsis opam, OpamFile.OPAM.descr_body opam
|
| Some opam -> OpamFile.OPAM.synopsis opam, OpamFile.OPAM.descr_body opam
|
||||||
in
|
in
|
||||||
let infer_section switch root =
|
let infer_section switch root =
|
||||||
let root_pkg_name = OpamPackage.Name.to_string root.OpamPackage.name in
|
let root_pkg = root.OpamPackage.name in
|
||||||
|
let root_pkg_name = OpamPackage.Name.to_string root_pkg in
|
||||||
if Astring.String.is_prefix ~affix:"mirage-unikernel-" root_pkg_name then
|
if Astring.String.is_prefix ~affix:"mirage-unikernel-" root_pkg_name then
|
||||||
|
let metrics_influx =
|
||||||
let influx = OpamPackage.Name.of_string "metrics-influx" in
|
let influx = OpamPackage.Name.of_string "metrics-influx" in
|
||||||
if OpamPackage.Set.exists (fun p -> OpamPackage.Name.equal p.OpamPackage.name influx)
|
OpamPackage.Set.exists (fun p -> OpamPackage.Name.equal p.OpamPackage.name influx)
|
||||||
switch.OpamFile.SwitchExport.selections.OpamTypes.sel_installed
|
switch.OpamFile.SwitchExport.selections.OpamTypes.sel_installed
|
||||||
then
|
in
|
||||||
|
let mirage_monitoring =
|
||||||
|
let monitoring = OpamPackage.Name.of_string "mirage-monitoring" in
|
||||||
|
match OpamPackage.Name.Map.find_opt root_pkg switch.OpamFile.SwitchExport.overlays with
|
||||||
|
| None -> false
|
||||||
|
| Some opam ->
|
||||||
|
let depends = OpamFile.OPAM.depends opam in
|
||||||
|
OpamFormula.fold_left (fun acc (n', _) ->
|
||||||
|
acc || OpamPackage.Name.equal n' monitoring)
|
||||||
|
false depends
|
||||||
|
in
|
||||||
|
if metrics_influx || mirage_monitoring then
|
||||||
"Unikernels (with metrics reported to Influx)"
|
"Unikernels (with metrics reported to Influx)"
|
||||||
else
|
else
|
||||||
"Unikernels"
|
"Unikernels"
|
||||||
|
|
Loading…
Reference in a new issue