-
Notifications
You must be signed in to change notification settings - Fork 0
DOCSP-55611: Add Kanopy cronjob deployment for GitHub metrics collection #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add Dockerfile to containerize the Node.js application - Add cronjobs.yml with weekly schedule and persistent volume for state tracking - Add .drone.yml CI/CD pipeline for build and deployment - Add check-last-run.js to prevent duplicate runs within 14-day window - Update index.js to integrate smart 14-day check logic - Update README.md with deployment documentation and monitoring instructions The cronjob runs weekly but only collects metrics if 14+ days have passed, ensuring no data gaps while preventing duplicate collection.
- Combine test, build, and deploy into one pipeline - Remove unnecessary pipeline dependencies - Simplify change detection logic - Fix typo: DevOps -> DevDocs team in README
dacharyc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Back to you with a handful of small Qs. Nothing blocking necessarily - I just want to make sure I understand correctly what we're doing here.
| const STATE_FILE_PATH = process.env.STATE_FILE_PATH || '/data/last-run.json'; | ||
|
|
||
| // Minimum days between runs | ||
| const MIN_DAYS_BETWEEN_RUNS = parseInt(process.env.MIN_DAYS_BETWEEN_RUNS || '14', 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make this 13, instead? I'm wondering if any possibility of weirdness related to timing of test runs, etc. If it's only running on Monday and it's been close to 14 it should probably run.
| import path from 'path'; | ||
|
|
||
| // Path to the state file (mounted from persistent volume) | ||
| const STATE_FILE_PATH = process.env.STATE_FILE_PATH || '/data/last-run.json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it looks like we're trying to read from process.env here but I don't see where we're setting these vars in the env setup?
| } | ||
|
|
||
| // Write the state file | ||
| fs.writeFileSync(STATE_FILE_PATH, JSON.stringify(stateData, null, 2), 'utf8'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if there's any possibility of weirdness if the file already exists. Have you tested this manually with an extant file to ensure the behavior is correct - i.e. overwrites file contents? I'm wondering if we should remove the old file during the update func just for safety, or if that's overkill.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like overkill, esp for this tiny doc. @krollins-mdb does this align with common practice around writeFileSync()?
Dockerfileto containerize the Node.js applicationcronjobs.ymlwith weekly schedule and persistent volume for state tracking.drone.ymlCI/CD pipeline for build and deploymentcheck-last-run.jsto prevent duplicate runs within 14-day windowindex.jsto integrate smart 14-day check logicREADME.mdwith deployment documentation and monitoring instructionsThe cronjob runs weekly but only collects metrics if 14+ days have passed, ensuring no data gaps while preventing duplicate collection.