From 6901750e4c9a238daa97f357025d6cc5856cbf78 Mon Sep 17 00:00:00 2001 From: Viktor Kleen Date: Mon, 24 Apr 2023 18:15:32 +0000 Subject: [PATCH] Fix benchmark enum tag syntax --- benches/arrays/sort.ncl | 6 +- benches/mantis/deploy-example.ncl | 2 +- benches/mantis/deploy.ncl | 4 +- benches/mantis/jobs/mantis.ncl | 46 +++++++-------- benches/mantis/run.ncl | 2 +- benches/mantis/schemas/nomad/types.ncl | 82 +++++++++++++------------- benches/mantis/tasks/promtail.ncl | 4 +- benches/mantis/tasks/telegraf.ncl | 4 +- benches/serialization/main.ncl | 2 +- 9 files changed, 76 insertions(+), 76 deletions(-) diff --git a/benches/arrays/sort.ncl b/benches/arrays/sort.ncl index 6f15b91d67..8ec5964137 100644 --- a/benches/arrays/sort.ncl +++ b/benches/arrays/sort.ncl @@ -1,7 +1,7 @@ let ascending = fun x y => - if x < y then `Lesser - else if x == y then `Equal - else `Greater + if x < y then 'Lesser + else if x == y then 'Equal + else 'Greater in { run = std.array.sort ascending } diff --git a/benches/mantis/deploy-example.ncl b/benches/mantis/deploy-example.ncl index e80c468222..e5b7b343c8 100644 --- a/benches/mantis/deploy-example.ncl +++ b/benches/mantis/deploy-example.ncl @@ -1 +1 @@ -import "deploy.ncl" { namespace = "mantis-staging", job = "miner", role = `miner } +import "deploy.ncl" { namespace = "mantis-staging", job = "miner", role = 'miner } diff --git a/benches/mantis/deploy.ncl b/benches/mantis/deploy.ncl index 540e559aa4..fa9b9648d8 100644 --- a/benches/mantis/deploy.ncl +++ b/benches/mantis/deploy.ncl @@ -62,7 +62,7 @@ fun vars => logLevel | default = "INFO", loggers = defaultLoggers, job = vars.job, - role | [| `passive, `miner, `backup |] = vars.role, + role | [| 'passive, 'miner, 'backup |] = vars.role, reschedule = {}, } in @@ -79,7 +79,7 @@ fun vars => let miner_ = jobDefs.Mantis & { - role = `miner, + role = 'miner, mantisRev = revisions.mantisRev } in diff --git a/benches/mantis/jobs/mantis.ncl b/benches/mantis/jobs/mantis.ncl index aa86598a19..5280000555 100644 --- a/benches/mantis/jobs/mantis.ncl +++ b/benches/mantis/jobs/mantis.ncl @@ -10,7 +10,7 @@ let Params = { | std.number.Nat | default = 5, - role | [| `passive, `miner, `backup |], + role | [| 'passive, 'miner, 'backup |], datacenters | Dyn, job | Dyn, namespace | String, @@ -54,11 +54,11 @@ fun params => & ( if params.network == "etc" then { - type = `batch, + type = 'batch, periodic = { prohibit_overlap = true, cron = "@daily", - time_zone = `UTC, + time_zone = 'UTC, } } else @@ -67,11 +67,11 @@ fun params => & ( if params.network != "etc" then { - type = `service, + type = 'service, update = { max_parallel = 1, - health_check = `checks, + health_check = 'checks, min_healthy_time = "1m", # Give enough time for the DAG generation healthy_deadline = "15m", @@ -90,7 +90,7 @@ fun params => { count = params.count, network = { - mode = `host, + mode = 'host, port = { discovery = {}, metrics = {}, @@ -147,11 +147,11 @@ fun params => # #baseTags: [namespace, #role, "mantis-${NOMAD_ALLOC_INDEX}"] } & ( - if params.role == `passive then + if params.role == 'passive then { #TODO: dependent if service."%{params.namespace}-mantis-%{std.string.from_enum params.role}-rpc" = { - address_mode = `host, + address_mode = 'host, port = "rpc", tags = [ @@ -175,11 +175,11 @@ params.role}.rule=Host(`%{params.namespace}-%{std.string.from_enum params.role}. service."%{params.namespace}-mantis-%{std.string.from_enum params.role}-rpc" = { check.rpc = { - address_mode = `host, + address_mode = 'host, interval = "10s", port = "rpc", timeout = "3s", - type = `http, + type = 'http, path = "/healthcheck", } & ( @@ -196,11 +196,11 @@ params.role}.rule=Host(`%{params.namespace}-%{std.string.from_enum params.role}. } } & ( - if params.role == `miner then + if params.role == 'miner then { # TODO: dependent if service."%{params.namespace}-mantis-%{std.string.from_enum params.role}-rpc" = { - address_mode = `host, + address_mode = 'host, port = "rpc", tags = ["rpc"] @ baseTags, } @@ -211,13 +211,13 @@ params.role}.rule=Host(`%{params.namespace}-%{std.string.from_enum params.role}. & { service = { "%{params.namespace}-mantis-%{std.string.from_enum params.role}-prometheus" = { - address_mode = `host, + address_mode = 'host, port = "metrics", tags = ["prometheus"] @ baseTags, }, "%{params.namespace}-%{std.string.from_enum params.role}-${NOMAD_ALLOC_INDEX}" = { - address_mode = `host, + address_mode = 'host, port = "rpc", tags = [ @@ -236,7 +236,7 @@ params.role}.rule=Host(`%{params.namespace}-%{std.string.from_enum params.role}. port = "discovery", } & ( - if params.role == `miner then + if params.role == 'miner then { tags = [ @@ -253,7 +253,7 @@ params.role}.rule=Host(`%{params.namespace}-%{std.string.from_enum params.role}. {} ) & ( - if params.role == `passive then + if params.role == 'passive then { tags = ["discovery"] @ baseTags } @@ -269,11 +269,11 @@ params.role}.rule=Host(`%{params.namespace}-%{std.string.from_enum params.role}. "%{params.namespace}-mantis-%{std.string.from_enum params.role}-server-${NOMAD_ALLOC_INDEX}" = { - address_mode = `host, + address_mode = 'host, port = "server", } & ( - if params.role == `miner then + if params.role == 'miner then { tags = [ @@ -289,7 +289,7 @@ params.role}.rule=Host(`%{params.namespace}-%{std.string.from_enum params.role}. {} ) & ( - if params.role == `passive then + if params.role == 'passive then { tags = ["server"] @ baseTags, } @@ -304,11 +304,11 @@ params.role}.rule=Host(`%{params.namespace}-%{std.string.from_enum params.role}. check.server = { - address_mode = `host, + address_mode = 'host, interval = "10s", port = "server", timeout = "3s", - type = `tcp, + type = 'tcp, } & ( if params.network != "etc" then @@ -324,7 +324,7 @@ params.role}.rule=Host(`%{params.namespace}-%{std.string.from_enum params.role}. }, "%{params.namespace}-mantis-%{std.string.from_enum params.role}-server" = { - address_mode = `host, + address_mode = 'host, port = "server", tags = [ "ingress", "server" ] @ baseTags, meta = { @@ -334,7 +334,7 @@ params.role}.rule=Host(`%{params.namespace}-%{std.string.from_enum params.role}. }, "%{params.namespace}-mantis-%{std.string.from_enum params.role}" = { - address_mode = `host, + address_mode = 'host, port = "server", tags = ["server"] @ baseTags, meta = { diff --git a/benches/mantis/run.ncl b/benches/mantis/run.ncl index e7a0c037f8..6e6f21386b 100644 --- a/benches/mantis/run.ncl +++ b/benches/mantis/run.ncl @@ -2,6 +2,6 @@ run = import "deploy.ncl", serialize.run = fun args => ( - std.serialize `Json (run args) + std.serialize 'Json (run args) ) } diff --git a/benches/mantis/schemas/nomad/types.ncl b/benches/mantis/schemas/nomad/types.ncl index 1e1be5939c..230d2b0713 100644 --- a/benches/mantis/schemas/nomad/types.ncl +++ b/benches/mantis/schemas/nomad/types.ncl @@ -14,7 +14,7 @@ in Namespace | String, Id | Name, Name | String, - Type | [| `service, `system, `batch |], + Type | [| 'service, 'system, 'batch |], Priority | std.number.Nat, Datacenters | std.array.NonEmpty, TaskGroups @@ -221,9 +221,9 @@ in Migrate = { HealthCheck - | [| `checks, `task_states |] + | [| 'checks, 'task_states |] | default - = `checks, + = 'checks, HealthyDeadline | std.number.Nat | default @@ -260,9 +260,9 @@ in AutoRevert | Bool | default = false, Canary | std.number.Nat | default = 0, HealthCheck - | [| `checks, `task_states, `manual |] + | [| 'checks, 'task_states, 'manual |] | default - = `checks, + = 'checks, HealthyDeadline | lib.contracts.Nullable std.number.Nat | default = null, MaxParallel | std.number.Nat | default = 1, MinHealthyTime | lib.contracts.Nullable std.number.Nat | default = null, @@ -344,7 +344,7 @@ in }, Network = { - Mode | [| `host, `bridge |] | default = `host, + Mode | [| 'host, 'bridge |] | default = 'host, Device | String | default = "", CIDR | String | default = "", IP | String | default = "", @@ -355,7 +355,7 @@ in }, ServiceCheck = { - AddressMode | [| `alloc, `driver, `host |], + AddressMode | [| 'alloc, 'driver, 'host |], Args | lib.contracts.Nullable (Array String) | default = null, CheckRestart | json.CheckRestart, Command | String | default = "", @@ -373,7 +373,7 @@ in TaskName | String | default = "", Timeout | std.number.Nat, TLSSkipVerify | Bool | default = false, - Type | [| `http, `tcp, `script, `grpc |], + Type | [| 'http, 'tcp, 'script, 'grpc |], Body | lib.contracts.Nullable String | default = null, # TODO Header [string] [...string] }, @@ -387,7 +387,7 @@ in }, Lifecycle = { - Hook | [| `prestart, `poststart, `poststop |], + Hook | [| 'prestart, 'poststart, 'poststop |], Sidecar | lib.contracts.Nullable Bool | default = null, }, @@ -414,7 +414,7 @@ in | default = false, PortLabel | String, - AddressMode | [| `alloc, `auto, `driver, `host |], + AddressMode | [| 'alloc, 'auto, 'driver, 'host |], Checks | Array ServiceCheck | default @@ -427,7 +427,7 @@ in Task = { Name | String, - Driver | [| `exec, `docker, `nspawn |], + Driver | [| 'exec, 'docker, 'nspawn |], Config | stanza.taskConfig | { driver | Driver }, @@ -497,7 +497,7 @@ in GetterSource | String, # TODO GetterOptions: [string]: string # TODO GetterHeaders: [string]: string - GetterMode | [| `any, `file, `dir |] | default = `any, + GetterMode | [| 'any, 'file, 'dir |] | default = 'any, RelativeDest | String, }, @@ -505,7 +505,7 @@ in SourcePath | String | default = "", DestPath | String, EmbeddedTmpl | String, - ChangeMode | [| `restart, `noop, `signal |] | default = `restart, + ChangeMode | [| 'restart, 'noop, 'signal |] | default = 'restart, ChangeSignal | String | default = "", Splay | std.number.Nat | default = 5000000000, Perms | lib.contracts.MatchRegexp "^[0-7]{4}$" | default = "0644", @@ -515,7 +515,7 @@ in }, Vault = { - ChangeMode | [| `noop, `restart, `signal |] | default = `restart, + ChangeMode | [| 'noop, 'restart, 'signal |] | default = 'restart, ChangeSignal | String | default = "", Env | Bool | default = true, Namespace | String | default = "", @@ -1063,14 +1063,14 @@ in stanza = { job = - let type_schema = [| `batch, `service, `system |] in + let type_schema = [| 'batch, 'service, 'system |] in { datacenters | std.array.NonEmpty, namespace | String, type | type_schema | default - = `service, + = 'service, affinities | Array stanza.affinity | default @@ -1087,7 +1087,7 @@ in | { _ : stanza.group & { - type | type_schema | default = `service + type | type_schema | default = 'service } }, update @@ -1114,9 +1114,9 @@ in migrate = { health_check - | [| `checks, `task_states |] + | [| 'checks, 'task_states |] | default - = `checks, + = 'checks, healthy_deadline | std.number.Nat | default @@ -1256,7 +1256,7 @@ in }, group = { - type | [| `service, `batch, `system |], + type | [| 'service, 'batch, 'system |], affinities | Array stanza.affinity | default @@ -1292,16 +1292,16 @@ in = null, reschedule | stanza.reschedule - & { type | [| `service, `batch, `system |] } + & { type | [| 'service, 'batch, 'system |] } | default = {}, }, reschedule = { type - | [| `batch, `service, `system |] + | [| 'batch, 'service, 'system |] | default - = `service, + = 'service, # TODO: convert with ifs or sth # if #type == "batch" { @@ -1324,7 +1324,7 @@ in }, network = { - mode | [| `host, `bridge |], + mode | [| 'host, 'bridge |], dns | lib.contracts.Nullable { @@ -1370,9 +1370,9 @@ in = null, port | String, address_mode - | [| `alloc, `driver, `auto, `host |] + | [| 'alloc, 'driver, 'auto, 'host |] | default - = `auto, + = 'auto, tags | Array String | default @@ -1387,10 +1387,10 @@ in check = { address_mode - | [| `alloc, `driver, `host |] + | [| 'alloc, 'driver, 'host |] | default - = `driver, - type | [| `http, `tcp, `script, `grpc |], + = 'driver, + type | [| 'http, 'tcp, 'script, 'grpc |], port | String, interval | Duration, timeout | Duration, @@ -1486,7 +1486,7 @@ in }, lifecycle = { - hook | [| `prestart, `poststart, `poststop |], + hook | [| 'prestart, 'poststart, 'poststop |], sidecar | lib.contracts.Nullable Bool | default @@ -1517,9 +1517,9 @@ in # destination | Destination, headers | { _ : String }, mode - | [| `any, `file, `dir |] + | [| 'any, 'file, 'dir |] | default - = `any, + = 'any, options | { _ : String }, source | String, } @@ -1539,7 +1539,7 @@ in # meantime, allow config field: config | { .. }, - driver | [| `exec, `docker, `nspawn |], + driver | [| 'exec, 'docker, 'nspawn |], env | { _ : String } @@ -1601,9 +1601,9 @@ in | default = false, change_mode - | [| `restart, `noop, `signal |] + | [| 'restart, 'noop, 'signal |] | default - = `restart, + = 'restart, change_signal | String | default @@ -1652,7 +1652,7 @@ in interval | Duration, attempts | std.number.PosNat, delay | Duration, - mode | [| `delay, `fail |], + mode | [| 'delay, 'fail |], }, update = { @@ -1669,9 +1669,9 @@ in | default = 0, health_check - | [| `checks, `task_states, `manual |] + | [| 'checks, 'task_states, 'manual |] | default - = `checks, + = 'checks, healthy_deadline | Duration | default @@ -1696,9 +1696,9 @@ in vault = { change_mode - | [| `noop, `restart, `signal |] + | [| 'noop, 'restart, 'signal |] | default - = `restart, + = 'restart, change_signal | String | default @@ -1718,7 +1718,7 @@ in }, volume = { - type | [| `host, `csi |], + type | [| 'host, 'csi |], source | String, read_only | Bool diff --git a/benches/mantis/tasks/promtail.ncl b/benches/mantis/tasks/promtail.ncl index b05693e1af..9352ff0ccc 100644 --- a/benches/mantis/tasks/promtail.ncl +++ b/benches/mantis/tasks/promtail.ncl @@ -1,7 +1,7 @@ let types = import "../schemas/nomad/types.ncl" in types.stanza.task & { - driver = `exec, + driver = 'exec, resources = { cpu = 100, @@ -16,7 +16,7 @@ types.stanza.task template."local/config.yaml".data = std.serialize - `Yaml + 'Yaml { server = { http_listen_port = 0, diff --git a/benches/mantis/tasks/telegraf.ncl b/benches/mantis/tasks/telegraf.ncl index f5c941a5f8..bb53d58d94 100644 --- a/benches/mantis/tasks/telegraf.ncl +++ b/benches/mantis/tasks/telegraf.ncl @@ -6,11 +6,11 @@ let types = import "../schemas/nomad/types.ncl" in | default = "{{ env \"NOMAD_JOB_NAME\" }}-{{ env \"NOMAD_ALLOC_INDEX\" }}", - driver = `exec, + driver = 'exec, vault = { policies = ["nomad-cluster"], - change_mode = `noop, + change_mode = 'noop, }, resources = { diff --git a/benches/serialization/main.ncl b/benches/serialization/main.ncl index 84260caaaa..95a890e158 100644 --- a/benches/serialization/main.ncl +++ b/benches/serialization/main.ncl @@ -1,6 +1,6 @@ { input.run = ( - std.serialize `Json (import "input.json") + std.serialize 'Json (import "input.json") ) }