Add PR README with complete instructions #4
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
| name: Post Root Cause Analysis Comment | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| issue_number: | ||
| description: 'Issue number to comment on' | ||
| required: true | ||
| default: '12' | ||
| permissions: | ||
| issues: write | ||
| contents: read | ||
| jobs: | ||
| post-comment: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Post Analysis Comment | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| const commentBody = `## π Root Cause Analysis | ||
| I've investigated the ArgoCD deployment failure for the \`2-broken-apps\` application and identified **two critical issues** in the source repository's Kubernetes manifest file. | ||
| ### Issue 1: Invalid apiVersion β | ||
| **Location:** Line 178 in \`apps/broken-aks-store-all-in-one.yaml\` | ||
| \`\`\`yaml | ||
| apiVersion: apps/v | ||
| kind: Deployment | ||
| metadata: | ||
| name: order-service | ||
| \`\`\` | ||
| **Problem:** The \`apiVersion\` field is incomplete. It should be \`apps/v1\` but is only \`apps/v\`. | ||
| **Impact:** This causes ArgoCD sync to fail because Kubernetes cannot recognize this as a valid resource definition. | ||
| --- | ||
| ### Issue 2: Incorrect Container Image Name β | ||
| **Location:** Line 475 in \`apps/broken-aks-store-all-in-one.yaml\` | ||
| \`\`\`yaml | ||
| containers: | ||
| - name: store-admin | ||
| image: ghcr.io/azure-samples/aks-store-demo/store-dmin:2.1.0 | ||
| \`\`\` | ||
| **Problem:** The image name has a typo: \`store-dmin\` should be \`store-admin\`. | ||
| **Impact:** Even if the manifest syncs successfully, this pod will fail to start because the image doesn't exist in the container registry. | ||
| --- | ||
| ## π§ Remediation Recommendations | ||
| ### Option 1: Fix the Source Repository (Recommended) | ||
| Since the application is pointing to an external repository (\`https://github.com/dcasati/argocd-notification-examples.git\`), the best solution is to fix the issues at the source: | ||
| 1. **Contact the repository owner** (@dcasati) or submit a pull request to fix: | ||
| - Line 178: Change \`apiVersion: apps/v\` to \`apiVersion: apps/v1\` | ||
| - Line 475: Change \`store-dmin\` to \`store-admin\` | ||
| 2. **Wait for ArgoCD auto-sync** (or manually trigger sync): | ||
| \`\`\`bash | ||
| argocd app sync 2-broken-apps | ||
| \`\`\` | ||
| ### Option 2: Fork and Fix | ||
| If you need immediate resolution: | ||
| 1. **Fork the repository** to your own GitHub account or organization | ||
| 2. **Fix the two issues** mentioned above | ||
| 3. **Update the ArgoCD Application** spec in \`Act-3/argocd-test-app.yaml\`: | ||
| \`\`\`yaml | ||
| spec: | ||
| source: | ||
| repoURL: https://github.com/YOUR-ORG/argocd-notification-examples.git | ||
| targetRevision: main | ||
| path: apps | ||
| \`\`\` | ||
| ### Option 3: Local Patch (Not Recommended) | ||
| Apply the resources with corrections directly to the cluster, but this will cause drift from the GitOps source. | ||
| --- | ||
| ## β Verification Steps | ||
| After applying the fix: | ||
| 1. **Check ArgoCD application status:** | ||
| \`\`\`bash | ||
| argocd app get 2-broken-apps | ||
| \`\`\` | ||
| 2. **Verify all pods are running:** | ||
| \`\`\`bash | ||
| kubectl get pods -n default | ||
| kubectl get deployment order-service -n default | ||
| kubectl get deployment store-admin -n default | ||
| \`\`\` | ||
| 3. **Check pod status and logs:** | ||
| \`\`\`bash | ||
| kubectl describe deployment order-service -n default | ||
| kubectl describe deployment store-admin -n default | ||
| kubectl logs deployment/store-admin -n default | ||
| \`\`\` | ||
| --- | ||
| ## π Summary | ||
| The deployment failure is caused by: | ||
| 1. β Incomplete \`apiVersion: apps/v\` (should be \`apps/v1\`) - **Line 178** | ||
| 2. β Typo in image name \`store-dmin\` (should be \`store-admin\`) - **Line 475** | ||
| **Recommended Action:** Contact the repository owner or submit a PR to fix these issues in the source repository, then re-sync the ArgoCD application.`; | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: parseInt('${{ github.event.inputs.issue_number }}'), | ||
| body: commentBody | ||
| }); | ||
| console.log('Root cause analysis comment posted successfully!'); | ||