Skip to content

Commit a56ef05

Browse files
authored
Merge branch 'main' into cleanup
2 parents 65963a2 + 99aa222 commit a56ef05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1479
-721
lines changed

.devcontainer/features/dev-tools/install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/sh
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT license.
4+
25
set -eux
36

47
echo "Installing development tools for Copilot Studio with Azure AI Search..."

.devcontainer/postCreate.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/sh
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT license.
4+
25
set -eux
36

47
echo "Running post-create setup for interactive operations..."
@@ -13,6 +16,7 @@ echo "Installing PowerApps CLI..."
1316
dotnet tool install --global Microsoft.PowerApps.CLI.Tool --version 1.49.3
1417

1518
# Restore .NET packages including Microsoft.Agents.CopilotStudio.Client
19+
echo "Restoring .NET packages..."
1620
if [ -f "tests/Copilot/CopilotTests.csproj" ]; then
1721
dotnet restore tests/Copilot/CopilotTests.csproj
1822
echo "Copilot project packages restored successfully!"

.github/workflows/azure-dev-down.yml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
default: "eastus"
1515

1616
permissions:
17-
id-token: write
17+
id-token: write # Needed for OIDC Authentication
1818
contents: read
1919

2020
jobs:
@@ -26,17 +26,17 @@ jobs:
2626

2727
steps:
2828
- name: Checkout the branch ${{ github.ref_name }}
29-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3030
with:
3131
ref: ${{ github.ref_name }}
3232

3333
- name: Install azd
34-
uses: Azure/setup-azd@ae0f8b5482eeac61e940f447327d84c73beb8b1e # v2.1.0
34+
uses: Azure/setup-azd@cf638ffd167fc81e1851241a478a723c05fa9cb3 # v2.2.0
3535
with:
3636
version: '1.20.0' # Specify your desired azd version here
37-
37+
3838
- name: Setup Node.js
39-
uses: actions/setup-node@v4
39+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
4040
with:
4141
node-version: '18.x'
4242

@@ -72,6 +72,7 @@ jobs:
7272
RS_CONTAINER_NAME: ${{ vars.RS_CONTAINER_NAME }}
7373
RS_RESOURCE_GROUP: ${{ vars.RS_RESOURCE_GROUP }}
7474
RESOURCE_SHARE_USER: ${{ vars.RESOURCE_SHARE_USER }}
75+
RESOURCE_TAGS: ${{ vars.RESOURCE_TAGS }}
7576

7677
shell: bash
7778
run: |
@@ -86,3 +87,25 @@ jobs:
8687
azd package # trigger prepackage hook to setup terraform provider
8788
azd provision --preview # https://github.com/Azure/azure-dev/issues/4317
8889
azd down --no-prompt --force --purge
90+
91+
- name: Purge Soft-Deleted Azure OpenAI Resources
92+
shell: bash
93+
run: |
94+
# Get the OpenAI resource name and location from environment outputs
95+
OPENAI_RESOURCE_NAME=$(azd env get-values --output json | jq -r '.openai_resource_name // empty')
96+
AZURE_REGION=$(azd env get-values --output json | jq -r '.primary_azure_region // empty')
97+
RESOURCE_GROUP=$(azd env get-values --output json | jq -r '.resource_group_name // empty')
98+
99+
# Only attempt to purge if we have the required information
100+
if [[ -n "$OPENAI_RESOURCE_NAME" && -n "$AZURE_REGION" ]]; then
101+
echo "Attempting to purge soft-deleted Azure OpenAI resource: $OPENAI_RESOURCE_NAME in $AZURE_REGION"
102+
103+
# Purge the soft-deleted Cognitive Services account (continue on error if resource not found)
104+
az cognitiveservices account purge \
105+
--location "$AZURE_REGION" \
106+
--resource-group "$RESOURCE_GROUP" \
107+
--name "$OPENAI_RESOURCE_NAME" || echo "Resource may not be in soft-delete state or already purged"
108+
else
109+
echo "OpenAI resource information not found in environment outputs. Skipping purge."
110+
fi
111+

