From f32b03207683e5149cf2507c1d80b05bdd1ff477 Mon Sep 17 00:00:00 2001 From: Meni Yakove <441263+myakove@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:38:20 +0300 Subject: [PATCH] sync dev branch (#590) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update poetry-deps (#415) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * enable to run tox with specific python version * [pre-commit.ci] pre-commit autoupdate (#416) updates: - [github.com/astral-sh/ruff-pre-commit: v0.3.5 → v0.3.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.5...v0.3.7) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Release 1.0.28 * chore(deps): update poetry-deps (#417) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * welcome msg: add not supported retest in repository do not have any * poetry update * chore(deps): update poetry-deps (#419) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#420) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.29 * chore(deps): update poetry-deps (#421) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#422) updates: - [github.com/astral-sh/ruff-pre-commit: v0.3.7 → v0.4.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.7...v0.4.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * do not block merge if PR merked as mergable by github * User can set extra required labels to set PR as ca be merged (#424) * Release 1.0.30 * dockerfile add * Release 1.0.31 * chore(deps): update poetry-deps (#426) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * can-be-mrged: check if pr mergeable_state is clean * can-be-mrged: check if pr mergeable_state is clean * can-be-mrged: remove check if pr mergeable_state is clean * chore(deps): update poetry-deps (#430) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Fix reviewers per folders * chore(deps): update poetry-deps (#433) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#432) updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.1 → v0.4.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.1...v0.4.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Support create jira issues to track PR lifecycle (#428) * Support create jira issues to track PR lifecycle * Add color to Jira label * Add logs for jira actions * PR lifecycle in jira * Open story under epic if provided * Fix duplicate log filter * Update readme * jira: add repo name to title * Release 1.0.32 * parent_commiter should be commiter of last commit * chore(deps): update poetry-deps (#435) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency pyhelper-utils to ^0.0.14 (#434) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.33 * chore(deps): update poetry-deps (#437) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * add last_commiter var * set jira assignee only if user in jira mapping * chore(deps): update dependency pyhelper-utils to ^0.0.15 (#436) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Meni Yakove <441263+myakove@users.noreply.github.com> * Fix return in init * Release 1.0.34 * chore(deps): update poetry-deps (#438) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * set labels on private repos * set labels on private repos * set labels on private repos * Release 1.0.35 * check_if_can_be_merged: check only required runs (#439) * [pre-commit.ci] pre-commit autoupdate (#441) updates: - [github.com/Yelp/detect-secrets: v1.4.0 → v1.5.0](https://github.com/Yelp/detect-secrets/compare/v1.4.0...v1.5.0) - [github.com/astral-sh/ruff-pre-commit: v0.4.2 → v0.4.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.2...v0.4.3) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Release 1.0.36 * Fix fstring * Release 1.0.37 * chore(deps): update poetry-deps (#442) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#443) updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.3 → v0.4.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.3...v0.4.4) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Release 1.0.38 * fix push to pypi * poetry update * chore(deps): update dependency pyhelper-utils to ^0.0.17 (#444) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.39 * pypi: save dist dir as arg * Release 1.0.40 * chore(deps): update dependency pyhelper-utils to ^0.0.18 (#445) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix when no jira issue label * chore(deps): update dependency requests to v2.32.0 (#446) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency requests to v2.32.1 (#447) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.41 * set self.all_required_status_checks to [] in init * chore(deps): update dependency requests to v2.32.2 (#449) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency pyhelper-utils to ^0.0.19 (#448) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#450) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.42 * chore(deps): update poetry-deps (#452) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency pyhelper-utils to ^0.0.20 (#451) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.43 * chore(deps): update poetry-deps (#454) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency pyhelper-utils to ^0.0.21 (#453) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.44 * [pre-commit.ci] pre-commit autoupdate (#455) updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.4 → v0.4.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.4...v0.4.5) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Release 1.0.45 * chore(deps): update poetry-deps (#457) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * update renovate.json * chore(deps): update poetry-deps (#458) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#459) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#460) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * do not comment when unsuported label passed from the user * push container: push from main branch if pull request was merged * chore(deps): update poetry-deps (#461) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build container: checkout the right branch if PR is merged (#462) * build container: checkout the right branch if PR is merged * no-cache for merged PRs * Use uwsgi to run the app (#464) * Use uwsgi to run the app * Use uwsgi to run the app * Use uwsgi to run the app * Use uwsgi to run the app * Use uwsgi to run the app * [pre-commit.ci] pre-commit autoupdate (#466) updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.5 → v0.4.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.5...v0.4.7) - [github.com/gitleaks/gitleaks: v8.18.2 → v8.18.3](https://github.com/gitleaks/gitleaks/compare/v8.18.2...v8.18.3) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#467) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.46 * Fix upload to pypi * Fix upload to pypi * Fix upload to pypi * Release 1.0.47 * remove unused function skip_repo * Tox add unused-code check * remove commented lines * Release 1.0.48 * [pre-commit.ci] pre-commit autoupdate (#468) updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.4.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.7...v0.4.8) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Release 1.0.49 * Fix container release push * chore(deps): update poetry-deps (#469) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update poetry * update renovate file * chore(deps): update poetry-deps (#471) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Meni Yakove <441263+myakove@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#472) updates: - [github.com/PyCQA/flake8: 7.0.0 → 7.1.0](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.0) - [github.com/astral-sh/ruff-pre-commit: v0.4.8 → v0.4.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.8...v0.4.9) - [github.com/gitleaks/gitleaks: v8.18.3 → v8.18.4](https://github.com/gitleaks/gitleaks/compare/v8.18.3...v8.18.4) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#473) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * log success when test run success (#474) * Release 1.0.50 * chore(deps): update poetry-deps (#476) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#477) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * delete pr tag on merge/close of a pr (#478) * delete pr tag on merge/close of a pr * updates based on review comments * fixing some commands * determine registry url from container_repository value * address review comment * update based on comments received * remove verify_stderr * updates * [pre-commit.ci] pre-commit autoupdate (#479) updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.9 → v0.4.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.9...v0.4.10) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Release 1.0.51 * remove sonarcload workflow * Move to using FastAPI (#480) * Move to using FastAPI * update post function * remove label module * add missing host and port * Fix request type * remove uneeded code * Fix logger calls --------- Co-authored-by: rnetser * delete_remote_tag_for_merged_or_closed_pr: run only when repo have container * Fix delete pr cintainer tag when merged/closed * Fix delete pr container tag when merged/closed * Release 1.0.52 * support log file * add some typing, fix delete tag * chore(deps): update poetry-deps (#482) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.53 * Fix delete tag * create webhhok: remove duplicate log * [pre-commit.ci] pre-commit autoupdate (#483) updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.10 → v0.5.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.10...v0.5.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Meni Yakove <441263+myakove@users.noreply.github.com> * Add more typing * Add future in branch protection (#484) * Use future in branch protection * fix arg * fix arg * unused * unused remove * update sleep * chore(deps): update poetry-deps (#488) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.54 * Add Typing (#486) * Add typing * Add typing * fix type * remove DockerHub * ad mypy * update return type * update return type * More typing * More typing * More typing * More typing * More typing * update return type * update return type * More typing * More typing * More typing * Remove can be merged lable when check failed * Fix call check_run process * improve check if can be merged * improve process pull request speed * add pr number to log when check run reset to queued on startup * pass log to get_future_results * Fix delete tag for merged PR * Set log warn when set check run to queued * update poetry * Fix add reviewers * Fix add reviewers * fix release for container * fix release for container * fix release for container --------- Co-authored-by: Meni Yakove * Release 1.0.55 * move process to function (#490) * move process to function * improve can_be_mrged calls * chore(deps): update poetry-deps (#489) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#492) updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.0 → v0.5.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.0...v0.5.1) - [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.10.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.0...v1.10.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Add comment when reviewer failed to be added (#493) * Add command arguments to the build-and-push-container (#495) * Add command arguments to the build-and-push-container * Podman fix * chore(deps): update poetry-deps (#496) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#499) updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.1 → v0.5.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.1...v0.5.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Set approve label only if reviewer is part of approvers (#497) * Set approve label only if reviewer is part of approvers * Update the readme * Add missing typing * Fix missing {} in fstring * Fix missing {} in fstring * fix can be merged check * Add support to pass log level * Fix where is no last commiter in commit (#501) * chore(deps): update poetry-deps (#500) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.56 * chore(deps): update poetry-deps (#505) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#506) updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.2 → v0.5.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.2...v0.5.4) - [github.com/pre-commit/mirrors-mypy: v1.10.1 → v1.11.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.1...v1.11.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * ProcessGithubWehook: do not use @ignore_exceptions (#503) * ProcessGithubWehook: do not use @ignore_exceptions * fail if any exeption in from process() * remove @ignore_exceptions from all files * fix some typing * Improve logging (#507) * Improve logging * Add color to repository name in the log * Add color to repository name in the log * convert some logger info to debug * convert some logger info to debug * Function to get logger * Function to get logger * More logging debug * log api rate only if below minimum * More debug logs * Use string-color for log_prefix * Use string-color for log_prefix * Use string-color for log_prefix * Use string-color for log_prefix * Use string-color for log_prefix * Use string-color for log_prefix * Use string-color for log_prefix * Use string-color for log_prefix * Use string-color for log_prefix * always read config when creating logger to support switch levels without restart * Try to fix log console colors * Update example config * set wip label based on title (#509) * wip label - add missing f-string (#511) * Release 1.0.57 * chore(deps): update poetry-deps (#513) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#514) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.58 * chore(deps): update poetry-deps (#515) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update tox configuration to run tests based on pull request parent branch * Release 1.0.59 * chore(deps): update poetry-deps (#516) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Fix remove lgtm by on pr sync * Set log file zise to 10mb * [pre-commit.ci] pre-commit autoupdate (#517) updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.4 → v0.5.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.4...v0.5.5) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Extract some code to function (#518) * Extract some code to function * Improve error msg of build and push container command * No limit log file size * Log file zise set to 50MB * fix check if user command supported * fix check if user command supported * Rename _process_verified to more clrean name * log file, no size limi * Improve no ready to merged output * Use one logger for all * Fix BUILD_AND_PUSH_CONTAINER_STR user command * Fix BUILD_AND_PUSH_CONTAINER_STR user command * Fix BUILD_AND_PUSH_CONTAINER_STR user command * chore(deps): update poetry-deps (#520) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#522) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#523) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Extract to functions, run in parallel (#524) * Extract to functions, run in parallel * Extract to functions, run in parallel * Extract to functions, run in parallel * Remove time loggers * [pre-commit.ci] pre-commit autoupdate (#526) updates: - [github.com/PyCQA/flake8: 7.1.0 → 7.1.1](https://github.com/PyCQA/flake8/compare/7.1.0...7.1.1) - [github.com/astral-sh/ruff-pre-commit: v0.5.5 → v0.5.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.5...v0.5.6) - [github.com/pre-commit/mirrors-mypy: v1.11.0 → v1.11.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.0...v1.11.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#527) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Fix mypy pre-commit types deps issues * chore(deps): update poetry-deps (#528) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Remove unused code (#529) * Release 1.0.60 * chore(deps): update poetry-deps (#531) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#532) updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.6 → v0.5.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.6...v0.5.7) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#533) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#534) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.61 * chore(deps): update poetry-deps (#535) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.62 * chore(deps): update poetry-deps (#536) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#538) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#537) updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.7 → v0.6.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.7...v0.6.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * run rm -rf /run/containers/storage /run/libpod on server start * chore(deps): update poetry-deps (#539) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * add back k3d to the container * Add docker to the container (#540) * chore(deps): update poetry-deps (#542) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#543) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#544) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#545) updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.1 → v0.6.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.1...v0.6.2) - [github.com/pre-commit/mirrors-mypy: v1.11.1 → v1.11.2](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.1...v1.11.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Release 1.0.63 * chore(deps): update poetry-deps (#546) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.64 * chore(deps): update poetry-deps (#547) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.65 * [pre-commit.ci] pre-commit autoupdate (#548) updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.2 → v0.6.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.2...v0.6.3) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#549) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#550) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#551) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#552) updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.3 → v0.6.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.3...v0.6.4) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#553) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#554) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#556) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#557) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Only approvers should be able to set `hold` lable on PR (#558) * Release 1.0.66 * chore(deps): update poetry-deps (#560) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#561) updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.4 → v0.6.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.4...v0.6.5) - [github.com/gitleaks/gitleaks: v8.18.4 → v8.19.2](https://github.com/gitleaks/gitleaks/compare/v8.18.4...v8.19.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#562) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Release 1.0.67 * chore(deps): update poetry-deps (#563) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * update poetry * chore(deps): update poetry-deps (#564) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(github_api): refactor size label calculation (#565) * chore(deps): update poetry-deps (#567) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#569) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#568) updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.5 → v0.6.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.5...v0.6.7) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Add simple test for `get_size` (#570) * Add simple test for `get_size` * Add simple test for `get_size` * fix type * Fix config path for test when running inside container * revert config path for tests * add config.yaml for tests * fix typo * chore(deps): update poetry-deps (#572) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#573) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * remove k3d from dockerfile * Set PR as auto-merge when commiter is part of auth-merged users (#574) * fix pre-commit mypy exlude regex * [pre-commit.ci] pre-commit autoupdate (#576) updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.7 → v0.6.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.7...v0.6.8) - [github.com/gitleaks/gitleaks: v8.19.2 → v8.19.3](https://github.com/gitleaks/gitleaks/compare/v8.19.2...v8.19.3) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Release 1.0.68 * chore(deps): update poetry-deps (#577) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update poetry-deps (#578) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#581) updates: - [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.6.0...v5.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.6.8 → v0.6.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.8...v0.6.9) - [github.com/gitleaks/gitleaks: v8.19.3 → v8.20.1](https://github.com/gitleaks/gitleaks/compare/v8.19.3...v8.20.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Run check if can be merged when hold label is add/removed (#582) * check if pr is already set to auto merge before enable (#586) * check if pr is already set to automerge before enable * do not raise if label not exists in remove label * set_pull_request_automerge: do not fail on exception * use `uv` instead of `poetry` (#579) * use `uv` only to manage project install and exeute * Fix dockerfile PATH * Fix dockerfile $PATH * tox: use uv * remove poetry.lock * Add YAML $schema file * Add YAML $schema file to example config --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Debarati Basu-Nag Co-authored-by: rnetser Co-authored-by: Jenia Peimer <86722603+jpeimer@users.noreply.github.com> --- .github/workflows/build.yml | 20 - .gitignore | 5 +- .pre-commit-config.yaml | 92 +- Dockerfile | 53 +- README.md | 229 +- VERSION | 2 +- docker-compose-example.yaml | 13 +- entrypoint.sh | 17 + example.config.yaml | 44 +- poetry.lock | 1918 ----------------- pyproject.toml | 81 +- renovate.json | 2 +- tox.ini | 14 +- uv.lock | 1470 +++++++++++++ webhook_server_container/app.py | 120 +- webhook_server_container/config/schema.yaml | 150 ++ webhook_server_container/libs/config.py | 18 +- webhook_server_container/libs/github_api.py | 1823 ++++++++++------ webhook_server_container/libs/jira_api.py | 55 + .../tests/manifests/config.yaml | 92 + .../tests/test_github_api.py | 52 + webhook_server_container/utils/constants.py | 96 +- .../utils/dockerhub_rate_limit.py | 52 - .../utils/github_repository_settings.py | 310 ++- webhook_server_container/utils/helpers.py | 169 +- webhook_server_container/utils/webhook.py | 75 +- 26 files changed, 3784 insertions(+), 3188 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100755 entrypoint.sh delete mode 100644 poetry.lock create mode 100644 uv.lock create mode 100644 webhook_server_container/config/schema.yaml create mode 100644 webhook_server_container/libs/jira_api.py create mode 100644 webhook_server_container/tests/manifests/config.yaml create mode 100644 webhook_server_container/tests/test_github_api.py delete mode 100644 webhook_server_container/utils/dockerhub_rate_limit.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index d15d87e9..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Build -on: - push: - branches: - - main - pull_request: - types: [opened, synchronize, reopened] -jobs: - sonarcloud: - name: SonarCloud - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.gitignore b/.gitignore index 09628947..3de11f24 100644 --- a/.gitignore +++ b/.gitignore @@ -139,10 +139,11 @@ dmypy.json cython_debug/ # App -config.yaml +/config.yaml docker-compose.yaml github-webhook-server.json -config-dev.yaml +/config-dev.yaml local-run.sh .scannerwork/ webhook-server.private-key.pem +log-colors.json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 806b3f22..aee9052c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,51 +1,59 @@ --- default_language_version: - python: python3 + python: python3 repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 - hooks: - - id: check-added-large-files - - id: check-docstring-first - - id: check-executables-have-shebangs - - id: check-merge-conflict - - id: check-symlinks - - id: detect-private-key - - id: mixed-line-ending - - id: debug-statements - - id: trailing-whitespace - args: [--markdown-linebreak-ext=md] # Do not process Markdown files. - - id: end-of-file-fixer - - id: check-ast - - id: check-builtin-literals - - id: check-docstring-first - - id: check-toml + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-added-large-files + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-symlinks + - id: detect-private-key + - id: mixed-line-ending + - id: debug-statements + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] # Do not process Markdown files. + - id: end-of-file-fixer + - id: check-ast + - id: check-builtin-literals + - id: check-docstring-first + - id: check-toml - - repo: https://github.com/PyCQA/flake8 - rev: 7.0.0 - hooks: - - id: flake8 - args: [--config=.flake8] - additional_dependencies: [git+https://github.com/RedHatQE/flake8-plugins.git, flake8-mutable] + - repo: https://github.com/PyCQA/flake8 + rev: 7.1.1 + hooks: + - id: flake8 + args: [--config=.flake8] + additional_dependencies: + [git+https://github.com/RedHatQE/flake8-plugins.git, flake8-mutable] - - repo: https://github.com/Yelp/detect-secrets - rev: v1.4.0 - hooks: - - id: detect-secrets + - repo: https://github.com/Yelp/detect-secrets + rev: v1.5.0 + hooks: + - id: detect-secrets - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.4 - hooks: - - id: ruff - - id: ruff-format + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.9 + hooks: + - id: ruff + - id: ruff-format - - repo: https://github.com/gitleaks/gitleaks - rev: v8.18.2 - hooks: - - id: gitleaks + - repo: https://github.com/gitleaks/gitleaks + rev: v8.20.0 + hooks: + - id: gitleaks - - repo: https://github.com/iamthefij/docker-pre-commit - rev: v3.0.1 - hooks: - - id: docker-compose-check + - repo: https://github.com/iamthefij/docker-pre-commit + rev: v3.0.1 + hooks: + - id: docker-compose-check + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.11.2 + hooks: + - id: mypy + exclude: (tests/) + additional_dependencies: [types-requests, types-PyYAML] diff --git a/Dockerfile b/Dockerfile index 24f8fbc6..851a716f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,48 @@ FROM quay.io/podman/stable:latest EXPOSE 5000 -RUN dnf -y update \ - && dnf -y install python3.8 python3.9 python3.10 python3.11 python3.12 python3-pip git hub unzip libcurl-devel \ +RUN dnf -y install dnf-plugins-core \ + && dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo \ + && dnf -y update \ + && dnf -y install python3.8 \ + python3.9 \ + python3.10 \ + python3.11 \ + python3.12 \ + python3-pip \ + git \ + hub \ + unzip \ + libcurl-devel \ + gcc \ + python3-devel \ + libffi-devel \ + docker-ce \ + docker-ce-cli \ + containerd.io \ + docker-buildx-plugin \ + docker-compose-plugin \ && dnf clean all \ && rm -rf /var/cache /var/log/dnf* /var/log/yum.* ENV USER_BIN_DIR="/root/.local/bin" +ENV UV_INSTALL_DIR="/root/.local" +ENV PATH="$PATH:$USER_BIN_DIR" + ENV DATA_DIR=/webhook_server ENV APP_DIR=/github-webhook-server -ENV PATH="$USER_BIN_DIR:$PATH" RUN mkdir -p $USER_BIN_DIR \ && mkdir -p $DATA_DIR \ && mkdir -p $DATA_DIR/logs \ && mkdir -p /tmp/containers +# Download the latest uv installer +RUN curl -sSL https://astral.sh/uv/install.sh -o /tmp/uv-installer.sh \ + && sh /tmp/uv-installer.sh \ + && rm /tmp/uv-installer.sh + RUN set -x \ - && curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash \ && curl https://mirror.openshift.com/pub/openshift-v4/clients/rosa/latest/rosa-linux.tar.gz --output /tmp/rosa-linux.tar.gz \ && tar xvf /tmp/rosa-linux.tar.gz --no-same-owner \ && mv rosa $USER_BIN_DIR/rosa \ @@ -29,15 +54,21 @@ RUN ln -s /usr/bin/python3 /usr/bin/python RUN python -m pip install --no-cache-dir pip --upgrade \ && python -m pip install --no-cache-dir poetry tox twine pre-commit -COPY pyproject.toml poetry.lock README.md $APP_DIR/ +RUN python3.8 -m ensurepip \ + && python3.9 -m ensurepip \ + && python3.10 -m ensurepip \ + && python3.11 -m ensurepip \ + && python3.12 -m ensurepip \ + && python3.8 -m pip install tox \ + && python3.9 -m pip install tox \ + && python3.10 -m pip install tox \ + && python3.11 -m pip install tox \ + && python3.12 -m pip install tox + +COPY entrypoint.sh pyproject.toml uv.lock README.md $APP_DIR/ COPY webhook_server_container $APP_DIR/webhook_server_container/ WORKDIR $APP_DIR -RUN poetry config cache-dir $APP_DIR \ - && poetry config virtualenvs.in-project true \ - && poetry config installer.max-workers 10 \ - && poetry install - HEALTHCHECK CMD curl --fail http://127.0.0.1:5000/webhook_server/healthcheck || exit 1 -ENTRYPOINT ["poetry", "run", "python3", "webhook_server_container/app.py"] +ENTRYPOINT ["./entrypoint.sh"] diff --git a/README.md b/README.md index 93f778e1..06323291 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,47 @@ # github-webhook-server -A Flask-based webhook server for managing GitHub repositories. It handles tasks such as repository setup, branch protection, and webhook configuration. +A [FastAPI-based](https://fastapi.tiangolo.com) webhook server for managing GitHub pull requests workflow. and manage repositories. + +## Overview + +The tool will manage the following: + +###### Repositories + +- Configure repositories setting +- Configure branch protection +- Set itself as webhook for the repository +- Add missing lables to the repository + +###### Pull requests + +- Add reviewers from OWNER file +- Manage pull requests labels +- Check when the pull request is ready to be merged +- Build container from Dockerfile when pull request is merged +- Build container from Dockerfile when new release is pushed +- Push new release to PyPI when new release is pushed +- Open an issue for each pull request +- Add pull request size label + +###### Available user actions + +- Mark pull request as WIP by comment /wip to the pull request, To remove it from the pull request comment /wip cancel to the pull request. +- Block merging of pull request by comment /hold, To un-block merging of pull request comment /hold cancel. +- Mark pull request as verified by comment /verified to the pull request, to un-verify comment /verified cancel to the pull request. + - verified label removed on each new commit push. +- Cherry pick a merged pull request comment /cherry-pick in the pull request. + - Multiple target branches can be cherry-picked, separated by spaces. (/cherry-pick branch1 branch2) + - Cherry-pick will be started when pull request is merged +- Build and push container image command /build-and-push-container in the pull request (tag will be the pull request number). + - You can add extra args to the Podman build command + - Example: /build-and-push-container --build-arg OPENSHIFT_PYTHON_WRAPPER_COMMIT= +- Add a label by comment use /