mfocko / hardly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hardly

Build Status black pre-commit

Code for (Celery) worker used in our "Stream service". It reuses packit-service's worker code and implements new jobs as new handlers.

Workflow

The service is similar to Packit service, but is expected to eventually follow this workflow:

Must have:
  • If a user creates a merge-request on the source-git repository:
    • Create a matching merge-request to the dist-git repository.
    • Sync the CI results from the dist-git merge-request to the source-git merge-request.
  • If the dist-git is updated, update the source-git repository by opening a PR.
  • User is able to convert source-git change to the dist-git change locally via CLI.
Should have:
  • If the source-git merge-request is updated, update the dist-git merge-request.
  • 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 we have a docker-compose.yml for fast prototyping.

It expects, that you have:

  • .env.fedora-source-git or 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 for the other settings. Once you have it running (and see no errors), you can test (uses HTTPie) 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 and:

  1. create the variable files in vars/stream/
  2. link secrets into secrets / stream/{prod|stg}
  3. SERVICE={fedora-source-git|stream} DEPLOYMENT={deployment} make deploy

Image

The image is currently based on the packit-worker image 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 to Quay.io whenever you push to main. Or you can rebuild manually in Actions.

Actual deployments

Tests

Locally: make test-image && make check-in-container

CI: Zuul

About

License:MIT License


Languages

Language:Python 91.5%Language:Makefile 4.2%Language:Dockerfile 2.7%Language:Shell 1.6%