.github/workflows/azure-dev.yml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,45 +20,54 @@ on:
2020
# Set this to the mainline branch you are using
2121
branches:
2222
- main
23+
pull_request:
24+
# Run when pull requests are opened or updated
25+
branches:
26+
- main
27+
2328
# GitHub Actions workflow to deploy to Azure using azd
29+
# Ensure only one deployment runs at a time to prevent conflicts
30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
32+
cancel-in-progress: false
2433

2534
permissions:
2635
actions: read # Needed for uploading SARIF reports
2736
security-events: write # Needed for uploading SARIF reports
28-
id-token: write
37+
id-token: write # Needed for OIDC Authentication
2938
contents: read
3039

3140

3241
jobs:
3342
build:
3443
runs-on: ${{ fromJson(vars.ACTIONS_RUNNER_NAME || '["ubuntu-latest"]') }}
3544
env:
36-
AZURE_ENV_NAME: ${{ github.event.inputs.azd_environment_name || 'CICD' }}
45+
AZURE_ENV_NAME: ${{ github.event.inputs.azd_environment_name || (github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number)) || 'CICD' }}
3746
AZURE_LOCATION: ${{ github.event.inputs.azure_location || 'eastus' }}
3847

3948
steps:
40-
- name: Checkout the branch ${{ github.ref_name }}
41-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
49+
- name: Checkout code
50+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4251
with:
43-
ref: ${{ github.ref_name }}
52+
persist-credentials: false
4453

4554
- name: Install azd
46-
uses: Azure/setup-azd@ae0f8b5482eeac61e940f447327d84c73beb8b1e # v2.1.0
55+
uses: Azure/setup-azd@cf638ffd167fc81e1851241a478a723c05fa9cb3 # v2.2.0
4756
with:
4857
version: '1.20.0' # Specify your desired azd version here
4958

5059
- name: Setup Node.js
51-
uses: actions/setup-node@v4
60+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
5261
with:
5362
node-version: '18.x'
5463

5564
- name: Install Terraform
5665
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
5766
with:
58-
terraform_version: 1.13.3
67+
terraform_version: 1.13.3
5968

6069
- name: Install TFLint
61-
uses: terraform-linters/setup-tflint@90f302c255ef959cbfb4bd10581afecdb7ece3e6 # v4.1.1
70+
uses: terraform-linters/setup-tflint@acd1575d3c037258ce5b2dd01379dc49ce24c6b7 # v6.2.0
6271
with:
6372
tflint_version: v0.58.1
6473
github_token: ${{ secrets.GITHUB_TOKEN }} # Used to avoid rate
@@ -113,7 +122,7 @@ jobs:
113122
pac help
114123
115124
- name: Set Up Python
116-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # 5.6.0
125+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # 6.0.0
117126
with:
118127
python-version: "3.x"
119128

@@ -193,8 +202,8 @@ jobs:
193202
with:
194203
sarif_file: ./checkov-results.sarif/results_sarif.sarif
195204

196-
- name: Azd down
197-
if: ${{ github.event.inputs.run_azd_down == 'true' }}
205+
- name: Destroy Infrastructure
206+
if: ${{ github.event.inputs.run_azd_down == 'true' || github.event_name == 'pull_request' }}
198207
env:
199208
POWER_PLATFORM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
200209
POWER_PLATFORM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
@@ -212,6 +221,7 @@ jobs:
212221
RS_CONTAINER_NAME: ${{ vars.RS_CONTAINER_NAME }}
213222
RS_RESOURCE_GROUP: ${{ vars.RS_RESOURCE_GROUP }}
214223
RESOURCE_SHARE_USER: ${{ vars.RESOURCE_SHARE_USER }}
224+
RESOURCE_TAGS: ${{ vars.RESOURCE_TAGS }}
215225

