Files
iLSP/scripts/push_catalogs.sh
Henrik Jess Nielsen 333d986e76
All checks were successful
Build and Deploy iLSP / test (push) Successful in 25s
Build and Deploy iLSP / build-and-deploy (push) Successful in 1m34s
feat: YAML pipeline template autocomplete (AzDO + GHA)
- Add scripts/sync_pipeline_templates.py — scans LRU AzDO and GHA template
  repos; outputs unified pipeline_templates_catalog.json (48 templates: 45
  AzDO + 3 GHA)
- Add scripts/template_sources.yml — source config (AzDO alias, GHA org)
- Add pipeline_templates_catalog.json — baked catalog (49 KB)
- Add ilsp/yaml_lsp/catalog.py — PipelineTemplateCatalog with completion item
  generators for template paths, param names, allowed values, GHA inputs
- Add ilsp/yaml_lsp/proxy.py — async WS↔TCP bridge with LSP frame buffering,
  per-connection document tracking, AzDO/GHA context detection, and completion
  injection (LRU items sortText 0_, standard items downgraded to 9_)
- Wire yaml_ws_handler into server.py (replaces raw _ws_proxy call)
- Load PipelineTemplateCatalog at startup; reload + health report template count
- Update push_catalogs.sh to push pipeline_templates_catalog.json
- Update Dockerfile to bake pipeline_templates_catalog.json as image fallback
- Add tests/test_yaml_catalog.py (14 tests) + tests/test_yaml_proxy.py (18 tests)
  All 67 tests green
2026-05-10 15:59:37 +02:00

75 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# push_catalogs.sh — Push fresh catalogs to autobox iLSP volume
#
# Usage:
# ./scripts/push_catalogs.sh # push all catalogs
# ./scripts/push_catalogs.sh --no-reload # push but don't call /reload
#
# Catalogs:
# bicep_modules_catalog.json — from DevOpsMCP repo (sync_bicep_modules.py)
# iac_source_catalog.json — from DevOpsMCP repo (sync_iac_module_sources.py)
# pipeline_templates_catalog.json — from iLSP repo (scripts/sync_pipeline_templates.py)
#
# All files are written to /opt/nomad/volumes/ilsp-data/ on autobox — the host volume iLSP mounts at /data.
set -euo pipefail
DEVOPS_MCP_REPO="${DEVOPS_MCP_REPO:-$HOME/Projects/DevOpsMCP}"
AUTOBOX="autobox.i80.dk"
REMOTE_DIR="/opt/nomad/volumes/ilsp-data"
HEALTH_URL="https://ilsp.i80.dk/health"
RELOAD_URL="https://ilsp.i80.dk/reload"
NO_RELOAD=false
for arg in "$@"; do
[[ "$arg" == "--no-reload" ]] && NO_RELOAD=true
done
# Catalog files to push
BICEP_CATALOG="$DEVOPS_MCP_REPO/bicep_modules_catalog.json"
IAC_CATALOG="$DEVOPS_MCP_REPO/iac_source_catalog.json"
ILSP_REPO="$(cd "$(dirname "$0")/.." && pwd)"
TMPL_CATALOG="$ILSP_REPO/pipeline_templates_catalog.json"
echo "── iLSP catalog push ──────────────────────────────"
for f in "$BICEP_CATALOG" "$IAC_CATALOG"; do
if [[ ! -f "$f" ]]; then
echo " ✗ Not found: $f"
echo " Run: python3 $DEVOPS_MCP_REPO/scripts/sync_bicep_modules.py"
exit 1
fi
echo "$(basename "$f") ($(du -sh "$f" | cut -f1))"
done
if [[ ! -f "$TMPL_CATALOG" ]]; then
echo " ✗ Not found: $TMPL_CATALOG"
echo " Run: python3 $ILSP_REPO/scripts/sync_pipeline_templates.py"
exit 1
fi
echo "$(basename "$TMPL_CATALOG") ($(du -sh "$TMPL_CATALOG" | cut -f1))"
echo ""
echo " → Copying to $AUTOBOX:$REMOTE_DIR/ …"
ssh "$AUTOBOX" "mkdir -p $REMOTE_DIR"
scp "$BICEP_CATALOG" "$IAC_CATALOG" "$TMPL_CATALOG" "$AUTOBOX:$REMOTE_DIR/"
echo " ✓ Upload done"
if [[ "$NO_RELOAD" == "true" ]]; then
echo " (skipping /reload — restart iLSP manually to apply)"
exit 0
fi
echo ""
echo " → Calling $RELOAD_URL"
if response=$(curl -sf -X POST "$RELOAD_URL" 2>/dev/null); then
echo "$response"
else
echo " ✗ /reload failed (is ilsp.i80.dk reachable? try: curl https://ilsp.i80.dk/health)"
echo " Catalogs are on disk — they'll be used on next restart."
exit 1
fi
echo ""
echo " Done. Bicep + YAML pipeline template completions updated."