Skip to content

Commit da33c7c

Browse files
committed
missing readme
1 parent f5b0cea commit da33c7c

3 files changed

Lines changed: 93 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ sudo yum install -y git make && git clone https://github.com/jitsecurity/jit-cus
2121
### Ubuntu distro
2222

2323
```shell
24-
sudo apt install -y git make && git clone https://github.com/jitsecurity/jit-customer-scripts.git && cd jit-customer-scripts
24+
sudo apt update && sudo apt install -y git make && git clone https://github.com/jitsecurity/jit-customer-scripts.git && cd jit-customer-scripts
2525
```
2626

2727
### Mac
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Sync Teams
2+
3+
This target has three sub-targets:
4+
5+
- `install`: Ensures Python 3 is installed, sets up a virtual environment, and installs the required dependencies.
6+
- `configure`: Prompts the user to input configuration details like GitHub organization name, API client ID, client
7+
secret, and GitHub token. The responses are written to a `.env` file.
8+
- `run`: Activates the virtual environment and runs two Python scripts in succession to generate teams.
9+
10+
## Creating Teams from Github Topics
11+
12+
To run the script and create teams and update assets, use the following command:
13+
14+
```shell
15+
make create-teams
16+
```
17+
18+
This command is a convenience utility that extracts the teams to generate from Github topics. \
19+
It runs these commands:
20+
21+
```bash
22+
python src/utils/github_topics_to_json_file.py
23+
python src/scripts/create_teams.py teams.json
24+
```
25+
26+
This command will fetch the repository names and topics from the GitHub API and generate the JSON file. And then it will
27+
create the teams and update the assets.
28+
29+
> We recommend using something like Github Actions and Github secrets to run this script on a schedule to make sure you
30+
> are always synced.
31+
32+
### Using External JSON File
33+
34+
You can also provide a JSON file containing team details using a command line argument directly. The JSON file should
35+
have the following structure:
36+
37+
```json
38+
{
39+
"teams": [
40+
{
41+
"name": "Team 1",
42+
"members": [
43+
"user1",
44+
"user2"
45+
],
46+
"resources": [
47+
{
48+
"type": "{resource_type}",
49+
"name": "Resource 1"
50+
},
51+
{
52+
"type": "{resource_type}",
53+
"name": "Resource 2"
54+
}
55+
]
56+
},
57+
{
58+
"name": "Team 2",
59+
"members": [
60+
"user3",
61+
"user4"
62+
],
63+
"resources": [
64+
{
65+
"type": "{resource_type}",
66+
"name": "Resource 3"
67+
}
68+
]
69+
}
70+
]
71+
}
72+
```
73+
74+
You can run the command like this:
75+
76+
```shell
77+
python scripts/create_teams.py path/to/teams.json
78+
```
79+
80+
Replace `path/to/teams.json` with the actual path to your JSON file.
81+
82+
### Excluding Topics
83+
84+
You can exclude certain topics from being considered when creating teams. \
85+
To exclude topics, you could add them in the `make configure` command or update this env var in
86+
the `.env` file: `TEAM_WILDCARD_TO_EXCLUDE`.
87+
88+
For example, to exclude topics that contain the word "test", you can set the variable as follows:
89+
90+
TEAM_WILDCARD_TO_EXCLUDE=*test*
91+
92+
This will exclude topics with names like "test", "test123", and "abc-testing".

0 commit comments

Comments
 (0)