|
| 1 | +--- |
| 2 | +title: Decoupling Fedora CI deployment from Packit Service |
| 3 | +authors: lbarcziova |
| 4 | +--- |
| 5 | + |
| 6 | +Related links: |
| 7 | + |
| 8 | +- [issue](https://github.com/packit/packit-service/issues/2737) |
| 9 | + |
| 10 | +This research describes requirements and plan to decouple Fedora CI-specific worker functionality from |
| 11 | +the [Packit Service repository](https://github.com/packit/packit-service) and deploy it as a separate, independent service. |
| 12 | +This will improve maintainability, scalability, and make the deployment within Fedora infrastructure easier. |
| 13 | + |
| 14 | +## Code |
| 15 | + |
| 16 | +- create the new repo (`https://github.com/packit/fedora-ci`?) structure, something like this: |
| 17 | + |
| 18 | +``` |
| 19 | +fedora-ci/ |
| 20 | +├── fedora_ci/ |
| 21 | +│ ├── handlers/ # Fedora CI handlers |
| 22 | +│ ├── helpers/ # Helper classes like FedoraCIHelper |
| 23 | +│ ├── checker/ # Checker classes |
| 24 | +│ ├── jobs.py # Job processing logic |
| 25 | +│ └── tasks.py # Celery tasks |
| 26 | +├── tests/ |
| 27 | +
|
| 28 | +``` |
| 29 | + |
| 30 | +- code migration: |
| 31 | + - identify and move all Fedora CI-related worker functionality from packit-service to the new repository; this concerns jobs that do not depend on a repo having Packit configuration in the repository |
| 32 | + - set up tests and CI |
| 33 | + - create files needed for deployment: `run_worker.sh`, Containerfile, docker-compose file, etc. |
| 34 | +- remove the moved code from the `packit-service` repo |
| 35 | + (this should be done after the code from new repo is deployed) |
| 36 | +- needed changes: |
| 37 | + - once there is separate dashboard page, change the URL paths in the code |
| 38 | + |
| 39 | +### Implementation changes during the transition period |
| 40 | + |
| 41 | +- changes only to the new repo, without deploying |
| 42 | + - this would mean for few weeks the changes wouldn't take effect in the old deployment, |
| 43 | + and might cause some bugs landing when the new deployment happens which might be harder to investigate (if there are a lot of new changes) |
| 44 | + - old deployment might continue to run with known bugs |
| 45 | +- changes to both repos |
| 46 | + - this involves duplicated work, and might be prone to errors (e.g. forgetting to apply a change to one repo) |
| 47 | + - first changing the code in old repo, and then applying the same to the new one |
| 48 | +- importing the code from new repo |
| 49 | + |
| 50 | + - cleaner transition |
| 51 | + - requires more initial effort and might be more complex to set up |
| 52 | + - how to implement: |
| 53 | + - git submodule - directly link the new repository as a subdirectory in the old one |
| 54 | + - open to other suggestions |
| 55 | + - this might be not possible to do easily, as it could cause circular imports, as fedora-ci code will need to import events from packit-service |
| 56 | + |
| 57 | +- in any case, we could try to minimize the new features and focus only on bug fixing during this time |
| 58 | + |
| 59 | +## DB and API |
| 60 | + |
| 61 | +- schema same, empty tables |
| 62 | +- do we want to migrate the data from the current deployment? |
| 63 | +- API at e.g. `prod.fedora-ci.packit.dev/api` |
| 64 | + |
| 65 | +## Dashboard |
| 66 | + |
| 67 | +- keeping one instance or having 2 |
| 68 | + - 1 instance: we can use [`Context selector`](https://www.patternfly.org/components/menus/context-selector/design-guidelines) like OpenShift does |
| 69 | + - using different backends |
| 70 | + - we agreed we prefer this solution |
| 71 | + - 2 instances: |
| 72 | + - implementation wise this would require more changes |
| 73 | +- to consider: this might be also required to be deployed in Fedora infra |
| 74 | + - dashboard deployment is quite straightforward, shouldn't be an issue |
| 75 | + |
| 76 | +## Identity |
| 77 | + |
| 78 | +- we probably want a new identity (or 2, both for stg and prod) on `src.fedoraproject.org` to be set up |
| 79 | +- current Fedora CI user (`releng-bot`) is in these groups: |
| 80 | + - cvsadmin |
| 81 | + - fedora-contributor |
| 82 | + - fedorabugs |
| 83 | + - packager |
| 84 | + - relenggroup |
| 85 | + |
| 86 | +## Openshift |
| 87 | + |
| 88 | +### Ansible playbook, roles, Openshift object definitions |
| 89 | + |
| 90 | +- [Fedora infra ansible repo](https://pagure.io/fedora-infra/ansible) |
| 91 | +- copy and adjust the existing [deployment playbook](https://github.com/packit/deployment/blob/main/playbooks/deploy.yml) and related files |
| 92 | +- mimic existing Fedora infrastructure playbooks, such as https://pagure.io/fedora-infra/ansible/blob/main/f/playbooks/openshift-apps/openscanhub.yml, and remove any unneeded tasks specific to Packit Service |
| 93 | +- copy and adjust the Openshift object definitions, also remove Packit Service specific values (e.g. MPP specific) |
| 94 | +- logs collection in Fedora infra? |
| 95 | + |
| 96 | +### Configuration |
| 97 | + |
| 98 | +- create Packit service config (specific server name etc.), variable file templates |
| 99 | + |
| 100 | +### Secrets |
| 101 | + |
| 102 | +- all the secrets should be new (different from Packit Service) |
| 103 | + - certificates |
| 104 | + - identity related files: token, SSH keys, keytab |
| 105 | + - Fedora messaging |
| 106 | + - Testing Farm |
| 107 | + - Flower |
| 108 | + - postgres |
| 109 | + - Sentry |
| 110 | + - ? |
| 111 | + |
| 112 | +# To discuss |
| 113 | + |
| 114 | +- repo naming |
| 115 | + - fedora-ci-worker |
| 116 | +- identity |
| 117 | + - new one |
| 118 | +- do we want both stg and prod? new code deployment strategy? weekly prod updates? |
| 119 | + - yes, for the beginning stick with weekly updates, this might need to be adjusted later on |
| 120 | +- existing data migration |
| 121 | + - let's not do this and rather spend time on other tasks |
| 122 | +- how to handle code changes while being in the process of the decoupling |
| 123 | + - try to minimize changes, urgent fixes contribute to both repos |
| 124 | + |
| 125 | +# Follow-up work (to be adjusted based on discussion) |
| 126 | + |
| 127 | +- code migration as described above: |
| 128 | + - functionality and tests |
| 129 | + - CI setup |
| 130 | + - deployment related files |
| 131 | +- configuration and secrets generation |
| 132 | +- integrate our deployment into https://pagure.io/fedora-infra/ansible/blob/main/f/playbooks |
| 133 | +- dashboard changes |
| 134 | +- reverse dependency tests run in packit-service repo to make sure changes there do not break the Fedora CI |
0 commit comments