Skip to content

Add support for selectors (cue file filters)

Ghost User requested to merge selectors-includes into master

Add support for selectors (cue file filters)

A selector is a flag you can pass to trackbone using -s/--selector, it is used to pre-process files and determine whether they should be included for cue eval.

A file can indicate selectors it supports by adding @include() attributes before package clause.

trackbone expects a list of selectors inside @include():

@include(key1=value1 key2=value2 key3=value3)

@include() is parsed as follow:

  • Each key can have multiple values, either by separating values by commas, or by repeating the same key multiple time with different values.
  • key=value couples are separated from other couples by space, tab or carriage return.

so the following file would be valid:

// a.cue
@include(
configuration=a provider=fe,aws
extra=1
extra=2
)
package a

a: 1

It is possible to specify multiple keys/values inside @include(), trackbone will load the file only if all assertions (each key/value) are valid.

Assertion validation is described as follow:

  • the assertion key is not defined by any selector: the assertion is always true
  • the assertion key is defined at least once in a selector: in that case, one of the assertion values has to match a selector value

passing selectors to trackbone CLI looks like that:

trackbone plan -z <zone> -c <config> -s <key>=<value1> -s <key>=<value2>
Edited by Ghost User

Merge request reports

Loading