setup_sprint8_taiga.py 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import requests
  2. import urllib3
  3. from datetime import datetime, timedelta
  4. urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  5. # Authenticate
  6. base_url = 'https://192.168.130.161/taiga/api/v1'
  7. auth_url = f'{base_url}/auth'
  8. auth = requests.post(auth_url, json={'type': 'normal', 'username': 'FrancoisLange', 'password': 'BTSai123'}, verify=False).json()
  9. headers = {'Authorization': f'Bearer {auth["auth_token"]}', 'Content-Type': 'application/json'}
  10. proj_id = 21
  11. print("Fetching Sprints...")
  12. milestones = requests.get(f'{base_url}/milestones?project={proj_id}', headers=headers, verify=False).json()
  13. sprint8 = next((m for m in milestones if m['name'] == 'Sprint 8'), None)
  14. if not sprint8:
  15. print("Sprint 8 not found, creating it...")
  16. payload = {
  17. "project": proj_id,
  18. "name": "Sprint 8",
  19. "estimated_start": datetime.now().strftime('%Y-%m-%d'),
  20. "estimated_finish": (datetime.now() + timedelta(days=7)).strftime('%Y-%m-%d')
  21. }
  22. sprint8 = requests.post(f'{base_url}/milestones', json=payload, headers=headers, verify=False).json()
  23. sprint_id = sprint8['id']
  24. print(f"Sprint 8 ID: {sprint_id}")
  25. stories = [
  26. {"subject": "Clinical Explorer Verification Testing", "description": "Generate comprehensive test cases for a Pregnant, Diabetic, and Kidney patient profile across AI Chat, Search, and Meal Planning."},
  27. {"subject": "Zabbix Application Monitoring Checks", "description": "Verify Zabbix installation and configure it to monitor both the server and application successfully."},
  28. {"subject": "Zabbix Email Integration", "description": "Configure Zabbix default mail media types to direct alerts to the administrator email."},
  29. {"subject": "Zabbix Live Alert Testing", "description": "Simulate and trigger an application alert and a server alert to confirm detection by Zabbix."},
  30. {"subject": "Server Backup Procedures", "description": "Generate and document a formalized backup procedure for the MySQL databases and Docker infrastructure."},
  31. {"subject": "WSL Deployment Playbook", "description": "Create a procedural runbook for deploying the entire Local Food AI project into a new fresh WSL instance."},
  32. {"subject": "Agile Scrum Rituals Wiki", "description": "Document the Agile methodologies used in the project including Daily scrums, Sprint Reviews, Retrospectives, and Planning in the Wiki."}
  33. ]
  34. for s in stories:
  35. payload = {
  36. "project": proj_id,
  37. "subject": s["subject"],
  38. "description": s["description"],
  39. "milestone": sprint_id
  40. }
  41. res = requests.post(f'{base_url}/userstories', json=payload, headers=headers, verify=False)
  42. if res.status_code == 201:
  43. us = res.json()
  44. print(f"Created US: {us['subject']}")
  45. # Create a task for it
  46. t_payload = {
  47. "project": proj_id,
  48. "subject": f"Execute: {us['subject']}",
  49. "user_story": us['id'],
  50. "milestone": sprint_id
  51. }
  52. requests.post(f'{base_url}/tasks', json=t_payload, headers=headers, verify=False)
  53. else:
  54. print(f"Failed US: {res.text}")
  55. print("Sprint 8 populated!")