Skip to content

Validate pipeline fails for PR with custom sorting #950

Description

@Agger1995

Describe the bug
In an AzOps repository, with the configuration AZOPS_CUSTOM_SORT_ORDER=true, i.e. custom sorting is enabled.
The Validate pipeline fails for pull-requests where the change set only consists of modifications to a .order file.

This happens because the CustomSorting step of the pipeline modifies the /tmp/diff.txt file to be empty, when there is only a change to the .order file.

Relevant script: https://github.com/Azure/AzOps-Accelerator/blob/main/.scripts/customSorting.ps1#L26C1-L28C6

Steps to reproduce

  1. Create an AzOps Accelerator repository, to track Azure resources at any level
  2. Enable custom sorting, by setting environment variable AZOPS_CUSTOM_SORT_ORDER=true
  3. Create a PR, modifying only a .order file, at any tracked level in the AzOps repository
  4. Execute the Validate pipeline for the PR

Pipeline outputs:
CustomSorting pipeline step:

Files found in diff:
M	root/my management group (00000000-0000-0000-0000-000000000000)/my subscription (00000000-0000-0000-0000-000000000000)/.order
Sorted files:

Validate pipeline step error:

Cannot bind argument to parameter 'ChangeSet' because it is null.
At /__w/_temp/52355258-7ba8-4086-8efb-8bdca5da3788.ps1:15 char:31
+   Invoke-AzOpsPush -ChangeSet $diff -WhatIf:$RunWhatIf -CustomSortOrd …
+                               ~~~~~

##[error]PowerShell exited with code '1'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions