Skip to content

Commit d0d8897

Browse files
committed
CLOUDP-315586: Postman API retry on any error code
0 parents  commit d0d8897

File tree

659 files changed

+6928177
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

659 files changed

+6928177
-0
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Maintained by the APIx team
2+
* @mongodb/apix
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: Release Bug
3+
about: This template is used by the CD to file bugs during the release process
4+
title: "({{env.TARGET_ENV}}) The {{env.RELEASE_NAME}} Release has failed. :scream_cat:"
5+
labels: failed-release
6+
---
7+
See https://github.com/mongodb/openapi/actions/runs/{{env.GITHUB_RUN_ID}}
8+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[BUG]"
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Curl command '...'
16+
2. API Endpoint '....'
17+
3. API version
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Additional context**
27+
Add any other context about the problem here.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: OpenAPI Specification Bug Report
2+
description: Submit a bug report to help us improve the OpenAPI Specification and documentation.
3+
title: "[OpenAPI Spec Issue]: "
4+
labels: ["bug"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thank you for taking the time to report an issue with the OpenAPI Specification or documentation. Your feedback helps us improve!
10+
- type: input
11+
id: api_version
12+
attributes:
13+
label: API Version
14+
description: Specify the API version relevant to the issue (e.g., 2024-08-05, v2024-10-23).
15+
placeholder: latest
16+
validations:
17+
required: true
18+
- type: input
19+
id: documentation_section
20+
attributes:
21+
label: Documentation Section
22+
description: Mention the specific section of the documentation where the issue occurs (e.g., Clusters, Access Tracking, etc.).
23+
validations:
24+
required: true
25+
- type: textarea
26+
id: issue_description
27+
attributes:
28+
label: Description of the Issue
29+
description: Clearly explain the issue. Include what you found confusing, missing, or incorrect, and describe what you expected to find instead.
30+
placeholder: |
31+
Provide as much detail as possible to help us understand and address the issue.
32+
Example:
33+
The section is unclear or missing important details. I expected to see:
34+
- [Example of expected content]
35+
- [Additional information relevant to this API call or section]
36+
validations:
37+
required: true

.github/actionlint-matcher.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "actionlint",
5+
"pattern": [
6+
{
7+
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"message": 4,
12+
"code": 5
13+
}
14+
]
15+
}
16+
]
17+
}

.github/copilot-instructions.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copilot Review Guidelines
2+
3+
## IPA Developement guidelines
4+
5+
These guidelines should be applied only to changes within the following folders:
6+
- `tools/spectral/ipa/`
7+
8+
Ensure that the changes being reviewed or implemented are within these specified folders. If changes are outside these folders, these guidelines do not apply.
9+
10+
### Role and Expertise
11+
When reviewing IPA rule implementations, act as a Node.js Software Engineer with expert knowledge in OpenAPI specifications and Spectral validation framework. Focus on ensuring rules are functional and well-documented.
12+
13+
### Review Checklist
14+
When reviewing IPA rule implementations, verify:
15+
- All rules are set at warning level
16+
- Exceptions are properly placed on the given object
17+
- Rules follow the proper format (order of checks and method names)
18+
- Appropriate use of resolved or unresolved Spectral documents
19+
- No redundant JavaScript checks for undefined inputs
20+
- Code follows latest Node.js best practices
21+
22+
### Implementation Guidelines
23+
Ensure the rule follows this structure:
24+
- Proper determination of component level for rule processing
25+
- Consistent collection of exceptions, adoptions, and violations at the same component level
26+
- Appropriate use of helper functions:
27+
- `collectException(object, ruleName, jsonPath)` for exceptions
28+
- `collectAdoption(jsonPath, ruleName)` for adoptions
29+
- `collectAndReturnViolation(jsonPath, ruleName, errorData)` for violations
30+
- Check #file:tools/spectral/ipa/rulesets/functions/utils/collectionUtils.js for examples
31+
32+
### Context
33+
34+
Please refer to the example IPA (OpenAPI standard) implementation:
35+
- #file:tools/spectral/ipa/__tests__/IPA102CollectionIdentifierCamelCase.test.js
36+
- #file:tools/spectral/ipa/rulesets/IPA-102.yaml
37+
- #file:/tools/spectral/ipa/rulesets/functions/IPA102CollectionIdentifierCamelCase.js

