Skip to content

[Bug]: bug in AL-Go's GetDependencies function #2236

@LorenzoVancoillie

Description

@LorenzoVancoillie

AL-Go version

9

Describe the issue

The variable $mask from the outer foreach is reassigned inside the inner foreach. So when iterating dependencies:

Iteration 1 — your App_xyz entry has "buildMode": "ONPREM" → $mask gets rewritten from "Apps" to "ONPREMApps".
Iteration 2 — your App_abc entry has no buildMode (so $buildMode is $null). $null -ne "Default" is true, so it executes $mask = "$buildMode$mask" which evaluates to "" + "ONPREMApps" = "ONPREMApps". (Even if that branch were skipped, the leaked value from iteration 1 would still be in $mask.)

foreach($mask in $masks) { # outer: 'Apps','Dependencies','TestApps'
foreach($dependency in $probingPathsJson) { # inner: each probing entry
$buildMode = $dependency.buildMode
...
if($buildMode -ne "Default") {
$mask = "$buildMode$mask" # ← mutates the OUTER loop variable
$altMask = "$buildMode$altMask"
}
Write-Host "Locating $mask artifacts for projects: $projects"
...
}
}

Expected behavior

If no buildmode is defined in the appDependencyProbingPaths entry it should clear the buildmode

Steps to reproduce

run a CI/CD that has dependency on 2 other github projects, where the first dependency uses a build mode and the second one does not.

"appDependencyProbingPaths": [
{
"repo": "https://github.com/org/App_xyz",
"version": "latest",
"release_status": "latestBuild",
"authTokenSecret": "GHTOKENWORKFLOW",
"projects": "",
"branch": "23.3.0.0-Production",
"buildMode": "ONPREM"
},
{
"repo": "https://github.com/org/App_abc",
"version": "latest",
"release_status": "latestBuild",
"authTokenSecret": "GHTOKENWORKFLOW",
"projects": "
",
"branch": "Production"
}
],

Additional context (logs, screenshots, etc.)

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions