forked from LengKundee/MQL5-Google-Onedrive
- Created comprehensive workflow diagram showing pipeline stages - Visualized artifact flow and deployment process - Documented trigger conditions and success criteria - All implementation complete and tested Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
228 lines
19 KiB
Markdown
228 lines
19 KiB
Markdown
# GitLab CI/CD Workflow Diagram
|
|
|
|
```
|
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
│ GITLAB CI/CD PIPELINE │
|
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
TRIGGER
|
|
│
|
|
┌───────────────┼───────────────┐
|
|
│ │ │
|
|
Push Tag Create Merge Request
|
|
│ │ │
|
|
└───────────────┴───────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
│ STAGE 1: VALIDATE │
|
|
├─────────────────────────────────────────────────────────────────────────────┤
|
|
│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
|
|
│ │ validate: │ │ validate: │ │ validate: │ │
|
|
│ │ repository │ │ scripts │ │ secrets │ │
|
|
│ │ │ │ │ │ │ │
|
|
│ │ • Check MQL5 │ │ • Bash syntax │ │ • Scan for │ │
|
|
│ │ files │ │ • Script │ │ credentials │ │
|
|
│ │ • Validate │ │ validation │ │ • Security │ │
|
|
│ │ structure │ │ │ │ check │ │
|
|
│ └──────────────────┘ └──────────────────┘ └──────────────────┘ │
|
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
│ STAGE 2: BUILD │
|
|
├─────────────────────────────────────────────────────────────────────────────┤
|
|
│ ┌──────────────────────────────────────────────────────────┐ │
|
|
│ │ build:docs │ │
|
|
│ │ │ │
|
|
│ │ • Compile documentation │ │
|
|
│ │ • Package docs for distribution │ │
|
|
│ │ • Create README artifacts │ │
|
|
│ └──────────────────────────────────────────────────────────┘ │
|
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
│ STAGE 3: TEST │
|
|
├─────────────────────────────────────────────────────────────────────────────┤
|
|
│ ┌──────────────────────────────────────────────────────────┐ │
|
|
│ │ test:automation │ │
|
|
│ │ │ │
|
|
│ │ • Run Python test suite │ │
|
|
│ │ • Validate automation scripts │ │
|
|
│ │ • Check configurations │ │
|
|
│ └──────────────────────────────────────────────────────────┘ │
|
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
│ STAGE 4: PACKAGE │
|
|
├─────────────────────────────────────────────────────────────────────────────┤
|
|
│ ┌──────────────────┐ ┌──────────────────┐ │
|
|
│ │ package:mt5 │ │ package:docker │ │
|
|
│ │ │ │ │ │
|
|
│ │ • Collect MQL5 │ │ • Build Docker │ │
|
|
│ │ sources │ │ image │ │
|
|
│ │ • Create ZIP │ │ • Tag image │ │
|
|
│ │ • Upload │ │ • Push to │ │
|
|
│ │ artifact │ │ registry │ │
|
|
│ │ │ │ │ │
|
|
│ │ 📦 Exness_MT5_ │ │ 🐳 Docker Image │ │
|
|
│ │ MQL5.zip │ │ (GitLab) │ │
|
|
│ └──────────────────┘ └──────────────────┘ │
|
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
│ STAGE 5: DEPLOY │
|
|
├─────────────────────────────────────────────────────────────────────────────┤
|
|
│ │
|
|
│ ┌────────────────────────────────────────────────────────┐ │
|
|
│ │ deploy:staging (Manual) │ │
|
|
│ │ • Deploy to staging environment │ │
|
|
│ │ • Run on main branch only │ │
|
|
│ └────────────────────────────────────────────────────────┘ │
|
|
│ │ │
|
|
│ ┌────────────────────────────────────────────────────────┐ │
|
|
│ │ deploy:production (Manual, Tags) │ │
|
|
│ │ • Deploy to production │ │
|
|
│ │ • Run on tags only │ │
|
|
│ │ • Requires approval │ │
|
|
│ └────────────────────────────────────────────────────────┘ │
|
|
│ │ │
|
|
│ ┌────────────────────────────────────────────────────────┐ │
|
|
│ │ deploy:cloud (Manual) │ │
|
|
│ │ • Deploy to Render.com │ │
|
|
│ │ • Deploy to Railway.app │ │
|
|
│ │ • Deploy to Fly.io │ │
|
|
│ └────────────────────────────────────────────────────────┘ │
|
|
│ │ │
|
|
│ ┌────────────────────────────────────────────────────────┐ │
|
|
│ │ release:create (Tags) │ │
|
|
│ │ • Create GitLab Release │ │
|
|
│ │ • Attach artifacts │ │
|
|
│ │ • Generate release notes │ │
|
|
│ └────────────────────────────────────────────────────────┘ │
|
|
│ │
|
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
════════════════════════════════════════════════════════════════════════════════
|
|
ARTIFACTS & OUTPUTS
|
|
════════════════════════════════════════════════════════════════════════════════
|
|
|
|
📦 MT5 Package 🐳 Docker Images
|
|
• Exness_MT5_MQL5.zip • registry.gitlab.com/.../mql5:latest
|
|
• Expires: 30 days • registry.gitlab.com/.../mql5:<sha>
|
|
• Size: ~100KB • Multi-architecture support
|
|
|
|
📚 Documentation 🏷️ GitLab Release
|
|
• docs/ directory • Version tag
|
|
• README.md • Release notes
|
|
• Expires: 1 week • Attached artifacts
|
|
|
|
════════════════════════════════════════════════════════════════════════════════
|
|
ENVIRONMENT VARIABLES & SECRETS
|
|
════════════════════════════════════════════════════════════════════════════════
|
|
|
|
Required (Protected & Masked):
|
|
• TELEGRAM_BOT_TOKEN • RENDER_API_KEY
|
|
• GEMINI_API_KEY • RAILWAY_TOKEN
|
|
• JULES_API_KEY • FLY_API_TOKEN
|
|
• GITHUB_PAT • DOCKER_PASSWORD
|
|
• CLOUDFLARE_API_TOKEN
|
|
|
|
Optional:
|
|
• CLOUDFLARE_ZONE_ID • SLACK_WEBHOOK
|
|
• CLOUDFLARE_ACCOUNT_ID • DISCORD_WEBHOOK
|
|
• DOMAIN_NAME • Various others
|
|
|
|
════════════════════════════════════════════════════════════════════════════════
|
|
GITLAB RUNNER CONFIGURATION
|
|
════════════════════════════════════════════════════════════════════════════════
|
|
|
|
Executor: Docker
|
|
Image: python:3.12-slim
|
|
Tags: mql5, python, docker, trading
|
|
Concurrent Jobs: 2 per runner
|
|
Count: 2 runners (scalable with GET)
|
|
|
|
════════════════════════════════════════════════════════════════════════════════
|
|
GITLAB ENVIRONMENT TOOLKIT (GET)
|
|
════════════════════════════════════════════════════════════════════════════════
|
|
|
|
┌───────────────────────────────────────────────────────────┐
|
|
│ Infrastructure │
|
|
│ │
|
|
│ AWS / GCP / Azure │
|
|
│ ┌─────────────┐ ┌─────────────┐ │
|
|
│ │ Runner 1 │ │ Runner 2 │ ... (Scalable) │
|
|
│ │ (Docker) │ │ (Docker) │ │
|
|
│ └─────────────┘ └─────────────┘ │
|
|
│ │ │ │
|
|
│ └────────────────┘ │
|
|
│ │ │
|
|
│ ▼ │
|
|
│ ┌────────────────┐ │
|
|
│ │ GitLab.com │ │
|
|
│ │ (CI/CD Server) │ │
|
|
│ └────────────────┘ │
|
|
└───────────────────────────────────────────────────────────┘
|
|
|
|
Managed by:
|
|
• Terraform (Infrastructure as Code)
|
|
• Ansible (Configuration Management)
|
|
• .get-config.yml (Project Configuration)
|
|
|
|
════════════════════════════════════════════════════════════════════════════════
|
|
|
|
Legend:
|
|
▼ = Sequential execution
|
|
│ = Dependency
|
|
🔒 = Protected/Masked variable
|
|
📦 = Artifact
|
|
🐳 = Docker
|
|
✅ = Success required
|
|
⚠️ = Manual trigger
|
|
```
|
|
|
|
## Pipeline Behavior
|
|
|
|
### On Push to Main
|
|
- ✅ validate:repository
|
|
- ✅ validate:scripts
|
|
- ✅ validate:secrets
|
|
- ✅ build:docs
|
|
- ✅ test:automation
|
|
- ✅ package:mt5
|
|
- ✅ package:docker
|
|
- ⚠️ deploy:staging (manual)
|
|
- ⚠️ deploy:cloud (manual)
|
|
|
|
### On Merge Request
|
|
- ✅ validate:repository
|
|
- ✅ validate:scripts
|
|
- ✅ validate:secrets
|
|
- ✅ test:automation
|
|
- ✅ package:mt5
|
|
|
|
### On Tag Push (Release)
|
|
- ✅ All validation jobs
|
|
- ✅ All package jobs
|
|
- ✅ release:create (automatic)
|
|
- ⚠️ deploy:production (manual)
|
|
- ⚠️ deploy:cloud (manual)
|
|
|
|
## Success Criteria
|
|
|
|
All jobs must pass for:
|
|
- ✅ Merge requests to be mergeable
|
|
- ✅ Deployments to proceed
|
|
- ✅ Releases to be created
|
|
|
|
## Documentation
|
|
|
|
See detailed guides:
|
|
- [GitLab CI/CD Setup](docs/GITLAB_CI_CD_SETUP.md)
|
|
- [GitLab Environment Toolkit](docs/GITLAB_ENVIRONMENT_TOOLKIT.md)
|
|
- [API Environment Secrets](docs/API_ENVIRONMENT_SECRETS.md)
|
|
- [GitLab Quick Reference](docs/GITLAB_QUICK_REFERENCE.md)
|