-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #354 from lsst-sqre/tickets/DM-44635/nicer-github-…
…integration-config DM-44635: Nicer GitHub integration config
- Loading branch information
Showing
34 changed files
with
1,056 additions
and
927 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
changelog.d/20240711_095604_danfuchs_nicer_github_integration_config.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!-- Delete the sections that don't apply --> | ||
|
||
### Backwards-incompatible changes | ||
|
||
- GitHub CI and refresh app config are now each a separate, all-or-nothing set of config that comes from a mix of a yaml file and env vars. This requires some new and different Helm values in Phalanx (see https://mobu.lsst.io/operations/github_ci_app.html#add-phalanx-configuration) | ||
- The GitHub CI app now takes the scopes it assigns from config values, rather than hardcoding a list of scopes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
###################################### | ||
Adding a new GitHub CI app integration | ||
###################################### | ||
|
||
|
||
Create a new GitHub app | ||
======================= | ||
|
||
#. Click the ``New GitHub App`` button in the `lsst-sqre org Developer Settings apps page <https://github.com/organizations/lsst-sqre/settings/apps>`__. | ||
#. Name it :samp:`mobu CI ({env URL or id if the URL is too long})`. | ||
#. Make sure the ``Active`` checkbox is checked in the ``Webhook`` section. | ||
#. Enter :samp:`https://{env URL}/mobu/github/ci/webhook` in the :guilabel:`Webhook URL` input. | ||
#. Generate a strong password to use as the webhook secret. | ||
#. Store this in the ``SQuaRE`` vault in the ``LSST IT`` 1Password account in an ``Server`` item named :samp:`mobu ({env URL})` in a ``password`` field named ``mobu-github-ci-app-webhook-secret``. | ||
#. Get this into the Phalanx secret store for that env under the key: ``github-ci-app-webhook-secret`` (`this process <https://phalanx.lsst.io/admin/add-new-secret.html>`__ is different for different envs). | ||
#. Enter this secret in the :guilabel:`Webhook secret (optional)` box in the GitHub App config. | ||
#. Select :menuselection:`Read and Write` in the dropdown of the :guilabel:`Checks` access category in the :guilabel:`Repository Permissions` section. | ||
#. Select :menuselection:`Read-only` in the dropdown of the :guilabel:`Contents` access category in the :guilabel:`Repository Permissions` section. | ||
#. Check the :guilabel:`Check suite` and :guilabel:`Check run` checkboxes in the :guilabel:`Subscribe to events` section. | ||
#. Select the :guilabel:`Any account` radio button in the :guilabel:`Where can this GitHub App be installed?` section. | ||
#. Click the :guilabel:`Create GitHub App` button. | ||
#. Find the :guilabel:`App ID` (an integer) in the :guilabel:`About` section. Get this into the Phalanx secret store for that env under the key: ``github-ci-app-id`` (`this process <https://phalanx.lsst.io/admin/add-new-secret.html>`__ is different for different envs). | ||
#. Click the :guilabel:`Generate a private key` button in the :guilabel:`Private keys` section. | ||
#. Store this private key in the same :samp:`mobu ({env URL})` item in a ``text`` key called ``github-mobu-ci-app-private-key``. | ||
#. Get this into the Phalanx secret store for that env under the key: ``github-ci-app-private-key`` (`this process <https://phalanx.lsst.io/admin/add-new-secret.html>`__ is different for different envs). | ||
|
||
Install the app for a repo | ||
========================== | ||
|
||
#. Go to new app’s homepage (something like https://github.com/apps/mobu-refresh-usdfdev). | ||
#. Click the :guilabel:`Install` button. | ||
#. Select the :guilabel:`Only select repositories` radio button. | ||
#. Select the repo in the dropdown. | ||
#. Click :guilabel:`Install`. | ||
|
||
Add Phalanx configuration | ||
========================= | ||
In :samp:`applications/mobu/values-{env}.yaml`, add a ``config.githubCiApp`` value: | ||
|
||
.. code:: yaml | ||
config: | ||
github: | ||
acceptedGithubOrgs: | ||
- lsst-sqre | ||
users: | ||
- username: "bot-mobu-ci-user-1" | ||
uidnumber: 123 | ||
gidnumber: 456 | ||
- username: "bot-mobu-ci-user-2" | ||
uidnumber: 789 | ||
gidnumber: 876 | ||
scopes: | ||
- "exec:notebook" | ||
- "exec:portal" | ||
- "read:image" | ||
- "read:tap" | ||
All items are required. | ||
|
||
``accepted_github_orgs`` | ||
A list of GitHub organizations from which this instance of Mobu will accept webhook requests. | ||
Webhook requests from any orgs not in this list will get a ``403`` response. | ||
|
||
``users`` | ||
Follows the same rules as the ``users`` list in a flock autostart config. | ||
The usernames must all start with ``bot-mobu``. | ||
In envs with Firestore integration, you only need to specify ``username``. | ||
In envs without it, you need to ensure that users are manually provisioned, and then you need all three of ``username``, ``uidnumber``, and ``gidnumber``. | ||
|
||
``scopes`` | ||
A list of `Gafaelfawr scopes <https://dmtn-235.lsst.io/#current-scopes>`__ to grant to the users running in the monkeys started from GitHub CI checks. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
########################################### | ||
Adding a new GitHub Refresh app integration | ||
########################################### | ||
|
||
Adding the GitHub refresh app integration to a new environment requires configuring things in GitHub and Phalanx. | ||
|
||
Create a new GitHub app | ||
======================= | ||
|
||
|
||
#. Click the ``New GitHub App`` button in the `lsst-sqre org Developer Settings apps page <https://github.com/organizations/lsst-sqre/settings/apps>`__. | ||
#. Name it :samp:`mobu refresh ({env URL or id if the URL is too long})`. | ||
#. Make sure the :guilabel:`Active` checkbox is checked in the :guilabel:`Webhook` section. | ||
#. Enter :samp:`https://{env URL}/mobu/github/refresh/webhook` in the :guilabel:`Webhook URL` input. | ||
#. Generate a strong password to use as the webhook secret. | ||
#. Store this in the ``SQuaRE`` vault in the ``LSST IT`` 1Password account in an ``Server`` item named :samp:`mobu ({env URL})` in a ``password`` field called ``github-refresh-app-webhook-secret``. | ||
#. Get this into the Phalanx secret store for that env under the key: ``github-refresh-app-webhook-secret`` (`this process <https://phalanx.lsst.io/admin/add-new-secret.html>`__ is different for different envs). | ||
#. Enter this secret in the :guilabel:`Webhook secret (optional)` box in the GitHub App config. | ||
#. Select :menuselection:`Read and Write` in the dropdown of the :guilabel:`Checks` access category in the :guilabel:`Repository Permissions` section. | ||
#. Select :menuselection:`Read-only` in the dropdown of the :guilabel:`Contents` access category in the :guilabel:`Repository Permissions` section. | ||
#. Check the :guilabel:`Check suite` and :guilabel:`Check run` checkboxes in the :guilabel:`Subscribe to events` section. | ||
#. Select the :guilabel:`Any account` radio button in the :guilabel:`Where can this GitHub App be installed?` section. | ||
#. Click the :guilabel:`Create GitHub App` button. | ||
|
||
Install the app for a repo | ||
========================== | ||
|
||
#. Go to new app’s homepage (something like https://github.com/apps/mobu-refresh-usdfdev). | ||
#. Click the :guilabel:`Install` button. | ||
#. Select the :guilabel:`Only select repositories` radio button. | ||
#. Select the repo in the dropdown. | ||
#. Click :guilabel:`Install`. | ||
|
||
Add Phalanx configuration | ||
========================= | ||
In :samp:`applications/mobu/values-{env}.yaml`, add a ``config.githubRefreshApp`` value: | ||
|
||
.. code:: yaml | ||
config: | ||
githubRefreshApp: | ||
acceptedGithubOrgs: | ||
- lsst-sqre | ||
All of these items are required. | ||
|
||
``accepted_github_orgs`` | ||
A list of GitHub organizations from which this instance of Mobu will accept webhook requests. | ||
Webhook requests from any orgs not in this list will get a ``403`` response. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.