Skip to content

Commit 50088cb

Browse files
committed
extract missing_notify to newly created ci-check.libsonnet
1 parent 5a220ac commit 50088cb

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

ci-check.libsonnet

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
local std_get = (import 'common-utils.libsonnet').std_get;
2+
3+
{
4+
# check that all non [gate, ondemand] entries have notify_emails or notify_groups defined
5+
local missing_notify(builds) = {
6+
[x.name]: $.std_get(x, "defined_in") for x in builds if !std.objectHas(x, "notify_emails") && !std.objectHasAll(x, "notify_groups") && (std.member(x.targets, "daily") || std.member(x.targets, "weekly") || std.member(x.targets, "monthly"))
7+
},
8+
9+
verify_ci(builds)::
10+
local missingNotify = missing_notify(builds);
11+
assert std.length(missingNotify) == 0 : "Missing notify_emails or notify_groups: " + missingNotify;
12+
true
13+
,
14+
}

ci.jsonnet

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ local javadoc = import "ci_includes/publish-javadoc.jsonnet";
3535
# VM
3636
local vm = import 'vm/ci/ci_includes/vm.jsonnet';
3737

38-
local missing_notify = (import 'common-utils.libsonnet').missing_notify;
38+
local verify_ci = (import 'ci-check.libsonnet').verify_ci;
3939

4040
{
4141
# Ensure that entries in common.jsonnet can be resolved.
@@ -56,6 +56,5 @@ local missing_notify = (import 'common-utils.libsonnet').missing_notify;
5656
javadoc.builds +
5757
vm.builds
5858
)],
59-
missingNotify:: missing_notify(self.builds),
60-
assert std.length(self.missingNotify) == 0 : "Missing notify_emails or notify_groups: " + self.missingNotify,
59+
assert verify_ci(self.builds),
6160
}

common-utils.libsonnet

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,4 @@
9494
if objectHas(o, f) then o[f] else default
9595
,
9696

97-
# check that all non [gate, ondemand] entries have notify_emails or notify_groups defined
98-
missing_notify(builds):: {
99-
[x.name]: $.std_get(x, "defined_in") for x in builds if !std.objectHas(x, "notify_emails") && !std.objectHasAll(x, "notify_groups") && (std.member(x.targets, "daily") || std.member(x.targets, "weekly") || std.member(x.targets, "monthly"))
100-
},
10197
}

0 commit comments

Comments
 (0)