Коммит
b453504193
|
@ -636,7 +636,12 @@ try {
|
|||
|
||||
$devOpsResult = ""
|
||||
if ($result) {
|
||||
$devOpsResult = Convert-ALCOutputToAzureDevOps -FailOn $FailOn -AlcOutput $result -DoNotWriteToHost -gitHubActions:$gitHubActions
|
||||
if ($gitHubActions) {
|
||||
$devOpsResult = Convert-ALCOutputToAzureDevOps -FailOn $FailOn -AlcOutput $result -DoNotWriteToHost -gitHubActions -basePath (Get-BcContainerPath -containerName $containerName -path $ENV:GITHUB_WORKSPACE)
|
||||
}
|
||||
else {
|
||||
$devOpsResult = Convert-ALCOutputToAzureDevOps -FailOn $FailOn -AlcOutput $result -DoNotWriteToHost
|
||||
}
|
||||
}
|
||||
if ($AzureDevOps -or $gitHubActions) {
|
||||
$devOpsResult | ForEach-Object { $outputTo.Invoke($_) }
|
||||
|
|
|
@ -8,8 +8,12 @@
|
|||
One or more lines of outout from the AL Compiler
|
||||
.Parameter Failon
|
||||
Specify if you want the AzureDevOps output to fail on Error or Warning
|
||||
.Parameter GitHubActions
|
||||
Include this switch, if you are running GitHub Actions
|
||||
.Parameter DoNotWriteToHost
|
||||
Include this switch to return the converted result instead of outputting the result to the Host
|
||||
.Parameter basePath
|
||||
Base Path of the files in the ALC output, to convert file paths to relative paths
|
||||
.Example
|
||||
Compile-AppInBcContainer -containerName test -credential $credential -appProjectFolder "C:\Users\freddyk\Documents\AL\Test" -AzureDevOps
|
||||
.Example
|
||||
|
@ -25,12 +29,15 @@ Function Convert-AlcOutputToDevOps {
|
|||
[ValidateSet('none','error','warning')]
|
||||
[string] $FailOn,
|
||||
[switch] $gitHubActions,
|
||||
[switch] $doNotWriteToHost
|
||||
[switch] $doNotWriteToHost,
|
||||
[string] $basePath = ''
|
||||
)
|
||||
|
||||
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
|
||||
try {
|
||||
|
||||
if ($basePath) {
|
||||
$basePath = "$($basePath.TrimEnd('\'))\"
|
||||
}
|
||||
$hasError = $false
|
||||
$hasWarning = $false
|
||||
|
||||
|
@ -38,11 +45,15 @@ try {
|
|||
switch -regex ($line) {
|
||||
"^warning (\w{2}\d{4}):(.*('.*').*|.*)$" {
|
||||
if ($null -ne $Matches[3]) {
|
||||
$file = $Matches[3]
|
||||
if ($file -like "$($basePath)*") {
|
||||
$file = ".\$($file.SubString($basePath.Length))".Replace('\','/')
|
||||
}
|
||||
if ($gitHubActions) {
|
||||
$newLine = "::warning file=$($Matches[3])::code=$($Matches[1]) $($Matches[2])"
|
||||
$newLine = "::warning file=$($file)::code=$($Matches[1]) $($Matches[2])"
|
||||
}
|
||||
else {
|
||||
$newLine = "##vso[task.logissue type=warning;sourcepath=$($Matches[3]);$($Matches[1]);]$($Matches[2])"
|
||||
$newLine = "##vso[task.logissue type=warning;sourcepath=$($file);$($Matches[1]);]$($Matches[2])"
|
||||
}
|
||||
} else {
|
||||
if ($gitHubActions) {
|
||||
|
@ -59,11 +70,15 @@ try {
|
|||
"^(.*)\((\d+),(\d+)\): error (\w{2,3}\d{4}): (.*)$"
|
||||
#Objects\codeunit\Cod50130.name.al(62,30): error AL0118: The name '"Parent Object"' does not exist in the current context
|
||||
{
|
||||
$file = $Matches[1]
|
||||
if ($file -like "$($basePath)*") {
|
||||
$file = ".\$($file.SubString($basePath.Length))".Replace('\','/')
|
||||
}
|
||||
if ($gitHubActions) {
|
||||
$newLine = "::error file=$($Matches[1]),line=$($Matches[2]),col=$($Matches[3])::$($Matches[4]) $($Matches[5])"
|
||||
$newLine = "::error file=$($file),line=$($Matches[2]),col=$($Matches[3])::$($Matches[4]) $($Matches[5])"
|
||||
}
|
||||
else {
|
||||
$newLine = "##vso[task.logissue type=error;sourcepath=$($Matches[1]);linenumber=$($Matches[2]);columnnumber=$($Matches[3]);code=$($Matches[4]);]$($Matches[5])"
|
||||
$newLine = "##vso[task.logissue type=error;sourcepath=$($file);linenumber=$($Matches[2]);columnnumber=$($Matches[3]);code=$($Matches[4]);]$($Matches[5])"
|
||||
}
|
||||
$hasError = $true
|
||||
break
|
||||
|
@ -84,11 +99,15 @@ try {
|
|||
#Prepared for unified warning format
|
||||
#Objects\codeunit\Cod50130.name.al(62,30): warning AL0118: The name '"Parent Object"' does not exist in the current context
|
||||
{
|
||||
$file = $Matches[1]
|
||||
if ($file -like "$($basePath)*") {
|
||||
$file = ".\$($file.SubString($basePath.Length))".Replace('\','/')
|
||||
}
|
||||
if ($gitHubActions) {
|
||||
$newLine = "::warning file=$($Matches[1]),line=$($Matches[2]),col=$($Matches[3])::$($Matches[4]) $($Matches[5])"
|
||||
$newLine = "::warning file=$($file),line=$($Matches[2]),col=$($Matches[3])::$($Matches[4]) $($Matches[5])"
|
||||
}
|
||||
else {
|
||||
$newLine = "##vso[task.logissue type=warning;sourcepath=$($Matches[1]);linenumber=$($Matches[2]);columnnumber=$($Matches[3]);code=$($Matches[4]);]$($Matches[5])"
|
||||
$newLine = "##vso[task.logissue type=warning;sourcepath=$($file);linenumber=$($Matches[2]);columnnumber=$($Matches[3]);code=$($Matches[4]);]$($Matches[5])"
|
||||
}
|
||||
$hasWarning = $true
|
||||
break
|
||||
|
@ -107,7 +126,13 @@ try {
|
|||
}
|
||||
|
||||
$errLine = ""
|
||||
if (-not $gitHubActions) {
|
||||
if ($gitHubActions) {
|
||||
if ($FailOn -eq 'warning' -and $hasWarning) {
|
||||
$errLine = "::Error::Failing build as warnings exists"
|
||||
$host.SetShouldExit(1)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (($FailOn -eq 'error' -and $hasError) -or ($FailOn -eq 'warning' -and ($hasError -or $hasWarning))) {
|
||||
$errLine = "##vso[task.complete result=Failed;]Failed."
|
||||
}
|
||||
|
@ -132,5 +157,5 @@ finally {
|
|||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
}
|
||||
Set-Alias -Name Convert-AlcOutputToAzureDevOps -Value Convert-AlcOutputToDevOps
|
||||
Export-ModuleMember -Function Convert-AlcOutputToDevOps -Alias Convert-AlcOutputToAzureDevOps
|
||||
Set-Alias -Name Convert-AlcOutputToAzureDevOps -Value Convert-AlcOutputToDevOps
|
||||
Export-ModuleMember -Function Convert-AlcOutputToDevOps -Alias Convert-AlcOutputToAzureDevOps
|
||||
|
|
|
@ -521,17 +521,17 @@ Write-Host -ForegroundColor Yellow @'
|
|||
|_| \__,_|_| \__,_|_| |_| |_|\___|\__\___|_| |___/
|
||||
|
||||
'@
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Pipeline name "; Write-Host $pipelineName
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Container name "; Write-Host $containerName
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Image name "; Write-Host $imageName
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "ArtifactUrl "; Write-Host $artifactUrl.Split('?')[0]
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "SasToken "; if ($artifactUrl.Contains('?')) { Write-Host "Specified" } else { Write-Host "Not Specified" }
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "BcAuthContext "; if ($bcauthcontext) { Write-Host "Specified" } else { Write-Host "Not Specified" }
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Environment "; Write-Host $environment
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "ReUseContainer "; Write-Host $reUseContainer
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "KeepContainer "; Write-Host $keepContainer
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Auth "; Write-Host $auth
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Credential ";
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Pipeline name "; Write-Host $pipelineName
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Container name "; Write-Host $containerName
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Image name "; Write-Host $imageName
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "ArtifactUrl "; Write-Host $artifactUrl.Split('?')[0]
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "SasToken "; if ($artifactUrl.Contains('?')) { Write-Host "Specified" } else { Write-Host "Not Specified" }
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "BcAuthContext "; if ($bcauthcontext) { Write-Host "Specified" } else { Write-Host "Not Specified" }
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Environment "; Write-Host $environment
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "ReUseContainer "; Write-Host $reUseContainer
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "KeepContainer "; Write-Host $keepContainer
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Auth "; Write-Host $auth
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Credential ";
|
||||
if ($credential) {
|
||||
Write-Host "Specified"
|
||||
}
|
||||
|
@ -542,6 +542,8 @@ else {
|
|||
}
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "CompanyName "; Write-Host $companyName
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "MemoryLimit "; Write-Host $memoryLimit
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "FailOn "; Write-Host $failOn
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "TreatTestFailuresAsWarnings "; Write-Host $treatTestFailuresAsWarnings
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Enable Task Scheduler "; Write-Host $enableTaskScheduler
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Assign Premium Plan "; Write-Host $assignPremiumPlan
|
||||
Write-Host -NoNewLine -ForegroundColor Yellow "Install Test Runner "; Write-Host $installTestRunner
|
||||
|
|
Загрузка…
Ссылка в новой задаче