From ffb1e96a8d048cb1454d0b30f0047f19f2be71f4 Mon Sep 17 00:00:00 2001 From: Hariharen Veerakumar Date: Thu, 18 Apr 2024 08:28:27 +0000 Subject: [PATCH 1/3] Allow custom sorting on Push as well --- .github/workflows/push.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e22b070..9e467ac 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -38,6 +38,17 @@ env: AZOPS_MODULE_VERSION: ${{ secrets.AZOPS_MODULE_VERSION }} APPLICATIONINSIGHTS_CONNECTIONSTRING: ${{ secrets.APPLICATIONINSIGHTS_CONNECTIONSTRING }} + # + # customSortOrder + # Set to true to support custom sort order. + # When enabled, add a file named .order containing a list of + # file names and the files in that folder will be deployed in the + # order specified in the file. All files not listed in the file + # will be deployed after the files listed in the file. + # + + AZOPS_CUSTOM_SORT_ORDER: ${{ secrets.AZOPS_CUSTOM_SORT_ORDER }} + # # modulesFolder # To enable caching of PowerShell modules between From 546dbed79f7105383cd00a1a84826db1b590b4a3 Mon Sep 17 00:00:00 2001 From: Hariharen Veerakumar Date: Tue, 23 Apr 2024 01:35:29 +0000 Subject: [PATCH 2/3] Also including for validate --- .github/workflows/validate.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 2a64198..5897cdd 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -34,6 +34,17 @@ env: AZOPS_MODULE_VERSION: ${{ secrets.AZOPS_MODULE_VERSION }} APPLICATIONINSIGHTS_CONNECTIONSTRING: ${{ secrets.APPLICATIONINSIGHTS_CONNECTIONSTRING }} + # + # customSortOrder + # Set to true to support custom sort order. + # When enabled, add a file named .order containing a list of + # file names and the files in that folder will be deployed in the + # order specified in the file. All files not listed in the file + # will be deployed after the files listed in the file. + # + + AZOPS_CUSTOM_SORT_ORDER: ${{ secrets.AZOPS_CUSTOM_SORT_ORDER }} + # # modulesFolder # To enable caching of PowerShell modules between From dba8a0f00c98291623e31d5b5eb17beaf2d705ac Mon Sep 17 00:00:00 2001 From: Hariharen Veerakumar Date: Tue, 23 Apr 2024 02:00:05 +0000 Subject: [PATCH 3/3] Add custom sort order to the shared action --- .github/actions/validate-deploy/action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/actions/validate-deploy/action.yml b/.github/actions/validate-deploy/action.yml index 74985d6..73c6426 100644 --- a/.github/actions/validate-deploy/action.yml +++ b/.github/actions/validate-deploy/action.yml @@ -57,14 +57,16 @@ runs: - name: ${{ inputs.name }} shell: pwsh run: | + $Env:PSModulePath = $Env:PSModulePath, '$(modulesFolder)' -join [IO.Path]::PathSeparator + $CustomSortOrder = $Env:AZOPS_CUSTOM_SORT_ORDER -eq 'true' Import-PSFConfig -Path settings.json -Schema MetaJson -EnableException $RunWhatIf = -not ('${{inputs.deploy}}' -eq 'true') $diff = Get-Content -Path /tmp/diff.txt if(Test-Path -Path "/tmp/diffdeletedfiles.txt") { $diffdeletedfiles = Get-Content -Path /tmp/diffdeletedfiles.txt - Invoke-AzOpsPush -ChangeSet $diff -DeleteSetContents $diffdeletedfiles -WhatIf:$RunWhatIf + Invoke-AzOpsPush -ChangeSet $diff -DeleteSetContents $diffdeletedfiles -WhatIf:$RunWhatIf -CustomSortOrder:$CustomSortOrder } else { - Invoke-AzOpsPush -ChangeSet $diff -WhatIf:$RunWhatIf + Invoke-AzOpsPush -ChangeSet $diff -WhatIf:$RunWhatIf -CustomSortOrder:$CustomSortOrder } Get-Job | Remove-Job -Force