Skip to content

Commit 250e6fd

Browse files
Merge pull request #214 from microsoft/dev
fix: merging dev to main
2 parents a39ff23 + 56d9c9b commit 250e6fd

37 files changed

+968
-525
lines changed

.azdo/pipelines/azure-dev.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# Set this to the mainline branch you are using
33
trigger:
44
- main
5-
- master
6-
- feature/azd-semantickernel
75

86
# Azure Pipelines workflow to deploy to Azure using azd
97
# To configure required secrets and service connection for connecting to Azure, simply run `azd pipeline config --provider azdo`

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[flake8]
22
max-line-length = 88
33
extend-ignore = E501
4-
exclude = .venv, frontend
4+
exclude = .venv, frontend, src/backend/tests
55
ignore = E203, W503, G004, G200, E402

.github/workflows/azure-dev.yml

Lines changed: 9 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ name: Azure Template Validation
22
on:
33
push:
44
branches:
5-
- dev
65
- main
7-
- feature/azd-semantickernel
86
workflow_dispatch:
97

108
permissions:
@@ -15,69 +13,19 @@ permissions:
1513
jobs:
1614
template_validation_job:
1715
runs-on: ubuntu-latest
18-
name: Template validation
16+
name: template validation
1917
steps:
20-
# Step 1: Checkout the code from your repository
21-
- name: Checkout code
22-
uses: actions/checkout@v4
18+
- uses: actions/checkout@v4
2319

24-
# Step 2: Set up Python
25-
- name: Set up Python
26-
uses: actions/setup-python@v4
27-
with:
28-
python-version: "3.9"
29-
30-
# Step 3: Create and populate the virtual environment
31-
- name: Create virtual environment and install dependencies
32-
run: |
33-
python -m venv .venv
34-
source .venv/bin/activate
35-
python -m pip install --upgrade pip
36-
pip install azure-mgmt-resource azure-identity azure-core azure-mgmt-subscription azure-cli-core
37-
# Install any other dependencies that might be needed
38-
pip freeze > requirements-installed.txt
39-
echo "Virtual environment created with these packages:"
40-
cat requirements-installed.txt
41-
42-
# Step 4: Create azd directory if it doesn't exist
43-
- name: Create azd directory
44-
run: |
45-
mkdir -p ./.azd || true
46-
touch ./.azd/.env || true
47-
48-
# Step 5: Validate the Azure template
49-
- name: Validate Azure Template
50-
uses: microsoft/[email protected]
20+
- uses: microsoft/template-validation-action@Latest
5121
id: validation
5222
env:
53-
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
54-
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
55-
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
56-
AZURE_ENV_NAME: ${{ secrets.AZURE_ENV_NAME }}
57-
AZURE_LOCATION: ${{ secrets.AZURE_LOCATION }}
23+
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
24+
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
25+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
26+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
27+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
5828
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5929

60-
# Step 6: Debug output in case of failure
61-
- name: Debug on failure
62-
if: failure()
63-
run: |
64-
echo "Validation failed. Checking environment:"
65-
ls -la
66-
if [ -d ".venv" ]; then
67-
echo ".venv directory exists"
68-
ls -la .venv/bin/
69-
else
70-
echo ".venv directory does not exist"
71-
fi
72-
if [ -d "tva_*" ]; then
73-
echo "TVA directory exists:"
74-
find . -name "tva_*" -type d
75-
ls -la $(find . -name "tva_*" -type d)
76-
else
77-
echo "No TVA directory found"
78-
fi
79-
80-
# Step 7: Print the result of the validation
81-
- name: Print result
82-
if: success()
30+
- name: print result
8331
run: cat ${{ steps.validation.outputs.resultFile }}

.github/workflows/docker-build-and-push.yml

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
- dev
1919
- demo
2020
- hotfix
21-
workflow_dispatch:
21+
workflow_dispatch:
2222

2323
jobs:
2424
build-and-push:
@@ -32,14 +32,19 @@ jobs:
3232
uses: docker/setup-buildx-action@v1
3333

3434
- name: Log in to Azure Container Registry
35-
if: ${{ (github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix') }}
35+
if: ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix' }}
3636
uses: azure/docker-login@v2
3737
with:
3838
login-server: ${{ secrets.ACR_LOGIN_SERVER || 'acrlogin.azurecr.io' }}
3939
username: ${{ secrets.ACR_USERNAME }}
4040
password: ${{ secrets.ACR_PASSWORD }}
4141

42-
- name: Set Docker image tag
42+
- name: Get current date
43+
id: date
44+
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
45+
46+
- name: Determine Tag Name Based on Branch
47+
id: determine_tag
4348
run: |
4449
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
4550
echo "TAG=latest" >> $GITHUB_ENV
@@ -52,24 +57,30 @@ jobs:
5257
else
5358
echo "TAG=pullrequest-ignore" >> $GITHUB_ENV
5459
fi
55-
56-
- name: Build and push Docker images optionally
60+
61+
- name: Set Historical Tag
5762
run: |
58-
cd src/backend
59-
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.TAG }} -f Dockerfile . && \
60-
if [[ "${{ env.TAG }}" == "latest" || "${{ env.TAG }}" == "dev" || "${{ env.TAG }}" == "demo" || "${{ env.TAG }}" == "hotfix" ]]; then
61-
docker push ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.TAG }} && \
62-
echo "Backend image built and pushed successfully."
63-
else
64-
echo "Skipping Docker push for backend with tag: ${{ env.TAG }}"
65-
fi
66-
cd ../frontend
67-
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.TAG }} -f Dockerfile . && \
68-
if [[ "${{ env.TAG }}" == "latest" || "${{ env.TAG }}" == "dev" || "${{ env.TAG }}" == "demo" || "${{ env.TAG }}" == "hotfix" ]]; then
69-
docker push ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.TAG }} && \
70-
echo "Frontend image built and pushed successfully."
71-
else
72-
echo "Skipping Docker push for frontend with tag: ${{ env.TAG }}"
73-
fi
63+
DATE_TAG=$(date +'%Y-%m-%d')
64+
RUN_ID=${{ github.run_number }}
65+
# Create historical tag using TAG, DATE_TAG, and RUN_ID
66+
echo "HISTORICAL_TAG=${{ env.TAG }}_${DATE_TAG}_${RUN_ID}" >> $GITHUB_ENV
7467
75-
68+
- name: Build and optionally push Backend Docker image
69+
uses: docker/build-push-action@v6
70+
with:
71+
context: ./src/backend
72+
file: ./src/backend/Dockerfile
73+
push: ${{ env.TAG != 'pullrequest-ignore' }}
74+
tags: |
75+
${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.TAG }}
76+
${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.HISTORICAL_TAG }}
77+
78+
- name: Build and optionally push Frontend Docker image
79+
uses: docker/build-push-action@v6
80+
with:
81+
context: ./src/frontend
82+
file: ./src/frontend/Dockerfile
83+
push: ${{ env.TAG != 'pullrequest-ignore' }}
84+
tags: |
85+
${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.TAG }}
86+
${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.HISTORICAL_TAG }}

0 commit comments

Comments
 (0)