Skip to content

Commit dde6b3a

Browse files
committed
Merge main into development
2 parents 96c784f + b7eef66 commit dde6b3a

6 files changed

Lines changed: 597 additions & 23 deletions

File tree

.github/ISSUE_TEMPLATE.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
## Issue Description
2+
3+
<!-- Provide a clear and concise description of the issue you're experiencing -->
4+
5+
## Sample App Information
6+
7+
**Which sample app are you using?**
8+
<!-- Check one -->
9+
- [ ] Java (Spring Boot)
10+
- [ ] JavaScript (Express.js)
11+
- [ ] Python (FastAPI)
12+
13+
## Environment Details
14+
15+
**MongoDB Database Version:**
16+
<!-- e.g., 7.0, 8.0, etc. -->
17+
18+
**MongoDB Driver Version:**
19+
<!-- e.g., Java Driver 5.2.0, Node.js Driver 6.10.0, PyMongo 4.10.1, etc. -->
20+
21+
**Deployment Type:**
22+
<!-- Check one -->
23+
- [ ] Local MongoDB instance
24+
- [ ] MongoDB Atlas (cloud)
25+
- [ ] Docker container
26+
- [ ] Other (please specify):
27+
28+
**Operating System:**
29+
<!-- e.g., macOS 14.5, Ubuntu 22.04, Windows 11, etc. -->
30+
31+
**Runtime Version:**
32+
<!-- e.g., Java 17, Node.js 20.11.0, Python 3.11, etc. -->
33+
34+
## Steps to Reproduce
35+
36+
<!-- Provide detailed steps to reproduce the issue -->
37+
38+
1.
39+
2.
40+
3.
41+
42+
## Expected Behavior
43+
44+
<!-- What did you expect to happen? -->
45+
46+
## Actual Behavior
47+
48+
<!-- What actually happened? -->
49+
50+
## Error Messages or Logs
51+
52+
<!-- If applicable, paste any error messages or relevant log output -->
53+
54+
```
55+
<!-- Paste error messages or logs here -->
56+
```
57+
58+
## Additional Context
59+
60+
<!-- Add any other context about the problem here, such as:
61+
- Screenshots
62+
- Configuration files
63+
- Network setup
64+
- Any modifications you made to the sample app
65+
- Links to relevant documentation
66+
-->
67+
68+
## Checklist
69+
70+
Before submitting this issue, please confirm:
71+
72+
- [ ] I have checked the README for setup instructions
73+
- [ ] I have verified my MongoDB connection string is correct
74+
- [ ] I have installed all required dependencies
75+
- [ ] I have searched existing issues to avoid duplicates
76+
Lines changed: 54 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,64 @@
11
name: Security Vulnerability Slack Notification
22

3-
# This workflow runs whenever a Dependabot alert is created or reopened.
43
on:
5-
dependabot_alert:
6-
types: [created, reopened]
4+
schedule:
5+
- cron: "0 */2 * * *" # Every 2 hours
6+
workflow_dispatch: # Allow manual trigger from GitHub Actions tab
77

