1
0

setup_sprint10_taiga.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. sprint10 = next((m for m in milestones if m['name'] == 'Sprint 10'), None)
  14. if not sprint10:
  15. print("Sprint 10 not found, creating it...")
  16. payload = {
  17. "project": proj_id,
  18. "name": "Sprint 10",
  19. "estimated_start": datetime.now().strftime('%Y-%m-%d'),
  20. "estimated_finish": (datetime.now() + timedelta(days=7)).strftime('%Y-%m-%d')
  21. }
  22. sprint10 = requests.post(f'{base_url}/milestones', json=payload, headers=headers, verify=False).json()
  23. sprint_id = sprint10['id']
  24. print(f"Sprint 10 ID: {sprint_id}")
  25. stories = [
  26. {"subject": "Fix Llama3 Tool Compatibility", "description": "Upgrade local LLM from llama3 to llama3.1 to support the tool calling API required by Streamlit."},
  27. {"subject": "Resolve MySQL Cartesian Product Explosion", "description": "Identify and fix duplicate `code` entries causing massive JOIN explosions and Streamlit duplicate key crashes."},
  28. {"subject": "Implement Subquery First Optimization Strategy", "description": "Rewrite application SQL queries to apply MATCH() AGAINST() limits inside a subquery before executing LEFT JOINS, reducing search times to milliseconds."},
  29. {"subject": "UI Execution Timers", "description": "Add time.time() measurement wrappers around SQL queries and display execution times to the user to monitor application performance."},
  30. {"subject": "Zabbix Microsoft Teams Alert Integration", "description": "Configure Zabbix Webhook Media Types to post server and application alerts directly to a Microsoft Teams channel."}
  31. ]
  32. for s in stories:
  33. payload = {
  34. "project": proj_id,
  35. "subject": s["subject"],
  36. "description": s["description"],
  37. "milestone": sprint_id
  38. }
  39. res = requests.post(f'{base_url}/userstories', json=payload, headers=headers, verify=False)
  40. if res.status_code == 201:
  41. us = res.json()
  42. print(f"Created US: {us['subject']}")
  43. # Create a task for it
  44. t_payload = {
  45. "project": proj_id,
  46. "subject": f"Execute: {us['subject']}",
  47. "user_story": us['id'],
  48. "milestone": sprint_id
  49. }
  50. requests.post(f'{base_url}/tasks', json=t_payload, headers=headers, verify=False)
  51. else:
  52. print(f"Failed US: {res.text}")
  53. print("Sprint 10 populated!")