From e14505ab2be5900f29b772e4a9bd7ec004bc08aa Mon Sep 17 00:00:00 2001 From: Roopan P M Date: Fri, 22 Nov 2024 20:11:50 +0530 Subject: [PATCH 1/4] workflow updated --- .github/dependabot.yml | 11 ++++++ .github/workflows/build-docker-images.yml | 10 +++--- .github/workflows/build-docker.yml | 4 +-- .github/workflows/ci.yml | 22 +++++++++--- .github/workflows/sync-branches.yml | 44 +++++++++++++++++++++++ 5 files changed, 80 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/sync-branches.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f1f39cb96..40eecc389 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,12 +8,16 @@ updates: directory: "/" schedule: interval: "weekly" + commit-message: prefix: "build" + target-branch: "dependabotchanges" - package-ecosystem: "pip" directory: "/" schedule: interval: "weekly" + + commit-message: prefix: "build" groups: @@ -21,17 +25,24 @@ updates: patterns: - "langchain*" open-pull-requests-limit: 50 + target-branch: "dependabotchanges" - package-ecosystem: "npm" directory: "/code/frontend" schedule: interval: "weekly" + + commit-message: prefix: "build" open-pull-requests-limit: 50 + target-branch: "dependabotchanges" - package-ecosystem: "npm" directory: "/tests/integration/ui" schedule: interval: "weekly" + + commit-message: prefix: "build" open-pull-requests-limit: 50 + target-branch: "dependabotchanges" diff --git a/.github/workflows/build-docker-images.yml b/.github/workflows/build-docker-images.yml index dd6bf3c22..b6eb1ed45 100644 --- a/.github/workflows/build-docker-images.yml +++ b/.github/workflows/build-docker-images.yml @@ -4,9 +4,9 @@ on: workflow_run: workflows: [Tests] types: [completed] - branches: [main] + branches: [main, dev, demo] pull_request: - branches: [main] + branches: [main, dev, demo] types: - opened - ready_for_review @@ -28,9 +28,9 @@ jobs: dockerfile: docker/Frontend.Dockerfile uses: ./.github/workflows/build-docker.yml with: - registry: fruoccopublic.azurecr.io - username: fruoccopublic + registry: ${{ github.event.workflow_run.head_branch == 'main' && 'fruoccopublic.azurecr.io' || 'cwydcontainerreg.azurecr.io'}} + username: ${{ github.event.workflow_run.head_branch == 'main' && 'fruoccopublic' || 'cwydcontainerreg'}} app_name: ${{ matrix.app_name }} dockerfile: ${{ matrix.dockerfile }} - push: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' }} + push: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'dev' || github.event.workflow_run.head_branch == 'demo' }} secrets: inherit diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 6f6fe1a7d..40398698e 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -51,7 +51,7 @@ jobs: context: . file: ${{ inputs.dockerfile }} push: ${{ inputs.push }} - cache-from: type=registry,ref=${{ inputs.registry }}/${{ inputs.app_name}}:latest + cache-from: type=registry,ref=${{ inputs.registry }}/${{ inputs.app_name}}:${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo' || 'latest' }} tags: | - ${{ inputs.registry }}/${{ inputs.app_name}}:latest + ${{ inputs.registry }}/${{ inputs.app_name}}:${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo' || 'latest' }} ${{ inputs.registry }}/${{ inputs.app_name}}:${{ steps.date.outputs.date }}_${{ github.run_number }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9eacaa8c..0b2f37c16 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,8 @@ on: push: branches: - main + - dev + - demo schedule: - cron: '0 6,18 * * *' # Runs at 6:00 AM and 6:00 PM GMT @@ -34,6 +36,17 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set imageTag + id: set-image-tag + run: | + if [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "imageTag=latest" >> $GITHUB_ENV + elif [[ "${{ github.ref_name }}" == "main" ]]; then + echo "imageTag=latest" >> $GITHUB_ENV + else + echo "imageTag=${{ github.ref_name }}" >> $GITHUB_ENV + fi + - name: Pre-build image and run make in dev container uses: devcontainers/ci@v0.3 env: @@ -43,8 +56,9 @@ jobs: with: imageName: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator cacheFrom: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator + imageTag: ${{ env.imageTag }} runCmd: make ci && make deploy - refFilterForPush: refs/heads/main + refFilterForPush: refs/heads/${{ github.event_name == 'schedule' && 'main' || github.ref_name }} env: | AZURE_CLIENT_ID AZURE_CLIENT_SECRET @@ -64,6 +78,7 @@ jobs: with: push: never imageName: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator + imageTag: ${{ env.imageTag }} runCmd: make destroy env: | AZURE_CLIENT_ID @@ -78,7 +93,6 @@ jobs: if: failure() run: | RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - # Construct the email body EMAIL_BODY=$(cat < Date: Fri, 22 Nov 2024 20:37:55 +0530 Subject: [PATCH 2/4] code updated --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b2f37c16..87e4b8b3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,5 +103,5 @@ jobs: # Send the notification curl -X POST "${{ secrets.LOGIC_APP_URL }}" \ - -H "Content-Type: application/json" \ - -d "$EMAIL_BODY" || echo "Failed to send notification" + -H "Content-Type: application/json" \ + -d "$EMAIL_BODY" || echo "Failed to send notification" From 678490ad2a290a4e11e74a2b538d7c17d9891246 Mon Sep 17 00:00:00 2001 From: Roopan P M Date: Mon, 25 Nov 2024 13:37:03 +0530 Subject: [PATCH 3/4] updated weekly to monthly --- .github/dependabot.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 40eecc389..8c39a521b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,7 +7,7 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" + interval: "monthly" commit-message: prefix: "build" @@ -15,7 +15,7 @@ updates: - package-ecosystem: "pip" directory: "/" schedule: - interval: "weekly" + interval: "monthly" commit-message: @@ -29,7 +29,7 @@ updates: - package-ecosystem: "npm" directory: "/code/frontend" schedule: - interval: "weekly" + interval: "monthly" commit-message: @@ -39,7 +39,7 @@ updates: - package-ecosystem: "npm" directory: "/tests/integration/ui" schedule: - interval: "weekly" + interval: "monthly" commit-message: From 8750d2225ca5b6abeac1fdde8360405d2722c42e Mon Sep 17 00:00:00 2001 From: Roopan P M Date: Mon, 25 Nov 2024 17:52:53 +0530 Subject: [PATCH 4/4] workflow updated --- .github/workflows/build-docker-images.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-docker-images.yml b/.github/workflows/build-docker-images.yml index b6eb1ed45..a67cdd6ac 100644 --- a/.github/workflows/build-docker-images.yml +++ b/.github/workflows/build-docker-images.yml @@ -1,6 +1,8 @@ name: Build Docker Images on: + push: + branches: [main, dev, demo] workflow_run: workflows: [Tests] types: [completed]