Skip to content

Commit 486ea90

Browse files
Merge branch 'main' into CLOUDP-338553
2 parents ad1a03b + bf9c013 commit 486ea90

40 files changed

+2465
-37
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
set -eou pipefail
3+
4+
if [ "${WARNING_COUNT}" -eq 0 ]; then
5+
echo "No warning violations found, skipping ticket creation"
6+
exit 0
7+
fi
8+
9+
# Read violation details if available
10+
VIOLATION_DETAILS=""
11+
if [ -f "tools/spectral/ipa/metrics/outputs/warning-violations.json" ]; then
12+
VIOLATION_DETAILS=$(jq -r '
13+
group_by(.code) |
14+
map("• " + .[0].code + " (" + (length | tostring) + " violations)") |
15+
join("\n")
16+
' tools/spectral/ipa/metrics/outputs/warning-violations.json)
17+
fi
18+
19+
# Check if warning ticket already exists
20+
EXISTING_TICKET=$(curl -s -H "Authorization: Bearer ${JIRA_API_TOKEN}" \
21+
"https://jira.mongodb.org/rest/api/2/search?jql=project=CLOUDP AND summary~'Warning-level IPA violations' AND status!=Done" \
22+
| jq -r '.issues[0].key // empty')
23+
24+
if [ -n "${EXISTING_TICKET}" ]; then
25+
echo "Warning ticket already exists: ${EXISTING_TICKET}"
26+
exit 0
27+
fi
28+
29+
# Create detailed description
30+
DESCRIPTION="Warning-level violations were found during IPA validation. Please review and add exceptions if valid, or address false positives.
31+
These warning-level checks are part of the rule rollout process. See the IPA Validation Technical Documentation for details:
32+
https://wiki.corp.mongodb.com/spaces/MMS/pages/315003555/IPA+Validation+Technical+Documentation+Runbook#IPAValidationTechnicalDocumentation%26Runbook-RolloutofNewRule
33+
34+
Violation Summary:
35+
${VIOLATION_DETAILS}
36+
37+
Total violations: ${WARNING_COUNT}"
38+
39+
# Create new Jira ticket
40+
TICKET_RESPONSE=$(curl -s -X POST -H "Authorization: Bearer ${JIRA_API_TOKEN}" \
41+
-H "Content-Type: application/json" \
42+
-d "{
43+
\"fields\": {
44+
\"project\": {\"key\": \"CLOUDP\"},
45+
\"summary\": \"Warning-level IPA violations found\",
46+
\"description\": \"${DESCRIPTION}\",
47+
\"issuetype\": {\"name\": \"Task\"},
48+
\"assignee\": {\"id\": \"${TEAM_ID}\"}
49+
}
50+
}" \
51+
"https://jira.mongodb.org/rest/api/2/issue/")
52+
53+
TICKET_KEY=$(echo "${TICKET_RESPONSE}" | jq -r '.key')
54+
55+
if [ "${TICKET_KEY}" != "null" ]; then
56+
echo "Created Jira ticket: ${TICKET_KEY}"
57+
58+
# Create summary for Slack
59+
SLACK_SUMMARY=""
60+
if [ -n "${VIOLATION_DETAILS}" ]; then
61+
SLACK_SUMMARY=$(echo "${VIOLATION_DETAILS}" | head -3)
62+
if [ "$(echo "${VIOLATION_DETAILS}" | wc -l)" -gt 3 ]; then
63+
SLACK_SUMMARY="${SLACK_SUMMARY}\n... and more"
64+
fi
65+
fi
66+
67+
# Send Slack notification with violation summary
68+
SLACK_MESSAGE="Warning-level IPA violations found (${WARNING_COUNT} violations) (${SLACK_ONCALL_USER}).
69+
70+
Jira ticket: https://jira.mongodb.org/browse/${TICKET_KEY}"
71+
72+
curl -X POST -H "Authorization: Bearer ${SLACK_BEARER_TOKEN}" \
73+
-H "Content-type: application/json" \
74+
--data "{\"channel\":\"${SLACK_CHANNEL_ID}\",\"text\":\"${SLACK_MESSAGE}\"}" \
75+
https://slack.com/api/chat.postMessage
76+
else
77+
echo "Failed to create Jira ticket"
78+
exit 1
79+
fi

.github/workflows/release-IPA-metrics.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
tools/spectral/ipa
2424
package.json
2525
package-lock.json
26+
.github/scripts
2627
2728
- name: Setup Node
2829
uses: actions/setup-node@v4
@@ -38,8 +39,10 @@ jobs:
3839
working-directory: ${{ github.workspace }}
3940

4041
- name: Run Metric Collection Job
42+
id: metric-collection
4143
working-directory: tools/spectral/ipa/metrics/scripts
42-
run: node runMetricCollection.js "${{ github.workspace }}/v2.json"
44+
run: |
45+
node runMetricCollection.js "${{ github.workspace }}/v2.json"
4346
4447
- name: aws configure
4548
uses: aws-actions/configure-aws-credentials@v4
@@ -54,6 +57,18 @@ jobs:
5457
working-directory: tools/spectral/ipa/metrics/scripts
5558
run: node dataDump.js
5659

