{"id":21273262,"url":"https://github.com/sclorg/betka","last_synced_at":"2025-07-11T06:33:02.116Z","repository":{"id":37929915,"uuid":"246528601","full_name":"sclorg/betka","owner":"sclorg","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-18T13:39:02.000Z","size":462,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-18T15:15:04.405Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sclorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-11T09:29:39.000Z","updated_at":"2024-11-18T13:39:06.000Z","dependencies_parsed_at":"2023-02-09T11:47:36.322Z","dependency_job_id":"b66dad90-aae6-4ff6-a6eb-c7a15fcb0027","html_url":"https://github.com/sclorg/betka","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sclorg%2Fbetka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sclorg%2Fbetka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sclorg%2Fbetka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sclorg%2Fbetka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sclorg","download_url":"https://codeload.github.com/sclorg/betka/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225700924,"owners_count":17510448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T09:13:14.687Z","updated_at":"2024-11-21T09:13:15.167Z","avatar_url":"https://github.com/sclorg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Betka\n\n[![Docker Repository on Quay](https://quay.io/repository/rhscl/betka/status \"Docker Repository on Quay\")](https://quay.io/repository/rhscl/betka)\n\n## Why Betka (name)?\n\nBetka is a familar name for [Alžběta](https://cs.wikipedia.org/wiki/Al%C5%BEb%C4%9Bta) ([Elizabeth](https://en.wikipedia.org/wiki/Elizabeth) in English).\nBetka is a nice lady you can meet at a local store or while walking a dog.\nShe's pleasant to talk to and is always smiling.\n\n## What is Betka?\n\nBetka syncs changes from upstream repository to downstream the way you ask her to\n(e.g. whenever anything changes in upstream, or just specific commits).\n\n### Betka main configuration file\n\nMain betka's configuration file looks like:\n\n```yaml\nname: Fedora configuration file for betka.\n\ndist_git_repos:\n  s2i-base:\n    - https://github.com/sclorg/s2i-base-container\n  s2i-core:\n    - https://github.com/sclorg/s2i-base-container\n  python3:\n    - https://github.com/sclorg/s2i-python-container\n\nmaster_commit_message: \"Upstream master commit hash {hash}\"\ndownstream_master_msg: \"[betka-master-sync]\"\ndownstream_pr_msg: \"[betka-pr-sync]\"\n```\n\nwhere keys mean:\n- `dist_git_repos` ... references to Fedora Pagure repositories, e.g. https://src.fedoraproject.org/container/s2i-base\n- `downstream_master_msg` ... title message for PR related to master sync\n- `downstream_pr_msg` ... title message for PR related to PR sync\n\n### Betka downstream configuration file\n\nOnce betka is started, it loads specified downstream repositories and checks\nif a branch used for syncing contains `bot-cfg.yml` configuration file.\n\nThis downstream configuration file looks like:\n\n```yaml\nversion: \"1\"\n\nupstream-to-downstream:\n  # is betka enabled for this repository\n  # optional - defaults to false\n  enabled: true\n\n  # optional\n  notifications:\n    email_addresses: [phracek@redhat.com]\n\n  # Specify if master branch in upstream repository is synced\n  master_checker: true\n  # Should pull requests be synced?\n  # optional\n  pr_checker: false\n  # Either 'upstream_branch_name' or 'upstream_git_path' has to be specified\n  # Branch name which is used for sync\n  upstream_branch_name: master\n  # Path to directory with dockerfile withing upstream repository\n  upstream_git_path: \"2.4\"\n  # Github comment message to enforce sync of a pull request\n  # required if pr_checker is true otherwise optional\n  pr_comment_message: \"[test]\"\n  # URL to an image used for dist-git source generation.\n  # optional\n  image_url: docker.io/rhscl/dist-git-generator\n\n```\n\nwhere keys mean:\n- `enabled` ... if sync is enabled generally\n- `master_checker` ... sync of master branch is enabled\n- `pr_checker` ... sync of upstream pull requests is enabled\n- `pr_comment_message` ... pull request message on which PR is synced into downstream PR\n- `upstream_git_path` ... path to directory with dockerfile within upstream repository\n- `upstream_branch_name` ... repository branch with dockerfile within upstream repository\n- `image_url` ... docker image used for generation source into downstream repository.\n\n\n## Betka's workflow\nThese are steps how betka works.\n- loads main configuration file\n- clones specific downstream repository\n- checks if downstream branches, in dist-git repository, contain specific configuration file `bot-cfg.yml`\n- parses `bot-cfg.yml` file and checks if some of checks like `master_checker` or `pr_checker` are allowed\n\n### master_checker\n- if `master_checker` is enabled, then it checks `master` upstream repository branch for new commits\n    - clones upstream repository in case of new commit and configuration file contains `master_checker` flag\n    - syncs files from upstream into downstream specific branch\n    - fills a pull request into Internal Pagure instance `src.fedoraproject.org` if pull request does not exist yet\n    - updates specific pull request in Internal Pagure instance\n\n### pr_checker\n- if `pr_checker` is enabled, then it checks all pull requests in upstream repository\n    - syncs files from upstream into downstream specific branch\n    - clones upstream repository in case of new commit and configuration file contains `pr_checker` flag\n    - If specific downstream pull request does not exist yet, then it's created from the upstream pull request\n    - If specific downstream pull request already exists, then it's updated\n\n## Requirements\n\nIn order to run betka, some requirements are needed:\n- `Pagure API token` ... for creating Pull Request and working with repositories.\nGet the token from https://src.fedoraproject.org/settings#nav-basic-tab\n- `GitHub API token` ... for getting information from upstream repositories.\nGet the token from https://github.com/settings/tokens\n\nFor local development we use docker-compose, so you have to install it first.\nIts configuration file, [docker-compose.yml](docker-compose.yml), sources `secrets.env`.\nThere's a [secrets.env.template](secrets.env.template) file, which you have to copy to `secrets.env`\nand fill in the values there!\n\n## How to start betka\n\n```\nmake run\n```\n\nYour SSH keys (`${HOME}/.ssh/*`) will be mounted to `/home/betka/.ssh` directory inside container.\n\n## How to test betka locally in OpenShift (this is outdated, needs update)\n\nIn order to run betka locally, some requirements are needed:\n- package `origin-clients` has to be installed, if image configuration file contains variable `image_url`\n- build image with `make build`\n- tag image with `docker tag docker.io/rhscl/betka docker.io/rhscl/betka:git-HASH` (use random HASH)\n- update image tag in `openshift/old/tpl-betka-deployment.yaml` with HASH\n- run command `make oc-cluster-up-and-deploy` as root or with sudo command\n    - starts OpenShift cluster locally\n    - adds ServiceAccount and RoleBindings\n- Now start tests by command: `py.test-3 tests/test_openshift_pod.py`\n\nSee also [bots-deployment](https://github.com/user-cont/bots-deployment) repo.\n\n## User guide for image maintainers\n\n1. You need to contact us for adding your repository to the configuration of our instance of Betka.\n    - You can directly create PR with proper changes in\n    [betka.yaml](https://github.com/sclorg/betka/blob/master/betka-prod.yaml),\n    see [this section](https://github.com/sclorg/betka#betka-main-configuration-file) for more information.\n    - or you can contact us via `phracek@redhat.com` mailing list.\n2. Your upstream repository needs to have [fedmsg](https://github.com/fedora-infra/github2fedmsg) enabled.\n3. You need to have correct [bot-cfg.yml](https://github.com/sclorg/betka#betka-downstream-configuration-file)\nin your downstream repository.\n\n### Source generator used by betka\nIf you need to generate the sources for the downstream repository,\nuse your own source generation image, which you are responsible for.\nBetka provides two variables into your own source generation image:\n- `DOWNSTREAM_IMAGE_NAME` ... needed for `cwt` tool developed by SCL team\n(https://github.com/sclorg/container-workflow-tool) which is responsible for downstream sources generation.\n- `UPSTREAM_IMAGE_NAME` ... upstream sources name.`\n\nThe upstream sources in your image are stored in `/tmp/betka-generator/\u003cUPSTREAM_IMAGE_NAME\u003e`.\nE.g. `/tmp/betka-generator/mariadb-container` from https://github.com/sclorg/mariadb-container.\n\nGenerated sources to sync to downstream are then stored in `/tmp/betka-generator/\u003ctimestamp\u003e/results`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsclorg%2Fbetka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsclorg%2Fbetka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsclorg%2Fbetka/lists"}