Skip to content

Commit

Permalink
sort unique id
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredfholgate committed Oct 23, 2024
1 parent a2ba6f0 commit 2689931
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 9 additions & 4 deletions .github/tests/scripts/generate-matrix.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
param(
[string]$runNumber = "999"
)

$combinations = [ordered]@{
azuredevops_bicep = [ordered]@{
infrastructureAsCode = @("bicep")
Expand Down Expand Up @@ -106,7 +110,8 @@ function Get-MatrixRecursively {
param(
$calculatedCombinations = @(),
$indexes = [ordered]@{},
$definition
$definition,
$runNumber
)

if($indexes.Count -eq 0) {
Expand All @@ -130,7 +135,7 @@ function Get-MatrixRecursively {

$combination.Name = $name.Trim("-")
$combination.Hash = Get-Hash $name
$combination.ShortName = $combination.Hash.Substring(0,5)
$combination.ShortName = "r" + $combination.Hash.Substring(0,5).ToLower() + "r" + $runNumber

$calculatedCombinations += $combination

Expand All @@ -144,7 +149,7 @@ function Get-MatrixRecursively {
}

if($hasMore) {
$calculatedCombinations = Get-MatrixRecursively -calculatedCombinations $calculatedCombinations -indexes $indexes -definition $definition
$calculatedCombinations = Get-MatrixRecursively -calculatedCombinations $calculatedCombinations -indexes $indexes -definition $definition -runNumber $runNumber
}

return $calculatedCombinations
Expand All @@ -153,7 +158,7 @@ function Get-MatrixRecursively {
$finalMatrix = @()

foreach($key in $combinations.Keys) {
$finalMatrix += Get-MatrixRecursively -definition $combinations[$key]
$finalMatrix += Get-MatrixRecursively -definition $combinations[$key] -runNumber $runNumber
}

return $finalMatrix
6 changes: 3 additions & 3 deletions .github/workflows/end-to-end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ jobs:
- name: Generate Matrix
id: matrix
run: |
$matrix = ${{ env.BOOTSTRAP_MODULE_FOLDER }}/.github/tests/scripts/generate-matrix.ps1
$matrix = ${{ env.BOOTSTRAP_MODULE_FOLDER }}/.github/tests/scripts/generate-matrix.ps1 -runNumber "${{ github.run_number }}"
$matrixJson = ConvertTo-Json $matrix -Depth 10 -Compress
Write-Host (ConvertTo-Json $matrix -Depth 10)
Write-Output "matrix=$matrixJson" >> $env:GITHUB_OUTPUT
shell: pwsh

e2e-test:
needs: define-matrix
name: "${{ matrix.name }} (${{ matrix.ShortName }}${{ github.run_number }})"
name: "${{ matrix.name }} (${{ matrix.ShortName }})"
environment: ${{ github.event_name == 'schedule' && 'CSUTFAUTO' || 'CSUTF' }}
if: "${{ github.repository == 'Azure/accelerator-bootstrap-modules' && (contains(github.event.pull_request.labels.*.name, 'PR: Safe to test 🧪') || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') }}"
strategy:
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
Write-Host "Location: $location"
Write-Host "Location 2: $location2"

$uniqueId = "$shortName$runNumber".ToLower()
$uniqueId = $shortName
echo "UNIQUE_ID=$uniqueId" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append

Write-Host "Unique ID: $uniqueId"
Expand Down

0 comments on commit 2689931

Please sign in to comment.