49 lines
1.2 KiB
PowerShell
49 lines
1.2 KiB
PowerShell
function Write-FailureStateFile() {
|
|
<#
|
|
.SYNOPSIS
|
|
Writes the current pipeline step into failure log.
|
|
|
|
.DESCRIPTION
|
|
This Cmdlet is used to mark single steps as failed without stopping the complete pipeline.
|
|
|
|
.PARAMETER StepName
|
|
The current DroneHelper step name which should be added into to the log.
|
|
|
|
.INPUTS
|
|
[None] No pipeline input.
|
|
|
|
.OUTPUTS
|
|
[None] No pipeline output.
|
|
|
|
.EXAMPLE
|
|
Write-FailureStateFile
|
|
#>
|
|
[CmdletBinding()]
|
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
|
|
'PSUseConsistentWhitespace',
|
|
'',
|
|
Justification = 'justification'
|
|
)]
|
|
param (
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$StepName
|
|
)
|
|
|
|
process {
|
|
$Repo = Get-RepoPath
|
|
$WriteParams = @{
|
|
FilePath = $Repo.FailureLogPath
|
|
Encoding = 'utf8'
|
|
NoClobber = $true
|
|
Force = $true
|
|
InputObject = $StepName
|
|
}
|
|
|
|
if ( Test-Path -Path $Repo.FailureLogPath ) {
|
|
$WriteParams.Append = $true
|
|
}
|
|
|
|
Out-File @WriteParams
|
|
}
|
|
}
|