From 5bd1121139f36cfa012d6e241a5998be34d525ff Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Sep 2025 16:51:50 +0000 Subject: [PATCH 1/2] Initial plan From c4dd3337881079f41fb124f35651e2afc66f26a8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Sep 2025 17:00:55 +0000 Subject: [PATCH 2/2] Fix PowerShell build scripts to fail on any error Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com> --- cli/azd/extensions/microsoft.azd.ai.builder/build.ps1 | 7 +++++++ cli/azd/extensions/microsoft.azd.demo/build.ps1 | 7 +++++++ cli/azd/extensions/microsoft.azd.extensions/build.ps1 | 7 +++++++ .../internal/resources/languages/dotnet/build.ps1 | 7 +++++++ .../internal/resources/languages/go/build.ps1 | 7 +++++++ .../internal/resources/languages/javascript/build.ps1 | 3 +++ .../internal/resources/languages/python/build.ps1 | 7 +++++++ 7 files changed, 45 insertions(+) diff --git a/cli/azd/extensions/microsoft.azd.ai.builder/build.ps1 b/cli/azd/extensions/microsoft.azd.ai.builder/build.ps1 index a003f4d1029..abced22e573 100644 --- a/cli/azd/extensions/microsoft.azd.ai.builder/build.ps1 +++ b/cli/azd/extensions/microsoft.azd.ai.builder/build.ps1 @@ -1,3 +1,6 @@ +# Ensure script fails on any error +$ErrorActionPreference = 'Stop' + # Get the directory of the script $EXTENSION_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path @@ -17,6 +20,10 @@ if (-not (Test-Path -Path $OUTPUT_DIR)) { # Get Git commit hash and build date $COMMIT = git rev-parse HEAD +if ($LASTEXITCODE -ne 0) { + Write-Host "Error: Failed to get git commit hash" + exit 1 +} $BUILD_DATE = (Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ") # List of OS and architecture combinations diff --git a/cli/azd/extensions/microsoft.azd.demo/build.ps1 b/cli/azd/extensions/microsoft.azd.demo/build.ps1 index 99069215b12..1c2bcb6a63a 100644 --- a/cli/azd/extensions/microsoft.azd.demo/build.ps1 +++ b/cli/azd/extensions/microsoft.azd.demo/build.ps1 @@ -1,3 +1,6 @@ +# Ensure script fails on any error +$ErrorActionPreference = 'Stop' + # Get the directory of the script $EXTENSION_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path @@ -17,6 +20,10 @@ if (-not (Test-Path -Path $OUTPUT_DIR)) { # Get Git commit hash and build date $COMMIT = git rev-parse HEAD +if ($LASTEXITCODE -ne 0) { + Write-Host "Error: Failed to get git commit hash" + exit 1 +} $BUILD_DATE = (Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ") # List of OS and architecture combinations diff --git a/cli/azd/extensions/microsoft.azd.extensions/build.ps1 b/cli/azd/extensions/microsoft.azd.extensions/build.ps1 index a003f4d1029..abced22e573 100644 --- a/cli/azd/extensions/microsoft.azd.extensions/build.ps1 +++ b/cli/azd/extensions/microsoft.azd.extensions/build.ps1 @@ -1,3 +1,6 @@ +# Ensure script fails on any error +$ErrorActionPreference = 'Stop' + # Get the directory of the script $EXTENSION_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path @@ -17,6 +20,10 @@ if (-not (Test-Path -Path $OUTPUT_DIR)) { # Get Git commit hash and build date $COMMIT = git rev-parse HEAD +if ($LASTEXITCODE -ne 0) { + Write-Host "Error: Failed to get git commit hash" + exit 1 +} $BUILD_DATE = (Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ") # List of OS and architecture combinations diff --git a/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/dotnet/build.ps1 b/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/dotnet/build.ps1 index 16b16662e79..8af0ae35d91 100644 --- a/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/dotnet/build.ps1 +++ b/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/dotnet/build.ps1 @@ -1,3 +1,6 @@ +# Ensure script fails on any error +$ErrorActionPreference = 'Stop' + # Get the directory of the script $EXTENSION_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path @@ -17,6 +20,10 @@ if (-not (Test-Path -Path $OUTPUT_DIR)) { # Get Git commit hash and build date $COMMIT = git rev-parse HEAD +if ($LASTEXITCODE -ne 0) { + Write-Host "Error: Failed to get git commit hash" + exit 1 +} $BUILD_DATE = (Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ") # List of OS and architecture combinations diff --git a/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/go/build.ps1 b/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/go/build.ps1 index 8cdd4ae9281..5ceb60a8bbc 100644 --- a/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/go/build.ps1 +++ b/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/go/build.ps1 @@ -1,3 +1,6 @@ +# Ensure script fails on any error +$ErrorActionPreference = 'Stop' + # Get the directory of the script $EXTENSION_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path @@ -17,6 +20,10 @@ if (-not (Test-Path -Path $OUTPUT_DIR)) { # Get Git commit hash and build date $COMMIT = git rev-parse HEAD +if ($LASTEXITCODE -ne 0) { + Write-Host "Error: Failed to get git commit hash" + exit 1 +} $BUILD_DATE = (Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ") # List of OS and architecture combinations diff --git a/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/javascript/build.ps1 b/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/javascript/build.ps1 index 7f50f757389..50a06c1c25e 100644 --- a/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/javascript/build.ps1 +++ b/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/javascript/build.ps1 @@ -1,3 +1,6 @@ +# Ensure script fails on any error +$ErrorActionPreference = 'Stop' + # Get the directory of the script $EXTENSION_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path diff --git a/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/python/build.ps1 b/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/python/build.ps1 index b6cb3b2b7c2..111626b885a 100644 --- a/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/python/build.ps1 +++ b/cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/python/build.ps1 @@ -1,3 +1,6 @@ +# Ensure script fails on any error +$ErrorActionPreference = 'Stop' + # Get the directory of the script $EXTENSION_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path @@ -17,6 +20,10 @@ if (-not (Test-Path -Path $OUTPUT_DIR)) { # Get Git commit hash and build date $COMMIT = git rev-parse HEAD +if ($LASTEXITCODE -ne 0) { + Write-Host "Error: Failed to get git commit hash" + exit 1 +} $BUILD_DATE = (Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ") # List of OS and architecture combinations