Skip to content

Commit

Permalink
Merge branch 'main' into abanuelo/feat-ending-dynamic-scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
lola831 authored Dec 17, 2024
2 parents 5f50fe4 + a6e48a2 commit dcb3111
Show file tree
Hide file tree
Showing 72 changed files with 1,846 additions and 445 deletions.
15 changes: 10 additions & 5 deletions .github/ISSUE_TEMPLATE/1-bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@ body:
attributes:
label: Detailed Description
description: |
Please provide a clear and concise description of what the bug is and paste the error log below. Please rerun your simulation error with the **`-b`** parameter for a full stack trace.
It helps improving readability if the error log is wrapped in ```triple quotes blocks```.
placeholder: |
A clear and concise description of what the bug is. You can rerun your Scenic simulation with `-b` to get a full stack trace.
Please provide a clear and concise description of what the bug is and paste the error log below.
1. Clear and concise description of the bug
2. `scenic` command you ran locally (e.g. `scenic test.scenic --count 1 -b`, etc.). Please rerun your simulation error with the **`-b`** parameter for a full stack trace.
3. Error log. It helps improving readability if the error log is wrapped in ```triple quotes blocks```.
placeholder: |
1. Scenic has a bug
2. `scenic test.scenic -b`
3. Error Log
```
# error full stack trace
```
Expand Down Expand Up @@ -67,5 +72,5 @@ body:
options:
- label: I am reporting an issue, not asking a question
required: true
- label: I checked the open issues, forum, etc. and have not found any solution
- label: I checked the open and closed issues, forum, etc. and have not found any solution
- label: I have provided all necessary code, etc. to reproduce the issue
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/2-docs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Documentation
description: Report an issue or enhancement related to https://scenic-lang.readthedocs.io/
description: Report an issue or enhancement related to https://docs.scenic-lang.org/
labels:
- "type: documentation"
- "status: triage"
Expand All @@ -8,15 +8,15 @@ body:
- type: markdown
attributes:
value: >
#### Thank you for contributing! Before submitting a doc issue, please make sure it has no duplicate and has not already been addressed by searching through [the existing and past issues](https://github.com/BerkeleyLearnVerify/Scenic/issues)
#### Thank you for contributing! Before submitting a doc issue, please make sure it has no duplicate and has not already been addressed by searching through [the existing and past open and closed issues](https://github.com/BerkeleyLearnVerify/Scenic/issues)
- type: textarea
attributes:
label: Describe the doc issue or enhancement
description: >
Please provide a clear and concise description of what content in https://scenic-lang.readthedocs.io/ has an issue or needs enhancement.
Please provide a clear and concise description of what content in https://docs.scenic-lang.org/ has an issue or needs enhancement.
placeholder: |
Link to location in the docs: https://scenic-lang.readthedocs.io/
Link to location in the docs: https://docs.scenic-lang.org/
validations:
required: true

Expand All @@ -32,4 +32,4 @@ body:
options:
- label: I am reporting an issue, not asking a question
required: true
- label: I checked the open issues, forum, etc. and have not found any solution
- label: I checked the open and closed issues, forum, etc. and have not found any solution
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/3-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body:
- type: markdown
attributes:
value: >
#### Thank you for contributing! Before submitting a feature request, please make sure it has no duplicate and has not already been addressed by searching through [the existing and past issues](https://github.com/BerkeleyLearnVerify/Scenic/issues)
#### Thank you for contributing! Before submitting a feature request, please make sure it has no duplicate and has not already been addressed by searching through [the existing and past open and closed issues](https://github.com/BerkeleyLearnVerify/Scenic/issues)
- type: textarea
attributes:
Expand All @@ -28,4 +28,4 @@ body:
attributes:
label: Issue Submission Checklist
options:
- label: I checked the open issues, forum, etc. and have not found any solution
- label: I checked the open and closed issues, forum, etc. and have not found any solution
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Questions
url: https://forms.gle/uUhQNuPzQrvvBFJX9
about: Send your questions via Google Form
url: https://forum.scenic-lang.org/
about: Post your questions on our community forum
70 changes: 70 additions & 0 deletions .github/slack_oncall_reminder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import argparse