60+
# Enable this step in scope of CLOUDP-339852
61+
# - name: Handle Warning Violations
62+
# if: ${{ steps.metric-collection.outputs.warning_count > 0 }}
63+
# env:
64+
# WARNING_COUNT: ${{ steps.metric-collection.outputs.warning_count }}
65+
# TEAM_ID: ${{ vars.JIRA_TEAM_ID_APIX_PLATFORM }}
66+
# JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
67+
# SLACK_BEARER_TOKEN: ${{ secrets.SLACK_BEARER_TOKEN }}
68+
# SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID_APIX_PLATFORM_DEV }}
69+
# SLACK_ONCALL_USER: ${{ secrets.SLACK_APIX_PLATFORM_ONCALL_USER }}
70+
# run: .github/scripts/handle_warning_violations.sh
71+
5772
failure-handler:
5873
name: Failure Handler
5974
needs: [ release-IPA-metrics ]

changelog/internal/metadata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"runDate": "2025-08-20",
3-
"specRevision": "d5931bb8090b0cc84ca06f9aa6741e84a4aee7c9",
4-
"specRevisionShort": "d5931bb8090",
2+
"runDate": "2025-08-21",
3+
"specRevision": "1dc62d846cbcd0f7dcda7251fb0d2a2edd439d54",
4+
"specRevisionShort": "1dc62d846cb",
55
"versions": [
66
"2023-01-01",
77
"2023-02-01",

openapi/.raw/v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53021,7 +53021,7 @@
5302153021
"termsOfService": "https://www.mongodb.com/mongodb-management-service-terms-and-conditions",
5302253022
"title": "MongoDB Atlas Administration API",
5302353023
"version": "2.0",
53024-
"x-xgen-sha": "d5931bb8090b0cc84ca06f9aa6741e84a4aee7c9"
53024+
"x-xgen-sha": "1dc62d846cbcd0f7dcda7251fb0d2a2edd439d54"
5302553025
},
5302653026
"openapi": "3.0.1",
5302753027
"paths": {

openapi/.raw/v2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41705,7 +41705,7 @@ info:
4170541705
termsOfService: https://www.mongodb.com/mongodb-management-service-terms-and-conditions
4170641706
title: MongoDB Atlas Administration API
4170741707
version: "2.0"
41708-
x-xgen-sha: d5931bb8090b0cc84ca06f9aa6741e84a4aee7c9
41708+
x-xgen-sha: 1dc62d846cbcd0f7dcda7251fb0d2a2edd439d54
4170941709
openapi: 3.0.1
4171041710
paths:
4171141711
/api/atlas/v2:

openapi/v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50353,7 +50353,7 @@
5035350353
"termsOfService": "https://www.mongodb.com/mongodb-management-service-terms-and-conditions",
5035450354
"title": "MongoDB Atlas Administration API",
5035550355
"version": "2.0",
50356-
"x-xgen-sha": "d5931bb8090b0cc84ca06f9aa6741e84a4aee7c9"
50356+
"x-xgen-sha": "1dc62d846cbcd0f7dcda7251fb0d2a2edd439d54"
5035750357
},
5035850358
"openapi": "3.0.1",
5035950359
"paths": {

openapi/v2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39852,7 +39852,7 @@ info:
3985239852
termsOfService: https://www.mongodb.com/mongodb-management-service-terms-and-conditions
3985339853
title: MongoDB Atlas Administration API
3985439854
version: "2.0"
39855-
x-xgen-sha: d5931bb8090b0cc84ca06f9aa6741e84a4aee7c9
39855+
x-xgen-sha: 1dc62d846cbcd0f7dcda7251fb0d2a2edd439d54
3985639856
openapi: 3.0.1
3985739857
paths:
3985839858
/api/atlas/v2:

openapi/v2/openapi-2023-01-01.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45190,7 +45190,7 @@
4519045190
"termsOfService": "https://www.mongodb.com/mongodb-management-service-terms-and-conditions",
4519145191
"title": "MongoDB Atlas Administration API",
4519245192
"version": "2.0",
45193-
"x-xgen-sha": "d5931bb8090b0cc84ca06f9aa6741e84a4aee7c9"
45193+
"x-xgen-sha": "1dc62d846cbcd0f7dcda7251fb0d2a2edd439d54"
4519445194
},
4519545195
"openapi": "3.0.1",
4519645196
"paths": {

openapi/v2/openapi-2023-01-01.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35729,7 +35729,7 @@ info:
3572935729
termsOfService: https://www.mongodb.com/mongodb-management-service-terms-and-conditions
3573035730
title: MongoDB Atlas Administration API
3573135731
version: "2.0"
35732-
x-xgen-sha: d5931bb8090b0cc84ca06f9aa6741e84a4aee7c9
35732+
x-xgen-sha: 1dc62d846cbcd0f7dcda7251fb0d2a2edd439d54
3573335733
openapi: 3.0.1
3573435734
paths:
3573535735
/api/atlas/v2:

openapi/v2/openapi-2023-02-01.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45905,7 +45905,7 @@
4590545905
"termsOfService": "https://www.mongodb.com/mongodb-management-service-terms-and-conditions",
4590645906
"title": "MongoDB Atlas Administration API",
4590745907
"version": "2.0",
45908-
"x-xgen-sha": "d5931bb8090b0cc84ca06f9aa6741e84a4aee7c9"
45908+
"x-xgen-sha": "1dc62d846cbcd0f7dcda7251fb0d2a2edd439d54"
4590945909
},
4591045910
"openapi": "3.0.1",
4591145911
"paths": {

0 commit comments

Comments
 (0)