Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incremental Builds #1304

Merged
merged 293 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
293 commits
Select commit Hold shift + click to select a range
c300bbf
add concurrency
freddydk Nov 11, 2024
7e85650
use format
freddydk Nov 11, 2024
3fbef9d
check for artifacts
freddydk Nov 11, 2024
2f5970a
conditional analyze
freddydk Nov 11, 2024
1591d40
set token
freddydk Nov 11, 2024
5a83ef8
ps 5 trick
freddydk Nov 11, 2024
38ef283
check errlevel
freddydk Nov 11, 2024
2775342
use pwsh
freddydk Nov 11, 2024
293d4b7
use ghtoken
freddydk Nov 11, 2024
232ff01
ignore
freddydk Nov 11, 2024
32120fc
use try
freddydk Nov 11, 2024
c5b3dcd
get modified
freddydk Nov 11, 2024
173aaef
arr
freddydk Nov 11, 2024
b5af39a
)
freddydk Nov 11, 2024
34b94b4
find folders
freddydk Nov 12, 2024
8f4dab5
use full path
freddydk Nov 12, 2024
1451f4b
dump
freddydk Nov 12, 2024
9cd8e28
dont join
freddydk Nov 12, 2024
c3d0daf
syntax
freddydk Nov 12, 2024
2694ea5
syntax
freddydk Nov 12, 2024
a294a9e
remove ./
freddydk Nov 12, 2024
cff8a34
test
freddydk Nov 12, 2024
702e818
add runid
freddydk Nov 12, 2024
742c41b
rename
freddydk Nov 12, 2024
ddc3d07
ignore cancelled
freddydk Nov 12, 2024
2e304a5
use projectname
freddydk Nov 12, 2024
aa316d5
use repo name
freddydk Nov 12, 2024
e74238c
use repo
freddydk Nov 12, 2024
90a1255
dump
freddydk Nov 12, 2024
64290ca
create tempfolder
freddydk Nov 12, 2024
c217a7e
download
freddydk Nov 12, 2024
3ef3aae
do not set
freddydk Nov 12, 2024
768d052
s
freddydk Nov 12, 2024
9840475
err
freddydk Nov 12, 2024
9309ae2
use this
freddydk Nov 12, 2024
507ea1e
include project
freddydk Nov 12, 2024
c07156c
buildall
freddydk Nov 12, 2024
a1b2ee4
call
freddydk Nov 12, 2024
95f92d5
parm
freddydk Nov 12, 2024
76880c2
+
freddydk Nov 12, 2024
e6969a6
Merge branch 'main' into partial
freddydk Nov 12, 2024
b104f8f
remove download all
freddydk Nov 13, 2024
e8e9031
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Nov 13, 2024
cc4f7f5
avoid warning
freddydk Nov 13, 2024
5a62b54
fix precommit
freddydk Nov 13, 2024
604c1fe
only download thisbuild
freddydk Nov 13, 2024
ff99ecd
b
freddydk Nov 13, 2024
b7360be
no double downloads
freddydk Nov 13, 2024
e80fe8d
dump
freddydk Nov 13, 2024
2640c11
remove ()
freddydk Nov 13, 2024
23baf93
add dumps
freddydk Nov 13, 2024
145df8e
fix
freddydk Nov 13, 2024
47c558c
remove dumps
freddydk Nov 13, 2024
a5e9fc9
remove dump
freddydk Nov 13, 2024
cc0bad9
do not issue warnings if donotbuild is set
freddydk Nov 13, 2024
422315a
resolve path
freddydk Nov 13, 2024
4f90bfd
use relative
freddydk Nov 13, 2024
391b53e
use filesystem
freddydk Nov 13, 2024
f138883
use dirsep
freddydk Nov 13, 2024
08171ea
output
freddydk Nov 13, 2024
b4b0f86
-(
freddydk Nov 13, 2024
b58819e
Merge branch 'main' into partial
freddydk Nov 13, 2024
9ad517a
MOVE
freddydk Nov 13, 2024
07286b7
check all folders
freddydk Nov 13, 2024
674e4e3
dump
freddydk Nov 13, 2024
8bdae86
save time
freddydk Nov 13, 2024
ff59a9b
settings
freddydk Nov 13, 2024
2b641ba
always all
freddydk Nov 13, 2024
3d4e8b2
remove dump
freddydk Nov 13, 2024
eb1c5c8
use special
freddydk Nov 13, 2024
0c7e42b
buildmode
freddydk Nov 14, 2024
d84bfa7
rename to incrementalBuilds
freddydk Nov 14, 2024
f19cdc7
set modifiedfiles
freddydk Nov 15, 2024
ef088b0
exit0
freddydk Nov 15, 2024
d1236b5
setshouldexit
freddydk Nov 15, 2024
596edd8
head
freddydk Nov 15, 2024
263235a
using pr head
freddydk Nov 15, 2024
631624c
use artifacts cache
freddydk Nov 15, 2024
db3a07d
move
freddydk Nov 15, 2024
fa8e388
check duplicate
freddydk Nov 16, 2024
f6aa3cc
allowprerel
freddydk Nov 16, 2024
057e5be
()
freddydk Nov 16, 2024
86c28cc
exact
freddydk Nov 16, 2024
748a501
version
freddydk Nov 16, 2024
5c49073
find - not download
freddydk Nov 16, 2024
2692a96
use appjson.version
freddydk Nov 16, 2024
8f261c2
Merge branch 'main' into partial
freddydk Nov 22, 2024
abf4f59
space
freddydk Nov 22, 2024
0613613
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Nov 22, 2024
1d668d8
review
freddydk Nov 22, 2024
c565875
remove buildPP from appsource template
freddydk Nov 22, 2024
07cd036
precommit
freddydk Nov 22, 2024
eb7d483
Merge branch 'main' into partial
freddydk Nov 22, 2024
f52120c
Merge branch 'main' into partial
freddydk Nov 28, 2024
8bec033
no incremental
freddydk Dec 9, 2024
0642e8b
spell
freddydk Dec 10, 2024
4e8572f
Merge branch 'main' into partial
freddydk Dec 10, 2024
a371a9b
change parameter name
freddydk Dec 10, 2024
0d2ae93
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Dec 10, 2024
72ccf70
enable
freddydk Dec 12, 2024
83cb87c
fix tests
freddydk Dec 12, 2024
a4b46f6
remove dumps
freddydk Dec 12, 2024
e3e59f7
precommit
freddydk Dec 12, 2024
3d883ee
use preview
freddydk Dec 12, 2024
8e09a7a
ped
freddydk Dec 13, 2024
2aa69e7
add unknown
freddydk Dec 13, 2024
4b50bd8
add knownApps
freddydk Dec 13, 2024
aae75b7
arr
freddydk Dec 13, 2024
7e1178e
add project
freddydk Dec 13, 2024
faf8f90
all folders
freddydk Dec 14, 2024
1f2a607
add project
freddydk Dec 14, 2024
665e84f
dump
freddydk Dec 14, 2024
f9303e3
sub 2
freddydk Dec 14, 2024
39547d9
add end 2 end test
freddydk Dec 15, 2024
60f0b2f
review
freddydk Dec 15, 2024
0f934ff
-bash
freddydk Dec 15, 2024
61a6a77
-linux
freddydk Dec 15, 2024
23bb87f
release notes and settings
freddydk Dec 15, 2024
020dfa5
Merge branch 'main' into partial
freddydk Dec 15, 2024
796ccdb
remove mode
freddydk Dec 16, 2024
dfb42b8
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Dec 16, 2024
0b68f06
add cancelinprogress setting
freddydk Dec 16, 2024
ab06358
bool
freddydk Dec 16, 2024
c334581
replace
freddydk Dec 16, 2024
4516ae9
concurrency setting
freddydk Dec 16, 2024
8e578b5
move
freddydk Dec 16, 2024
c6be36e
default allowed
freddydk Dec 16, 2024
dd1dee0
update docs
freddydk Dec 16, 2024
53c2414
fix e2e test
freddydk Dec 16, 2024
ca1b3b7
precommit
freddydk Dec 16, 2024
e6f2eea
doc
freddydk Dec 16, 2024
619c5b4
Merge branch 'main' into partial
freddydk Dec 16, 2024
6dc589b
Merge branch 'main' into partial
freddydk Dec 18, 2024
be1253c
move
freddydk Dec 18, 2024
17e571a
move2
freddydk Dec 18, 2024
9596353
Merge branch 'main' into partial
freddydk Dec 18, 2024
6ce0007
Merge branch 'main' into partial
freddydk Dec 18, 2024
5b0c838
Merge branch 'main' into partial
freddydk Dec 30, 2024
932ab42
Merge branch 'main' into partial
freddydk Dec 30, 2024
466f671
Merge branch 'main' into partial
freddydk Jan 9, 2025
8a8bc7c
Merge branch 'main' into partial
freddydk Jan 10, 2025
360d6db
fix
freddydk Jan 10, 2025
3f61918
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Jan 10, 2025
274aacd
Update e2eTests/scenarios/IncrementalBuilds/runtest.ps1
freddydk Jan 10, 2025
b84b4d1
Update Actions/DetermineProjectsToBuild/action.yaml
freddydk Jan 10, 2025
ca7cdbe
review
freddydk Jan 10, 2025
99745be
incremental
freddydk Jan 10, 2025
cfd9e87
doc
freddydk Jan 10, 2025
6252d0d
remove concurrency
freddydk Jan 10, 2025
f053d67
lines
freddydk Jan 10, 2025
fbcd0e2
space
freddydk Jan 10, 2025
8d88d67
Merge branch 'main' into partial
freddydk Jan 14, 2025
1fa094c
Merge branch 'main' into partial
freddydk Jan 14, 2025
7c1a37e
Merge branch 'main' into partial
freddydk Jan 16, 2025
fdbef48
Merge branch 'main' into partial
freddydk Jan 16, 2025
332e2cc
review
freddydk Jan 16, 2025
a068ef1
new modification of yaml
freddydk Jan 18, 2025
46a1fae
loop
freddydk Jan 19, 2025
43b0770
prop
freddydk Jan 19, 2025
0b73f18
dump
freddydk Jan 19, 2025
0a2a2f1
buildmode ''
freddydk Jan 19, 2025
6d26d7e
add branchsha
freddydk Jan 19, 2025
469bd0c
7
freddydk Jan 19, 2025
50fa2d2
add deprecation
freddydk Jan 19, 2025
79543b8
add deorecations to troubleshooting
freddydk Jan 20, 2025
890dbf3
add deprecation tests
freddydk Jan 20, 2025
1910274
add err
freddydk Jan 20, 2025
fb7002a
test
freddydk Jan 21, 2025
90a752b
fix
freddydk Jan 21, 2025
aa3fdde
use preview
freddydk Jan 21, 2025
8f431aa
Merge branch 'main' into partial
freddydk Jan 25, 2025
3bd5805
rename parameter
freddydk Jan 25, 2025
f259633
full build on schedule
freddydk Jan 27, 2025
61ee3f1
thisbuild artifacts no longer exists
freddydk Jan 27, 2025
815cc50
Modify settings
freddydk Jan 29, 2025
7a21c94
md
freddydk Jan 29, 2025
25af796
use github_event_name
freddydk Jan 29, 2025
bfe4058
e2e
freddydk Jan 29, 2025
015d3a5
Merge branch 'main' into partial
freddydk Jan 30, 2025
1bebd9c
review
freddydk Jan 30, 2025
ec0c3f5
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Jan 30, 2025
9d962ca
move
freddydk Jan 30, 2025
9f78686
move
freddydk Jan 30, 2025
2bdba91
back
freddydk Jan 30, 2025
e16eaaf
Merge branch 'main' into partial
freddydk Jan 31, 2025
549c7e6
env ghtoken
freddydk Jan 31, 2025
1b44912
use token parameter
freddydk Jan 31, 2025
8c8a755
use e2epat parameter
freddydk Jan 31, 2025
a746505
add dollar
freddydk Jan 31, 2025
9ac9c77
s
freddydk Jan 31, 2025
6419484
fix merge problem and e2e failure
freddydk Feb 1, 2025
fffdd57
Update Actions/Github-Helper.psm1
freddydk Feb 3, 2025
b3999f0
review
freddydk Feb 6, 2025
17522f7
make workflowSchedule a structure
freddydk Feb 6, 2025
1f6335a
test failures
freddydk Feb 7, 2025
f8757c0
review
freddydk Feb 7, 2025
2391885
Merge branch 'main' into partial
freddydk Feb 7, 2025
b09120c
Merge branch 'main' into partial
freddydk Feb 8, 2025
c0af78c
do not build all projects in PRs
freddydk Feb 8, 2025
413bb94
pr target
freddydk Feb 8, 2025
4cb540c
give warning if alwysBuild is set
freddydk Feb 8, 2025
0e3629b
add notice about last known good build
freddydk Feb 8, 2025
e0d48c5
test only urls
freddydk Feb 8, 2025
463e822
add underscore
freddydk Feb 8, 2025
c5b2f3b
number to start
freddydk Feb 8, 2025
99ad88c
test url
freddydk Feb 8, 2025
7727f27
Last known good build
freddydk Feb 8, 2025
f5f8231
compare files
freddydk Feb 8, 2025
ddb02b5
Merge branch 'main' into partial
freddydk Feb 9, 2025
6a33e5a
Update RELEASENOTES.md
freddydk Feb 11, 2025
dd113ca
review
freddydk Feb 11, 2025
5414021
use function
freddydk Feb 11, 2025
a08f0f4
review
freddydk Feb 11, 2025
9b88542
Update Scenarios/settings.md
freddydk Feb 11, 2025
0fcf308
review
freddydk Feb 11, 2025
eadd46a
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Feb 11, 2025
e4399ec
review + rename
freddydk Feb 11, 2025
47489ee
only call get-ProjectsToBuild once
freddydk Feb 11, 2025
2161f86
spell
freddydk Feb 11, 2025
af6420e
remove unnecessary dump
freddydk Feb 11, 2025
1c2a7aa
Merge branch 'main' into partial
freddydk Feb 11, 2025
5b5d7da
Update Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.psm1
freddydk Feb 12, 2025
7168431
Merge branch 'main' into partial
freddydk Feb 13, 2025
4088e5f
use correct targetbranch
freddydk Feb 14, 2025
de08e37
baseref
freddydk Feb 14, 2025
937a9bf
review
freddydk Feb 14, 2025
f47f566
Update RELEASENOTES.md
freddydk Feb 14, 2025
3cbb1d3
Update RELEASENOTES.md
freddydk Feb 14, 2025
128342a
Merge branch 'main' into partial
freddydk Feb 14, 2025
b2ebf27
add tests for modifiedProjects
freddydk Feb 14, 2025
f004dda
add retry to git fetch
freddydk Feb 15, 2025
4f747fa
add newline
freddydk Feb 15, 2025
e88f6e5
move code to function
freddydk Feb 17, 2025
6b2bc5d
trailing spaces
freddydk Feb 17, 2025
9226b88
-
freddydk Feb 17, 2025
eac2c1d
apps
freddydk Feb 17, 2025
74a3c17
add silent mode
freddydk Feb 17, 2025
b062137
Merge branch 'main' into partial
freddydk Feb 17, 2025
a80d31d
rename
freddydk Feb 18, 2025
73e5a28
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Feb 18, 2025
d99f308
dump 1
freddydk Feb 18, 2025
008c791
Wrong conversion of old workflowSchedule
freddydk Feb 18, 2025
1fa6425
review
freddydk Feb 18, 2025
818cfec
add telemetry
freddydk Feb 18, 2025
f30bc7d
add dumps for testing
freddydk Feb 18, 2025
1e699c1
use dotnet type
freddydk Feb 18, 2025
fc7e42a
use dict
freddydk Feb 18, 2025
6ff8ab7
remove dumps
freddydk Feb 18, 2025
e8693fd
use apptype
freddydk Feb 18, 2025
13dd22e
Merge branch 'main' into partial
freddydk Feb 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ updates:
directories:
- ".github/workflows/"
- "/Templates/**/.github/workflows/"
- "/Actions/**/"
groups:
External-Dependencies:
applies-to: version-updates
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CleanupTempRepos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
Import-Module (Join-Path "." "e2eTests/e2eTestHelper.psm1") -DisableNameChecking
$owner = '${{ needs.Check.outputs.githubowner }}'
$e2epat = '${{ Secrets.E2EPAT }}'
SetTokenAndRepository -github -githubOwner $owner -e2epat $e2epat -repository ''
SetTokenAndRepository -github -githubOwner $owner -token $e2epat -repository ''
@(invoke-gh repo list $owner --limit 1000 -silent -returnValue) | ForEach-Object { $_.Split("`t")[0] } | Where-Object { "$_" -like "$owner/tmp*" } | ForEach-Object {
$repo = $_
Write-Host "https://github.com/$repo"
Expand Down
131 changes: 90 additions & 41 deletions Actions/AL-Go-Helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@ function Copy-HashTable() {
}
}

# Convert SecureString to plain text
function Get-PlainText {
Param(
[parameter(ValueFromPipeline, Mandatory = $true)]
[System.Security.SecureString] $SecureString
)
Process {
$bstr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString);
try {
return [Runtime.InteropServices.Marshal]::PtrToStringBSTR($bstr);
}
finally {
[Runtime.InteropServices.Marshal]::FreeBSTR($bstr);
}
}
}

