Skip to content

Commit

Permalink
Merge pull request #1 from Prashant-Microsoft/main
Browse files Browse the repository at this point in the history
feat: CI Pipeline Notification handling
  • Loading branch information
Roopan-Microsoft authored Oct 18, 2024
2 parents c42053a + af1a887 commit 07832f5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/bicep-audit.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Validate bicep templates
on:
push:
branches:
branches:
- main
paths:
- "**/*.bicep"
pull_request:
branches:
branches:
- main
paths:
- "**/*.bicep"
Expand All @@ -30,6 +30,6 @@ jobs:

- name: Upload alerts to Security tab
uses: github/codeql-action/upload-sarif@v3
if: github.repository_owner == 'Azure-Samples'
if: github.repository_owner == 'Roopan-Microsoft'
with:
sarif_file: ${{ steps.msdo.outputs.sarifFile }}
4 changes: 2 additions & 2 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
dockerfile: docker/Frontend.Dockerfile
uses: ./.github/workflows/build-docker.yml
with:
registry: fruoccopublic.azurecr.io
username: fruoccopublic
registry: pkcwydcontainerreg.azurecr.io
username: pkcwydcontainerreg
app_name: ${{ matrix.app_name }}
dockerfile: ${{ matrix.dockerfile }}
push: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' }}
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
AZURE_ENV_NAME: ${{ github.run_id }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
with:
imageName: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
cacheFrom: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
imageName: ghcr.io/roopan-microsoft/psl-cwyd-main
cacheFrom: ghcr.io/roopan-microsoft/psl-cwyd-main
runCmd: make ci && make deploy
refFilterForPush: refs/heads/main
env: |
Expand All @@ -58,7 +58,7 @@ jobs:
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
with:
push: never
imageName: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
imageName: ghcr.io/roopan-microsoft/psl-cwyd-main
runCmd: make destroy
env: |
AZURE_CLIENT_ID
Expand All @@ -67,3 +67,21 @@ jobs:
AZURE_SUBSCRIPTION_ID
AZURE_ENV_NAME
AZURE_LOCATION
- name: Send Notification on Failure
if: failure()
run: |
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# Construct the email body
EMAIL_BODY=$(cat <<EOF
{
"body": "<p>Dear Team,</p><p>We would like to inform you that the CWYD Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> ${RUN_URL}<br> ${OUTPUT}</p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>"
}
EOF
)
# Send the notification
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
-H "Content-Type: application/json" \
-d "$EMAIL_BODY" || echo "Failed to send notification"

0 comments on commit 07832f5

Please sign in to comment.