|
| 1 | +--- |
| 2 | +title: Running operations in target-matching environments |
| 3 | +authors: lbarczio |
| 4 | +--- |
| 5 | + |
| 6 | +For some of the operations run in our service, it would be beneficial |
| 7 | +to run them in target-matching environment, e.g. parsing the specfile placed |
| 8 | +in F41 branch should happen on F41. Currently, we base our images |
| 9 | +on Fedora 41. |
| 10 | + |
| 11 | +## Use cases |
| 12 | + |
| 13 | +- user-configured commands (`actions` in config) |
| 14 | + - affected jobs: `copr_build`, `propose_downstream`, `pull_from_upstream` |
| 15 | + - run in on demand pods in `sandbox` (dedicated Openshift project) |
| 16 | +- building SRPM |
| 17 | + - affected jobs: |
| 18 | + - `upstream_koji_build` - in `long-running` workers |
| 19 | + - `copr_build` - in Copr, we just pass the required env as an argument for the API call |
| 20 | +- specfile parsing |
| 21 | + - for getting version, manipulating changelog, etc. during release syncing |
| 22 | + - affected jobs: `pull_from_upstream`, `propose_downstream` |
| 23 | + - run in `long-running` workers |
| 24 | +- potentially new use cases if Packit runs as Fedora dist-git CI |
| 25 | + |
| 26 | +## Possible solutions |
| 27 | + |
| 28 | +### container-based solutions |
| 29 | + |
| 30 | +#### dedicated workers for each Fedora version |
| 31 | + |
| 32 | +- for building SRPM, running release syncing (=> specfile parsing) |
| 33 | +- build separate images for each Fedora version |
| 34 | +- use Celery for task routing; tasks requiring specific environments would be routed accordingly |
| 35 | +- by default, tasks could run on the "main" worker (e.g. currently F41-based). |
| 36 | +- tasks requiring target-matching environments would be refactored (e.g. release syncing for |
| 37 | + all branches (currently one task) will need to be split) |
| 38 | +- suggestion from review: for better load balancing, we could consider running all the tasks except `process_message` utilising |
| 39 | + this routing logic, i.e. the tasks would be refactored so that one task runs for specific target and is always routed accordingly from `process_message` |
| 40 | +- potential waste of resources |
| 41 | +- shouldn't introduce any delays |
| 42 | + |
| 43 | +#### sandcastle adjustments |
| 44 | + |
| 45 | +- for running `actions` |
| 46 | +- build separate images for each Fedora version |
| 47 | +- adjust the code running sandcastle to dynamically pass the image reference |
| 48 | +- for commands not specified by users, e.g. `rpmbuild`, `fedpkg`, we could also utilise |
| 49 | + sandcastle, without the need of deploying the pod in different project, but this would lead |
| 50 | + to slower execution (overhead of scheduling the pods) |
| 51 | + |
| 52 | +### Copr resalloc |
| 53 | + |
| 54 | +- set up a custom resalloc instance, most of the tooling would need to be implemented |
| 55 | +- communication via SSH |
| 56 | +- relying on external infra, might be slow |
| 57 | + |
| 58 | +### Testing Farm reservations |
| 59 | + |
| 60 | +- [docs](https://docs.testing-farm.io/Testing%20Farm/0.1/cli.html#reserve) |
| 61 | +- `testing-farm reserve` to get a chosen OS |
| 62 | +- communication via SSH |
| 63 | +- there are already users using it in CI for provisioning systems for Ansible Molecule |
| 64 | +- not yet a proper API, a proper supported use case in plan |
| 65 | +- in the future a target machine could be obtained in <30s |
| 66 | +- still relying on external infra |
| 67 | +- could be considered for running actions |
| 68 | + |
| 69 | +### mock |
| 70 | + |
| 71 | +- [mock in a container](https://rpm-software-management.github.io/mock/#mock-inside-podman-fedora-toolbox-or-docker-container) |
| 72 | + requires privileged mode which is not possible in our current OpenShift instance |
| 73 | + |
| 74 | +## Next steps |
| 75 | + |
| 76 | +- with switching to F41 based image, we have unblocked users needing the latest RPM macros |
| 77 | +- once there is more user demand for any of the use cases, we can consider the options above, depending on |
| 78 | + the particular use-case |
| 79 | + - the container-based solution with dedicated workers looks like the best fit for running the whole tasks to me |
| 80 | + - for the `actions`, the `sandcastle` adjustments could be enough, |
| 81 | + but for the future I could see using TF reservations as a complete replacement |
0 commit comments