import requests
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError


def save_users(users_array):
users = {}
for user in users_array:
# NOTE: some apps, slackbots do not have emails to map to
profile = user["profile"]
if "email" in profile.keys():
user_email = profile["email"]
username = user_email.split("@")[0]
users[username] = user
return users


def grab_whos_on_call(OPS_GENIE_API_TOKEN, ROTATION_SCHEDULE_ID):
url = f"https://api.opsgenie.com/v2/schedules/{ROTATION_SCHEDULE_ID}/on-calls"
headers = {"Authorization": f"GenieKey {OPS_GENIE_API_TOKEN}"}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
else:
print(f"Request failed with status code {response.status_code}")
print("Response content:")
print(response.content.decode("utf-8"))
return data["data"]["onCallParticipants"][0]["name"].split("@")[0]


def postSlackMessage(client, CHANNEL_ID, OPS_GENIE_API_TOKEN, ROTATION_SCHEDULE_ID):
try:
result = client.users_list()
users = save_users(result["members"])
on_call = grab_whos_on_call(OPS_GENIE_API_TOKEN, ROTATION_SCHEDULE_ID)
slack_id = users[on_call]["id"]

result = client.chat_postMessage(
channel=CHANNEL_ID,
text=f"""🛠️Maintenance On-Call: <@{slack_id}>, you will be on-call for the next week. Resources:\n
📖 <https://https://scenic-lang.atlassian.net/l/cp/cnaQtVXY|On Call Best Practices>
🔍 <https://scenic-lang.atlassian.net/l/cp/jR0CifEf|Issue Triage Guide>
📊 <https://scenic-lang.atlassian.net/jira/software/projects/SCENIC/boards/1|Jira Board to monitor active workstreams>
📋 <https://scenic-lang.atlassian.net/jira/software/projects/SCENIC/boards/1/backlog?epics=visible|Jira Backlog to monitor issues that need triaging>
🔧 <https://github.com/BerkeleyLearnVerify/Scenic/issues|Scenic GitHub Issues>
""",
)
except SlackApiError as e:
print(f"SlackAPIError: {e}")


if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Script that notifies on-call rotation daily"
)
parser.add_argument("--slack_api_token", required=True, type=str)
parser.add_argument("--ops_genie_api_token", required=True, type=str)
args = parser.parse_args()

SLACK_API_TOKEN = args.slack_api_token
OPS_GENIE_API_TOKEN = args.ops_genie_api_token
# NOTE: Feel free to grab the relevant channel ID to post the message to but ensure the App is installed within the channel
CHANNEL_ID = "C06N9KJHN2J"
# NOTE: Rotation schedule is grabbed directly from within the OpsGenie site
ROTATION_SCHEDULE_ID = "904cd122-f269-418d-8c29-3e6751716bae"

client = WebClient(token=SLACK_API_TOKEN)
postSlackMessage(client, CHANNEL_ID, OPS_GENIE_API_TOKEN, ROTATION_SCHEDULE_ID)
30 changes: 30 additions & 0 deletions .github/workflows/on-call-reminder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: on_call_reminder

on:
schedule:
- cron: '0 17 * * 3' # Runs every Wednesday at 9am PST (17:00 UTC)
workflow_dispatch: # Allows manual triggering of the workflow

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests slack_sdk argparse
- name: Run Python script
env:
SLACK_API_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
OPS_GENIE_API_TOKEN: ${{ secrets.OPS_GENIE_API_TOKEN }}
run: python .github/slack_oncall_reminder.py --slack_api_token $SLACK_API_TOKEN --ops_genie_api_token $OPS_GENIE_API_TOKEN
2 changes: 1 addition & 1 deletion .github/workflows/run-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
os: [ubuntu-latest]
extras: ["test-full"]
runs-on: ${{ matrix.os }}
Expand Down
Loading

0 comments on commit dcb3111

Please sign in to comment.