88
jobs:
99
notify_slack_on_alert:
1010
runs-on: ubuntu-latest
11+
1112
steps:
12-
- name: Send Slack Notification via Direct Curl Payload
13+
- name: Fetch Open Dependabot Alerts
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
1317
run: |
14-
MESSAGE_TEXT="*🚨 Dependabot Alert: ${{ github.event.action }} 🚨*\n\n*Vulnerability:* ${{ github.event.alert.security_vulnerability.package.ecosystem }} package *${{ github.event.alert.security_vulnerability.package.name }}*\n*Severity:* ${{ github.event.alert.security_vulnerability.severity }}\n*Repository:* ${{ github.repository }}\n\n*View Details:* ${{ github.event.alert.html_url }}"
18+
echo ":mag: Checking for open Dependabot vulnerability alerts..."
1519
16-
SLACK_PAYLOAD=$(jq -n \
17-
--arg text "${MESSAGE_TEXT}" \
18-
'{
19-
"channel": "#docs-devdocs-notifications",
20-
"username": "Dependabot Notifier",
21-
"icon_emoji": ":lock:",
22-
"text": $text
23-
}')
24-
25-
# 3. Send the request directly to the webhook URL stored as a secret
26-
curl -X POST \
27-
-H 'Content-type: application/json' \
28-
--data "$SLACK_PAYLOAD" \
29-
${{ secrets.SLACK_WEBHOOK }}
30-
env:
31-
# jq is pre-installed on GitHub runners and is used to safely build the JSON payload.
32-
JQ_VERSION: 1.6
20+
# Fetch open alerts from GitHub API
21+
RESPONSE=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
22+
"https://github.com/mongodb/docs-sample-apps/security/dependabot/alerts?state=open")
23+
24+
ALERT_COUNT=$(echo "$RESPONSE" | jq length)
25+
echo "Found $ALERT_COUNT open alerts."
26+
27+
# Only send Slack message if there are alerts
28+
if [ "$ALERT_COUNT" -gt 0 ]; then
29+
echo ":warning: Sending Slack notification..."
30+
31+
MESSAGE_TEXT="*:rotating_light: Dependabot found $ALERT_COUNT open security alert(s) in ${{ github.repository }}!* :rotating_light:\n\n"
32+
33+
# Loop through each alert to include details
34+
for i in $(seq 0 $(($ALERT_COUNT - 1))); do
35+
PACKAGE=$(echo "$RESPONSE" | jq -r ".[$i].security_vulnerability.package.name")
36+
ECOSYSTEM=$(echo "$RESPONSE" | jq -r ".[$i].security_vulnerability.package.ecosystem")
37+
SEVERITY=$(echo "$RESPONSE" | jq -r ".[$i].security_vulnerability.severity")
38+
URL=$(echo "$RESPONSE" | jq -r ".[$i].html_url")
39+
40+
MESSAGE_TEXT+="*Package:* ${PACKAGE} (${ECOSYSTEM})\n"
41+
MESSAGE_TEXT+="*Severity:* ${SEVERITY}\n"
42+
MESSAGE_TEXT+="*Details:* ${URL}\n\n"
43+
done
44+
45+
# Build Slack payload
46+
SLACK_PAYLOAD=$(jq -n \
47+
--arg text "$MESSAGE_TEXT" \
48+
'{
49+
"channel": "#docs-devdocs-notifications",
50+
"username": "Dependabot Notifier",
51+
"icon_emoji": ":lock:",
52+
"text": $text
53+
}')
54+
55+
# Send notification to Slack
56+
curl -X POST \
57+
-H 'Content-type: application/json' \
58+
--data "$SLACK_PAYLOAD" \
59+
"$SLACK_WEBHOOK"
60+
61+
echo ":white_check_mark: Slack notification sent successfully!"
62+
else
63+
echo ":white_check_mark: No active alerts — no Slack message sent."
64+
fi
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Issue Opened Slack Notification
2+
3+
# This workflow runs only when a new issue is opened.
4+
on:
5+
issues:
6+
types: [opened]
7+
8+
9+
jobs:
10+
notify_slack_on_issue:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Send Slack Notification for New Issue
14+
run: |
15+
MESSAGE_TEXT="*📢 New Issue Opened in ${{ github.repository }} 📢*\n\n*Issue Title:* ${{ github.event.issue.title }}\n*Opened By:* ${{ github.event.issue.user.login }}\n\n*View Issue:* ${{ github.event.issue.html_url }}"
16+
17+
SLACK_PAYLOAD=$(jq -n \
18+
--arg text "${MESSAGE_TEXT}" \
19+
'{
20+
"channel": "#docs-devdocs-notifications",
21+
"username": "Issue Notifier",
22+
"icon_emoji": ":mega:",
23+
"text": $text
24+
}')
25+
26+
curl -X POST \
27+
-H 'Content-type: application/json' \
28+
--data "$SLACK_PAYLOAD" \
29+
${{ secrets.SLACK_WEBHOOK }}

README.md

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,111 @@
11
# Docs Sample Apps
22

