Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Updated git workflow and bicep for multi pipeline based on branch #56

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,9 +28,9 @@ jobs:
dockerfile: docker/Frontend.Dockerfile
uses: ./.github/workflows/build-docker.yml
with:
registry: cwydcontainerreg.azurecr.io
username: cwydcontainerreg
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
4 changes: 2 additions & 2 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
17 changes: 16 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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/[email protected]
env:
Expand All @@ -42,8 +55,9 @@ jobs:
with:
imageName: ghcr.io/roopan-microsoft/psl-cwyd-main
cacheFrom: ghcr.io/roopan-microsoft/psl-cwyd-main
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
Expand All @@ -61,6 +75,7 @@ jobs:
with:
push: never
imageName: ghcr.io/roopan-microsoft/psl-cwyd-main
imageTag: ${{ env.imageTag }}
runCmd: make destroy
env: |
AZURE_CLIENT_ID
Expand Down
6 changes: 3 additions & 3 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ module web_docker './app/web.bicep' = if (hostingModel == 'container') {
name: '${websiteName}-docker'
location: location
tags: union(tags, { 'azd-service-name': 'web-docker' })
dockerFullImageName: 'fruoccopublic.azurecr.io/rag-webapp'
dockerFullImageName: 'fruoccopublic.azurecr.io/rag-webapp:latest'
appServicePlanId: hostingplan.outputs.name
applicationInsightsName: monitoring.outputs.applicationInsightsName
healthCheckPath: '/api/health'
Expand Down Expand Up @@ -799,7 +799,7 @@ module adminweb_docker './app/adminweb.bicep' = if (hostingModel == 'container')
name: '${adminWebsiteName}-docker'
location: location
tags: union(tags, { 'azd-service-name': 'adminweb-docker' })
dockerFullImageName: 'fruoccopublic.azurecr.io/rag-adminwebapp'
dockerFullImageName: 'fruoccopublic.azurecr.io/rag-adminwebapp:latest'
appServicePlanId: hostingplan.outputs.name
applicationInsightsName: monitoring.outputs.applicationInsightsName
azureOpenAIName: openai.outputs.name
Expand Down Expand Up @@ -974,7 +974,7 @@ module function_docker './app/function.bicep' = if (hostingModel == 'container')
name: '${functionName}-docker'
location: location
tags: union(tags, { 'azd-service-name': 'function-docker' })
dockerFullImageName: 'fruoccopublic.azurecr.io/rag-backend'
dockerFullImageName: 'fruoccopublic.azurecr.io/rag-backend:latest'
appServicePlanId: hostingplan.outputs.name
applicationInsightsName: monitoring.outputs.applicationInsightsName
azureOpenAIName: openai.outputs.name
Expand Down
Loading
Loading