Master repository for shared network templates and resources.
This is the central repository containing authoritative copies of shared folders (Jinja2 templates, TextFSM parsers, JSNAPy tests, etc.) that are automatically synchronized to consumer repositories.
Central hub for shared resources that automatically propagates to consumer repos:
- SRR-audit-tool
- SRR-monitoring-tool
- SRR-template-editor
Any change pushed to main triggers automatic downstream sync to all configured consumers.
SRR-shared-resources/
βββ .github/
β βββ consumer-config.yml # Defines which folders sync to which consumers
β βββ workflows/
β βββ populate-downstream.yml # [Auto] Syncs updates to all consumers
β βββ reverse-upstream.yml # [Auto] Processes consumer changes
β βββ auto-pr-upstream.yml # [Auto] Creates PR for upstream changes
βββ grafana-dashboard/ # Grafana dashboards
βββ jinja2/ # Jinja2 templates
βββ jsnapy/ # JSNAPy test templates
βββ query-rule/ # Network query rules
βββ robottest/ # Robot Framework tests
βββ tableview/ # Table view templates
βββ textfsm/ # TextFSM parsing templates
βββ ttp/ # Template Text Parser templates
- Developer pushes changes to any shared folder (e.g.,
jsnapy/test-bgp.yml) - GitHub Actions workflow
populate-downstream.ymltriggers - System syncs folders to all configured consumers
- Auto-PR created in each consumer repo (sync-auto β main)
- Consumer developers review and merge
Time: ~60 seconds for 3 consumers
- Developer edits template in consumer repo
- Consumer sends webhook to this repo
reverse-upstream.ymlprocesses change, creates branchfrom-<consumer>-<folder>auto-pr-upstream.ymlcreates PR- Maintainer reviews and merges
- Change propagates back to all other consumers via downstream sync
Time: ~45 seconds + manual review
Location: .github/consumer-config.yml
Defines which folders sync to which consumers and where they're placed:
audit-tool:
repo: https://github.com/moophat/SRR-audit-tool.git
folders:
jsnapy: network_template/jsnapy
robottest: network_template/robottest
tableview: network_template/tableview
monitoring-tool:
repo: https://github.com/moophat/SRR-monitoring-tool.git
folders:
grafana-dashboard: resource/grafana-dashboard
query-rule: resource/query-rule
tableview: resource/tableview
template-editor:
repo: https://github.com/moophat/SRR-template-editor.git
folders:
jsnapy: template/jsnapy
jinja2: template/jinja2
ttp: template/ttp
textfsm: template/textfsm
tableview: template/tableviewKey feature: Same folder can map to different paths per consumer (e.g., tableview β 3 different locations).
Trigger: Push to main
Function: Syncs all shared folders to configured consumers
Output: Auto-PR in each consumer repo
Trigger: repository_dispatch webhook from consumer
Function: Creates branch with consumer changes
Output: Branch from-<consumer>-<folder> pushed to this repo
Trigger: Invoked by reverse-upstream.yml
Function: Creates PR for upstream changes
Output: PR from from-* branch β main
All workflows fully automated, no manual intervention required.
# 1. Edit any file in shared folders
vim jsnapy/test-bgp.yml
# 2. Commit and push
git add jsnapy/test-bgp.yml
git commit -m "Update BGP test for Junos 23.4"
git push origin main
# 3. Watch Actions tab - populate-downstream.yml runs
# 4. Check consumer repos - PRs appear automatically
# 5. Consumer teams review and mergeDo NOT:
- Push directly to consumer repos' synced folders (changes get overwritten)
- Edit
sync-autobranch in consumers (force-pushed on every sync)
-
Update
.github/consumer-config.yml:new-consumer: repo: https://github.com/org/new-consumer.git folders: jsnapy: path/to/jsnapy
-
Grant
GH_PATsecret access to new consumer repo -
Deploy workflows to new consumer (see specs)
-
Push to
main- new consumer receives sync
main- Production, triggers downstream sync on push
split-<folder>- Local only, exists during workflow executionfrom-<consumer>-<folder>- Upstream PR source branches (e.g.,from-audit-tool-jsnapy)
Manual cleanup needed periodically for from-* branches (see troubleshooting).
All automated commits are tagged with [auto-sync]:
[auto-sync][audit-tool] update jsnapy from consumer
Consumer commit: github.com/moophat/SRR-audit-tool@abc123
Consumer workflows skip commits containing [auto-sync] - prevents infinite sync loops.
Type: Fine-grained Personal Access Token Access: All consumer repositories Permissions:
- Contents: Read/Write
- Pull Requests: Read/Write
- Metadata: Read
Used by: All 3 workflows to clone consumers and create PRs
Cause: GH_PAT expired or lacks permissions Fix: Regenerate token, update secret in Settings β Secrets
Cause: Not in consumer-config.yml or wrong repo URL Fix: Check config syntax, verify repo URL
Cause: Folder content unchanged since last sync Fix: Close PR, not a bug (known behavior)
Cause: No auto-cleanup (by design) Fix: Manual cleanup periodically:
git branch -r | grep 'origin/from-' | cut -d'/' -f2- | xargs -I{} git push origin --delete {}Full troubleshooting: See ai_spec_v4/07_TROUBLESHOOTING.md in demo folder
Typical downstream sync (3 consumers, 8 folders):
- Folder splits: ~24 seconds
- Consumer processing: ~30 seconds
- Total: ~60 seconds
Typical upstream sync:
- Process consumer change: ~35 seconds
- PR creation: ~10 seconds
- Total: ~45 seconds (+ manual review time)
Full documentation: ai_spec_v4/ folder in demo repository
Key files:
00_OVERVIEW_v4.md- System overview01_ARCHITECTURE_v4.md- Detailed architecture02_DOWNSTREAM_v4.md- Downstream flow03_UPSTREAM_v4.md- Upstream flow07_TROUBLESHOOTING.md- Common issues
Deleting a file in any shared folder propagates to all consumers (via rm -rf before injection).
Same shared folder can map to different paths per consumer - this is the key feature enabling this architecture.
Consumers receive snapshot only. For commit history and git blame, check this repo.
sync-auto branch in consumers is force-pushed on every sync. Never commit manually to that branch.
Questions? Check ai_spec_v4/00_OVERVIEW_v4.md for complete system documentation.