https://github.com/packit/hardly
Project is archived since Packit team agreed on prioritising work with more benefits and bigger user base.
https://github.com/packit/hardly
Last synced: 11 months ago
JSON representation
Project is archived since Packit team agreed on prioritising work with more benefits and bigger user base.
- Host: GitHub
- URL: https://github.com/packit/hardly
- Owner: packit
- License: mit
- Created: 2021-05-18T16:47:56.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-08-26T22:53:36.000Z (almost 2 years ago)
- Last Synced: 2024-08-27T01:42:31.033Z (almost 2 years ago)
- Language: Python
- Homepage: https://packit.dev/source-git/status
- Size: 273 KB
- Stars: 0
- Watchers: 6
- Forks: 7
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hardly
[](https://softwarefactory-project.io/zuul/t/packit-service/project/github.com/packit/hardly)
[](https://github.com/psf/black)
[](https://github.com/pre-commit/pre-commit)
Code for (Celery) worker used in our "Stream service".
It reuses [packit-service's worker](https://github.com/packit/packit-service/tree/main/packit_service/worker)
code and [implements new jobs as new handlers](https://github.com/packit/research/tree/main/split-the-stream#2-separate-workers).
## Workflow
The service is similar to [Packit service](https://github.com/packit/packit-service),
but is expected to eventually follow [this workflow](https://github.com/packit/research/tree/main/split-the-stream#what-does-the-source-git-workflow-mean):
##### Must have:
- [x] If a user creates a merge-request on the source-git repository:
- [x] Create a matching merge-request to the dist-git repository.
- [x] Sync the CI results from the dist-git merge-request to the source-git merge-request.
- [x] If the dist-git is updated, update the source-git repository by opening a PR.
- Implemented, but [not enabled yet](https://github.com/packit/hardly/issues/109).
- [x] User is able to convert source-git change to the dist-git change locally via CLI.
##### Should have:
- [x] If the source-git merge-request is updated, update the dist-git merge-request.
- [x] If the source-git merge-request is closed, close the dist-git merge-request.
##### Could have:
- [ ] User is able to re-trigger the dist-git CI from the source-git merge-request.
- [ ] User is able to re-create the dist-git MR from the source-git merge-request.
## Running it locally
[Similar to packit-service](https://github.com/packit/packit-service/blob/main/CONTRIBUTING.md#running-packit-service-locally)
we have a [docker-compose.yml](docker-compose.yml) for fast prototyping.
It expects, that you have:
- [.env.fedora-source-git](.env.fedora-source-git) or [env.stream](.env.stream)
copied or symlinked (`ln -s .env.fedora-source-git .env`) to `.env`.
- `secrets/fedora-source-git/dev/` or `secrets/stream/dev/` populated (linked)
with secrets mostly taken from our internal repo.
"Mostly", because you should use your credential where possible.
- `../ogr/`, `../packit/` and `../packit-service/` dirs with the respected repos cloned.
Those are mounted into the container, so you don't have to
rebuild the image each time you change anything in them.
Follow the [packit-service's guide](https://github.com/packit/packit-service/blob/main/CONTRIBUTING.md#running-packit-service-locally)
for the other settings. Once you have it running (and see no errors), you can test (uses [HTTPie](https://httpie.io)) the webhook with:
cat tests/data/webhooks/gitlab/mr_event.json | http --verify=no https://service.localhost:8443/api/webhooks/gitlab
## How to deploy
To deploy the service into Openshift cluster,
clone the [deployment repo](https://github.com/packit/deployment) and:
1. [create the variable files](https://github.com/packit/deployment/tree/main/vars) in [vars/stream/](https://github.com/packit/deployment/tree/main/vars/stream)
2. link secrets into [secrets](https://github.com/packit/deployment/tree/main/secrets) / stream/{prod|stg}
3. `SERVICE={fedora-source-git|stream} DEPLOYMENT={deployment} make deploy`
## Image
[The image](files/Containerfile) is currently based on the
[packit-worker image](https://github.com/packit/packit-service/blob/main/files/docker/Dockerfile.worker)
but that might change in the future to decouple those.
For running locally with docker-compose, build it with `docker-compose build`.
For deploying in cluster, the image is
[built and pushed](.github/workflows/rebuild-and-push-images.yml)
to [Quay.io](https://quay.io/repository/packit/hardly) whenever you push to `main`.
Or you can rebuild manually in
[Actions](https://github.com/packit/hardly/actions/workflows/rebuild-and-push-images.yml).
## Actual deployments
- [Fedora](https://github.com/packit/deployment/blob/main/docs/deployment/specifics/fedora-source-git.md)
- [CentOS Stream](https://github.com/packit/deployment/blob/main/docs/deployment/specifics/centos-stream-source-git.md)
## Tests
Locally: `make test-image` && `make check-in-container`
CI: [Zuul](.zuul.yaml)