Package: kiwitcms-github-app
IntroductionThis package provides the GitHub App integration forKiwi TCMS Enterpriseand is designed to work only for multi-tenant environments!
You don’t need this add-on in order to run Kiwi TCMS without extended
GitHub integration!Communication from GitHub to this plugin is via webhooks.Plugin behavior:Auto-configure which tenant to use for database operations, either
‘public’ or a single private tenant to which user has access.If unable to auto-configure display warning and redirect to configuration
page once the GitHub account who installed this integration onto their
GitHub repository logs into Kiwi TCMSExisting & newly created repositories are added as products in Kiwi TCMSBugSystem records are automatically configured for repositoriesFork repositories are skippedNewly created git tags are added as product versions in Kiwi TCMSSeeIssuesfor other ideas!Installationpip install kiwitcms-github-appinside Kiwi TCMS’s docker image and make sure the following settings are configured:AUTHENTICATION_BACKENDS = [
    'social_core.backends.github.GithubAppAuth',
    ...
]
SOCIAL_AUTH_GITHUB_APP_KEY = 'xxxxxx'
SOCIAL_AUTH_GITHUB_APP_SECRET = 'yyy'
KIWI_GITHUB_APP_SECRET = b'your-webhook-secret'
KIWI_GITHUB_APP_ID = 123456
KIWI_GITHUB_APP_PRIVATE_KEY = """-----BEGIN RSA PRIVATE KEY-----
+++++++++base64-encoded-private-key+++++++
-----END RSA PRIVATE KEY-----"""everything else will be taken care for by Kiwi TCMS plugin loading code!GitHub App configurationThis plugin needs an existing GitHub App application with the following
configuration:User authorization callback URL:https://tcms.example.com/complete/github-app/Request user authorization (OAuth) during installation - TrueWebhook Active - TrueWebhook URL -https://tcms.example.com/kiwitcms_github_app/webhook/Webhook Secret - <the value of KIWI_GITHUB_APP_SECRET>SSL verification - EnabledThen configure how the application interacts with GitHub:Repository permissions:Contents: Read-onlyIssues: Read & write (required for 1-click bug report on private repos)Metadata: Read-onlyUser permissions:Email addresses: Read-onlySubscribe to events:MetaCreateRepositoryChangelogv1.6.0 (15 Jan 2024)1-click bug report will now useexecution.build.version.productinstead
ofexecution.run.plan.productfollowing changes in Kiwi TCMS, see:
<https://github.com/kiwitcms/Kiwi/commit/48a33a71e664c8c3ed2ceb298b5f1e19d0bddb52>_
andPR #3439for more detailsRequire minimum version of several transitive dependencies,certifi>=2023.7.22,cryptography>=41.0.4,pyjwt>=2.4.0,requests>=2.31.0in order to minimize exposure to known security vulnerabilitiesBuild & test with Python 3.11Start testing with psycopg3Small updates around test jobs & CIv1.5.1 (28 Mar 2023)Unpin PyGithub dependencyAdd more testsv1.5.0 (24 Feb 2023)Refactor code so it works with PyGithub==1.58.0Remove PatchedGithubIntegration classAdd sanity tests for upstream/downstream interfaces for PyGithubv1.4.1 (13 Feb 2023)Adjust arguments for latest github.Github implementationRaise RuntimeError instead of Exceptionv1.4.0 (05 Sep 2022)Don’t ask user to configure GitHub App if they are not tenant owner. Breaks
an endless loop cycle in case tenant creation goes wrongSpecify 30 sec timeout for internal HTTP requestsImprovements to CIv1.3.3 (31 Jan 2022)Fix for GitHub exceptions. FixesKIWI-TCMS-HHv1.3.2 (05 Jan 2022)Don’t crash on 404 from GitHub. FixesKIWI-TCMS-EAWorkaround upstream <https://github.com/PyGithub/PyGithub/pull/2079>. FixesKIWI-TCMS-HDv1.3.1 (04 Oct 2021)Adjust 2 parameters for changes introduced in PyGithub 1.55v1.3.0 (14 Feb 2021)Migrate to Python 3.8Always test with the latest Kiwi TCMS versionAdjustments to the internal test suite now that Kiwi TCMS is available via
sourcePrevent crash ifuidfield is not a number to make it work with Keycloakv1.2.4 (14 Feb 2021)Don’t cause ISE in case of race conditions between webhooksFix ISE for existing Versionv1.2.3 (25 Jan 2021)Allow POST request (web hooks) without CSRF tokenv1.2.2 (08 Dec 2020)Update for newer PyGithubv1.2.1 (17 Sep 2020)Require login for views.Resync()v1.2 (13 Sep 2020)Adjusted to work with Django 3.1 and Kiwi TCMS > 8.6Replace deprecatedurl()withre_path()Migrate thepayloadfield to newermodels.JSONFieldtypeSettingPUBLIC_VIEWSis removed in Kiwi TCMS so remove the
automatic adjustmentMake error messages for missing AppInst more clearRemove redundant if condition in Resync()Update translation stringsUpdate documentation around GitHub permission requirements for
1-click bug reportv1.1 (05 Aug 2020)Add GitHub issue-tracker integration which authenticates as the installed app.
FixesIssue #25Configure BugSystem for new repos. FixesIssue #15Create Product & BugSystem records when installation_repositores change.
FixesIssue #21Trigger resync from GitHub via menu. FixesIssue #19Trigger resync from GitHub after AppInstallation is configured. FixesIssue #20Database: AddAppInstallation.settings_urlfieldLink to the correct URL for GitHub settings. FixesIssue #33Require user to be logged in for ApplicationEdit. FixesIssue #36Update translation stringsAdd more testsv1.0 (13 Apr 2020)Install settings overrides undertcms_settings_dir/(compatible with Kiwi TCMS v8.2 or later):does not needMIDDLEWAREandPUBLIC_VIEWSoverride anymoreRemoveGithubAppAuthbackend, shipped with social-auth-core v3.3.0Fix a redirect to use the correct name of our social_core backendv0.0.5 (19 Feb 2020)Address GitHub API deprecation not yet fixed in social-auth-corev0.0.4 (25 Dec 2019)Do not fail if product already existsDo not fail if repository doesn’t have descriptionSearch UserSocialAuth by uid and providerv0.0.1 (24 Dec 2019)initial release