216226
shell: bash
217227
run: |
@@ -222,4 +232,26 @@ jobs:
222232
azd env set RESOURCE_TAGS "$RESOURCE_TAGS"
223233
224234
azd env select "$AZURE_ENV_NAME"
225-
azd down --no-prompt --force --purge
235+
azd down --no-prompt --force --purge
236+
237+
- name: Purge Soft-Deleted Azure OpenAI Resources
238+
if: ${{ github.event.inputs.run_azd_down == 'true' || github.event_name == 'pull_request' }}
239+
shell: bash
240+
run: |
241+
# Get the OpenAI resource name and location from environment outputs
242+
OPENAI_RESOURCE_NAME=$(azd env get-values --output json | jq -r '.openai_resource_name // empty')
243+
AZURE_REGION=$(azd env get-values --output json | jq -r '.primary_azure_region // empty')
244+
RESOURCE_GROUP=$(azd env get-values --output json | jq -r '.resource_group_name // empty')
245+
246+
# Only attempt to purge if we have the required information
247+
if [[ -n "$OPENAI_RESOURCE_NAME" && -n "$AZURE_REGION" ]]; then
248+
echo "Attempting to purge soft-deleted Azure OpenAI resource: $OPENAI_RESOURCE_NAME in $AZURE_REGION"
249+
250+
# Purge the soft-deleted Cognitive Services account (continue on error if resource not found)
251+
az cognitiveservices account purge \
252+
--location "$AZURE_REGION" \
253+
--resource-group "$RESOURCE_GROUP" \
254+
--name "$OPENAI_RESOURCE_NAME" || echo "Resource may not be in soft-delete state or already purged"
255+
else
256+
echo "OpenAI resource information not found in environment outputs. Skipping purge."
257+
fi

.github/workflows/terraform-validate.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ permissions:
1313
contents: read
1414
security-events: write
1515
pull-requests: write # Allow workflow to comment on PRs
16+
id-token: write # Needed for OIDC Authentication
1617

1718
# Global environment variables
1819
env:
@@ -45,12 +46,12 @@ jobs:
4546

4647
steps:
4748
- name: Checkout code
48-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
49+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4950
with:
5051
fetch-depth: 0 # Required for proper GitLeaks scanning
5152

5253
- name: Setup Node.js
53-
uses: actions/setup-node@v4
54+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
5455
with:
5556
node-version: '18.x'
5657

@@ -94,7 +95,7 @@ jobs:
9495
working-directory: ./infra
9596

9697
- name: Setup TFLint
97-
uses: terraform-linters/setup-tflint@90f302c255ef959cbfb4bd10581afecdb7ece3e6 # v4.1.1
98+
uses: terraform-linters/setup-tflint@acd1575d3c037258ce5b2dd01379dc49ce24c6b7 # v6.2.0
9899
with:
99100
tflint_version: v0.58.1 # Specify a version (recommended)
100101
github_token: ${{ secrets.GITHUB_TOKEN }} # Used to avoid rate limiting
@@ -159,7 +160,7 @@ jobs:
159160

160161
- name: Run Checkov action
161162
id: checkov
162-
uses: bridgecrewio/checkov-action@38a95e98d734de90b74687a0fc94cfb4dcc9c169 # v12.1347.0
163+
uses: bridgecrewio/checkov-action@cba89e33f08479973cadc681333ffe84f7c8e824 # v12.1347.0
163164
with:
164165
framework: terraform
165166
download_external_modules: true
@@ -235,7 +236,7 @@ jobs:
235236
if: needs.check-dependabot.outputs.is_dependabot == 'true' && success()
236237
steps:
237238
- name: Comment on PR
238-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
239+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
239240
with:
240241
github-token: ${{ secrets.GITHUB_TOKEN }}
241242
script: |
@@ -272,7 +273,7 @@ jobs:
272273
if: needs.check-dependabot.outputs.is_dependabot == 'true' && failure()
273274
steps:
274275
- name: Comment on PR about failure
275-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
276+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
276277
with:
277278
github-token: ${{ secrets.GITHUB_TOKEN }}
278279
script: |

.github/workflows/test-search.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
steps:
4141
- name: Checkout the branch ${{ github.ref_name }}
42-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4343
with:
4444
ref: ${{ github.ref_name }}
4545

0 commit comments

Comments
 (0)