diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f1f39cb96..8c39a521b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,13 +7,17 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" + interval: "monthly" + commit-message: prefix: "build" + target-branch: "dependabotchanges" - package-ecosystem: "pip" directory: "/" schedule: - interval: "weekly" + interval: "monthly" + + 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" + interval: "monthly" + + commit-message: prefix: "build" open-pull-requests-limit: 50 + target-branch: "dependabotchanges" - package-ecosystem: "npm" directory: "/tests/integration/ui" schedule: - interval: "weekly" + interval: "monthly" + + 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..3b57b5c1d 100644 --- a/.github/workflows/build-docker-images.yml +++ b/.github/workflows/build-docker-images.yml @@ -4,9 +4,15 @@ 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 +34,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.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..0d14652e9 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -21,6 +21,8 @@ on: secrets: DOCKER_PASSWORD: required: false + DEV_DOCKER_PASSWORD: + required: false jobs: docker-build: @@ -31,13 +33,21 @@ jobs: uses: actions/checkout@v4 - name: Docker Login - if: ${{ inputs.push }} + if: ${{ inputs.push == true && github.ref_name == 'main' }} uses: docker/login-action@v3 with: registry: ${{ inputs.registry }} username: ${{ inputs.username }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Dev Docker Login + if: ${{ inputs.push == true && (github.ref_name == 'dev' || github.ref_name == 'demo') }} + uses: docker/login-action@v3 + with: + registry: ${{ inputs.registry }} + username: ${{ inputs.username }} + password: ${{ secrets.DEV_DOCKER_PASSWORD }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -51,7 +61,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..87e4b8b3b 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 <