AzOps-Accelerator icon indicating copy to clipboard operation
AzOps-Accelerator copied to clipboard

Add support for custom sort order

Open SimonWahlin opened this issue 2 years ago • 4 comments

Overview/Summary

Add option to configure in which order templates will be deployed by adding a conditional step between Diff and Validate/Deploy.

I am a bit uncertain on if the variable AZOPS_CUSTOM_SORT_ORDER should be put into the credentials variable group or if a new group should be created. If a new group should be created, I am uncertain of what to name it.
I have considered the following names:

  • azops
  • azopsConfig
  • config

I do not think it should be named anything related to settings to avoid confusion with settings.json

This PR fixes/adds/changes/removes

  1. Add support for custom sort order of templates

Breaking Changes

For Azure DevOps only: Requires creation of variable group azops as well as granting pipelines access to that group.

Testing Evidence

CustomSorting step sorts files in diff.txt image

Deploy step uses parameter -CustomSortOrder and picks up on the order in diff.txt image

As part of this Pull Request I have

  • [x] Checked for duplicate Pull Requests
  • [x] Associated it with relevant issues, for tracking and closure.
  • [x] Ensured my code/branch is up-to-date with the latest changes in the main branch
  • [x] Performed testing and provided evidence.
  • [x] Updated relevant and associated documentation. (https://github.com/Azure/AzOps/pull/660)

Fixes Azure/AzOps#592

SimonWahlin avatar Jun 11 '22 12:06 SimonWahlin

I have tested the functionality and it works as expected - awesome job! 😄 Do you think it makes sense to externalize the script as it becomes quite cumbersome to manage 30+ lines of PS directly in the yaml pipeline?

daltondhcp avatar Jul 13 '22 10:07 daltondhcp

Sure, I can put the code in a scripts folder. How about .pipelines/.script/customSortOrder.ps1?

Or maybe have a generic location for both GitHub and ADO? Maybe .scripts/customSortOrder.ps1?

SimonWahlin avatar Jul 26 '22 06:07 SimonWahlin

Sure, I can put the code in a scripts folder. How about .pipelines/.script/customSortOrder.ps1?

Or maybe have a generic location for both GitHub and ADO? Maybe .scripts/customSortOrder.ps1?

Sounds like a good plan to me!

daltondhcp avatar Aug 01 '22 13:08 daltondhcp

Sorry for the delay, should be working now.

SimonWahlin avatar Aug 15 '22 20:08 SimonWahlin