Skip to content

Commit f844ed1

Browse files
Copilotdcasati
andcommitted
Add helper script and documentation for posting issue analysis
Co-authored-by: dcasati <3240777+dcasati@users.noreply.github.com>
1 parent 61007f9 commit f844ed1

2 files changed

Lines changed: 152 additions & 0 deletions

File tree

.github/README_ANALYSIS.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# ArgoCD Deployment Failure Analysis
2+
3+
## Summary
4+
5+
This directory contains the root cause analysis for the ArgoCD deployment failure of the `2-broken-apps` application reported in [Issue #12](https://github.com/DevExpGbb/agentic-platform-engineering/issues/12).
6+
7+
## Quick Start
8+
9+
To post the analysis as a comment on the GitHub issue, use one of these methods:
10+
11+
### Method 1: GitHub CLI (Recommended)
12+
13+
```bash
14+
gh issue comment 12 --body-file .github/ISSUE_12_ANALYSIS.md
15+
```
16+
17+
### Method 2: GitHub Actions Workflow
18+
19+
Trigger the workflow manually from the Actions tab or via CLI:
20+
21+
```bash
22+
gh workflow run post-issue-analysis.yml -f issue_number=12
23+
```
24+
25+
### Method 3: Bash Script
26+
27+
Run the provided script:
28+
29+
```bash
30+
./.github/scripts/post-to-issue.sh 12
31+
```
32+
33+
### Method 4: Manual Copy-Paste
34+
35+
1. Open the issue: https://github.com/DevExpGbb/agentic-platform-engineering/issues/12
36+
2. Copy the contents of `.github/ISSUE_12_ANALYSIS.md`
37+
3. Paste into a new comment
38+
39+
## Files
40+
41+
- **ISSUE_12_ANALYSIS.md** - Complete root cause analysis and remediation recommendations
42+
- **workflows/post-issue-analysis.yml** - GitHub Actions workflow to post the analysis
43+
- **scripts/post-to-issue.sh** - Bash script to post the analysis
44+
- **scripts/post-issue-analysis.js** - Node.js helper script
45+
- **README_ANALYSIS.md** - This file
46+
47+
## Root Cause (TL;DR)
48+
49+
The deployment is failing due to an **invalid Kubernetes API version** in the manifest file:
50+
51+
**File:** `apps/broken-aks-store-all-in-one.yaml` (line 178) in the external repository
52+
**Issue:** `apiVersion: apps/v` should be `apiVersion: apps/v1`
53+
54+
This was intentionally broken for testing ArgoCD notification workflows (commit message: "break apiVersion formatting in deployment YAML").
55+
56+
## Remediation Options
57+
58+
1. **Fix the source repository** - Correct the `apiVersion` field in the YAML file
59+
2. **Point to a different source** - Update the ArgoCD Application to use a working repository
60+
3. **Use resource exclusion** - Temporarily exclude the broken deployment while investigating
61+
62+
See the full analysis in `ISSUE_12_ANALYSIS.md` for detailed remediation steps.

.github/scripts/post-to-issue.sh

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/bin/bash
2+
3+
# Post Issue Analysis to GitHub
4+
# This script posts the root cause analysis to a GitHub issue
5+
6+
set -e
7+
8+
ISSUE_NUMBER="${1:-12}"
9+
ANALYSIS_FILE=".github/ISSUE_12_ANALYSIS.md"
10+
REPO_OWNER="DevExpGbb"
11+
REPO_NAME="agentic-platform-engineering"
12+
13+
# Colors for output
14+
RED='\033[0;31m'
15+
GREEN='\033[0;32m'
16+
YELLOW='\033[1;33m'
17+
NC='\033[0m' # No Color
18+
19+
echo "================================================"
20+
echo " GitHub Issue Analysis Poster"
21+
echo "================================================"
22+
echo ""
23+
24+
# Check if analysis file exists
25+
if [ ! -f "$ANALYSIS_FILE" ]; then
26+
echo -e "${RED}Error: Analysis file not found at $ANALYSIS_FILE${NC}"
27+
exit 1
28+
fi
29+
30+
echo -e "${GREEN}✓ Analysis file found${NC}"
31+
32+
# Clean the comment body (remove the note section)
33+
COMMENT_BODY=$(sed '/^---$/,$ d' "$ANALYSIS_FILE" | sed -e 's/$/\\n/' | tr -d '\n')
34+
35+
# Method 1: Try gh CLI
36+
if command -v gh &> /dev/null && [ -n "$GITHUB_TOKEN" ] || gh auth status &> /dev/null 2>&1; then
37+
echo -e "${GREEN}Using GitHub CLI...${NC}"
38+
gh issue comment "$ISSUE_NUMBER" --body-file "$ANALYSIS_FILE"
39+
echo -e "${GREEN}✓ Comment posted successfully using gh CLI!${NC}"
40+
exit 0
41+
fi
42+
43+
# Method 2: Try curl with GITHUB_TOKEN
44+
if [ -n "$GITHUB_TOKEN" ]; then
45+
echo -e "${GREEN}Using curl with GITHUB_TOKEN...${NC}"
46+
47+
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
48+
-H "Accept: application/vnd.github+json" \
49+
-H "Authorization: Bearer $GITHUB_TOKEN" \
50+
-H "X-GitHub-Api-Version: 2022-11-28" \
51+
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/issues/$ISSUE_NUMBER/comments" \
52+
-d @<(jq -Rs '{body: .}' < "$ANALYSIS_FILE"))
53+
54+
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
55+
BODY=$(echo "$RESPONSE" | sed '$d')
56+
57+
if [ "$HTTP_CODE" = "201" ]; then
58+
echo -e "${GREEN}✓ Comment posted successfully using curl!${NC}"
59+
COMMENT_URL=$(echo "$BODY" | jq -r '.html_url')
60+
echo "Comment URL: $COMMENT_URL"
61+
exit 0
62+
else
63+
echo -e "${RED}✗ Failed to post comment. HTTP code: $HTTP_CODE${NC}"
64+
echo "$BODY" | jq .
65+
exit 1
66+
fi
67+
fi
68+
69+
# Method 3: Provide instructions for manual posting
70+
echo -e "${YELLOW}No authentication method available.${NC}"
71+
echo ""
72+
echo "To post this analysis to issue #$ISSUE_NUMBER, use one of these methods:"
73+
echo ""
74+
echo "Method 1 - GitHub CLI:"
75+
echo " gh issue comment $ISSUE_NUMBER --body-file $ANALYSIS_FILE"
76+
echo ""
77+
echo "Method 2 - GitHub Web UI:"
78+
echo " 1. Go to: https://github.com/$REPO_OWNER/$REPO_NAME/issues/$ISSUE_NUMBER"
79+
echo " 2. Copy the contents of: $ANALYSIS_FILE"
80+
echo " 3. Paste into a new comment"
81+
echo ""
82+
echo "Method 3 - Trigger the workflow:"
83+
echo " gh workflow run post-issue-analysis.yml -f issue_number=$ISSUE_NUMBER"
84+
echo ""
85+
echo "Method 4 - Use curl with your token:"
86+
echo " export GITHUB_TOKEN=your_token_here"
87+
echo " bash .github/scripts/post-to-issue.sh $ISSUE_NUMBER"
88+
echo ""
89+
90+
exit 1

0 commit comments

Comments
 (0)