diff --git a/.github/workflows/bicep-audit.yml b/.github/workflows/bicep-audit.yml index eb7f66d98..e8583abf7 100644 --- a/.github/workflows/bicep-audit.yml +++ b/.github/workflows/bicep-audit.yml @@ -1,12 +1,12 @@ name: Validate bicep templates on: push: - branches: + branches: - main paths: - "**/*.bicep" pull_request: - branches: + branches: - main paths: - "**/*.bicep" @@ -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 }} diff --git a/.github/workflows/build-docker-images.yml b/.github/workflows/build-docker-images.yml index dd6bf3c22..250588ed3 100644 --- a/.github/workflows/build-docker-images.yml +++ b/.github/workflows/build-docker-images.yml @@ -28,8 +28,8 @@ jobs: dockerfile: docker/Frontend.Dockerfile uses: ./.github/workflows/build-docker.yml with: - registry: fruoccopublic.azurecr.io - username: fruoccopublic + registry: cwydcontainerreg.azurecr.io + username: cwydcontainerreg app_name: ${{ matrix.app_name }} dockerfile: ${{ matrix.dockerfile }} push: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6260f5ccb..8edfe8954 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,8 @@ on: push: branches: - main + schedule: + - cron: '0 6,18 * * *' # Runs at 6:00 AM and 6:00 PM GMT permissions: contents: read @@ -37,9 +39,10 @@ jobs: env: AZURE_ENV_NAME: ${{ github.run_id }} AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} + AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }} 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: | @@ -49,6 +52,7 @@ jobs: AZURE_SUBSCRIPTION_ID AZURE_ENV_NAME AZURE_LOCATION + AZURE_RESOURCE_GROUP - name: Tidy up uses: devcontainers/ci@v0.3 @@ -56,9 +60,10 @@ jobs: env: AZURE_ENV_NAME: ${{ github.run_id }} AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} + AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }} 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 @@ -67,3 +72,22 @@ jobs: AZURE_SUBSCRIPTION_ID AZURE_ENV_NAME AZURE_LOCATION + AZURE_RESOURCE_GROUP + + - 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 <Dear Team,

We would like to inform you that the CWYD Automation process has encountered an issue and has failed to complete successfully.

Build URL: ${RUN_URL}
${OUTPUT}

Please investigate the matter at your earliest convenience.

Best regards,
Your Automation Team

" + } + EOF + ) + + # Send the notification + curl -X POST "${{ secrets.LOGIC_APP_URL }}" \ + -H "Content-Type: application/json" \ + -d "$EMAIL_BODY" || echo "Failed to send notification" diff --git a/Makefile b/Makefile index 24c047929..6c33f0b6d 100644 --- a/Makefile +++ b/Makefile @@ -57,10 +57,14 @@ azd-login: ## 🔑 Login to Azure with azd and a SPN @echo -e "\e[34m$@\e[0m" || true @azd auth login --client-id ${AZURE_CLIENT_ID} --client-secret ${AZURE_CLIENT_SECRET} --tenant-id ${AZURE_TENANT_ID} +az-login: ## 🔑 Login to Azure with az and a SPN + az login --service-principal -u ${AZURE_CLIENT_ID} -p ${AZURE_CLIENT_SECRET} --tenant ${AZURE_TENANT_ID} + deploy: azd-login ## 🚀 Deploy everything to Azure @echo -e "\e[34m$@\e[0m" || true @azd env new ${AZURE_ENV_NAME} @azd env set AZURE_APP_SERVICE_HOSTING_MODEL code --no-prompt + @az group create --name ${AZURE_RESOURCE_GROUP} --location ${AZURE_LOCATION} @azd provision --no-prompt @azd deploy web --no-prompt @azd deploy function --no-prompt