Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 98 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,75 @@ By default, this prints out a table built from the fetched content to the consol
When run with `--send-email` it also emails this table to all the listed maintainers.

## Installation

```bash
pip install git+https://github.com/ansible-network/ansible-network-triager.git@master

git clone https://github.com/ansible-network/ansible-network-triager.git

cd ansible-network-triager

pip install -r requirements.txt

```
## Configuration

1. add your details such as organization_name, workflow_name in `config.yaml` file:
1. Add your details such as `organization_name`, `workflow_name`, and `timedelta` in the `config.yaml` file:

For example:

organization_name: "Ansible Networking"
workflow_name: "tests.yml"
timedelta: 14
````yaml
organization_name: "Ansible Networking"
workflow_name: "tests.yml"
timedelta: 14
````

2. Create a `.env` file in the root of your directory and add these details:

[email protected]
EMAIL_PASSWORD=your_email_password
MAINTAINERS=[{"name": "Your Name", "email": "[email protected]"}]
#GITHUB_TOKEN=your_github_token (optional - enter your github token here to make authenticated requests or comment this line to make unauthenticated API requests)
- `EMAIL_SENDER`: Your tool's email address for sending reports
- `EMAIL_PASSWORD`: Your tool's email password
- `MAINTAINERS`: A JSON string containing the maintainers' information
- `GITHUB_TOKEN`: your_github_token (Optional)
- Enter your GitHub token here to make authenticated requests; comment out this line to make unauthenticated API requests.
- `REPO_CONFIG`: A JSON-formatted configuration of repositories to monitor
- `ci_and_bug_repos`: Repositories common to both CI and bug workflows
- `bug_specific_repos`: Repositories specific to bug workflows only

Example:

```yaml
EMAIL_SENDER= [email protected]
EMAIL_PASSWORD=superSecretP@ssWorD
GITHUB_TOKEN=your_github_pat_token
MAINTAINERS = [
{"name": "John doe", "email": "[email protected]"},
{"name": "Andrea Pirlo", "email": "[email protected]"}
]
REPO_CONFIG = {
<organization>: {
"ci_and_bug_repos": [<list of repositories>],
"bug_specific_repos": [<list of repositories>]
"ansible-collections": {
"ci_and_bug_repos": [
"cisco.nxos",
"cisco.ios"
],
"bug_specific_repos": [
"ansible.scm",
"vyos.vyos"
]
},
"ansible": {
"bug_specific_repos": [
"pylibssh"
]
},
"redhat-cop": {
"ci_and_bug_repos": [
"network.interfaces",
"network.bgp"
],
"bug_specific_repos": [
"network.backup"
]
}
}
}

```
## Usage

### Local Usage
Expand Down Expand Up @@ -68,12 +107,12 @@ REPO_CONFIG = {

This tool uses GitHub Actions for automated reporting. To set up the workflows:

1. Store your secrets in GitHub Actions:
a) Go to your GitHub repository
b) Click on "Settings" tab
c) In the left sidebar, click on "Secrets and variables", then "Actions"
d) Click on "New repository secret"
e) Add the following secrets:
1. Store your secrets in GitHub Actions:
a) Go to your GitHub repository
b) Click on "Settings" tab
c) In the left sidebar, click on "Secrets and variables", then "Actions"
d) Click on "New repository secret"
e) Add the following secrets:

- `EMAIL_SENDER`: Your tool's email address for sending reports
- `EMAIL_PASSWORD`: Your tool's email password
Expand All @@ -96,55 +135,75 @@ name: Bug Triage Workflow

on:
schedule:
- cron: '0 9 * * 3'
workflow_dispatch:
- cron: "0 9 * * 3"
workflow_dispatch: # for manual triggering of the workflow

jobs:
run-bug-triage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Check out repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- run: pip install -r requirements.txt
- run: python -m triager --bugs -c example-config.yaml --log --send-email
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run Bug Triage
env:
EMAIL_SENDER: ${{ secrets.EMAIL_SENDER }}
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}
GITHUB_TOKEN: ${{ github.token }}
MAINTAINERS: ${{ secrets.MAINTAINERS }}
REPO_CONFIG: ${{ secrets.REPO_CONFIG }}

run: |
python -m triager --bugs -c config.yaml --log --send-email
```
#### CI Report Workflow

This workflow runs daily at 12:00 PM IST (6:30 AM UTC) and can also be triggered manually.

''''yaml
```yaml
name: Nightly CI Report Workflow

on:
schedule:
- cron: '30 6 * * *'
workflow_dispatch:
- cron: "30 6 * * *"
workflow_dispatch: # for manual triggering of the workflow

jobs:
run-ci-report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Check out repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- run: pip install -r requirements.txt
- run: python -m triager --ci -c example-config.yaml --log --send-email
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run CI Report
env:
EMAIL_SENDER: ${{ secrets.EMAIL_SENDER }}
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}
GITHUB_TOKEN: ${{ github.token }}
MAINTAINERS: ${{ secrets.MAINTAINERS }}
REPO_CONFIG: ${{ secrets.REPO_CONFIG }}

run: |
python -m triager --ci -c config.yaml --log --send-email
````

## Options

Expand Down Expand Up @@ -192,4 +251,4 @@ Pre-commit will now run automatically on `git commit`. You can also run it manua
GNU General Public License v3.0 or later.

See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text.
```