cuelang.org/go@v0.13.0/tools/flow/testdata/issue2416a.txtar (about) 1 #IgnoreConcrete: true 2 #InferTasks: true 3 -- in.cue -- 4 package kubecluster 5 6 import ( 7 "list" 8 "strings" 9 "tool/file" 10 ) 11 12 #Cluster: { 13 clusterName: string 14 15 dnsPrefix: *"kube-\(clusterName)" | string 16 if strings.HasPrefix(clusterName, "foo_") { 17 dnsPrefix: "foo-kube-" + strings.TrimPrefix(clusterName, "foo_") 18 } 19 } 20 21 clusters: [CLUSTER=string]: #Cluster & { 22 clusterName: CLUSTER 23 } 24 25 dnsRecords: [string]: string 26 27 for clusterName, cluster in clusters { 28 dnsRecords: "\(cluster.dnsPrefix)-monitoring-proxy": "127.0.0.1" 29 } 30 31 clusters: vagrant: { 32 33 } 34 35 #Cluster: CLUSTER={ 36 foobar: CLUSTER.clusterName 37 } 38 39 root: build: { 40 $short: "exportiert gesamte Konfiguration nach ./output/" 41 42 task: mkdir: { 43 output: file.MkdirAll & {path: "output"} 44 } 45 46 task: "output/dns-records.zone": file.Create & { 47 $after: task.mkdir.output 48 filename: "output/dns-records.zone" 49 let lines = list.SortStrings([ 50 for name, addr in dnsRecords { 51 "\(name) A \(addr)" 52 }, 53 ]) 54 contents: strings.Join(lines, "\n") + "\n" 55 } 56 57 } 58 59 -- out/run/errors -- 60 -- out/run/t0 -- 61 graph TD 62 t0("root.build.task.mkdir.output [Ready]") 63 t1("root.build.task.#quot;output/dns-records.zone#quot; [Waiting]") 64 t1-->t0 65 66 -- out/run/t1 -- 67 graph TD 68 t0("root.build.task.mkdir.output [Terminated]") 69 t1("root.build.task.#quot;output/dns-records.zone#quot; [Ready]") 70 t1-->t0 71 72 -- out/run/t1/value -- 73 { 74 $id: "tool/file.Mkdir" 75 path: "output" 76 createParents: true 77 permissions: 511 78 stdout: "foo" 79 } 80 -- out/run/t1/stats -- 81 Leaks: 0 82 Freed: 57 83 Reused: 48 84 Allocs: 9 85 Retain: 5 86 87 Unifications: 41 88 Conjuncts: 101 89 Disjuncts: 59 90 -- out/run/t2 -- 91 graph TD 92 t0("root.build.task.mkdir.output [Terminated]") 93 t1("root.build.task.#quot;output/dns-records.zone#quot; [Terminated]") 94 t1-->t0 95 96 -- out/run/t2/value -- 97 { 98 $after: { 99 $id: "tool/file.Mkdir" 100 path: "output" 101 createParents: true 102 permissions: 511 103 stdout: "foo" 104 } 105 $id: "tool/file.Create" 106 filename: "output/dns-records.zone" 107 permissions: 438 108 contents: """ 109 kube-vagrant-monitoring-proxy A 127.0.0.1 110 111 """ 112 stdout: "foo" 113 } 114 -- out/run/t2/stats -- 115 Leaks: 0 116 Freed: 58 117 Reused: 58 118 Allocs: 0 119 Retain: 5 120 121 Unifications: 42 122 Conjuncts: 108 123 Disjuncts: 60 124 -- out/run/stats/totals -- 125 Leaks: 0 126 Freed: 115 127 Reused: 106 128 Allocs: 9 129 Retain: 10 130 131 Unifications: 83 132 Conjuncts: 209 133 Disjuncts: 119