3-
A repository of sample applications for the MongoDB documentation.
3+
A repository of sample applications for the MongoDB documentation. This README
4+
describes internal details for the repository maintainers. If you are a developer
5+
having issues with the sample app, please refer to the `Issues` section below.
6+
7+
## Sample Apps
8+
9+
This repository currently contains a single sample app using the `mflix` dataset.
10+
11+
### MFlix Sample App
12+
13+
The sample app provides a Next.js frontend in the `client` directory, with the
14+
choice of three backend stacks in the `server` directory:
15+
16+
- Java: Spring Boot
17+
- JavaScript: Express.js
18+
- Python: FastAPI
19+
20+
```
21+
├── mflix/
22+
│ ├── client/ # Next.js frontend - source for all `mflix` sample app backend repos
23+
│ └── server/
24+
│ ├── express/ # Express.js backend - source for sample-app-nodejs-mflix
25+
│ ├── java-spring/ # Java/Spring backend - source for sample-app-java-mflix
26+
│ └── python/ # Python/FastAPI backend - source for sample-app-python-mflix
27+
├── README.md
28+
├── copier-config.yaml
29+
└── deprecated_examples.json
30+
```
31+
32+
## Artifact Repositories
33+
34+
This repository serves as the source for the following artifact repositories:
35+
36+
- Java: [mongodb/sample-app-java-mflix](https://github.com/mongodb/sample-app-java-mflix)
37+
- JavaScript: [mongodb/sample-app-nodejs-mflix](https://github.com/mongodb/sample-app-nodejs-mflix)
38+
- Python: [mongodb/sample-app-python-mflix](https://github.com/mongodb/sample-app-python-mflix)
39+
40+
## Development
41+
42+
When you merge to `main`, a copier tool copies the source from this repository
43+
to a target repository for each sample app. For configuration details, refer to
44+
`copier-config.yaml`.
45+
46+
### Branching Model
47+
48+
For development, work from the `development` branch. Make incremental PRs
49+
containing new features and bug fixes to `development`, *not* `main`.
50+
51+
When all development work is complete, *then* create a release PR from
52+
`development` to `main`. Upon merging to `main,` the copier tool runs
53+
automatically. It creates a new PR in the target repository, which must be
54+
tested and merged manually.
55+
56+
### Deleting Files
57+
58+
If a PR from `development` to `main` deletes any files, this creates a new
59+
entry in the `deprecated_examples.json` file. This entry resembles:
60+
61+
```json
62+
{
63+
"filename": "go/gcloud24march_v2.go",
64+
"repo": "docs-code-examples-test-target",
65+
"branch": "v2.2",
66+
"deleted_on": "2025-03-24T18:16:30Z"
67+
},
68+
```
69+
70+
The copier tool does not delete files from the target repository. You must
71+
manually delete files from the target repository that are listed in
72+
`deprecated_examples.json`. This is an intentional step to avoid accidentally
73+
deleting files that are referred to in documentation. Review documentation
74+
references before deleting files.
75+
76+
## Release Process
77+
78+
When you merge a release PR from `development` to `main`, the copier tool
79+
creates a new PR in the target repository. This PR must be tested and merged
80+
manually. This is an intentional design choice to ensure:
81+
82+
- The sample app still functions as expected after copying.
83+
- Any documentation references are updated as part of the release process.
84+
85+
To test and verify the PR, navigate to the target repository - see
86+
`Artifact Repositories` above. Perform the following checks:
87+
88+
- [ ] Verify that the PR contains the expected changes.
89+
- [ ] Check out the PR locally.
90+
- [ ] Build and test the changes.
91+
- [ ] Run the tests
92+
- [ ] Run the application and verify that it functions as expected.
93+
- [ ] Review the `deprecated_examples.json` file for any files that need to be
94+
deleted. If files are deleted:
95+
- [ ] Add a commit to the copier PR to delete the files from the target repository.
96+
- [ ] Merge the PR.
97+
98+
## Issues
99+
100+
If you are a developer having issues with the sample app, feel free to open an
101+
issue in this repository. Please include the following information:
102+
103+
- [ ] The sample app you are using (Java, JavaScript, or Python)
104+
- [ ] The version of the MongoDB database you are using
105+
- [ ] The version of the MongoDB driver you are using
106+
- [ ] What type of deployment you're using (local, Atlas, etc.)
107+
- [ ] Any other relevant information that might help us reproduce the issue
108+
109+
## Contributions
110+
111+
We are not currently accepting public contributions to this repository.

0 commit comments

Comments
 (0)