Skip to content

Commit ab5233f

Browse files
prakarsh-dtYashasviDevtronShivam-nagar23prakash100198raunit-verma
authored
misc: Pagerduty issue template change (#4796)
* misc: Pagerduty issue template change Pagerduty issue template change to seek more information for validating the criticality of the issue. * Update pager-duty.yaml * Update pager-duty.yaml * Update pager-duty.yaml * feat: Adding script to calculate score for pagerduty issues (#4832) * feat: active inactive user phase 3 (#4649) * listing user and group changes * default value chnage * group listing optimisation * wire_gen * order by in group * default values * discard * updated on * case insensitive * script number change * specs * review chnages * sql update * id for user * script number chnage * review comments-1 * review comments * review comments * rest handler remove methods * validation for delete * delete user handling * review comments * review comments * bulk delete user and permission group * legacy code fix from loop in query to bulk query * export csv filters support * Revert "export csv filters support" This reverts commit 4448c9e. * export csv filters * bulk delete support with filters * validation * method break * refactor the method * condition * open api specs * specs * refactoring filters in bulk delete rolegroup * comments * comments * script * group listing * review comments * review comments * review comments * review comments * user delete self-review * error handling * renaming helpers * commets * checks and renaming * last login order * script number change * rolegroup migration * name change * backward compatibility handling * self review name change * chart-group -manager-fix * userrolegroups * change chnage operation * specs update * groups * find by componet id * job project id * sql script chnage * script number change * fix: extra check added for mono-repo migraiton (#4764) * extra check added for mono-repo migraiton * comparison of repoNameWithoutPrefix and appstore name for mono repo condition * refactor * remove prefix * fix * remove-gitops-prefix-oss * refactor * refactor * refactor * added request method in audit logger (#4817) * fix: rolefilters correction with all applications and particular application selected. (#4820) * merging issue resolved * all namespace, cluster, kind remove as it is used in key * removing unnecessary code * fix: 5xx 4.0 iter (#4620) * bugs revert * 4th iter code changes * delete dag exec * initial poc (ongoing) of handling grpc errors * grpc error handling at install helm chart and template services * refactoring * refactor * code review changes with some refactoring * removed unused files * refactor * chore: refactoring v4 (#4775) * removed registerInArgo multiple impls * extracted app metrics code * migrated envLevel app metrics code to new service * chore: Removed unused jira and migration integration (#4498) * removed unsued jira integration * removed test-suite-code * db migration conf removal * chore: removed unused injection * chore: removed dead code * added: migration script --------- Co-authored-by: Ash-exp <[email protected]> * chore: App store dead code cleanup and restructuring (#4497) * moved chart-group in seperate code * removed unused dependency * removed dead code * extracted resource tree * moved notes * resource movement * removed unused code * removed unused dependency * commit methods * extracted status update * chore: clean up unused dead code * updated: EA mode docker file * updated: migration number --------- Co-authored-by: Ash-exp <[email protected]> * chart ref refactoring * removed infra metrics db calls * moved app metrics repositories from /internal to /pkg * moved: const and types to bean * removed: unused const * review comments * migrated some methods from chartService to chartRefService * added dt validation service interface * minor refactoring * moved validation method - 1 * wip * removed redundant appMetrics req obj * moved app metrics bindings to wireset * removed multiple dead code * remove redundant dependency * moved ChartGroup router and rest handler to respective folder * stage 1 * gitOps refactoring * moved gitClient code to a common wrapper service * chore: AppStoreDeployment Install flow refactoring * review changes * wip * fix for unsupported charts * refactoring: App Store deployment services * minor cleanup * renamed remote package to git * renamed gitOpsRemoteOpService If and impl * migrated usages of gitService to gitOperationService * shifted git service and all gitOps clients to pkg * gitops repository usages refactor * refactored gitOpsRepository usages * gitlab client creation refactoring * renamed util/ChartService * reverted renaming changes * reverted renaming changes * reverted renaming changes * wip * wip * removed typo * changes * changes * extracted trigger cd, nats subscriptions from wfDAGExec service * removed gitOpsRepoName fetch logic duplicacy * minor change for cd trigger method * removed redundant imports * extracted deployment bulk trigger publish event logic from workflowDag * extracted manifest creation code from WorkflowDagExecutor * moved WorkflowStatusUpdateHandler * removed old refactored code * wip - extracted k8s op method from workflowDAG part 1 * extracted artifact logic from workflowDAG * extracted artifact logic from workflowDAG * refactoring * replaced slices -> k8s.io/utils/strings/slices import * replaced slices -> k8s.io/utils/strings/slices import * fix prod bug * renamed PrePostStageTriggerService -> preStageTriggerService * fix for rollback * wip * refactoring pre & post stage service * updated PreCdTriggerService * migrated AsyncTrigger consumer to eventProcessor * review comments * removed whitespaces * migrated ci material topic to processor service * migrated argo app status subsciption to common processor pkg * migrated argo type pipeline publish and process to common pkg * migrated appstore bulk deploy topic * migrated cd bulk deploy topic * migrated appstore helm install status topic * migrated git webhook event publish * minor changes in manifest creation service * minor changes in cd trigger service * minor changes in cd trigger service * wip * minor change in async helm install req handling * wip * updated common lib version(synced with main) * safety check for concurrency in pipeline delete and asyn trigger * updated common-lib version * updated common-lib version to main 5807b130153800727ace993e98b24cb27b8fc1fa --------- Co-authored-by: Nishant <[email protected]> Co-authored-by: Ash-exp <[email protected]> Co-authored-by: nishant <[email protected]> * fix: hide ldap creds in in get req (#4788) * hide ldap creds in in get req * removed unnecessary code * refactor * revert * refactor * pointer binding (#4826) * Adding script to calculate score for pagerduty issues * Update github_pagerduty_issue_score_calculation.py * feat: Branch Divergence Checker Plugin (#4806) * Branch Divergence Checker Plugin * Delete scripts/sql/229_GitHub_branch_divergence_checker_v1.0.down.sql * Delete assets/GitHubBranchDivergenceCheckerlogo.png * Adding assets * Changing asset name * Removing asset * Update 229_github_branch_divergence_checker.up.sql * feat: Added Apply job in k8s plugin (#4828) * feat: Added Devtron CI Trigger Plugin v1.0.0 * feat: Added Apply JOB in k8s Plugin * modified structure * Added error handelling * Removed CI trigger plugin * Migration number changed * logo changed * feat: Information of Linked CI Pipelines on Parent CI Pipeline (#4786) * Refactor ArgoUserService.go by adding a TODO * wip * updated API spec * Update repo and service * Add logging of errors * modified API spec * added total count in query * updated service and rest handler layer * Update router and resthandler * set default req params at rest handler * moved generics to global util * Update resthandler * added tracing for new queries * fixed undefined ctx * Update handler's rbac * update error logs * Update cipipeline repo * added: comments for changes * Change handler * fixed typo and imports * fixed adapter and constants * updated test file errors and mock files * updated API specs * fixed API specs end points * fixed: query errors * fixed: linked cd condition * fixed: typo * fixed: search * fixed nil check for runner query * fixed: append in adapter * fix searchkey to lowercase * Fix duplicated env names * fix pass env array as empty * Fix error logs * fix error * fixed import --------- Co-authored-by: komalreddy3 <[email protected]> * Update github_pagerduty_issue_score_calculation.py * Update github_pagerduty_score_calculation.yml * Update github_pagerduty_score_calculation.yml * Update github_pagerduty_issue_score_calculation.py * Update github_pagerduty_issue_score_calculation.py * Update github_pagerduty_score_calculation.yml * feat:Github Pull Request Closer (#4833) * PR plugin script * Update 230_Github_Pull_Request_Closer.up.sql * Update 230_Github_Pull_Request_Closer.up.sql * Update 230_Github_Pull_Request_Closer.up.sql * Rename 230_Github_Pull_Request_Closer.down.sql to 231_Github_Pull_Request_Closer.down.sql * Rename 230_Github_Pull_Request_Closer.up.sql to 231_Github_Pull_Request_Closer.up.sql * Rename GithubReleasePR.png to GithubPullRequest-Plugin-logo.png * Update 231_Github_Pull_Request_Closer.up.sql --------- Co-authored-by: Prakarsh <[email protected]> * chore: Image scanning refactoring (#4802) * added sql * updated event type for job in workflow request * added comments, handling for global cm/cs * fixed json string global cmcs * updated global cm/cs spec * wip * updated sql script number * updated sql script number * Update github_pagerduty_score_calculation.yml * Update github_pagerduty_issue_score_calculation.py * Update github_pagerduty_score_calculation.yml * Update github_pagerduty_issue_score_calculation.py * fix: helm deployements stucked in queued for devtron apps (#4842) * ns not found in case ips is being injected in cluster (#4844) * Delete .github/github_pagerduty_issue_score_calculation.py --------- Co-authored-by: Shivam Nagar <[email protected]> Co-authored-by: Prakash <[email protected]> Co-authored-by: Raunit Verma <[email protected]> Co-authored-by: kartik-579 <[email protected]> Co-authored-by: Nishant <[email protected]> Co-authored-by: Ash-exp <[email protected]> Co-authored-by: nishant <[email protected]> Co-authored-by: Kiran <[email protected]> Co-authored-by: komalreddy3 <[email protected]> Co-authored-by: Prakarsh <[email protected]> * Adding scritps to calculate score (#4848) * Adding scritps to calculate score * Update github_pagerduty_score_calculation.yml --------- Co-authored-by: Prakarsh <[email protected]> --------- Co-authored-by: Yashasvi17 <[email protected]> Co-authored-by: Shivam Nagar <[email protected]> Co-authored-by: Prakash <[email protected]> Co-authored-by: Raunit Verma <[email protected]> Co-authored-by: kartik-579 <[email protected]> Co-authored-by: Nishant <[email protected]> Co-authored-by: Ash-exp <[email protected]> Co-authored-by: nishant <[email protected]> Co-authored-by: Kiran <[email protected]> Co-authored-by: komalreddy3 <[email protected]>
1 parent a37e3df commit ab5233f

File tree

3 files changed

+224
-15
lines changed

3 files changed

+224
-15
lines changed

.github/ISSUE_TEMPLATE/pager-duty.yaml

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,66 @@ body:
1818
description: "A clear and concise description of what the bug is."
1919
placeholder: "It bugs out when ..."
2020
- type: dropdown
21-
id: criticality
21+
id: affected-areas
2222
attributes:
23-
label: "Criticality"
24-
description: "How critical is the issue? Please include the impact in the "
23+
label: "Affected areas"
24+
description: "What areas of Devtron are impacted by the issue?"
2525
options:
26-
- P0 - Critical/Blocking
27-
- P1 - High
28-
- P2 - Medium
29-
- P3 - Low
26+
- Devtron dashboard completely down
27+
- Login issues
28+
- RBAC Issues
29+
- CI
30+
- CD
31+
- App creation
32+
- Deployment from Chart store
33+
- Security features
34+
- CI/CD Plugins
35+
- Other CRITICAL functionality
36+
- Other NON-CRITICAL functionality
37+
- type: dropdown
38+
id: additional-affected-areas
39+
attributes:
40+
label: "Additional affected areas"
41+
description: "Are there any additional affected areas?"
42+
options:
43+
- Devtron dashboard completely down
44+
- Login issues
45+
- RBAC Issues
46+
- CI
47+
- CD
48+
- App creation
49+
- Deployment from Chart store
50+
- Security features
51+
- CI/CD Plugins
52+
- Other CRITICAL functionality
53+
- Other NON-CRITICAL functionality
54+
- type: dropdown
55+
id: prod-environment
56+
attributes:
57+
label: "Prod/Non-prod environments?"
58+
description: "Is the issue affecting Prod environments?"
59+
options:
60+
- Prod
61+
- Non-prod
62+
- type: dropdown
63+
id: user-unblocked
64+
attributes:
65+
label: "Is User unblocked?"
66+
description: "Is the User unblocked?"
67+
options:
68+
- Yes
69+
- No
70+
- type: dropdown
71+
id: user-unblocked-reason
72+
attributes:
73+
label: "How was the user un-blocked?"
74+
description: "If the user was unblocked. How was the user un-blocked?"
75+
options:
76+
- TEMPORARILY - By disabling a CRITICAL functionality
77+
- TEMPORARILY - By disabling a NON-CRITICAL functionality
78+
- TEMPORARILY - By doing some changes from the backend/DB
79+
- PERMANENTLY - By giving a workaround (From outside Devtron)
80+
- PERMANENTLY - By giving a workaround (Within Devtron)
3081
- type: textarea
3182
id: impact
3283
validations:
@@ -91,14 +142,6 @@ body:
91142
- Something Else
92143
validations:
93144
required: true
94-
- type: textarea
95-
id: environment
96-
validations:
97-
required: false
98-
attributes:
99-
label: "🧱 Your Environment"
100-
description: "Is your environment customized in any way? Provide your Browser version as well."
101-
placeholder: "I use XYZ for ..."
102145
- type: textarea
103146
id: solution
104147
validations:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Issue Created
2+
on:
3+
issues:
4+
types: [opened]
5+
6+
jobs:
7+
extract-issue-body:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v2
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: '3.x'
17+
18+
- name: Check if pager-duty template is used
19+
if: ${{ contains(github.event.issue.labels.*.name, 'pager-duty') && contains(github.event.issue.labels.*.name, 'bug') }}
20+
run: |
21+
echo "Issue was created using pager-duty template"
22+
python3 scripts/utilities/github_pagerduty_issue_score_calculation.py
23+
env:
24+
ISSUE_NUMBER: ${{ github.event.issue.number }}
25+
ISSUE_BODY: ${{ github.event.issue.body }}
26+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
27+
PAGERDUTY_SCORE_THRESHOLD: ${{ vars.PAGERDUTY_SCORE_THRESHOLD }}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
import os
2+
import sys
3+
import re
4+
import subprocess
5+
6+
# Dictionaries to store different options
7+
affected_areas = {
8+
"Devtron dashboard completely down": 100,
9+
"Login issues": 50,
10+
"RBAC Issues": 40,
11+
"CI": 50,
12+
"CD": 50,
13+
"App creation": 30,
14+
"Deployment from Chart store": 40,
15+
"Security features": 50,
16+
"CI/CD Plugins": 30,
17+
"Other CRITICAL functionality": 30,
18+
"Other NON-CRITICAL functionality": 20,
19+
"None": 0
20+
}
21+
22+
additional_affected_areas = {
23+
"Devtron dashboard completely down": 100,
24+
"Login issues": 50,
25+
"RBAC Issues": 40,
26+
"CI": 50,
27+
"CD": 50,
28+
"App creation": 30,
29+
"Deployment from Chart store": 40,
30+
"Security features": 50,
31+
"CI/CD Plugins": 30,
32+
"Other CRITICAL functionality": 30,
33+
"Other NON-CRITICAL functionality": 20,
34+
"None": 0
35+
}
36+
37+
prod_environment = {
38+
"Prod": 2,
39+
"Non-prod": 1,
40+
"None": 1
41+
}
42+
43+
user_unblocked = {
44+
"Yes": 1,
45+
"No": 2,
46+
"None": 1
47+
}
48+
49+
user_unblocked_reason = {
50+
"TEMPORARILY - By disabling a CRITICAL functionality": 3,
51+
"TEMPORARILY - By disabling a NON-CRITICAL functionality": 1.2,
52+
"TEMPORARILY - By doing some changes from the backend/DB": 1,
53+
"PERMANENTLY - By giving a workaround (From outside Devtron)": 2,
54+
"PERMANENTLY - By giving a workaround (Within Devtron)": 1,
55+
"None": 1
56+
}
57+
# Function to extract and process information from the issue body
58+
def process_issue_body(issue_body):
59+
# Regular expressions to extract specific sections from the issue body
60+
affected_areas_pattern = r'###\s*Affected\s*areas\s*\n\n(.*?)\n\n###'
61+
additional_affected_areas_pattern = r'###\s*Additional\s*affected\s*areas\s*\n\n(.*?)\n\n###'
62+
prod_non_prod_pattern = r'###\s*Prod/Non-prod\s*environments\?\s*\n\n(.*?)\n\n###'
63+
user_unblocked_pattern = r'###\s*Is\s*User\s*unblocked\?\s*\n\n(.*?)\n\n###'
64+
user_unblocked_reason_pattern = r'###\s*How\s*was\s*the\s*user\s*un-blocked\?\s*\n\n(.*?)\n\n###'
65+
66+
# Matching patterns in the issue body
67+
affected_areas_match = re.search(affected_areas_pattern, issue_body)
68+
additional_affected_areas_match = re.search(additional_affected_areas_pattern, issue_body)
69+
prod_non_prod_match = re.search(prod_non_prod_pattern, issue_body)
70+
user_unblocked_match = re.search(user_unblocked_pattern, issue_body)
71+
user_unblocked_reason_match = re.search(user_unblocked_reason_pattern, issue_body)
72+
73+
# Extracting values from matches or setting default value to "None" if match not found
74+
affected_area_value = affected_areas_match.group(1).strip() if affected_areas_match else "None"
75+
additional_affected_area_value = additional_affected_areas_match.group(1).strip() if additional_affected_areas_match else "None"
76+
prod_non_prod_value = prod_non_prod_match.group(1).strip() if prod_non_prod_match else "None"
77+
user_unblocked_value = user_unblocked_match.group(1).strip() if user_unblocked_match else "None"
78+
user_unblocked_reason_value = user_unblocked_reason_match.group(1).strip() if user_unblocked_reason_match else "None"
79+
80+
# Retrieving values from dictionaries
81+
affected_areas_score = affected_areas.get(affected_area_value, 0)
82+
additional_affected_areas_score = additional_affected_areas.get(additional_affected_area_value, 0)
83+
prod_non_prod_score = prod_environment.get(prod_non_prod_value, 1)
84+
user_unblocked_score = user_unblocked.get(user_unblocked_value, 1)
85+
user_unblocked_reason_score = user_unblocked_reason.get(user_unblocked_reason_value, 1)
86+
87+
print("Affected areas:", affected_area_value)
88+
print("Additional affected areas:", additional_affected_area_value)
89+
print("Prod/Non-prod environments?:", prod_non_prod_value)
90+
print("Is User unblocked?:", user_unblocked_value)
91+
print("How was the user un-blocked?:", user_unblocked_reason_value)
92+
93+
# Checking for required values and skipping execution of script, if not found
94+
if affected_areas_score == 0 or prod_non_prod_score == 0 or user_unblocked_score == 0:
95+
print("One or more required values are missing. Exiting...")
96+
sys.exit(0)
97+
98+
if user_unblocked_reason_score == 0:
99+
user_unblocked_reason_score = 1
100+
101+
# Adding 'urgent' label to the issue if user_unblocked_reason is 'TEMPORARILY - By disabling a CRITICAL functionality' or affected_areas is 'Devtron dashboard completely down'
102+
if user_unblocked_reason_score == 3 or affected_areas_score == 100:
103+
try:
104+
105+
result = subprocess.run(['gh', 'issue', 'edit', str(issue_number), '--add-label', 'urgent'], capture_output=True, check=True, text=True)
106+
print("urgent label added to issue", issue_number)
107+
except subprocess.CalledProcessError as e:
108+
print(e.stderr)
109+
#calculating final score
110+
final_score = affected_areas_score + additional_affected_areas_score * prod_non_prod_score * user_unblocked_score * user_unblocked_reason_score
111+
print("Final Score:", final_score)
112+
113+
# Commenting the final score in the issue
114+
comment = f"Final Score: {final_score}"
115+
try:
116+
result1 = subprocess.run(['gh', 'issue', 'comment', str(issue_number), '--body', comment], capture_output=True, check=True, text=True)
117+
print("Final score commented on issue", issue_number)
118+
except subprocess.CalledProcessError as e:
119+
print(e.stderr)
120+
return final_score
121+
122+
token = os.environ.get('GITHUB_TOKEN')
123+
subprocess.run(['gh', 'auth', 'login', '--with-token'], input=token, text=True, capture_output=True)
124+
125+
# Retrieving environment variables
126+
issue_body = os.environ.get('ISSUE_BODY')
127+
issue_number = os.environ.get('ISSUE_NUMBER')
128+
pagerduty_score_threshold = os.environ.get('PAGERDUTY_SCORE_THRESHOLD')
129+
130+
final_score = process_issue_body(issue_body)
131+
132+
133+
# Removing 'pager-duty' label from issue if final score is below the threshold
134+
if final_score <= int(pagerduty_score_threshold):
135+
try:
136+
result = subprocess.run(['gh', 'issue', 'edit', str(issue_number), '--remove-label', 'pager-duty'])
137+
print("pager-duty label removed from issue", issue_number)
138+
except subprocess.CalledProcessError as e:
139+
print(e)

0 commit comments

Comments
 (0)