cuelang.org/go@v0.10.1/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  	stdout:        "foo"
    78  	permissions:   493
    79  }
    80  -- out/run-v3/t2/value --
    81  {
    82  	$after: {
    83  		$id:           "tool/file.Mkdir"
    84  		path:          "output"
    85  		createParents: true
    86  		stdout:        "foo"
    87  		permissions:   493
    88  	}
    89  	$id:         "tool/file.Create"
    90  	filename:    "output/dns-records.zone"
    91  	permissions: 438
    92  	contents: """
    93  		kube-vagrant-monitoring-proxy A 127.0.0.1
    94  
    95  		"""
    96  	stdout: "foo"
    97  }
    98  -- diff/-out/run-v3/t2/value<==>+out/run/t2/value --
    99  diff old new
   100  --- old
   101  +++ new
   102  @@ -1,5 +1,4 @@
   103   {
   104  -	$id: "tool/file.Create"
   105   	$after: {
   106   		$id:           "tool/file.Mkdir"
   107   		path:          "output"
   108  @@ -7,6 +6,7 @@
   109   		stdout:        "foo"
   110   		permissions:   493
   111   	}
   112  +	$id:         "tool/file.Create"
   113   	filename:    "output/dns-records.zone"
   114   	permissions: 438
   115   	contents: """
   116  -- diff/value/todo/p3 --
   117  Reordering.
   118  -- out/run/t1/stats --
   119  Leaks:  0
   120  Freed:  56
   121  Reused: 47
   122  Allocs: 9
   123  Retain: 2
   124  
   125  Unifications: 40
   126  Conjuncts:    98
   127  Disjuncts:    58
   128  -- out/run/t2 --
   129  graph TD
   130    t0("root.build.task.mkdir.output [Terminated]")
   131    t1("root.build.task.#quot;output/dns-records.zone#quot; [Terminated]")
   132    t1-->t0
   133  
   134  -- out/run/t2/value --
   135  {
   136  	$id: "tool/file.Create"
   137  	$after: {
   138  		$id:           "tool/file.Mkdir"
   139  		path:          "output"
   140  		createParents: true
   141  		stdout:        "foo"
   142  		permissions:   493
   143  	}
   144  	filename:    "output/dns-records.zone"
   145  	permissions: 438
   146  	contents: """
   147  		kube-vagrant-monitoring-proxy A 127.0.0.1
   148  
   149  		"""
   150  	stdout: "foo"
   151  }
   152  -- out/run/t2/stats --
   153  Leaks:  0
   154  Freed:  57
   155  Reused: 57
   156  Allocs: 0
   157  Retain: 2
   158  
   159  Unifications: 41
   160  Conjuncts:    104
   161  Disjuncts:    59
   162  -- out/run/stats/totals --
   163  Leaks:  0
   164  Freed:  113
   165  Reused: 104
   166  Allocs: 9
   167  Retain: 4
   168  
   169  Unifications: 81
   170  Conjuncts:    202
   171  Disjuncts:    117