mirror of
https://github.com/nubenetes/awesome-kubernetes.git
synced 2026-07-13 18:30:44 +00:00
Bumps the action-updates group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [actions/cache](https://github.com/actions/cache) and [peter-evans/repository-dispatch](https://github.com/peter-evans/repository-dispatch). Updates `actions/checkout` from 6 to 7 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v6...v7) Updates `actions/cache` from 5 to 6 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v5...v6) Updates `peter-evans/repository-dispatch` from 3 to 4 - [Release notes](https://github.com/peter-evans/repository-dispatch/releases) - [Commits](https://github.com/peter-evans/repository-dispatch/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major dependency-group: action-updates - dependency-name: actions/cache dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major dependency-group: action-updates - dependency-name: peter-evans/repository-dispatch dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major dependency-group: action-updates ... Signed-off-by: dependabot[bot] <support@github.com>
82 lines
3.0 KiB
YAML
82 lines
3.0 KiB
YAML
name: 08.2. Critical Asset Monitor
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 0 15 2,5,8,11 *' # Mid-Quarter pulse: Feb, May, Aug, Nov 15th
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
monitor-critical:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Repository Synchronization
|
|
uses: actions/checkout@v7
|
|
with:
|
|
ref: develop
|
|
|
|
- name: Python 3.11 Environment Provisioning
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.11'
|
|
cache: 'pip'
|
|
|
|
- name: Dependencies Installation
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install --no-cache-dir httpx PyYAML PyGithub beautifulsoup4 tenacity
|
|
|
|
- name: Critical Health Audit Execution
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
PYTHONPATH: ${{ github.workspace }}
|
|
PYTHONUNBUFFERED: 1
|
|
run: |
|
|
python -c "
|
|
import asyncio, httpx, yaml, os
|
|
from datetime import datetime
|
|
from src.gitops_manager import RepositoryController
|
|
|
|
async def check():
|
|
with open('data/inventory.yaml', 'r') as f:
|
|
inv = yaml.safe_load(f) or {}
|
|
|
|
critical_links = [u for u, d in inv.items() if any(t in ['[DE FACTO STANDARD]', '[ENTERPRISE-STABLE]'] for t in d.get('tags', []))]
|
|
print(f'[*] Auditing {len(critical_links)} critical assets...')
|
|
|
|
dead = []
|
|
async with httpx.AsyncClient(timeout=10.0, follow_redirects=True) as client:
|
|
for url in critical_links:
|
|
try:
|
|
resp = await client.get(url)
|
|
if resp.status_code == 404:
|
|
dead.append(url)
|
|
print(f' [!] CRITICAL DOWN: {url}')
|
|
except: pass
|
|
|
|
if dead:
|
|
# Flag in inventory
|
|
for url in dead:
|
|
inv[url]['status'] = 'offline'
|
|
inv[url]['last_offline'] = datetime.now().isoformat()
|
|
|
|
with open('data/inventory.yaml', 'w') as f:
|
|
yaml.dump(inv, f, sort_keys=False, allow_unicode=True)
|
|
|
|
with open('data/inventory.yaml', 'r') as f:
|
|
updated_inv = f.read()
|
|
|
|
# Create PR/Issue
|
|
git = RepositoryController(os.environ['GH_TOKEN'], 'nubenetes/awesome-kubernetes')
|
|
body = '### 🚨 Critical Assets Offline\n\n' + '\n'.join([f'- {u}' for u in dead])
|
|
git.apply_multi_file_changes({'data/inventory.yaml': updated_inv}, {'removals': len(dead)})
|
|
print('[OK] Inventory updated and PR created.')
|
|
else:
|
|
print('[OK] All critical assets are online.')
|
|
|
|
asyncio.run(check())
|
|
"
|