Skip to content

Commit

Permalink
Align to use Write-Output
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius authored and Marius committed Feb 6, 2022
1 parent 22664ed commit 9a1a678
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 73 deletions.
36 changes: 18 additions & 18 deletions .azuredevops/pipelineTemplates/jobs.publishModule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
targetType: inline
pwsh: true
script: |
Write-Host "##[group]Setup agent"
Write-Output "##[group]Setup agent"
# Load used functions
. (Join-Path '$(System.DefaultWorkingDirectory)' 'utilities' 'pipelines' 'sharedScripts' 'Set-EnvironmentOnAgent.ps1')
Expand All @@ -121,7 +121,7 @@ jobs:
# Set agent up
Set-EnvironmentOnAgent -PSModules $Modules
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# [Multi Repo] Support task
#--------------------------
Expand All @@ -131,7 +131,7 @@ jobs:
targetType: inline
pwsh: true
script: |
Write-Host "##[group]Handle Multi-Repo Invocation"
Write-Output "##[group]Handle Multi-Repo Invocation"
# ---------------------------- #
# HANDLE MULTI-REPO INVOCATION #
Expand All @@ -145,9 +145,9 @@ jobs:
Write-Verbose "No Multi-Repo Checkout" -Verbose
$modulePath = Join-Path '$(System.DefaultWorkingDirectory)' '${{ parameters.modulePath }}'
}
Write-Host "##vso[task.setvariable variable=ENVMODULEPATH]$modulePath"
Write-Output "##vso[task.setvariable variable=ENVMODULEPATH]$modulePath"
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# [Universal Artifact-feed publish] task(s)
#------------------------------------------
Expand All @@ -162,7 +162,7 @@ jobs:
targetType: inline
pwsh: true
script: |
Write-Host "##[group]Publish module to artifacts feed"
Write-Output "##[group]Publish module to artifacts feed"
# Load used functions
. (Join-Path '$(System.DefaultWorkingDirectory)' '$(pipelineFunctionsPath)' 'resourcePublish' 'Get-ModulesToUpdate.ps1')
Expand All @@ -184,11 +184,11 @@ jobs:
# Get the modified child resources
$ModulesToUpdate = Get-ModulesToUpdate @functionInput -Verbose
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# Publish the modified child resources
foreach ($ModuleToUpdate in $ModulesToUpdate) {
Write-Host "##[group]- $($ModuleToUpdate.TemplateFilePath)"
Write-Output "##[group]- $($ModuleToUpdate.TemplateFilePath)"
$functionInput = @{
TemplateFilePath = $ModuleToUpdate.TemplateFilePath
Expand All @@ -204,7 +204,7 @@ jobs:
Publish-ModuleToUniversalArtifactFeed @functionInput -Verbose
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
}
env:
TOKEN: $(vstsFeedToken)
Expand All @@ -225,7 +225,7 @@ jobs:
pwsh: true
ScriptType: InlineScript
inline: |
Write-Host "##[group]Publish module to template specs"
Write-Output "##[group]Publish module to template specs"
# Load used functions
. (Join-Path '$(System.DefaultWorkingDirectory)' '$(pipelineFunctionsPath)' 'resourcePublish' 'Get-ModulesToUpdate.ps1')
Expand All @@ -247,11 +247,11 @@ jobs:
# Get the modified child resources
$ModulesToUpdate = Get-ModulesToUpdate @functionInput -Verbose
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# Publish the modified child resources
foreach ($ModuleToUpdate in $ModulesToUpdate) {
Write-Host "##[group]- $($ModuleToUpdate.TemplateFilePath)"
Write-Output "##[group]- $($ModuleToUpdate.TemplateFilePath)"
$functionInput = @{
TemplateFilePath = $ModuleToUpdate.TemplateFilePath
Expand All @@ -266,7 +266,7 @@ jobs:
Publish-ModuleToTemplateSpec @functionInput -Verbose
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
}
# [private bicep registry publish] task(s)
Expand All @@ -285,7 +285,7 @@ jobs:
pwsh: true
ScriptType: InlineScript
inline: |
Write-Host "##[group]Publish module to private bicep registry"
Write-Output "##[group]Publish module to private bicep registry"
# Load used functions
. (Join-Path '$(System.DefaultWorkingDirectory)' '$(pipelineFunctionsPath)' 'resourcePublish' 'Get-ModulesToUpdate.ps1')
Expand All @@ -307,11 +307,11 @@ jobs:
# Get the modified child resources
$ModulesToUpdate = Get-ModulesToUpdate @functionInput -Verbose
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# Publish the modified child resources
foreach ($ModuleToUpdate in $ModulesToUpdate) {
Write-Host "##[group]- $($ModuleToUpdate.TemplateFilePath)"
Write-Output "##[group]- $($ModuleToUpdate.TemplateFilePath)"
$functionInput = @{
TemplateFilePath = $ModuleToUpdate.TemplateFilePath
Expand All @@ -325,6 +325,6 @@ jobs:
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
Publish-ModuleToPrivateBicepRegistry @functionInput -Verbose
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
}
28 changes: 14 additions & 14 deletions .azuredevops/pipelineTemplates/jobs.validateModuleDeployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
targetType: inline
pwsh: true
script: |
Write-Host "##[group]Setup agent"
Write-Output "##[group]Setup agent"
# Load used functions
. (Join-Path '$(System.DefaultWorkingDirectory)' 'utilities' 'pipelines' 'sharedScripts' 'Set-EnvironmentOnAgent.ps1')
Expand All @@ -131,7 +131,7 @@ jobs:
# Set agent up
Set-EnvironmentOnAgent -PSModules $Modules
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# [Multi Repo] Support task
#--------------------------
Expand All @@ -141,7 +141,7 @@ jobs:
targetType: inline
pwsh: true
script: |
Write-Host "##[group]Handle Multi-Repo Invocation"
Write-Output "##[group]Handle Multi-Repo Invocation"
# Handle multiple-repositories
if( "${{ join(';',parameters.checkoutRepositories) }}".length -gt 0) {
Expand All @@ -153,10 +153,10 @@ jobs:
$moduleRepoRoot = '$(System.DefaultWorkingDirectory)'
$parametersRepoRoot = '$(System.DefaultWorkingDirectory)'
}
Write-Host "##vso[task.setvariable variable=ModuleRepoRoot]$moduleRepoRoot"
Write-Host "##vso[task.setvariable variable=parametersRepoRoot]$parametersRepoRoot"
Write-Output "##vso[task.setvariable variable=ModuleRepoRoot]$moduleRepoRoot"
Write-Output "##vso[task.setvariable variable=parametersRepoRoot]$parametersRepoRoot"
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# [Agent] Replace tokens
#-----------------------
Expand All @@ -169,7 +169,7 @@ jobs:
ScriptType: InlineScript
pwsh: true
inline: |
Write-Host "##[group]Replace Tokens [${{ deploymentBlock.path }}] via connection [${{ parameters.serviceConnection }}]"
Write-Output "##[group]Replace Tokens [${{ deploymentBlock.path }}] via connection [${{ parameters.serviceConnection }}]"
# Load used functions
. (Join-Path '$(moduleRepoRoot)' 'utilities' 'pipelines' 'tokensReplacement' 'Convert-TokensInParameterFile.ps1')
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:
# Invoke Token Replacement Functionality
$null = Convert-TokensInParameterFile @ConvertTokensInputs -Verbose
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# [Validation] task(s)
#---------------------
Expand All @@ -215,7 +215,7 @@ jobs:
ScriptType: InlineScript
pwsh: true
inline: |
Write-Host "##[group]Validate [${{ deploymentBlock.path }}] via connection [${{ parameters.serviceConnection }}]"
Write-Output "##[group]Validate [${{ deploymentBlock.path }}] via connection [${{ parameters.serviceConnection }}]"
# Load used functions
. (Join-Path '$(moduleRepoRoot)' '$(pipelineFunctionsPath)' 'resourceValidation' 'Test-TemplateWithParameterFile.ps1')
Expand Down Expand Up @@ -246,7 +246,7 @@ jobs:
Test-TemplateWithParameterFile @functionInput -Verbose
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# [Deployment] task(s)
#---------------------
Expand All @@ -260,7 +260,7 @@ jobs:
pwsh: true
ScriptType: InlineScript
inline: |
Write-Host "##[group]Deploy [${{ deploymentBlock.path }}] via connection [${{ parameters.serviceConnection }}]"
Write-Output "##[group]Deploy [${{ deploymentBlock.path }}] via connection [${{ parameters.serviceConnection }}]"
# Load used functions
. (Join-Path '$(moduleRepoRoot)' '$(pipelineFunctionsPath)' 'resourceDeployment' 'New-ModuleDeployment.ps1')
Expand Down Expand Up @@ -313,7 +313,7 @@ jobs:
throw $res.exception
}
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# [Removal] task(s)
#------------------
Expand All @@ -328,7 +328,7 @@ jobs:
failOnStandardError: false
pwsh: true
inline: |
Write-Host "##[group]Remove deployed resources via [${{ parameters.serviceConnection }}]"
Write-Output "##[group]Remove deployed resources via [${{ parameters.serviceConnection }}]"
# Load used function
. (Join-Path '$(moduleRepoRoot)' '$(pipelineFunctionsPath)' 'resourceRemoval' 'Initialize-DeploymentRemoval.ps1')
Expand Down Expand Up @@ -357,4 +357,4 @@ jobs:
Initialize-DeploymentRemoval @functionInput
}
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
32 changes: 16 additions & 16 deletions .azuredevops/pipelineTemplates/jobs.validateModulePester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
targetType: inline
pwsh: true
script: |
Write-Host "##[group]Handle Multi-Repo Invocation"
Write-Output "##[group]Handle Multi-Repo Invocation"
# Handle multiple-repositories
if( "${{ join(';',parameters.checkoutRepositories) }}".length -gt 0) {
Expand All @@ -103,10 +103,10 @@ jobs:
$moduleRepoRoot = '$(System.DefaultWorkingDirectory)'
$parametersRepoRoot = '$(System.DefaultWorkingDirectory)'
}
Write-Host "##vso[task.setvariable variable=ModuleRepoRoot]$moduleRepoRoot"
Write-Host "##vso[task.setvariable variable=ParametersRepoRoot]$parametersRepoRoot"
Write-Output "##vso[task.setvariable variable=ModuleRepoRoot]$moduleRepoRoot"
Write-Output "##vso[task.setvariable variable=ParametersRepoRoot]$parametersRepoRoot"
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# [Agent] Prepare environment
#----------------------------
Expand All @@ -116,7 +116,7 @@ jobs:
targetType: inline
pwsh: true
script: |
Write-Host "##[group]Setup agent"
Write-Output "##[group]Setup agent"
# Load used functions
. (Join-Path '$(moduleRepoRoot)' 'utilities' 'pipelines' 'sharedScripts' 'Set-EnvironmentOnAgent.ps1')
Expand All @@ -131,7 +131,7 @@ jobs:
# Set agent up
Set-EnvironmentOnAgent -PSModules $Modules
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# [Module Pester Test] task(s)
#-----------------------------
Expand All @@ -144,7 +144,7 @@ jobs:
ScriptType: InlineScript
pwsh: true
inline: |
Write-Host "##[group]Run general tests via (Pester) via connection [${{ parameters.serviceConnection }}]"
Write-Output "##[group]Run general tests via (Pester) via connection [${{ parameters.serviceConnection }}]"
$moduleFolderPaths = @(Join-Path '$(moduleRepoRoot)' '${{ parameters.modulePath }}')
$moduleFolderPaths += (Get-ChildItem $moduleFolderPaths -Recurse -Directory -Force).FullName | Where-Object {
Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:
}
} -ErrorAction 'Stop'
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
errorActionPreference: continue

