mirror of
https://github.com/tribufu/ServerManagers
synced 2026-06-01 09:42:39 +00:00
move cleanup to separate file
This commit is contained in:
parent
355df71a6a
commit
b4c21a583c
2 changed files with 28 additions and 3 deletions
|
|
@ -23,8 +23,17 @@ stages:
|
||||||
displayName: Build and Publish
|
displayName: Build and Publish
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- template: azure-pipelines-clean-agent.yml@self
|
||||||
|
parameters:
|
||||||
|
CleanArtifactsFolder: true
|
||||||
|
CleanBinariesFolder: true
|
||||||
|
CleanSourcesFolder: false
|
||||||
|
CleanPublishFolder: true
|
||||||
|
PublishFolder: ${{parameters.PublishFolder}}
|
||||||
|
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
displayName: Pre Clean-up Agent Folders
|
displayName: Pre Clean-up Agent Folders
|
||||||
|
enabled: false
|
||||||
env:
|
env:
|
||||||
BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
|
BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
|
||||||
BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory)
|
BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory)
|
||||||
|
|
@ -254,7 +263,8 @@ stages:
|
||||||
|
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
displayName: Post Clean-up Agent Folders
|
displayName: Post Clean-up Agent Folders
|
||||||
condition: always()
|
enabled: false
|
||||||
|
#condition: always()
|
||||||
env:
|
env:
|
||||||
BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
|
BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
|
||||||
BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory)
|
BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory)
|
||||||
|
|
@ -279,3 +289,11 @@ stages:
|
||||||
Remove-Item -Path "$env:BUILD_PUBLISHDIRECTORY" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path "$env:BUILD_PUBLISHDIRECTORY" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
pwsh: true
|
pwsh: true
|
||||||
|
|
||||||
|
- template: azure-pipelines-clean-agent.yml@self
|
||||||
|
parameters:
|
||||||
|
CleanArtifactsFolder: true
|
||||||
|
CleanBinariesFolder: true
|
||||||
|
CleanSourcesFolder: true
|
||||||
|
CleanPublishFolder: true
|
||||||
|
PublishFolder: ${{parameters.PublishFolder}}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,10 @@
|
||||||
parameters:
|
parameters:
|
||||||
|
- name: CleanArtifactsFolder
|
||||||
|
type: bool
|
||||||
|
default: true
|
||||||
|
- name: CleanBinariesFolder
|
||||||
|
type: bool
|
||||||
|
default: true
|
||||||
- name: CleanSourcesFolder
|
- name: CleanSourcesFolder
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
|
|
@ -21,6 +27,7 @@ stages:
|
||||||
steps:
|
steps:
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
displayName: Clean-up Agent Folders
|
displayName: Clean-up Agent Folders
|
||||||
|
condition: always()
|
||||||
env:
|
env:
|
||||||
BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
|
BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
|
||||||
BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory)
|
BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory)
|
||||||
|
|
@ -29,12 +36,12 @@ stages:
|
||||||
inputs:
|
inputs:
|
||||||
targetType: inline
|
targetType: inline
|
||||||
script: |
|
script: |
|
||||||
if (Test-Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
if (${{parameters.CleanArtifactsFolder}} -and Test-Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||||
Write-Host -ForegroundColor Cyan "Cleaning folder $env:BUILD_ARTIFACTSTAGINGDIRECTORY"
|
Write-Host -ForegroundColor Cyan "Cleaning folder $env:BUILD_ARTIFACTSTAGINGDIRECTORY"
|
||||||
Remove-Item -Path "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\*" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\*" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Test-Path $env:BUILD_BINARIESDIRECTORY) {
|
if (${{parameters.CleanBinariesFolder}} -and Test-Path $env:BUILD_BINARIESDIRECTORY) {
|
||||||
Write-Host -ForegroundColor Cyan "Cleaning folder $env:BUILD_BINARIESDIRECTORY"
|
Write-Host -ForegroundColor Cyan "Cleaning folder $env:BUILD_BINARIESDIRECTORY"
|
||||||
Remove-Item -Path "$env:BUILD_BINARIESDIRECTORY\*" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path "$env:BUILD_BINARIESDIRECTORY\*" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue