-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add Chaibot test failure triage workflow to ci-chat-bot #80476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
08c4498
Add Chaibot test failure triage workflow to ci-chat-bot
chaclark1974 330bcc5
Configure ci-secret-bootstrap to sync Chaibot OpenAI API key from Vault
chaclark1974 ae7620b
Update clusters/app.ci/ci-chat-bot/ci-chat-bot.yaml
chaclark1974 e412dc8
Update clusters/app.ci/ci-chat-bot/ci-chat-bot.yaml
chaclark1974 17c503d
Update core-services/ci-secret-bootstrap/_config.yaml
chaclark1974 37165c6
Update clusters/app.ci/ci-chat-bot/chaibot-deployment-patch.yaml
chaclark1974 a2a41c4
Update CHAIBOT_QUICKSTART.md
chaclark1974 0cd7445
Update CHAIBOT_QUICKSTART.md
chaclark1974 902da97
Update CHAIBOT_QUICKSTART.md
chaclark1974 aaad668
Update DEPLOY_CHAIBOT.md
chaclark1974 d69ae0f
Update DEPLOY_CHAIBOT.md
chaclark1974 3385661
Update DEPLOY_CHAIBOT.md
chaclark1974 d3c3090
Update clusters/app.ci/ci-chat-bot/chaibot-deployment-patch.yaml
chaclark1974 8ea2623
Update clusters/app.ci/ci-chat-bot/chaibot-deployment-patch.yaml
chaclark1974 3c9fdb8
Fix malformed YAML in chaibot-deployment-patch.yaml
chaclark1974 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,218 @@ | ||
| # Chaibot Quick Start Guide | ||
|
|
||
| ## What is Chaibot? | ||
|
|
||
| An AI-powered Slack workflow that automatically triages test failures in #opp-discussion and posts analysis in threads. | ||
|
|
||
| ## Files Created | ||
|
|
||
| ``` | ||
| core-services/ci-chat-bot/ | ||
| ├── triage-config.yaml # Main config (source of truth) | ||
| └── CHAIBOT.md # Quick reference | ||
|
|
||
| clusters/app.ci/ci-chat-bot/ | ||
| ├── chaibot-configmap.yaml # Kubernetes ConfigMap | ||
| └── chaibot-deployment-patch.yaml # Deployment updates + alerts | ||
|
|
||
| core-services/ci-secret-bootstrap/ | ||
| └── chaibot-secret-config.yaml # Secret management | ||
|
|
||
| docs/ | ||
| └── chaibot-test-failure-triage.md # Full documentation | ||
| ``` | ||
|
|
||
| ## How to Deploy | ||
|
|
||
| ### Step 1: Get Credentials | ||
|
|
||
| ```bash | ||
| # 1. Get OpenAI API key from https://platform.openai.com/api-keys | ||
|
|
||
| # 2. Get Slack channel ID: | ||
| # - Right-click #opp-discussion in Slack | ||
| # - View channel details | ||
| # - Copy Channel ID (looks like C01234ABCD) | ||
|
|
||
| # 3. Update clusters/app.ci/ci-chat-bot/chaibot-configmap.yaml | ||
| # Replace REPLACE_WITH_CHANNEL_ID with actual ID | ||
| ``` | ||
|
|
||
| ### Step 2: Configure Secrets | ||
|
|
||
| ```bash | ||
| # Add to core-services/ci-secret-bootstrap/_config.yaml: | ||
| # (Follow pattern in chaibot-secret-config.yaml) | ||
|
|
||
| # Store OpenAI key in Vault | ||
| # Reference: https://docs.ci.openshift.org/docs/how-tos/adding-a-new-secret-to-ci/ | ||
| ``` | ||
|
|
||
| ### Step 3: Update ci-chat-bot Deployment | ||
|
|
||
| Edit `clusters/app.ci/ci-chat-bot/ci-chat-bot.yaml` and add: | ||
|
|
||
| ```yaml | ||
| # Add to spec.template.spec.volumes: | ||
| - name: triage-config | ||
| configMap: | ||
| name: ci-chat-bot-triage-config | ||
| - name: chaibot-secrets | ||
| secret: | ||
| secretName: cluster-secrets-chaibot-openai-key | ||
|
|
||
| # Add to spec.template.spec.containers[name=bot].volumeMounts: | ||
| - name: triage-config | ||
| mountPath: /etc/triage-config | ||
| readOnly: true | ||
| - name: chaibot-secrets | ||
| mountPath: /etc/chaibot-secrets | ||
| readOnly: true | ||
|
|
||
| # Add to spec.template.spec.containers[name=bot].env: | ||
| - name: CHAIBOT_ENABLED | ||
| value: "true" | ||
| - name: OPENAI_API_KEY | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: cluster-secrets-chaibot-openai-key | ||
| key: openai-api-key | ||
|
|
||
| # Add to spec.template.spec.containers[name=bot].args: | ||
| --enable-triage=true \ | ||
| --triage-config-path=/etc/triage-config/triage-config.yaml \ | ||
| ``` | ||
|
|
||
| ### Step 4: Deploy | ||
|
|
||
| ```bash | ||
| # From openshift/release repo root: | ||
| make update | ||
|
|
||
| # Apply ConfigMap | ||
| oc apply -f clusters/app.ci/ci-chat-bot/chaibot-configmap.yaml | ||
|
|
||
| # Apply updated deployment (after editing) | ||
| oc apply -f clusters/app.ci/ci-chat-bot/ci-chat-bot.yaml | ||
|
|
||
| # Watch rollout | ||
| oc rollout status deployment/ci-chat-bot -n ci | ||
| ``` | ||
|
|
||
| ### Step 5: Test | ||
|
|
||
| ``` | ||
| # In Slack #opp-discussion: | ||
| Post a message with a Prow job URL: | ||
|
|
||
| "This job failed: https://prow.ci.openshift.org/view/gs/origin-ci-test/..." | ||
|
|
||
| # Chaibot should respond in thread within 30-60 seconds | ||
| ``` | ||
|
|
||
| ## Example Output | ||
|
|
||
| ``` | ||
| Chaibot [BOT]: :cloud: Test Failure Analysis | ||
|
|
||
| Job: pull-ci-openshift-installer-master-e2e-aws | ||
| Status: Failed after 2h 15m | ||
| Root Cause: Infrastructure - AWS EC2 Capacity (85% confidence) | ||
|
|
||
| Analysis: | ||
| Cluster provisioning failed due to AWS InsufficientInstanceCapacity error. | ||
|
|
||
| Evidence: | ||
| Error: creating EC2 Instance: InsufficientInstanceCapacity (us-east-1c) | ||
|
|
||
| Historical: | ||
| 8 similar failures in last 24h (transient AWS issue) | ||
|
|
||
| Recommendations: | ||
| 1. Retest - likely to succeed on retry | ||
| 2. Check AWS Service Health Dashboard | ||
|
|
||
| Classification: Transient Infrastructure Issue | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| Edit `core-services/ci-chat-bot/triage-config.yaml`: | ||
|
|
||
| ```yaml | ||
| # Add channels | ||
| monitored_channels: | ||
| - name: "opp-discussion" | ||
| channel_id: "C01234567" | ||
|
|
||
| # Adjust AI settings | ||
| analysis: | ||
| ai_provider: "openai" | ||
| model: "gpt-4" # or "gpt-3.5-turbo" for lower cost | ||
|
|
||
| # Rate limiting | ||
| rate_limiting: | ||
| max_analyses_per_hour: 100 | ||
| ``` | ||
|
|
||
| ## Monitoring | ||
|
|
||
| ```bash | ||
| # Check logs | ||
| oc logs -n ci deployment/ci-chat-bot -c bot | grep chaibot | ||
|
|
||
| # View metrics | ||
| curl http://ci-chat-bot.ci.svc:9090/metrics | grep chaibot | ||
|
|
||
| # Grafana dashboard | ||
| https://grafana.ci.openshift.org/d/chaibot/ | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| **Not responding?** | ||
| ```bash | ||
| oc get pods -n ci -l app=ci-chat-bot | ||
| oc logs -n ci -l app=ci-chat-bot -c bot --tail=50 | ||
| ``` | ||
|
|
||
| **Wrong channel ID?** | ||
| ```bash | ||
| oc get configmap ci-chat-bot-triage-config -n ci -o yaml | ||
| # Update and reapply | ||
| ``` | ||
|
|
||
| **API errors?** | ||
| ```bash | ||
| # Check secret exists | ||
| oc get secret cluster-secrets-chaibot-openai-key -n ci | ||
|
|
||
| # View metrics for errors | ||
| curl http://ci-chat-bot.ci.svc:9090/metrics | grep chaibot_api_errors | ||
| ``` | ||
|
|
||
| ## Cost | ||
|
|
||
| - GPT-4: ~$0.03/analysis (~$90/month at 100 failures/day) | ||
| - GPT-3.5-turbo: ~$0.003/analysis (~$9/month at 100 failures/day) | ||
|
|
||
| Rate limiting prevents cost overruns. | ||
|
|
||
| ## Support | ||
|
|
||
| - **Questions**: #forum-ocp-testplatform | ||
| - **ci-chat-bot team**: #forum-ocp-crt | ||
| - **Full docs**: docs/chaibot-test-failure-triage.md | ||
| - **Issues**: https://github.com/openshift/ci-tools/issues | ||
|
|
||
| ## Important Note | ||
|
|
||
| ⚠️ This configuration requires **code implementation** in the ci-tools repo (openshift/ci-tools cmd/ci-chat-bot) to function. The configs are ready, but the bot logic needs development to: | ||
|
|
||
| 1. Parse triage-config.yaml | ||
| 2. Listen to Slack events | ||
| 3. Fetch job logs from GCS | ||
| 4. Call OpenAI API | ||
| 5. Format and post responses | ||
|
|
||
| See `docs/chaibot-test-failure-triage.md` for implementation details. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.