Skip to content

Fix batch generation build artifact #27945

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

Merged
merged 6 commits into from
Jun 24, 2025

Conversation

Pan-Qi
Copy link
Contributor

@Pan-Qi Pan-Qi commented Jun 12, 2025

Description

Fixed a few bugs in batch generation and added some loggings for further traking/debugging

Bug was related to the regx match index

 if ($ChangedFiles[$i] -match '^generated/([^/]+)/([^/]+\.Autorest)/') {
            $moduleName = $Matches[1]
            $subModuleName = $Matches[2]

TestChangedModulesOnly parameter was added, which was used as variable.

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

@Pan-Qi Pan-Qi force-pushed the bernard-fix-batch-generation-build-artifact branch from 772763f to c41d00c Compare June 12, 2025 09:26
@Pan-Qi Pan-Qi force-pushed the bernard-fix-batch-generation-build-artifact branch from 9536c6e to ea8ff73 Compare June 12, 2025 13:06
@Pan-Qi Pan-Qi force-pushed the bernard-fix-batch-generation-build-artifact branch from df2254d to 61fa378 Compare June 17, 2025 12:51
@Pan-Qi Pan-Qi force-pushed the bernard-fix-batch-generation-build-artifact branch from 0e76723 to f3b8726 Compare June 23, 2025 04:55
@Pan-Qi Pan-Qi marked this pull request as ready for review June 23, 2025 04:55
@Pan-Qi Pan-Qi requested review from Copilot and YanaXu June 23, 2025 04:55
Copy link
Contributor

@Copilot Copilot AI left a 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 refactors the batch-generation pipeline to support running tests only on changed modules, enhances logging and artifact outputs, and fixes timing typos.

  • Introduce a TestChangedModulesOnly parameter and wire it into the pipeline environment
  • Update batch-generation scripts to emit per-item JSON output and record artifact files
  • Correct typos in timing variables and improve grouping logs

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.azure-pipelines/batch-generation.yml Add TestChangedModulesOnly parameter and replace legacy env var
.azure-pipelines/PipelineSteps/BatchGeneration/util.psm1 Add Azure DevOps log grouping markers
.azure-pipelines/PipelineSteps/BatchGeneration/test-modules.ps1 Emit each test result as JSON
.azure-pipelines/PipelineSteps/BatchGeneration/prepare.ps1 Rename artifacts directory var and record prepared module list
.azure-pipelines/PipelineSteps/BatchGeneration/filter.ps1 Switch to TEST_CHANGED_MODULES_ONLY logic and persist filtered lists
.azure-pipelines/PipelineSteps/BatchGeneration/build-modules.ps1 Fix $endTine typo, output each build result as JSON
.azure-pipelines/PipelineSteps/BatchGeneration/batch-generate-modules.ps1 Output each generation result as JSON
.azure-pipelines/PipelineSteps/BatchGeneration/analyse-modules.ps1 Fix $endTine typo, output each analysis result as JSON
Comments suppressed due to low confidence (4)

.azure-pipelines/batch-generation.yml:1

  • Consider changing the TestChangedModulesOnly parameter type from string to boolean so that downstream scripts can use native boolean logic instead of string comparisons.
parameters:

.azure-pipelines/PipelineSteps/BatchGeneration/filter.ps1:18

  • New branches have been introduced for TEST_CHANGED_MODULES_ONLY; please add unit or integration tests covering both true and false cases to ensure the filter logic works correctly.
if ($env:TEST_CHANGED_MODULES_ONLY -eq "True") {

.azure-pipelines/PipelineSteps/BatchGeneration/filter.ps1:18

  • The regex pattern uses forward slashes only, which may not match Windows-style backslashes in $ChangedFiles. Consider normalizing path separators or updating the pattern to use [\\/] to support both.
if ($env:TEST_CHANGED_MODULES_ONLY -eq "True") {

.azure-pipelines/PipelineSteps/BatchGeneration/util.psm1:69

  • [nitpick] Azure DevOps grouping commands expect ##[group] immediately followed by the group name. Consider moving the count to a second line or separating the label for clearer log grouping.
    Write-Host "##[group]$VariableName module groups: $($GroupedModules.Count)"

@YanaXu YanaXu merged commit 3bb1042 into main Jun 24, 2025
12 checks passed
@YanaXu YanaXu deleted the bernard-fix-batch-generation-build-artifact branch June 24, 2025 09:15
emmeliaAra added a commit to emmeliaAra/azure-powershell that referenced this pull request Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants