feat: Implement Scheduler Worker Options and Planner Loop
- Added `SchedulerWorkerOptions` class to encapsulate configuration for the scheduler worker. - Introduced `PlannerBackgroundService` to manage the planner loop, fetching and processing planning runs. - Created `PlannerExecutionService` to handle the execution logic for planning runs, including impact targeting and run persistence. - Developed `PlannerExecutionResult` and `PlannerExecutionStatus` to standardize execution outcomes. - Implemented validation logic within `SchedulerWorkerOptions` to ensure proper configuration. - Added documentation for the planner loop and impact targeting features. - Established health check endpoints and authentication mechanisms for the Signals service. - Created unit tests for the Signals API to ensure proper functionality and response handling. - Configured options for authority integration and fallback authentication methods.
This commit is contained in:
@@ -109,6 +109,89 @@ jobs:
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
|
||||
- name: Export policy run schemas
|
||||
id: export-policy-schemas
|
||||
run: |
|
||||
set -euo pipefail
|
||||
OUTPUT_DIR="artifacts/policy-schemas/${GITHUB_SHA}"
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
scripts/export-policy-schemas.sh "$OUTPUT_DIR"
|
||||
|
||||
- name: Detect policy schema changes
|
||||
id: detect-policy-schema-changes
|
||||
run: |
|
||||
set -euo pipefail
|
||||
OUTPUT_DIR="artifacts/policy-schemas/${GITHUB_SHA}"
|
||||
FILES=("policy-run-request.schema.json" "policy-run-status.schema.json" "policy-diff-summary.schema.json" "policy-explain-trace.schema.json")
|
||||
CHANGED=()
|
||||
DIFF_FILE="$OUTPUT_DIR/policy-schema-diff.patch"
|
||||
rm -f "$DIFF_FILE"
|
||||
|
||||
for file in "${FILES[@]}"; do
|
||||
if [ ! -f "$OUTPUT_DIR/$file" ]; then
|
||||
echo "Missing exported schema: $OUTPUT_DIR/$file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! cmp -s "docs/schemas/$file" "$OUTPUT_DIR/$file"; then
|
||||
CHANGED+=("$file")
|
||||
{
|
||||
diff -u "docs/schemas/$file" "$OUTPUT_DIR/$file" || true
|
||||
} >> "$DIFF_FILE"
|
||||
printf '\n' >> "$DIFF_FILE"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#CHANGED[@]} -eq 0 ]; then
|
||||
echo "changed=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
JOINED="$(IFS=', '; echo "${CHANGED[*]}")"
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
echo "changed_files=$JOINED" >> "$GITHUB_OUTPUT"
|
||||
echo "diff_path=artifacts/policy-schemas/${GITHUB_SHA}/policy-schema-diff.patch" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload policy schema artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: policy-schema-exports
|
||||
path: artifacts/policy-schemas
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
|
||||
- name: Notify policy schema changes
|
||||
if: steps.detect-policy-schema-changes.outputs.changed == 'true'
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.POLICY_ENGINE_SCHEMA_WEBHOOK || vars.POLICY_ENGINE_SCHEMA_WEBHOOK }}
|
||||
CHANGED_FILES: ${{ steps.detect-policy-schema-changes.outputs.changed_files }}
|
||||
run: |
|
||||
if [ -z "${SLACK_WEBHOOK:-}" ]; then
|
||||
echo "ℹ️ POLICY_ENGINE_SCHEMA_WEBHOOK not configured; skipping Slack notification."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
payload="$(python3 - <<'PY'
|
||||
import json
|
||||
import os
|
||||
|
||||
changed_files = os.environ.get("CHANGED_FILES", "").strip()
|
||||
repo = os.environ["GITHUB_REPOSITORY"]
|
||||
sha = os.environ["GITHUB_SHA"]
|
||||
commit_url = f"{os.environ['GITHUB_SERVER_URL']}/{repo}/commit/{sha}"
|
||||
run_url = f"{os.environ['GITHUB_SERVER_URL']}/{repo}/actions/runs/{os.environ['GITHUB_RUN_ID']}"
|
||||
lines = [
|
||||
":scroll: Policy schema export updated.",
|
||||
f"*Commit:* <{commit_url}|{sha[:7]}>",
|
||||
]
|
||||
if changed_files:
|
||||
lines.append(f"*Files:* {changed_files}")
|
||||
lines.append(f"*CI run:* <{run_url}|Artifacts & diff>")
|
||||
print(json.dumps({"text": "\n".join(lines)}))
|
||||
PY
|
||||
)"
|
||||
|
||||
curl -sSf -X POST -H 'Content-type: application/json' --data "$payload" "$SLACK_WEBHOOK"
|
||||
- name: Run release tooling tests
|
||||
run: python ops/devops/release/test_verify_release.py
|
||||
|
||||
|
||||
Reference in New Issue
Block a user