From d2eeb557ca784212f912de4a9eacfe43bf84d38c Mon Sep 17 00:00:00 2001 From: Brett Hewitson Date: Fri, 23 Dec 2022 00:32:47 +1000 Subject: [PATCH] pipeline file changes --- .azure/pipelines/azure-pipelines-build.yml | 4 +- .azure/pipelines/azure-pipelines.yml | 81 ++++++++++++++++++---- 2 files changed, 70 insertions(+), 15 deletions(-) diff --git a/.azure/pipelines/azure-pipelines-build.yml b/.azure/pipelines/azure-pipelines-build.yml index d181df11..94736abb 100644 --- a/.azure/pipelines/azure-pipelines-build.yml +++ b/.azure/pipelines/azure-pipelines-build.yml @@ -24,7 +24,7 @@ stages: steps: - task: PowerShell@2 - displayName: Clean-up Agent Folders + displayName: Pre Clean-up Agent Folders env: BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory) BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory) @@ -254,7 +254,7 @@ stages: ArtifactName: '${{parameters.PublishFolder}}' - task: PowerShell@2 - displayName: Clean-up Agent Folders + displayName: Post Clean-up Agent Folders condition: always() env: BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory) diff --git a/.azure/pipelines/azure-pipelines.yml b/.azure/pipelines/azure-pipelines.yml index e757b82c..dd2669ee 100644 --- a/.azure/pipelines/azure-pipelines.yml +++ b/.azure/pipelines/azure-pipelines.yml @@ -54,18 +54,45 @@ stages: runOnce: deploy: steps: + - task: PowerShell@2 + displayName: Pre Clean-up Agent Folders + env: + BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory) + BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory) + BUILD_SOURCESDIRECTORY: $(Build.SourcesDirectory) + BUILD_PUBLISHDIRECTORY: "$(Build.BuildDirectory)/${{parameters.PublishFolder}}" + inputs: + targetType: inline + script: | + if (Test-Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY) { + Remove-Item -Path "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\*" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue + } + + if (Test-Path $env:BUILD_BINARIESDIRECTORY) { + Remove-Item -Path "$env:BUILD_BINARIESDIRECTORY\*" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue + } + + if (Test-Path $env:BUILD_SOURCESDIRECTORY) { + Remove-Item -Path "$env:BUILD_SOURCESDIRECTORY\*" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue + } + + if (Test-Path $env:BUILD_PUBLISHDIRECTORY) { + Remove-Item -Path "$env:BUILD_PUBLISHDIRECTORY" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue + } + pwsh: true + - checkout: GitHubRepo - task: PowerShell@2 displayName: Output Environment Variables - condition: contains(variables['system.debug'], 'true') + #condition: contains(variables['system.debug'], 'true') inputs: targetType: inline script: '(gci env:*).GetEnumerator() | Sort-Object Name | Out-String' pwsh: true - task: PowerShell@2 - displayName: Clean-up Agent Folders + displayName: Post Clean-up Agent Folders condition: always() env: BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory) @@ -108,18 +135,46 @@ stages: runOnce: deploy: steps: - - checkout: GitHubRepo - - - task: PowerShell@2 - displayName: Output Environment Variables - condition: contains(variables['system.debug'], 'true') - inputs: - targetType: inline - script: '(gci env:*).GetEnumerator() | Sort-Object Name | Out-String' - pwsh: true - - task: PowerShell@2 - displayName: Clean-up Agent Folders + displayName: Pre Clean-up Agent Folders + condition: always() + env: + BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory) + BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory) + BUILD_SOURCESDIRECTORY: $(Build.SourcesDirectory) + BUILD_PUBLISHDIRECTORY: "$(Build.BuildDirectory)/$(PublishFolder)" + inputs: + targetType: inline + script: | + if (Test-Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY) { + Remove-Item -Path "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\*" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue + } + + if (Test-Path $env:BUILD_BINARIESDIRECTORY) { + Remove-Item -Path "$env:BUILD_BINARIESDIRECTORY\*" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue + } + + if (Test-Path $env:BUILD_SOURCESDIRECTORY) { + Remove-Item -Path "$env:BUILD_SOURCESDIRECTORY\*" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue + } + + if (Test-Path $env:BUILD_PUBLISHDIRECTORY) { + Remove-Item -Path "$env:BUILD_PUBLISHDIRECTORY" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue + } + pwsh: true + + - checkout: GitHubRepo + + - task: PowerShell@2 + displayName: Output Environment Variables + #condition: contains(variables['system.debug'], 'true') + inputs: + targetType: inline + script: '(gci env:*).GetEnumerator() | Sort-Object Name | Out-String' + pwsh: true + + - task: PowerShell@2 + displayName: Post Clean-up Agent Folders condition: always() env: BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)