🚨 ArgoCD Deployment Failed: tech-connect-live #33
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: "Copilot - AKS Access" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| resource_group: | |
| description: 'Azure Resource Group' | |
| required: true | |
| default: 'rg-anyscale-demo' | |
| cluster_name: | |
| description: 'AKS Cluster Name' | |
| required: true | |
| default: 'aks-eastus2' | |
| issues: | |
| types: [labeled] | |
| env: | |
| ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | |
| ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
| ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | |
| ARM_USE_OIDC: true | |
| permissions: | |
| id-token: write | |
| contents: read | |
| issues: write | |
| jobs: | |
| copilot-setup-steps: | |
| runs-on: ubuntu-latest | |
| environment: copilot | |
| # Only run on label events if the label starts with 'cluster/' | |
| if: github.event_name == 'workflow_dispatch' || startsWith(github.event.label.name, 'cluster/') | |
| # Job-level permissions override workflow-level, so you must include id-token here | |
| permissions: | |
| contents: write | |
| id-token: write # Required for Azure federated identity | |
| issues: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Parse cluster info from label or inputs | |
| id: cluster-info | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| # Use workflow inputs | |
| echo "RESOURCE_GROUP=${{ github.event.inputs.resource_group }}" >> $GITHUB_OUTPUT | |
| echo "CLUSTER_NAME=${{ github.event.inputs.cluster_name }}" >> $GITHUB_OUTPUT | |
| echo "Using workflow inputs: RG=${{ github.event.inputs.resource_group }}, Cluster=${{ github.event.inputs.cluster_name }}" | |
| else | |
| # Parse from label: cluster/<resource-group>/<cluster-name> | |
| LABEL="${{ github.event.label.name }}" | |
| echo "Parsing label: $LABEL" | |
| # Extract resource group and cluster name from label | |
| # Expected format: cluster/<resource-group>/<cluster-name> | |
| RESOURCE_GROUP=$(echo "$LABEL" | cut -d'/' -f2) | |
| CLUSTER_NAME=$(echo "$LABEL" | cut -d'/' -f3) | |
| if [ -z "$RESOURCE_GROUP" ] || [ -z "$CLUSTER_NAME" ]; then | |
| echo "ERROR: Invalid label format. Expected: cluster/<resource-group>/<cluster-name>" | |
| echo "Got: $LABEL" | |
| exit 1 | |
| fi | |
| echo "RESOURCE_GROUP=$RESOURCE_GROUP" >> $GITHUB_OUTPUT | |
| echo "CLUSTER_NAME=$CLUSTER_NAME" >> $GITHUB_OUTPUT | |
| echo "Parsed from label: RG=$RESOURCE_GROUP, Cluster=$CLUSTER_NAME" | |
| fi | |
| - name: Azure CLI Login | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.ARM_CLIENT_ID }} | |
| tenant-id: ${{ secrets.ARM_TENANT_ID }} | |
| subscription-id: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
| - name: Install GitHub Copilot CLI | |
| run: | | |
| curl -fsSL https://gh.io/copilot-install | bash | |
| echo "Installed Copilot CLI version:" | |
| copilot --version | |
| - name: Verify Azure Login | |
| run: | | |
| echo "Verifying Azure authentication..." | |
| az account show | |
| - name: Get AKS Credentials | |
| run: | | |
| echo "Fetching kubeconfig for cluster ${{ steps.cluster-info.outputs.CLUSTER_NAME }}..." | |
| az aks get-credentials \ | |
| --resource-group ${{ steps.cluster-info.outputs.RESOURCE_GROUP }} \ | |
| --name ${{ steps.cluster-info.outputs.CLUSTER_NAME }} \ | |
| --overwrite-existing | |
| echo "Kubeconfig fetched successfully!" | |
| kubectl cluster-info | |
| kubectl port-forward -n aks-mcp svc/aks-mcp 8000:8000 & | |
| sleep 3 # Wait for port-forward to establish | |
| - name: Run Copilot to get AKS info | |
| env: | |
| GITHUB_MCP_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Workflow token for MCP GitHub operations (issues) | |
| GITHUB_TOKEN: ${{ secrets.COPILOT_CLI_TOKEN }} # Personal PAT for Copilot API authentication | |
| run: | | |
| echo "Analyzing issue #${{ github.event.issue.number }}" | |
| echo "Loading documentation criteria from prompt..." | |
| export PROMPT="How many nodes are in my AKS Cluster? Once you have that info, create a new GitHub Issue in this repository with the AKS Cluster node count information." | |
| echo "Delegating to GitHub Copilot..." | |
| echo "- Copilot will use MCP to examine the AKS Cluster" | |
| echo "- Copilot will use MCP to write the info to a new GitHub Issue" | |
| echo "" | |
| copilot -p "$PROMPT" \ | |
| --additional-mcp-config @'.copilot/mcp-config.json' \ | |
| --allow-all-tools |