Merge pull request 'Classify a build as monitoring build if mirage-monitoring is in the dependency cone' (#144) from fix-monitoring into main
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/144
This commit is contained in:
commit
3f3de027ce
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
|
||||
in
|
||||
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
|
||||
let metrics_influx =
|
||||
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
|
||||
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)"
|
||||
else
|
||||
"Unikernels"
|
||||
|
|
Loading…
Reference in a new issue