Added wiki generator
Some checks failed
Terraform / Terraform (push) Has been cancelled
Update Authentik Applications Wiki / Generate and Update Wiki (push) Failing after 20s

This commit is contained in:
AB from home.homenet
2025-09-16 16:04:18 +03:00
parent 1184ff9060
commit 8b959fec49
2 changed files with 26 additions and 5 deletions

View File

@@ -125,6 +125,17 @@ def main():
content = f.read() content = f.read()
print(f"🔍 File content preview: {content[:100]}...") print(f"🔍 File content preview: {content[:100]}...")
# Clean content - remove command line if present
if content.startswith('[command]'):
print("⚠️ Detected command prefix, removing...")
lines = content.split('\n', 1)
if len(lines) > 1:
content = lines[1]
print(f"🔍 Cleaned content preview: {content[:100]}...")
else:
print("ERROR: File contains only command line, no JSON data")
sys.exit(1)
# Parse JSON # Parse JSON
try: try:
terraform_output = json.loads(content) terraform_output = json.loads(content)
@@ -133,12 +144,18 @@ def main():
print(f"Content starts with: {content[:50]}") print(f"Content starts with: {content[:50]}")
sys.exit(1) sys.exit(1)
# Extract application data # Extract application data - now terraform_output IS the value
apps_data = terraform_output.get('applications_for_wiki', {}).get('value', {}) apps_data = terraform_output
if not apps_data: if not apps_data:
print("ERROR: No applications_for_wiki output found in Terraform output") print("ERROR: No applications data found in Terraform output")
print(f"Available outputs: {list(terraform_output.keys())}") print(f"Output content: {terraform_output}")
sys.exit(1)
# Check if we have correct structure
if 'proxy_apps' not in apps_data and 'oauth_apps' not in apps_data:
print("ERROR: Expected 'proxy_apps' or 'oauth_apps' in output")
print(f"Available keys: {list(apps_data.keys())}")
sys.exit(1) sys.exit(1)
print(f"📊 Found {len(apps_data.get('proxy_apps', {}))} proxy apps, {len(apps_data.get('oauth_apps', {}))} oauth apps") print(f"📊 Found {len(apps_data.get('proxy_apps', {}))} proxy apps, {len(apps_data.get('oauth_apps', {}))} oauth apps")

View File

@@ -36,7 +36,11 @@ jobs:
- name: Generate Terraform Output - name: Generate Terraform Output
run: | run: |
echo "🔍 Generating Terraform output..." echo "🔍 Generating Terraform output..."
terraform output -json > terraform-output.json # Use terraform-bin directly to avoid wrapper output
terraform output -json applications_for_wiki > terraform-output-raw.json
# Extract just the value field
jq '.value' terraform-output-raw.json > terraform-output.json
# Debug output file # Debug output file
echo "📄 Output file size: $(wc -c < terraform-output.json) bytes" echo "📄 Output file size: $(wc -c < terraform-output.json) bytes"