k8s.io/test-infra@v0.0.0-20240520184403-27c6b4c223d8/releng/config-forker/README.md (about) 1 # config-forker 2 3 config-forker forks presubmit, periodic, and postsubmit job configs with the `fork-per-release` annotation. 4 5 ## Usage 6 7 * `--job-config`: Path to the job config 8 * `--output`: Path to the output yaml to create. If not specified, the process still runs but no file is generated 9 (potentially useful for presubmits) 10 * `--version`: the version to generate a forked config for, e.g. `1.15` 11 12 ## Supported annotations 13 14 - `fork-per-release`: only jobs with this set to `"true"` will be forked. 15 - `fork-per-release-replacements`: allows replacing values in job `tags` (periodics only) and container `args` (see [Custom replacements](#custom-replacements)). 16 - `fork-per-release-deletions`: allows deleting values in job `labels` in periodics (see [Custom deletions](#custom-deletions)). 17 - `fork-per-release-periodic-interval`: if set, forked jobs will use this value for `interval`. If multiple space-separated values are provided, the first will be used. 18 - `fork-per-release-cron`: if set, forked jobs will use this value for `cron`. If multiple values separated with `, ` are provided, the first will be used. 19 20 ## Actions taken 21 22 For the sake of clarity, all the below will assume we are forking with `--version 1.15`. 23 24 Only jobs annotated with `fork-per-release` will be forked. 25 26 For all jobs: 27 28 - If `spec` includes a container with an `image` ending in `-master`, it is replaced with `-1.15`. 29 - If `spec` includes a container with an `env` variable with `BRANCH` (case-insensitive) in the name and the value 30 `master`, the value will be changed to `release-1.15`. 31 - If the `fork-per-release-replacements` annotation is specified, those replacements will be performed in the `args` 32 of all containers for that job. 33 - If the `testgrid-dashboards` annotation is specified, references to `master-blocking` and `master-informing` are 34 changed to `1.15-blocking` and `1.15-informing`. 35 - If the `testgrid-tab-name` annotation is specified, references to `master` are changed to `1.15`. 36 - If the `description` annotation is specified, it is removed (for now). 37 38 For presubmits only: 39 40 - If `name` has no `-master` ending, then `-1.15` will be appended. 41 - If `name` has a `-master` ending, it is replaced with `1.15`. 42 - If `context` is unset and `name` has no `-master` ending, it will be set to the original `name` without appending `-1.15`. 43 - If `context` is unset and `name` has a `-master` ending, it will be set to the `name`, including the `-1.15` suffix. 44 - If `context` is set and it has a `-master` ending, it is replaced with `-1.15`. 45 - If `context` is set and it has no `-master` ending, it will be taken over unmodified. 46 47 The `context` is modified in a way to report the same context name on different branches if `-master` was not included 48 in the original context. If `-master` was included (either in an explicit context value, or inferred from the job name), 49 it gets added to the context. 50 51 For presubmits and postsubmits: 52 53 - `skip_branches` will be deleted 54 - `branches` will be set to `release-1.15` 55 56 For periodics and postsubmits: 57 58 - If the job `name` ends in `-master`, it will be replaced with `-1-15`, otherwise `-1-15` will be appended 59 - `sig-release-1.15-all` is added to the job's `testgrid-dashboards` annotation (creating the annotation if necessary) 60 61 For periodics only: 62 63 - If `decorate` is `true`, and `extra_refs` contains a reference to `kubernetes/kubernetes` master, the `BaseRef` 64 will be updated to `release-1.15` 65 - If `decorate` is not true, some bootstrap-related `args` will be replaced: 66 - `--repo=k8s.io/kubernetes` or `--repo=k8s.io/kubernetes=master` will be replaced with `--repo=k8s.io/kubernetes=release-1.15` 67 - `--branch=master` will be replaced with `--branch=release-1.15` 68 - If the `fork-per-release-periodic-interval` annotation is set, the `interval` will be set to the first value it contains. 69 70 ## Custom replacements 71 72 The `fork-per-release-replacements` annotation can be used for custom replacements in your `args` or `tags` (periodic jobs only). 73 It takes the form of a comma-separated list of replacements, like this: 74 75 ``` 76 fork-per-release-replacements: "original1 -> replacement1, original2 -> replacement2" 77 ``` 78 79 The replacements are interpreted as Go templates, with one value defined: `{{.Version}}`. `{{.Version}}` will be replaced 80 by the version currently being forked (e.g. `1.15`). For example: 81 82 ``` 83 fork-per-release-replacements: "--version=stable -> --version={{.Version}" 84 ``` 85 86 ## Custom deletions 87 88 The `fork-per-release-deletions` annotation can be used for custom deletions in your `labels` (periodic jobs only). 89 This is a comma-separated list of keys of labels you would like to remove on forking, for instance: 90 91 ``` 92 fork-per-release-deletions: "label-key-to-delete1, label-key-to-delete2" 93 ``` 94 95 This is useful for getting rid of a specific preset in the forked job. For instance, one can have a master branch job that 96 has a label corresponding to a master-specific preset which is undesired for forked release jobs.