- task: PublishTestResults@2
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
targetType: inline
pwsh: true
script: |
Write-Host "##[group]Handle Multi-Repo Invocation"
Write-Output "##[group]Handle Multi-Repo Invocation"
# Handle multiple-repositories
if( "${{ join(';',parameters.checkoutRepositories) }}".length -gt 0) {
Expand All @@ -227,10 +227,10 @@ jobs:
$moduleRepoRoot = '$(System.DefaultWorkingDirectory)'
$parametersRepoRoot = '$(System.DefaultWorkingDirectory)'
}
Write-Host "##vso[task.setvariable variable=ModuleRepoRoot]$moduleRepoRoot"
Write-Host "##vso[task.setvariable variable=ParametersRepoRoot]$parametersRepoRoot"
Write-Output "##vso[task.setvariable variable=ModuleRepoRoot]$moduleRepoRoot"
Write-Output "##vso[task.setvariable variable=ParametersRepoRoot]$parametersRepoRoot"
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# [Agent] Prepare environment
#----------------------------
Expand All @@ -240,15 +240,15 @@ jobs:
targetType: inline
pwsh: true
script: |
Write-Host "##[group]Setup agent"
Write-Output "##[group]Setup agent"
# Load used functions
. (Join-Path '$(moduleRepoRoot)' 'utilities' 'pipelines' 'sharedScripts' 'Set-EnvironmentOnAgent.ps1')
# Set agent up
Set-EnvironmentOnAgent
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
# [Module Pester Test] task(s)
#-----------------------------
Expand All @@ -261,7 +261,7 @@ jobs:
ScriptType: InlineScript
pwsh: true
inline: |
Write-Host "##[group]Run API tests via (Pester) via connection [${{ parameters.serviceConnection }}]"
Write-Output "##[group]Run API tests via (Pester) via connection [${{ parameters.serviceConnection }}]"
$moduleFolderPaths = @(Join-Path '$(moduleRepoRoot)' '${{ parameters.modulePath }}')
$moduleFolderPaths += (Get-ChildItem $moduleFolderPaths -Recurse -Directory -Force).FullName | Where-Object {
Expand Down Expand Up @@ -292,7 +292,7 @@ jobs:
}
} -ErrorAction 'Stop'
Write-Host "##[endgroup]"
Write-Output "##[endgroup]"
errorActionPreference: continue

- task: PublishTestResults@2
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/templates/getWorkflowInput/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ runs:
id: get-input-param-action
run: |
# Get workflow input parameters
Write-Host "::group::Get workflow input parameters"
Write-Output "::group::Get workflow input parameters"
Write-Verbose "The workflow trigger is: ${{ github.event_name }}" -Verbose
Expand All @@ -44,7 +44,7 @@ runs:
}
# Output values to be accessed by next jobs
Write-Host "::set-output name=removeDeployment::$removeDeployment"
Write-Output "::set-output name=removeDeployment::$removeDeployment"
Write-Host "::endgroup::"
Write-Output "::endgroup::"
shell: pwsh
Loading

0 comments on commit 9a1a678

Please sign in to comment.