Skip to content

Commit bca4a5f

Browse files
📝 update docs (#63)
Related to #16 * add details, fix wording, etc.
1 parent 10210be commit bca4a5f

6 files changed

Lines changed: 181 additions & 60 deletions

File tree

README.md

Lines changed: 7 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -19,71 +19,19 @@ Before submitting a new Feature request, please check existing open and closed I
1919

2020
```sh
2121
# Run the application in "dev" mode and watch for changes
22-
npm start
22+
npm run dev
2323
# Generate models from the openapi definition
2424
npm run openapi
2525
```
2626

27-
## Configuration File
27+
## Application Configuration
2828

29-
This service/Action requires that a configuration file be present in the `.github` repository of your GitHub Organization. An example of this is show below:
29+
🚧 Coming soon...
3030

31-
Filename: `team-sync-options.yaml`
32-
```yaml
33-
# This property is used to set the Owners of the Organization. Currently, this will NOT
34-
# remove anyone who was manually added as an Owner to the org.
35-
OrganizationOwnersGroup: Some_Org_Owner_Group
31+
## Per-Organization Configuration
3632

37-
# This property is used to control the addition of general Members to your Organization.
38-
OrganizationMembersGroup: Some_Group_To_Sync_For_Organization_Membership
33+
See [./docs/OrganizationConfiguration.md](./docs/OrganizationConfiguration.md) for further details!
3934

40-
# This property is used for syncing all other GitHub Teams. Please note that users must also
41-
# be a part of the `OrganizationMembersGroup` for the synchronization of the teams below to
42-
# function properly.
43-
# Note: this is a convenience property. The `Teams` property allows for more complex
44-
# setup of teams (i.e., display names and eventually parent/child relationships).
45-
GitHubTeamNames:
46-
- Some_Team_To_Sync
47-
- Some_Other_Team_To_Sync
35+
## Running the sync bot
4836

49-
# Allows Organizations to add their own Security Manager teams in addition to those set at
50-
# the app level.
51-
# Note: this property supports Display Names.
52-
AdditionalSecurityManagerGroups:
53-
- Name: Some_SecurityManager_Team
54-
- Name: Some_SecurityManager_Team_2
55-
DisplayName: Some Security Manager Team 2
56-
57-
# This property is used for syncing all other GitHub Teams. Please note that users must also
58-
# be a part of the `OrganizationMembersGroup` for the synchronization of the teams below to
59-
# function properly.
60-
# Note: this property supports Display Names.
61-
Teams:
62-
- Name: Some_Team
63-
- Name: Some_Team_2
64-
DisplayName: Some Team 2
65-
```
66-
67-
## Necessary configuration of the tool/service
68-
69-
As of this writing, this sync tool can be ran as a standalone app, or as a GitHub Action.
70-
71-
### As a Standalone App
72-
73-
An Azure AD App registration must be created with the following permissions:
74-
75-
* **Application** Permission: `GroupMember.Read.All`
76-
* **Application** Permission: `User.Read.All`
77-
78-
The Client ID and Client Secret must be provided as environment variables to the application.
79-
80-
A GitHub App registration must be created with the following permissions (this information should be moved to an `app.yml file` instead of being documented here):
81-
82-
* Repository- Contents: Read (only necessary for the `.github` repository)
83-
* Repository- Deployments: Read and Write (only necessary for the `.github` repository)
84-
* Organization- Members: Read and Write
85-
* Organization- Administration: Read and Write
86-
* This is needed for managing [Security Managers](https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/security-managers?apiVersion=2022-11-28), though as Security Managers is in beta, this permission may also change.
87-
* ❗ **If you do not intend to use this functionality**, feel free to exclude this permission from your GitHub App Registration
88-
89-
The AppId and Private Key must be provided as environment variables to the application.
37+
See [./docs/RunningTheApp.md](./docs/RunningTheApp.md) for further details!

docs/ApplicationConfiguration.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Application Configuration
2+
3+
Your local `.env` file will look like the following:
4+
5+
```shell
6+
# AppId from the GitHub App Registration
7+
GitHubApp__AppId=
8+
# The Private Key from the GitHub App Registration
9+
GitHubApp__PrivateKey=
10+
11+
# Text that is appended to the end of a username that is fetched from the
12+
# source of truth.
13+
APP_OPTIONS_GitHubIdAppend=
14+
15+
# The GitHub Org to look towards for additional application configuration
16+
APP_OPTIONS_AppConfigOrg=
17+
# The GitHub Repository to look towards for additional application configuration
18+
APP_OPTIONS_AppConfigRepo=team-sync-bot-ops
19+
20+
# The LDAP Configuration. Eventually this will be moved to a plugin
21+
LDAP_SERVER=
22+
LDAP_USER=
23+
LDAP_PASSWORD=
24+
LDAP_GROUP_BASE_DN=
25+
26+
# Optional
27+
APP_OPTIONS_RedisHost=
28+
GITHUB_PROXY=
29+
SOURCE_PROXY=
30+
PORT=
31+
```

docs/GitHubAppRegistration.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Configuring the GitHub App Registration
2+
3+
As this bot interacts with Github, it needs a GitHub App registration to be created for proper authentication.
4+
5+
## Permissions
6+
7+
This bot currently requires a GitHub App Registration to have the following permissions:
8+
9+
```yaml
10+
repository:contents: Read-only
11+
repository:deployments: Read-and-write # Under review for removal
12+
repository:metadata: Read-only
13+
14+
organization:administration: Read-and-write # See note about Organization Administration Note below
15+
organization:members: Read-and-write
16+
17+
# Upcoming
18+
repository:checks: Read-and-write
19+
repository:commit-statuses: Read-and-write
20+
repository:pull-requests: Read
21+
22+
organization:github-copilot-business: Read-and-write
23+
```
24+
25+
## Events
26+
27+
TBD
28+
29+
## Organization Administration Note
30+
31+
* This permission is needed for managing [Security Managers](https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/security-managers?apiVersion=2022-11-28), though as Security Managers is in beta, this permission may also change.
32+
* ❗ **If you do not intend to use this functionality**, feel free to exclude this permission from your GitHub App Registration

docs/OrganizationConfiguration.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Organization Configuration
2+
3+
This service/Action requires that a configuration file be present in the `.github` repository of your GitHub Organization. An example of this is show below:
4+
5+
Filename: `team-sync-options.yaml`
6+
```yaml
7+
# This property is used to set the Owners of the Organization. Currently, this will NOT
8+
# remove anyone who was manually added as an Owner to the org.
9+
OrganizationOwnersGroup: Some_Org_Owner_Group
10+
11+
# This property is used to control the addition of general Members to your Organization.
12+
OrganizationMembersGroup: Some_Group_To_Sync_For_Organization_Membership
13+
14+
# This property is used for syncing all other GitHub Teams. Please note that users must also
15+
# be a part of the `OrganizationMembersGroup` for the synchronization of the teams below to
16+
# function properly.
17+
# Note: this is a convenience property. The `Teams` property allows for more complex
18+
# setup of teams (i.e., display names and eventually parent/child relationships).
19+
GitHubTeamNames:
20+
- Some_Team_To_Sync
21+
- Some_Other_Team_To_Sync
22+
23+
# Allows Organizations to add their own Security Manager teams in addition to those set at
24+
# the app level.
25+
# Note: this property supports Display Names.
26+
AdditionalSecurityManagerGroups:
27+
- Name: Some_SecurityManager_Team
28+
- Name: Some_SecurityManager_Team_2
29+
DisplayName: Some Security Manager Team 2
30+
31+
# This property is used for syncing all other GitHub Teams. Please note that users must also
32+
# be a part of the `OrganizationMembersGroup` for the synchronization of the teams below to
33+
# function properly.
34+
# Note: this property supports Display Names.
35+
Teams:
36+
- Name: Some_Team
37+
- Name: Some_Team_2
38+
DisplayName: Some Team 2
39+
```

docs/RunningTheApp.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Running the Groups to Teams Sync Bot
2+
3+
This application is written to be operating system agnostic. If it does not work properly on a particular operating system, submit an Issue detailing your setup and problem.
4+
5+
We strive to make successfully running and building this application fairly straightforward. The steps are as follows:
6+
7+
1. Install the necessary tooling
8+
2. Prepare your GitHub App registration
9+
3. Prepare your source-of-truth credentials
10+
4. Configure the app
11+
5. Run the app
12+
13+
## 1 Prerequisite Tooling
14+
15+
* NodeJS v20: https://nodejs.org/en/learn/getting-started/how-to-install-nodejs
16+
17+
### Optional
18+
19+
* A container runtime and builder- Docker, Podman, etc.
20+
* Docker: https://docs.docker.com/get-docker/
21+
* Podman: https://podman.io/docs
22+
23+
## 2 GitHub App Registration
24+
25+
See [./GitHubAppRegistration.md](./GitHubAppRegistration.md).
26+
27+
## 3 Source of Truth credentials
28+
29+
At this point in time, the logic to fetch information from an LDAP system is baked into this application. Eventually it will be moved to a plugin to make running and developing this application simpler.
30+
31+
At this point in time, you will need to provide 4 values in the application configuration for LDAP:
32+
33+
```sh
34+
LDAP_SERVER=
35+
LDAP_USER=
36+
LDAP_PASSWORD=
37+
LDAP_GROUP_BASE_DN=
38+
```
39+
40+
## 4 Configure the App
41+
42+
See [./ApplicationConfiguration.md](./ApplicationConfiguration.md).
43+
44+
## 5 Run the App
45+
46+
With all the prerequisites out of the way, the following commands will now allow you to run the app:
47+
48+
```sh
49+
npm install
50+
npm run dev
51+
```
52+
53+
After running the commands above, you should eventually see console output similar to the following:
54+
55+
```sh
56+
> teams-sync@1.0.0 dev
57+
> nodemon
58+
59+
[nodemon] 3.0.2
60+
[nodemon] to restart at any time, enter `rs`
61+
[nodemon] watching path(s): src\**\*
62+
[nodemon] watching extensions: ts,json,yaml
63+
[nodemon] starting `ts-node ./src/app.ts`
64+
{
65+
HostPort: '8080',
66+
ForwardingGitHubRequestsTo: 'Not forwarding',
67+
ForwardingGroupRequestsTo: 'Not forwarding',
68+
RedisCacheHost: 'No cache'
69+
}
70+
Connected to LDAP Server
71+
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "teams-sync-rewrite",
2+
"name": "teams-sync",
33
"version": "1.0.0",
44
"description": "",
55
"main": "app.ts",

0 commit comments

Comments
 (0)