function IsPropertySecret {
param (
[string] $propertyName
Expand Down Expand Up @@ -407,7 +424,7 @@ function DownloadAndImportBcContainerHelper([string] $baseFolder = $ENV:GITHUB_W
# Read Repository Settings file (without applying organization variables, repository variables or project settings files)
# Override default BcContainerHelper version from AL-Go-Helper only if new version is specifically specified in repo settings file
$repoSettings = Get-Content $repoSettingsPath -Encoding UTF8 | ConvertFrom-Json | ConvertTo-HashTable
if ($repoSettings.Keys -contains "BcContainerHelperVersion") {
if ($repoSettings.Keys -contains "BcContainerHelperVersion" -and $defaultBcContainerHelperVersion -notlike 'https://*') {
$bcContainerHelperVersion = $repoSettings.BcContainerHelperVersion
Write-Host "Using BcContainerHelper $bcContainerHelperVersion version"
if ($bcContainerHelperVersion -like "https://*") {
Expand Down Expand Up @@ -528,7 +545,8 @@ function ReadSettings {
[string] $userName = "$ENV:GITHUB_ACTOR",
[string] $branchName = "$ENV:GITHUB_REF_NAME",
[string] $orgSettingsVariableValue = "$ENV:ALGoOrgSettings",
[string] $repoSettingsVariableValue = "$ENV:ALGoRepoSettings"
[string] $repoSettingsVariableValue = "$ENV:ALGoRepoSettings",
[switch] $silent
)

# If the build is triggered by a pull request the refname will be the merge branch. To apply conditional settings we need to use the base branch
Expand All @@ -543,7 +561,7 @@ function ReadSettings {

if (Test-Path $path) {
try {
Write-Host "Applying settings from $path"
if (!$silent.IsPresent) { Write-Host "Applying settings from $path" }
$settings = Get-Content $path -Encoding UTF8 | ConvertFrom-Json
if ($settings) {
return $settings
Expand All @@ -554,7 +572,7 @@ function ReadSettings {
}
}
else {
Write-Host "No settings found in $path"
if (!$silent.IsPresent) { Write-Host "No settings found in $path" }
}
return $null
}
Expand Down Expand Up @@ -648,6 +666,13 @@ function ReadSettings {
"cacheImageName" = "my"
"cacheKeepDays" = 3
"alwaysBuildAllProjects" = $false
"incrementalBuilds" = [ordered]@{
"onPush" = $false
"onPull_Request" = $true
"onSchedule" = $false
"retentionDays" = 30
"mode" = "modifiedApps" # modifiedProjects, modifiedApps
}
"microsoftTelemetryConnectionString" = "InstrumentationKey=cd2cc63e-0f37-4968-b99a-532411a314b8;IngestionEndpoint=https://northeurope-2.in.applicationinsights.azure.com/"
"partnerTelemetryConnectionString" = ""
"sendExtendedTelemetryToMicrosoft" = $false
Expand Down Expand Up @@ -733,32 +758,16 @@ function ReadSettings {
if ("$conditionalSetting" -ne "") {
$conditionMet = $true
$conditions = @()
if ($conditionalSetting.PSObject.Properties.Name -eq "buildModes") {
$conditionMet = $conditionMet -and ($conditionalSetting.buildModes | Where-Object { $buildMode -like $_ })
$conditions += @("buildMode: $buildMode")
}
if ($conditionalSetting.PSObject.Properties.Name -eq "branches") {
$conditionMet = $conditionMet -and ($conditionalSetting.branches | Where-Object { $branchName -like $_ })
$conditions += @("branchName: $branchName")
}
if ($conditionalSetting.PSObject.Properties.Name -eq "repositories") {
$conditionMet = $conditionMet -and ($conditionalSetting.repositories | Where-Object { $repoName -like $_ })
$conditions += @("repoName: $repoName")
}
if ($project -and $conditionalSetting.PSObject.Properties.Name -eq "projects") {
$conditionMet = $conditionMet -and ($conditionalSetting.projects | Where-Object { $project -like $_ })
$conditions += @("project: $project")
}
if ($workflowName -and $conditionalSetting.PSObject.Properties.Name -eq "workflows") {
$conditionMet = $conditionMet -and ($conditionalSetting.workflows | Where-Object { $workflowName -like $_ })
$conditions += @("workflowName: $workflowName")
}
if ($userName -and $conditionalSetting.PSObject.Properties.Name -eq "users") {
$conditionMet = $conditionMet -and ($conditionalSetting.users | Where-Object { $userName -like $_ })
$conditions += @("userName: $userName")
@{"buildModes" = $buildMode; "branches" = $branchName; "repositories" = $repoName; "projects" = $project; "workflows" = $workflowName; "users" = $userName}.GetEnumerator() | ForEach-Object {
$propName = $_.Key
$propValue = $_.Value
if ($conditionMet -and $conditionalSetting.PSObject.Properties.Name -eq $propName) {
$conditionMet = $propValue -and $conditionMet -and ($conditionalSetting."$propName" | Where-Object { $propValue -like $_ })
$conditions += @("$($propName): $propValue")
}
}
if ($conditionMet) {
Write-Host "Applying conditional settings for $($conditions -join ", ")"
if (!$silent.IsPresent) { Write-Host "Applying conditional settings for $($conditions -join ", ")" }
MergeCustomObjectIntoOrderedDictionary -dst $settings -src $conditionalSetting.settings
}
}
Expand Down Expand Up @@ -927,11 +936,6 @@ function AnalyzeRepo {
)

$settings = $settings | Copy-HashTable

if (!$runningLocal) {
Write-Host "::group::Analyzing repository"
}

$projectPath = Join-Path $baseFolder $project -Resolve

# Check applicationDependency
Expand Down Expand Up @@ -1125,17 +1129,12 @@ function AnalyzeRepo {
if ($performanceToolkitApps.Contains($dep.id)) { $settings.installPerformanceToolkit = $true }
}
}

if (!$runningLocal) {
Write-Host "::endgroup::"
}

if (!$settings.doNotRunBcptTests -and -not $settings.bcptTestFolders) {
Write-Host "No performance test apps found in bcptTestFolders in $ALGoSettingsFile"
if (!$settings.doNotBuildTests) { Write-Host "No performance test apps found in bcptTestFolders in $ALGoSettingsFile" }
$settings.doNotRunBcptTests = $true
}
if (!$settings.doNotRunTests -and -not $settings.testFolders) {
if (!$doNotIssueWarnings) { OutputWarning -message "No test apps found in testFolders in $ALGoSettingsFile" }
if (-not ($doNotIssueWarnings -or $settings.doNotBuildTests)) { OutputWarning -message "No test apps found in testFolders in $ALGoSettingsFile" }
$settings.doNotRunTests = $true
}
if (-not $settings.appFolders) {
Expand Down Expand Up @@ -2120,7 +2119,7 @@ Function AnalyzeProjectDependencies {
Pop-Location
}

Write-Host "Folders containing apps are $($folders -join ',' )"
OutputMessageAndArray -Message "Folders containing apps" -arrayOfStrings $folders

$unknownDependencies = @()
$apps = @()
Expand Down Expand Up @@ -2383,6 +2382,7 @@ function RetryCommand {
try {
Invoke-Command $Command -ArgumentList $argumentList
if ($LASTEXITCODE -ne 0) {
$host.SetShouldExit(0);
throw "Command failed with exit code $LASTEXITCODE"
}
break
Expand Down Expand Up @@ -2438,6 +2438,22 @@ function GetProjectsFromRepository {
return @(GetMatchingProjects -projects $projects -selectProjects $selectProjects)
}

function GetFoldersFromAllProjects {
Param(
[string] $baseFolder
)

$settings = ReadSettings -baseFolder $baseFolder
$projects = GetProjectsFromRepository -baseFolder $baseFolder -projectsFromSettings $settings.projects
$folders = @()
foreach($project in $projects) {
$projectSettings = ReadSettings -project $project -baseFolder $baseFolder -silent
ResolveProjectFolders -baseFolder $baseFolder -project $project -projectSettings ([ref] $projectSettings)
$folders += @( @($projectSettings.appFolders) + @($projectSettings.testFolders) + @($projectSettings.bcptTestFolders) | ForEach-Object { Join-Path $project "$_".Substring(2) } )
}
return $folders
}

function GetPackageVersion($packageName) {
$alGoPackages = Get-Content -Path "$PSScriptRoot\Packages.json" | ConvertFrom-Json

Expand Down Expand Up @@ -2521,3 +2537,36 @@ function ConnectAz {
throw "Error trying to authenticate to Azure. Error was $($_.Exception.Message)"
}
}

function OutputMessageAndArray {
Param(
[string] $message,
[string[]] $arrayOfStrings
)
Write-Host "$($message):"
if (!$arrayOfStrings) {
Write-Host "- None"
}
else {
$arrayOfStrings | ForEach-Object {
Write-Host "- $_"
}
}
}

<#
.SYNOPSIS
Run an executable and check the exit code
.EXAMPLE
RunAndCheck git checkout -b xxx
#>
function RunAndCheck {
$ErrorActionPreference = 'SilentlyContinue'
$rest = if ($args.Count -gt 1) { $args[1..($args.Count - 1)] } else { $null }
& $args[0] $rest
$ErrorActionPreference = 'STOP'
if ($LASTEXITCODE -ne 0) {
$host.SetShouldExit(0)
throw "$($args[0]) $($rest | ForEach-Object { $_ }) failed with exit code $LASTEXITCODE"
}
}
32 changes: 25 additions & 7 deletions Actions/AL-Go-TestRepoHelper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ function Test-Shell {
}
}

function Test-Deprecations {
Param(
[HashTable] $json,
[string] $settingsDescription
)

# cleanModePreprocessorSymbols is deprecated
if ($json.Keys -contains 'cleanModePreprocessorSymbols') {
OutputWarning -Message "cleanModePreprocessorSymbols in $settingsDescription is deprecated. See https://aka.ms/algodeprecations#cleanModePreprocessorSymbols"
}

# <workflowName>Schedule is deprecated
($json.Keys | Where-Object {$_ -like '*Schedule' -and $_ -ne 'WorkflowSchedule'}) | ForEach-Object {
OutputWarning -Message "$_ in $settingsDescription is deprecated. See https://aka.ms/algodeprecations#_workflow_Schedule. This warning will become an error in the future."
}
}

function Test-SettingsJson {
Param(
[hashtable] $json,
Expand All @@ -51,6 +68,8 @@ function Test-SettingsJson {
[string] $type
)

Test-Deprecations -json $json -settingsDescription $settingsDescription

Test-Shell -json $json -settingsDescription $settingsDescription -property 'shell'
Test-Shell -json $json -settingsDescription $settingsDescription -property 'gitHubRunnerShell'

Expand All @@ -71,18 +90,17 @@ function Test-SettingsJson {
if ($type -eq 'Workflow') {
# Test for things that should / should not exist in a workflow settings file
}
else {
# workflowSchedule and workflowConcurrency should only exist in workflow specific settings files (or conditional settings - not tested)
Test-Property -settingsDescription $settingsDescription -json $json -key 'workflowSchedule' -maynot
Test-Property -settingsDescription $settingsDescription -json $json -key 'workflowConcurrency' -maynot
}
if ($type -eq 'Variable') {
# Test for things that should / should not exist in a settings variable
}
if ($type -eq 'Project' -or $type -eq 'Workflow') {
# templateUrl should not be in Project or Workflow settings
Test-Property -settingsDescription $settingsDescription -json $json -key 'templateUrl' -maynot

# schedules and runs-on should not be in Project or Workflow settings
# These properties are used in Update AL-Go System Files, hence they should only be in Repo settings
'nextMajorSchedule','nextMinorSchedule','currentSchedule','runs-on' | ForEach-Object {
Test-Property -settingsDescription $settingsDescription -json $json -key $_ -shouldnot
}
}
}

Expand All @@ -100,7 +118,7 @@ function Test-JsonStr {

try {
$json = $jsonStr | ConvertFrom-Json | ConvertTo-HashTable
Test-SettingsJson -json $json -settingsDescription $settingsDescription -type:$type
Test-SettingsJson -json $json -settingsDescription $settingsDescription -type $type
}
catch {
OutputError "$($_.Exception.Message.Replace("`r",'').Replace("`n",' ')) in $settingsDescription"
Expand Down
49 changes: 44 additions & 5 deletions Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -303,14 +303,53 @@ function GetWorkflowContentWithChangesFromSettings {

$baseName = [System.IO.Path]::GetFileNameWithoutExtension($srcFile)
$yaml = [Yaml]::Load($srcFile)
$workflowScheduleKey = "$($baseName)Schedule"
$yamlName = $yaml.get('name:')
if ($yamlName) {
$workflowName = $yamlName.content.SubString('name:'.Length).Trim().Trim('''"').Trim()
}
else {
$workflowName = $baseName
}

$workflowScheduleKey = "WorkflowSchedule"
$workflowConcurrencyKey = "WorkflowConcurrency"
foreach($key in @($workflowScheduleKey,$workflowConcurrencyKey)) {
if ($repoSettings.Keys -contains $key -and ($repoSettings."$key")) {
throw "The $key setting is not allowed in the global repository settings. Please use the workflow specific settings file or conditional settings."
}
}

# Any workflow (except for the PullRequestHandler and reusable workflows (_*)) can have a RepoSetting called <workflowname>Schedule, which will be used to set the schedule for the workflow
# Re-read settings and this time include workflow specific settings
$repoSettings = ReadSettings -buildMode '' -project '' -workflowName $workflowName -userName '' -branchName '' | ConvertTo-HashTable -recurse

# Old Schedule key is deprecated, but still supported
$oldWorkflowScheduleKey = "$($baseName)Schedule"
if ($repoSettings.Keys -contains $oldWorkflowScheduleKey) {
# DEPRECATION: REPLACE WITH ERROR AFTER October 1st 2025 --->
if ($repoSettings.Keys -contains $workflowScheduleKey) {
OutputWarning "Both $oldWorkflowScheduleKey and $workflowScheduleKey are defined in the settings file. $oldWorkflowScheduleKey will be ignored. This warning will become an error in the future"
}
else {
Trace-DeprecationWarning -Message "$oldWorkflowScheduleKey is deprecated" -DeprecationTag "_workflow_Schedule" -WillBecomeError
# Convert the old <workflow>Schedule setting to the new WorkflowSchedule setting
$repoSettings."$workflowScheduleKey" = @{ "cron" = $repoSettings."$oldWorkflowScheduleKey" }
}
# <--- REPLACE WITH ERROR AFTER October 1st 2025
}

# Any workflow (except for the PullRequestHandler and reusable workflows (_*)) can have concurrency and schedule defined
if ($baseName -ne "PullRequestHandler" -and $baseName -notlike '_*') {
# Add Schedule and Concurrency settings to the workflow
if ($repoSettings.Keys -contains $workflowScheduleKey) {
# Read the section under the on: key and add the schedule section
$yamlOn = $yaml.Get('on:/')
$yaml.Replace('on:/', $yamlOn.content+@('schedule:', " - cron: '$($repoSettings."$workflowScheduleKey")'"))
if ($repoSettings."$workflowScheduleKey" -isnot [hashtable] -or $repoSettings."$workflowScheduleKey".Keys -notcontains 'cron' -or $repoSettings."$workflowScheduleKey".cron -isnot [string]) {
throw "The $workflowScheduleKey setting must be a structure containing a cron property"
}
# Replace or add the schedule part under the on: key
$yaml.ReplaceOrAdd('on:/', 'schedule:', @("- cron: '$($repoSettings."$workflowScheduleKey".cron)'"))
}
if ($repoSettings.Keys -contains $workflowConcurrencyKey) {
# Replace or add the concurrency part
$yaml.ReplaceOrAdd('', 'concurrency:', $repoSettings."$workflowConcurrencyKey")
}
}

Expand Down
Loading
Loading