update_taiga_deployment.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import requests
  2. import json
  3. import urllib3
  4. import os
  5. from dotenv import load_dotenv
  6. load_dotenv()
  7. urllib3.disable_warnings()
  8. TAIGA_USER = os.environ.get('TAIGA_USER', 'FrancoisLange')
  9. TAIGA_PASS = os.environ.get('TAIGA_PASS', 'your_db_password_here')
  10. base_url = 'https://192.168.130.161/taiga/api/v1'
  11. auth = requests.post(f'{base_url}/auth', json={'type': 'normal', 'username': TAIGA_USER, 'password': TAIGA_PASS}, verify=False).json()
  12. h = {'Authorization': f'Bearer {auth["auth_token"]}', 'Content-Type': 'application/json'}
  13. project_id = 21
  14. # 1. Create a User Story / Task for Distributed Deployment
  15. us_payload = {
  16. "project": project_id,
  17. "subject": "Distribute Deployment Architecture (WSL, Hyper-V, VirtualBox)",
  18. "description": "Architected a distributed deployment model. Configured the VMs to use Bridged Adapters for subnet consistency. Created a Python CLI to dynamically deploy components (DB, App, Monitoring) to avoid port conflicts and isolate credentials inside Docker containers."
  19. }
  20. us_resp = requests.post(f'{base_url}/userstories', json=us_payload, headers=h, verify=False)
  21. if us_resp.status_code == 201:
  22. us_id = us_resp.json()['id']
  23. task_payload = {
  24. "project": project_id,
  25. "user_story": us_id,
  26. "subject": "Create setup_deploy.py for Docker orchestration",
  27. "description": "Added docker access checks. Credentials remain strictly isolated in the generated docker-compose .env files."
  28. }
  29. requests.post(f'{base_url}/tasks', json=task_payload, headers=h, verify=False)
  30. print("Taiga successfully updated with Distributed Deployment tasks!")