Validate pipeline fails for PR with custom sorting

Open Beginner friendly
#950 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
powershell
Domain
ci-cd

Research direction

Start with .scripts/customSorting.ps1 at lines 26-28 and trace how a diff containing only a .order file is handled by the CustomSorting step. Reproduce with AZOPS_CUSTOM_SORT_ORDER=true and an order-only pull request, then run the Validate pipeline. Done means the diff passed to Invoke-AzOpsPush is usable and validation no longer fails.

Written by the indexing model from the issue text.

Description

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'.
Dominant language
PowerShell
Stars
420
Forks
174
Avg merge
16d 18h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/AzOps

All issues in Azure/AzOps

Similar issues

More DevOps issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.