.github/dependabot.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: "/tools/cli"
5+
schedule:
6+
interval: weekly
7+
day: tuesday
8+
open-pull-requests-limit: 20
9+
commit-message:
10+
prefix: "chore"
11+
reviewers:
12+
- "mongodb/apix-2"
13+
- package-ecosystem: github-actions
14+
directory: "/"
15+
schedule:
16+
interval: weekly
17+
day: tuesday
18+
commit-message:
19+
prefix: "chore"
20+
reviewers:
21+
- "mongodb/apix-2"
22+
- package-ecosystem: npm
23+
directory: "/"
24+
schedule:
25+
interval: weekly
26+
day: tuesday
27+
commit-message:
28+
prefix: "chore"
29+
reviewers:
30+
- "mongodb/APIx"

.github/pull_request_template.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Proposed changes
2+
3+
<!--
4+
Describe the big picture of your changes here and communicate why we should accept this pull request.
5+
If it fixes a bug or resolves a feature request, be sure to link to that issue.
6+
-->
7+
8+
_Jira ticket:_ CLOUDP-#
9+
10+
<!--
11+
What issue does this PR address? (for example, #1234), remove this section if none.
12+
-->
13+
14+
Closes #[issue number]
15+
16+
## Checklist
17+
18+
<!--
19+
Check the boxes that apply. If you're unsure about any of them, don't hesitate to ask!
20+
We're here to help! This is simply a reminder of what we are going to look for before merging your code.
21+
-->
22+
23+
- [ ] I have signed the [MongoDB CLA](https://www.mongodb.com/legal/contributor-agreement)
24+
- [ ] I have added tests that prove my fix is effective or that my feature works
25+
26+
### Changes to Spectral
27+
- [ ] I have read the [README](../tools/spectral/README.md) file for Spectral Updates
28+
29+
## Further comments
30+
31+
<!--
32+
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc.
33+
34+
Alternatively, if this is a very minor, and self-explanatory change, feel free to remove this section.
35+
-->

.github/scripts/branded_preview.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
set -eou pipefail
3+
4+
foascli versions -s v2.json --env "${target_env:?}" -o versions.json
5+
6+
branch_name=${target_env:?}
7+
if [[ "$branch_name" == "prod" ]]; then
8+
branch_name="main"
9+
fi
10+
11+
# Load versions from versions.json
12+
versions=()
13+
14+
# Read versions from versions.json into an array
15+
while IFS= read -r version; do
16+
versions+=("$version")
17+
done < <(jq -r '.[]' versions.json)
18+
19+
all_urls=()
20+
21+
# Fetch and append file URLs from each version
22+
for version in "${versions[@]}"; do
23+
if [[ "${version}" == *"private"* ]]; then
24+
all_urls+=("https://raw.githubusercontent.com/mongodb/openapi/${branch_name:?}/openapi/v2/private/openapi-${version}.json")
25+
all_urls+=("https://raw.githubusercontent.com/mongodb/openapi/${branch_name:?}/openapi/v2/private/openapi-${version}.yaml")
26+
continue
27+
fi
28+
29+
all_urls+=("https://raw.githubusercontent.com/mongodb/openapi/${branch_name:?}/openapi/v2/openapi-${version}.json")
30+
all_urls+=("https://raw.githubusercontent.com/mongodb/openapi/${branch_name:?}/openapi/v2/openapi-${version}.yaml")
31+
done
32+
33+
links=""
34+
for url in "${all_urls[@]}"; do
35+
filename=$(basename "$url")
36+
echo "$url"
37+
link="https://www.mongodb.com/docs/openapi/preview/?src=$url"
38+
echo "Branded preview: ${link}"
39+
links="${links}<li><a href='$link' target=\"_blank\">${filename}</a></li>"
40+
done
41+
42+
cat << EOF > branded-preview.html
43+
<!DOCTYPE html>
44+
<html lang="en">
45+
<body>
46+
<h2>Preview docs for:</h2>
47+
<ul>
48+
${links}
49+
</ul>
50+
</body>
51+
</html>
52+
EOF
53+
54+
rm -f versions.json
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/bash
2+
3+
# This script creates a JIRA ticket if one does not already exist with the same title.
4+
# It performs the following steps:
5+
# 1. Defines a function to URL encode a given string.
6+
# 2. URL encodes the JIRA ticket title.
7+
# 3. Checks if a JIRA ticket with the same title already exists in the specified project (id=10984) and component (id=35986).
8+
# 4. If a ticket already exists, it exits without creating a new ticket.
9+
# 5. If no ticket exists, it creates a new JIRA ticket with the provided title, description and team id.
10+
# 6. Outputs the ID of the created JIRA ticket and sets it as a GitHub Actions output variable.
11+
12+
set -eou pipefail
13+
14+
url_encode() {
15+
local string="$1"
16+
local encoded=""
17+
encoded=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$string'''))")
18+
echo "$encoded"
19+
}
20+
21+
encoded_jira_ticket_title=$(url_encode "${JIRA_TICKET_TITLE:?}")
22+
echo "encoded_jira_ticket_title: ${encoded_jira_ticket_title}"
23+
24+
found_issue_response=$(curl --request GET \
25+
--url 'https://jira.mongodb.org/rest/api/2/search?jql=project=10984%20AND%20issuetype=12%20AND%20component=35986%20AND%20summary~"'"${encoded_jira_ticket_title:?}"'"' \
26+
--header 'Authorization: Bearer '"${JIRA_API_TOKEN:?}" \
27+
--header 'Accept: application/json' \
28+
--header 'Content-Type: application/json')
29+
30+
echo "found_issue_response: ${found_issue_response}"
31+
32+
found_issue=$(echo "${found_issue_response}" | jq .total)
33+
echo "found_issue: ${found_issue}"
34+
if [ "$found_issue" -ne 0 ]; then
35+
echo "There is already a Jira ticket with the title \"${JIRA_TICKET_TITLE:?}\""
36+
echo "No new Jira ticket will be created."
37+
exit 0
38+
fi
39+
40+
if [ "${found_issue}" == "null" ]; then
41+
echo "There was an error in retrieving the jira ticket: ${found_issue_response}"
42+
echo "No new Jira ticket will be created."
43+
exit 1
44+
fi
45+
46+
echo "Creating Jira ticket...."
47+
echo "JIRA_TICKET_TITLE: ${JIRA_TICKET_TITLE}"
48+
echo "JIRA_TICKET_DESCRIPTION: ${JIRA_TICKET_DESCRIPTION}"
49+
50+
json_response=$(curl --request POST \
51+
--url 'https://jira.mongodb.org/rest/api/2/issue' \
52+
--header 'Authorization: Bearer '"${JIRA_API_TOKEN:?}" \
53+
--header 'Accept: application/json' \
54+
--header 'Content-Type: application/json' \
55+
--data @- <<EOF
56+
{
57+
"fields": {
58+
"project": {
59+
"id": "10984"
60+
},
61+
"summary": "${JIRA_TICKET_TITLE:?}",
62+
"issuetype": {
63+
"id": "12"
64+
},
65+
"customfield_12751": [
66+
{
67+
"id": "${JIRA_TEAM_ID:?}"
68+
}
69+
],
70+
"description": "${JIRA_TICKET_DESCRIPTION:?}",
71+
"components": [
72+
{
73+
"id": "35986"
74+
}
75+
]
76+
}
77+
}
78+
EOF
79+
)
80+
81+
echo "Response: ${json_response}"
82+
83+
JIRA_TICKET_ID=$(echo "${json_response}" | jq -r '.key')
84+
85+
echo "The following JIRA ticket has been created: ${JIRA_TICKET_ID}"
86+
if [ "${JIRA_TICKET_ID}" != "null" ]; then
87+
echo "jira-ticket-id=${JIRA_TICKET_ID}" >> "${GITHUB_OUTPUT}"
88+
exit 0
89+
fi
90+
91+
exit 1
92+

0 commit comments

Comments
 (0)