Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/validate-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# =============================================================================
# validate-config.yml — Validate config/variables.example.yml against schema
# =============================================================================
# Triggered on PRs and pushes that touch config/ or this workflow.
# Validates YAML syntax and JSON Schema compliance.
# =============================================================================

name: Validate Configuration

on:
push:
branches: [main]
paths:
- 'config/**'
- '.github/workflows/validate-config.yml'
pull_request:
branches: [main]
paths:
- 'config/**'
workflow_dispatch:

permissions:
contents: read

jobs:
validate:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: pip install pyyaml jsonschema

- name: Validate variables.example.yml against schema
run: |
python3 -c "
import yaml, json, sys
from jsonschema import validate, ValidationError

with open('config/variables.example.yml') as f:
data = yaml.safe_load(f)

with open('config/schema/variables.schema.json') as f:
schema = json.load(f)

try:
validate(instance=data, schema=schema)
print('✅ config/variables.example.yml passes schema validation')
except ValidationError as e:
print(f'❌ Schema validation failed: {e.message}')
print(f' Path: {\" > \".join(str(p) for p in e.absolute_path)}')
sys.exit(1)
"
100 changes: 100 additions & 0 deletions config/schema/variables.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/AzureLocal/aurelocal-avd/config/schema/variables.schema.json",
"title": "AVD on Azure Local Variables",
"description": "Schema for config/variables.example.yml — validates required sections and key structure.",
"type": "object",
"required": ["subscription", "security", "control_plane", "session_hosts", "domain", "tags"],
"properties": {
"subscription": {
"type": "object",
"required": ["avd_subscription_id", "azure_local_subscription_id", "tenant_id", "location"],
"properties": {
"avd_subscription_id": { "type": "string" },
"azure_local_subscription_id": { "type": "string" },
"tenant_id": { "type": "string" },
"location": { "type": "string" }
}
},
"security": {
"type": "object",
"required": ["key_vault_name", "key_vault_resource_group"],
"properties": {
"key_vault_name": { "type": "string" },
"key_vault_resource_group": { "type": "string" }
}
},
"control_plane": {
"type": "object",
"required": ["resource_group", "host_pool_name", "host_pool_type", "app_group_name", "workspace_name"],
"properties": {
"resource_group": { "type": "string" },
"host_pool_name": { "type": "string" },
"host_pool_type": { "type": "string", "enum": ["Pooled", "Personal"] },
"load_balancer_type": { "type": "string", "enum": ["BreadthFirst", "DepthFirst"] },
"max_session_limit": { "type": "integer", "minimum": 1 },
"preferred_app_group_type": { "type": "string", "enum": ["Desktop", "RailApplications", "None"] },
"personal_assignment_type": { "type": "string", "enum": ["Automatic", "Direct"] },
"start_vm_on_connect": { "type": "boolean" },
"validation_environment": { "type": "boolean" },
"custom_rdp_properties": { "type": "string" },
"host_pool_friendly_name": { "type": "string" },
"host_pool_description": { "type": "string" },
"app_group_name": { "type": "string" },
"app_group_type": { "type": "string", "enum": ["Desktop", "RemoteApp"] },
"app_group_friendly_name": { "type": "string" },
"workspace_name": { "type": "string" },
"workspace_friendly_name": { "type": "string" }
}
},
"session_hosts": {
"type": "object",
"required": ["resource_group", "session_host_count", "vm_naming_prefix", "vm_processors", "vm_memory_mb", "vm_admin_username", "vm_admin_password", "custom_location_id", "logical_network_id", "gallery_image_id", "storage_path_id"],
"properties": {
"resource_group": { "type": "string" },
"session_host_count": { "type": "integer", "minimum": 1 },
"vm_naming_prefix": { "type": "string" },
"vm_start_index": { "type": "integer", "minimum": 0 },
"vm_processors": { "type": "integer", "minimum": 1 },
"vm_memory_mb": { "type": "integer", "minimum": 1024 },
"vm_admin_username": { "type": "string" },
"vm_admin_password": { "type": "string" },
"session_host_os": { "type": "string" },
"custom_location_id": { "type": "string" },
"logical_network_id": { "type": "string" },
"gallery_image_id": { "type": "string" },
"storage_path_id": { "type": "string" }
}
},
"domain": {
"type": "object",
"required": ["domain_fqdn", "domain_join_username", "domain_join_password"],
"properties": {
"domain_fqdn": { "type": "string" },
"domain_join_username": { "type": "string" },
"domain_join_password": { "type": "string" },
"domain_join_ou_path": { "type": "string" }
}
},
"entra_id": {
"type": "object",
"properties": {
"enable_entra_id_auth": { "type": "boolean" },
"enroll_in_intune": { "type": "boolean" },
"entra_user_login_group_id": { "type": "string" },
"entra_admin_login_group_id": { "type": "string" }
}
},
"tags": {
"type": "object",
"additionalProperties": { "type": "string" }
},
"ansible": {
"type": "object",
"properties": {
"ansible_connection": { "type": "string" }
}
}
},
"additionalProperties": false
}
Loading
Loading