-
Notifications
You must be signed in to change notification settings - Fork 4
Add debug flag support to azd commands in deployment workflows #335
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: ianjensenisme <[email protected]>
Co-authored-by: ianjensenisme <[email protected]>
|
@HadwaAbdelhalem does this look like a reasonable level of debug output, and at the correct times? |
Thanks for the draft PR @ianjensenisme . I was thinking of this being part of the deploy pipeline and leverage the GitHub native debug flags . Those are the flags that control the debus logs and they get set when you check the debug checkbox in to rerun pipeline. The proposed code would be much simpler like the following as the [provision]
# Detect if *any* debug flag is enabled during a re-run with "Enable debug logging"
$debugOn = ($env:ACTIONS_STEP_DEBUG -eq "true") `
-or ($env:ACTIONS_RUNNER_DEBUG -eq "true") `
-or ($env:RUNNER_DEBUG -eq "1")
if ($debugOn) {
azd provision --no-prompt --debug
} else {
azd provision --no-prompt
}
, |
|
@copilot reimplement this change by removing the original PR content and restarting with the instructions that Hadwa outlines in #335 (comment) . |
…w_dispatch Co-authored-by: ianjensenisme <[email protected]>
Reimplemented using GitHub's native debug flags as suggested by @HadwaAbdelhalem. The workflow now checks Changes in commit eefe799:
All logic tests pass. The implementation is simpler and follows the pattern you suggested. |
|
@copilot look into my previous comment with code suggestion. It is to be implemented in Copilot-Studio-with-Azure-AI-Search/.github/workflows/azure-dev.yml whenever a call is made to either azd deploy/up/down/provision. Rewrite this PR to match the guidelines. |
Co-authored-by: HadwaAbdelhalem <[email protected]>
Reimplemented as requested. The PR now applies debug flag detection to Changes in commit faaccaa:
The implementation follows the exact pattern you suggested with conditional logic that detects GitHub's native debug flags and passes |
|
@copilot can you trigger the CI-Deploy workflow to run using this PR branch to test your changes |
I cannot directly trigger GitHub Actions workflows as I don't have the necessary authentication credentials. However, you can trigger the CI-Deploy workflow to test these changes: Option 1: Via GitHub UI
Option 2: Via GitHub CLI gh workflow run "CI-Deploy" \
--ref copilot/add-debug-option-linter-workflow \
-f azd_environment_name="CICD-test" \
-f azure_location="eastus" \
-f run_azd_down="false"Option 3: Create a test commit To test the debug functionality, you can re-run any workflow execution with "Enable debug logging" checked to see the |
…ion-linter-workflow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for GitHub's native debug logging to Azure Developer CLI (azd) commands in deployment workflows. When debug logging is enabled via GitHub's "Re-run jobs" UI, the workflows automatically append the --debug flag to azd provision and azd down commands, providing detailed infrastructure provisioning, resource management, and error diagnostics output.
Key changes:
- Added conditional debug flag detection to all
azd provisionandazd downcommands - Implemented consistent pattern checking
ACTIONS_STEP_DEBUG,ACTIONS_RUNNER_DEBUG, andRUNNER_DEBUGenvironment variables - Applied changes to both CI-Deploy and CI-Destroy workflows
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.github/workflows/azure-dev.yml |
Added debug flag conditionals to azd provision and azd down commands in the CI-Deploy workflow |
.github/workflows/azure-dev-down.yml |
Added debug flag conditionals to azd provision --preview and azd down commands in the CI-Destroy workflow |
.github/workflows/azure-dev.yml
Outdated
| # Detect if debug logging is enabled | ||
| if [ "$ACTIONS_STEP_DEBUG" = "true" ] || [ "$ACTIONS_RUNNER_DEBUG" = "true" ] || [ "$RUNNER_DEBUG" = "1" ]; then | ||
| azd provision --no-prompt --debug | ||
| else | ||
| azd provision --no-prompt | ||
| fi |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The debug flag detection logic is duplicated across multiple locations in both workflow files. Consider extracting this into a composite action or a reusable shell script (e.g., in azd-hooks/scripts/) to centralize the logic and reduce maintenance burden. This would ensure consistent behavior and make future updates easier.
| # Detect if debug logging is enabled | |
| if [ "$ACTIONS_STEP_DEBUG" = "true" ] || [ "$ACTIONS_RUNNER_DEBUG" = "true" ] || [ "$RUNNER_DEBUG" = "1" ]; then | |
| azd provision --no-prompt --debug | |
| else | |
| azd provision --no-prompt | |
| fi | |
| # Run azd provision with debug detection logic centralized in a reusable script | |
| bash azd-hooks/scripts/azd-provision-with-debug.sh --no-prompt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot implement this script and make the related updates to azure-dev-down.yml and azure-dev.yml. Make it a powershell script, and create it at the appropriate location under the .github folder, not under azd-hooks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in commit 628d9ac. Created .github/scripts/Invoke-AzdWithDebug.ps1 as a reusable PowerShell script that centralizes the debug flag detection logic. Updated both azure-dev.yml and azure-dev-down.yml to use this script, reducing code duplication by 25+ lines while maintaining the same functionality.
The script:
- Detects GitHub Actions debug flags (ACTIONS_STEP_DEBUG, ACTIONS_RUNNER_DEBUG, RUNNER_DEBUG)
- Accepts Command and Arguments parameters for flexible azd command execution
- Automatically appends
--debugwhen debug logging is enabled - Includes comprehensive help documentation
Usage example:
pwsh .github/scripts/Invoke-AzdWithDebug.ps1 -Command "provision" -Arguments "--no-prompt"Co-authored-by: ianjensenisme <[email protected]>
Co-authored-by: ianjensenisme <[email protected]>
ianjensenisme
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
HadwaAbdelhalem
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description
This PR adds GitHub's native debug logging support to Azure Developer CLI (azd) commands in the deployment workflows, enabling verbose output for troubleshooting infrastructure provisioning and teardown operations.
Changes Made
azure-dev.yml (CI-Deploy workflow)
azd provisioncommandazd downcommandazure-dev-down.yml (CI Destroy Resources workflow)
azd provision --previewcommandazd downcommandWhen debug logging is enabled, the
--debugflag is passed to azd commands, providing:How to enable debug mode
To see verbose output from azd commands:
GitHub automatically sets the environment variables
ACTIONS_STEP_DEBUG,ACTIONS_RUNNER_DEBUG, andRUNNER_DEBUG, which the workflow detects to add the--debugflag to azd commands.Technical approach
DEBUG_FLAG variable pattern:
This approach uses a simple variable to conditionally append the
--debugflag, eliminating command duplication in if/else branches.Benefits
✅ Simple implementation: Inline logic with no external scripts
✅ No duplication: Single azd command invocation with conditional DEBUG_FLAG
✅ Easy to understand: All logic visible directly in workflow files
✅ Consistent behavior: Same pattern across all azd command invocations
✅ Maintainable: Straightforward conditional logic
Modified Files
.github/workflows/azure-dev.yml- Added DEBUG_FLAG pattern for azd provision and azd down.github/workflows/azure-dev-down.yml- Added DEBUG_FLAG pattern for azd provision and azd downRelated Issue(s)
Links to related issues will be added by the system
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.