|
|
před 2 roky | |
|---|---|---|
| .. | ||
| README.md | před 3 roky | |
| dependencies.yml | před 2 roky | |
generate_rules.py worksThis script can do only two things:
rules.ymlThis file only used basic YAML grammar and has nothing to do with the GitLab version YAML file.
It has five custom keywords:
matrix: An array of sub-arrays, used to replicate rules by formatting strings. You can use the format string everywhere, it will be formatted recursivelylabels: An array of labels.patterns: An array of patterns. Patterns that not includedincluded_in: An array of other rule names. It indicates the labels and patterns will be included in all specified rules as welldeploy: An array of strings, used to replicate rules by adding postfix -<item in deploy array>. It indicates the extra label used in rules, which will explain later.rules.ymlLet's take a complicated example to help understand the process
"test-{0}-{1}":
matrix:
- [a, b]
- [c, d]
labels:
- "{0}-{1}"
patterns:
- "{0}"
- pattern-not-exist
included_in:
- build-{0}
matrixAfter this step, it will turn into 4 dicts:
| key | labels | patterns | included_in | | -------- | ------ | -------- | ----------- | | test-a-c | a-c | a | build-a | | test-a-d | a-d | a | build-a | | test-b-c | b-c | b | build-b | | test-b-d | b-d | b | build-b |
Advanced Usage: You can overwrite a mapping by declaring it again later, For example:
If we concatenate this part to the previous example,
```yaml
# ... The same as the previous example
test-a-c:
labels:
- overwrite
```
rule test-a-c will be turned into:
| key | labels | | -------- | --------- | | test-a-c | overwrite |
Mappings with the keyword deploy will also replicate by adding a postfix -<item in deploy array> to the mapping key
included_inAfter this step, it will turn into 6 mapping dicts:
| key | labels | patterns | | -------- | -------- | -------- | | test-a-c | a-c | a | | test-a-d | a-d | a | | test-b-c | b-c | b | | test-b-d | b-d | b | | build-a | a-c, a-d | a | | build-b | b-c, b-d | b |
replace the auto-generated region in rules.yml with labels, and rules. Each mapping will generate a rule and all the required labels. patterns are pre-defined in rules.yml and could not be generated automatically. If a mapping is using a pattern undefined, the pattern will be ignored.
-preview, no if-protected-xxx clause will be added-production, an if-protected-no_label clause will be addedif-protected clause will be addedAll label nodes are in green, pattern nodes are in cyan, rule nodes are in blue
There are a few extra dependencies while generating the dependency tree graph, please refer to pygraphviz documentation to install both graphviz and pygraphviz
python $IDF_PATH/tools/ci/generate_rules.py --graph OUTPUT_PATH