|
| 1 | +# Provision Manager |
| 2 | + |
| 3 | +## Purpose: |
| 4 | +Detect which files are changed versus the latest `KUBEVIRTCI_TAG`, |
| 5 | +and build only the providers which should be updated. |
| 6 | +The other providers will be reused by retagging their latest version. |
| 7 | + |
| 8 | +## Motivation: |
| 9 | +1. Freeze a state unless a change happens. |
| 10 | +2. Faster provision job. |
| 11 | +3. Reduce collision domain, a problem on one provider won't block updating the others. |
| 12 | + |
| 13 | +## Related Files: |
| 14 | +1. `hack/pman/rules.yaml` - the rules that determine which folder/file affects which provider. |
| 15 | +2. `hack/pman/force` - changing this file allows to enforce rebuild of all vm based providers. |
| 16 | + |
| 17 | +## Flow: |
| 18 | +1. Read rules.yaml and build a database of the rules. |
| 19 | +2. For each changed file (comparing to latest `KUBEVIRTCI_TAG`), check which rule match: |
| 20 | +a. Check the full filename (relative to kubevirtci folder). |
| 21 | +b. Check the `dirname` of the file |
| 22 | +c. Check each of the `dirname`/* of the file and its parent directories (until `.`, not included). |
| 23 | +If a match is found, the assicated rule is accumulated. |
| 24 | +Match must be found, unless the file is deleted, |
| 25 | +because we have rules which are regex, so once some files, are deleted also their rule will be gone. |
| 26 | +The motivation is to have less to maintain when adding / removing new providers. |
| 27 | + |
| 28 | +See `Config` struct at `cluster-provision/gocli/cmd/provision_manager.go` for more details about rule types. |
| 29 | + |
| 30 | +## Parameters: |
| 31 | +`--debug` - Run in debug mode. |
| 32 | +Output has the following sections: |
| 33 | +1. Run Parameters such as the tag comparing to, and the targets detected. |
| 34 | +2. The expanded rules (based on rules file). |
| 35 | +3. The files that were detected, their git status, and what is their effect based on the rules. |
| 36 | +4. The cumulative targets (which is the output in case of non DEBUG mode as well). |
| 37 | +Example: `docker run --rm -v $(pwd):/workdir:Z quay.io/kubevirtci/gocli provision-manager --debug` |
| 38 | + |
| 39 | +## Notes: |
| 40 | +1. If you need to enforce provision of all providers, run and commit this file: |
| 41 | +`curl -sL https://storage.googleapis.com/kubevirt-prow/release/kubevirt/kubevirtci/latest?ignoreCache=1 > hack/pman/force` |
| 42 | +This is helpful in case you want a specific PR to rebuild all providers, without changing the publish job. |
| 43 | +2. In order to bypass provision manager and rebuild all targets, run `BYPASS_PMAN=true ./publish.sh`. |
0 commit comments