-
Notifications
You must be signed in to change notification settings - Fork 180
Give a warning before trying to publish symbols-only packages #1795
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
Open
aholstrup1
wants to merge
85
commits into
microsoft:main
Choose a base branch
from
aholstrup1:aholstrup/symbolspackage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
24c4c52
test
aholstrup1 0eb0a76
?
aholstrup1 9c7f8b4
installapps
aholstrup1 09e53bc
Update RunPipeline.ps1
aholstrup1 687d718
Update RunPipeline.ps1
aholstrup1 f2cf24d
Update RunPipeline.ps1
aholstrup1 9faedc2
Update RunPipeline.ps1
aholstrup1 6df6f34
Update RunPipeline.ps1
aholstrup1 c82b46a
Update RunPipeline.ps1
aholstrup1 7e7b46d
Update RunPipeline.ps1
aholstrup1 34911af
Update RunPipeline.ps1
aholstrup1 1074645
Refactor
aholstrup1 9944de5
Docs
aholstrup1 6924568
Merge branch 'microsoft:main' into aholstrup/symbolspackage
aholstrup1 30d9e77
Minor updates
aholstrup1 282f746
merge
aholstrup1 b15b339
Some updated docs
aholstrup1 072b03e
Fixes
aholstrup1 e50f890
Test
aholstrup1 e46aafa
test apps
aholstrup1 e21a2c0
fixes
aholstrup1 08f1363
Update RunPipeline.ps1
aholstrup1 e0baefb
Update RunPipeline.psm1
aholstrup1 c743f37
newer package
aholstrup1 919f056
update test
aholstrup1 653d30f
Update check
aholstrup1 a9233f8
Run in pwsh
aholstrup1 247cbee
Comment
aholstrup1 7c83581
Create tempDependenciesLocation
aholstrup1 7fb375f
merge
aholstrup1 358c354
Do not fail if file fails to download
aholstrup1 c081bd3
logging
aholstrup1 ef12a55
only filter out urls
aholstrup1 ad84033
Logging
aholstrup1 90e4464
test path
aholstrup1 0d1e268
Updates
aholstrup1 bc4f66e
docs
aholstrup1 399f95f
doc
aholstrup1 2fd11c6
Trace warning
aholstrup1 6cf06ef
Merge branch 'main' of https://github.com/microsoft/AL-Go into aholst…
aholstrup1 11b606b
Merge branch 'main' of https://github.com/microsoft/AL-Go into aholst…
aholstrup1 6880602
release note update
aholstrup1 5c1e835
suggestion
aholstrup1 d1a114b
Merge branch 'main' of https://github.com/microsoft/AL-Go into aholst…
aholstrup1 0c039c9
Suggestions
aholstrup1 7940041
Update Scenarios/settings.md
aholstrup1 df3d496
Merge branch 'main' into aholstrup/symbolspackage
mazhelez f234e63
Merge branch 'main' of https://github.com/microsoft/al-go into aholst…
aholstrup1 bf4a636
updates
aholstrup1 9c98d08
update IsSymbolsOnlyPackage
aholstrup1 e7dd1ee
$alExe
aholstrup1 640432c
remove powershell 7 call
aholstrup1 8582aa5
Merge branch 'main' of https://github.com/microsoft/al-go into aholst…
aholstrup1 4142b08
update Test-InstallApps
aholstrup1 d00775c
Handle linux / windows differences
aholstrup1 912c6fe
test
aholstrup1 0f08f62
Merge branch 'aholstrup/symbolspackage' of https://github.com/aholstr…
aholstrup1 0dc2823
-ExpandProperty
aholstrup1 3d50f4d
revert throw
aholstrup1 00162c0
throw on failed download
aholstrup1 12b68c1
allinstallapps
aholstrup1 b152674
Merge branch 'main' into aholstrup/symbolspackage
aholstrup1 f0b1d7c
Refactor
aholstrup1 d3838c9
Re-use if already installed on the same runner
aholstrup1 986b0e5
Remove runner temp folder
aholstrup1 c70a319
Update RunPipeline.ps1
aholstrup1 a3ee614
Fix
aholstrup1 5e11ead
logging
aholstrup1 91354b2
$installTestAppsJson
aholstrup1 8b5f873
fix
aholstrup1 8ff2932
Merge branch 'main' of https://github.com/aholstrup1/AL-Go into ahols…
aholstrup1 063f4f1
Update Install-DotNetTool function
aholstrup1 6d62f54
suggestions
aholstrup1 250a955
Use NewTemporaryFolder
aholstrup1 671ee82
Add telemetry to Test-InstallApps
aholstrup1 a98a365
Merge branch 'main' of https://github.com/microsoft/AL-Go into aholst…
aholstrup1 6c1d027
Revert
aholstrup1 48e781a
cleanup
aholstrup1 066e7f9
update release notes
aholstrup1 a267d44
Fix test
aholstrup1 16f78e1
Move logic to Get-AppFileFromUrl
aholstrup1 5e4e030
More actionable error
aholstrup1 d95484b
OUTPUTS
aholstrup1 61be1a5
thanks copilot
aholstrup1 9fd87bc
Merge branch 'main' into aholstrup/symbolspackage
mazhelez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| Import-Module (Join-Path $PSScriptRoot '..\TelemetryHelper.psm1' -Resolve) | ||
| . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve) | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Installs the AL tool. | ||
| .DESCRIPTION | ||
| Installs the AL tool from the Microsoft.Dynamics.BusinessCentral.Development.Tools package. | ||
| .RETURNS | ||
| The path to the al.exe tool. | ||
| #> | ||
| function Install-ALTool { | ||
| $alToolFolder = Install-DotNetTool -PackageName "Microsoft.Dynamics.BusinessCentral.Development.Tools" | ||
| # Load the AL tool from the downloaded package | ||
| $alExe = Get-ChildItem -Path $alToolFolder -Filter "al*" | Where-Object { $_.Name -eq "al" -or $_.Name -eq "al.exe" } | Select-Object -First 1 -ExpandProperty FullName | ||
| if (-not $alExe) { | ||
| throw "Could not find al.exe in the development tools package." | ||
| } | ||
| return $alExe | ||
| } | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Analyzes the install apps to check if they are symbols packages. | ||
| .DESCRIPTION | ||
| Analyzes the install apps to check if they are symbols packages. | ||
| If an app is a symbols package, it outputs a warning message. | ||
| .PARAMETER AllInstallApps | ||
| The list of all install apps to analyze. | ||
| .PARAMETER ProjectPath | ||
| The path to the project where the apps are located. | ||
| #> | ||
| function Test-InstallApps() { | ||
| Param( | ||
| [string[]] $AllInstallApps, | ||
| [string] $ProjectPath | ||
| ) | ||
|
|
||
| if ($AllInstallApps.Count -eq 0) { | ||
| Write-Host "No install apps to analyze." | ||
| return | ||
| } | ||
|
|
||
| try { | ||
| # Install the AL tool and get the path to al.exe | ||
| $alExe = Install-ALTool | ||
|
|
||
| $symbolsOnlyCount = 0 | ||
| foreach ($app in $AllInstallApps) { | ||
| if (Test-Path -Path $app) { | ||
| $appFilePath = (Get-Item -Path $app).FullName | ||
| } else { | ||
| $appFilePath = Join-Path $ProjectPath $app -Resolve -ErrorAction SilentlyContinue | ||
| } | ||
|
|
||
| if ($appFilePath) { | ||
| $appFile = Get-Item -Path $appFilePath | ||
| $appFileName = $appFile.Name | ||
| Write-Host "Analyzing app file $appFileName" | ||
| if (IsSymbolsOnlyPackage -AppFilePath $appFile -AlExePath $alExe) { | ||
| # If package is not a runtime package and has no source code files, it is a symbols package | ||
| # Symbols packages are not meant to be published to a BC Environment | ||
| $symbolsOnlyCount++ | ||
| OutputWarning -Message "App $appFileName is a symbols package and should not be published. The workflow may fail if you try to publish it." | ||
| } | ||
| } else { | ||
| Write-Host "App file path for $app could not be resolved. Skipping symbols check." | ||
| } | ||
| } | ||
|
|
||
| if ($symbolsOnlyCount -gt 0) { | ||
| Trace-Warning -Message "$symbolsOnlyCount symbols-only package(s) detected in install apps. These packages should not be published." | ||
| } | ||
| } | ||
| catch { | ||
| Trace-Warning -Message "Something went wrong while analyzing install apps." | ||
| OutputDebug -message "Error: $_" | ||
| } | ||
| } | ||
|
|
||
| function IsSymbolsOnlyPackage { | ||
| param( | ||
| [string] $AppFilePath, | ||
| [string] $AlExePath | ||
| ) | ||
| . $AlExePath IsSymbolOnly $AppFilePath | Out-Null | ||
| return $LASTEXITCODE -eq 0 | ||
| } | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Downloads an app file from a URL to a specified download path. | ||
| .DESCRIPTION | ||
| Downloads an app file from a URL to a specified download path. | ||
| It handles URL decoding and sanitizes the file name. | ||
| .PARAMETER Url | ||
| The URL of the app file to download. | ||
| .PARAMETER DownloadPath | ||
| The path where the app file should be downloaded. | ||
| .OUTPUTS | ||
| The path to the downloaded app file. | ||
| #> | ||
| function Get-AppFileFromUrl { | ||
|
||
| Param( | ||
| [string] $Url, | ||
| [string] $DownloadPath | ||
| ) | ||
| # Get the file name from the URL | ||
| $urlWithoutQuery = $Url.Split('?')[0].TrimEnd('/') | ||
| $rawFileName = [System.IO.Path]::GetFileName($urlWithoutQuery) | ||
| $decodedFileName = [Uri]::UnescapeDataString($rawFileName) | ||
| $decodedFileName = [System.IO.Path]::GetFileName($decodedFileName) | ||
|
|
||
| # Sanitize file name by removing invalid characters | ||
| $sanitizedFileName = $decodedFileName.Split([System.IO.Path]::getInvalidFileNameChars()) -join "" | ||
| $sanitizedFileName = $sanitizedFileName.Trim() | ||
|
|
||
| # Get the final app file path | ||
| $appFile = Join-Path $DownloadPath $sanitizedFileName | ||
| Invoke-WebRequest -Method GET -UseBasicParsing -Uri $Url -OutFile $appFile -MaximumRetryCount 3 -RetryIntervalSec 5 | Out-Null | ||
aholstrup1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return $appFile | ||
| } | ||
|
|
||
| Export-ModuleMember -Function Test-InstallApps, Get-AppFileFromUrl | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.