mirror of
https://github.com/tribufu/ServerManagers
synced 2026-06-01 09:42:39 +00:00
pipeline file cleanup
This commit is contained in:
parent
80738e7416
commit
227de2eb39
2 changed files with 42 additions and 169 deletions
|
|
@ -31,29 +31,6 @@ stages:
|
||||||
CleanPublishFolder: true
|
CleanPublishFolder: true
|
||||||
PublishFolder: ${{parameters.PublishFolder}}
|
PublishFolder: ${{parameters.PublishFolder}}
|
||||||
|
|
||||||
- task: PowerShell@2
|
|
||||||
displayName: Pre Clean-up Agent Folders
|
|
||||||
enabled: false
|
|
||||||
env:
|
|
||||||
BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
|
|
||||||
BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory)
|
|
||||||
BUILD_PUBLISHDIRECTORY: "$(Agent.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_PUBLISHDIRECTORY) {
|
|
||||||
Remove-Item -Path "$env:BUILD_PUBLISHDIRECTORY" -Filter '*.*' -Recurse -Force -ErrorAction SilentlyContinue
|
|
||||||
}
|
|
||||||
pwsh: true
|
|
||||||
|
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
displayName: Create AgentCapabilities Environment Variables
|
displayName: Create AgentCapabilities Environment Variables
|
||||||
env:
|
env:
|
||||||
|
|
@ -187,13 +164,12 @@ stages:
|
||||||
$appVersionShort = $appVersion.Substring(0, $appVersion.LastIndexOf('.'))
|
$appVersionShort = $appVersion.Substring(0, $appVersion.LastIndexOf('.'))
|
||||||
$appVersionWithUnderscores = $appVersion.Replace('.', '_')
|
$appVersionWithUnderscores = $appVersion.Replace('.', '_')
|
||||||
|
|
||||||
|
$iconFile = "$env:BUILD_SOURCESDIRECTORY/src/${{parameters.ApplicationName}}/Art/favicon.ico"
|
||||||
|
Copy-Item -Path "$iconFile" -Destination "$env:BUILD_BINARIESDIRECTORY/favicon.ico" -Force
|
||||||
|
|
||||||
$installScriptFile = ".azure/scripts/${{parameters.ApplicationName}}.iss"
|
$installScriptFile = ".azure/scripts/${{parameters.ApplicationName}}.iss"
|
||||||
$installTextFile = '.azure/scripts/Installer.txt'
|
$installTextFile = '.azure/scripts/Installer.txt'
|
||||||
|
|
||||||
$sourceIconFile = "$env:BUILD_SOURCESDIRECTORY/src/${{parameters.ApplicationName}}/Art/favicon.ico"
|
|
||||||
$destIconFile = "$env:BUILD_BINARIESDIRECTORY/favicon.ico"
|
|
||||||
Copy-Item -Path "$sourceIconFile" -Destination "$destIconFile" -Force
|
|
||||||
|
|
||||||
$installTextFileContent = @"
|
$installTextFileContent = @"
|
||||||
#define AppVer "$appVersionShort"
|
#define AppVer "$appVersionShort"
|
||||||
#define AppVerFull "$appVersion"
|
#define AppVerFull "$appVersion"
|
||||||
|
|
@ -206,12 +182,8 @@ stages:
|
||||||
|
|
||||||
& "$env:AGENTCAPABILITIES_USER_INNOSETUP" "$installScriptFile"
|
& "$env:AGENTCAPABILITIES_USER_INNOSETUP" "$installScriptFile"
|
||||||
|
|
||||||
$sourceFile = "$env:BUILD_BINARIESDIRECTORY/${{parameters.ApplicationName}}_$appVersionShort.exe"
|
$exeFile = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/${{parameters.ApplicationName}}_$appVersionShort.exe"
|
||||||
$destFile = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/${{parameters.ApplicationName}}_$appVersionShort.exe"
|
Copy-Item -Path $exeFile -Destination "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/latest.exe" -Force
|
||||||
Copy-Item -Path $sourceFile -Destination $destFile -Force
|
|
||||||
|
|
||||||
$destFile = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/latest.exe"
|
|
||||||
Copy-Item -Path $sourceFile -Destination $destFile -Force
|
|
||||||
pwsh: true
|
pwsh: true
|
||||||
|
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
|
|
@ -246,14 +218,13 @@ stages:
|
||||||
$applicationFolderName = "${{parameters.ApplicationName}}_$($appVersionWithUnderscores)"
|
$applicationFolderName = "${{parameters.ApplicationName}}_$($appVersionWithUnderscores)"
|
||||||
|
|
||||||
$sourcePath = "$env:BUILD_BINARIESDIRECTORY/Application Files/$applicationFolderName"
|
$sourcePath = "$env:BUILD_BINARIESDIRECTORY/Application Files/$applicationFolderName"
|
||||||
$zipFile1 = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/latest.zip"
|
$zipFile = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/${{parameters.ApplicationName}}_$($appVersionShort).zip"
|
||||||
$zipFile2 = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/${{parameters.ApplicationName}}_$($appVersionShort).zip"
|
|
||||||
|
|
||||||
Add-Type -Assembly System.IO.Compression.FileSystem
|
Add-Type -Assembly System.IO.Compression.FileSystem
|
||||||
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
|
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
|
||||||
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourcePath, $zipFile1, $compressionLevel, $false)
|
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourcePath, $zipFile, $compressionLevel, $false)
|
||||||
|
|
||||||
Copy-Item -Path "$zipFile1" -Destination "$zipFile2" -Force
|
Copy-Item -Path $zipFile -Destination "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/latest.zip" -Force
|
||||||
pwsh: true
|
pwsh: true
|
||||||
|
|
||||||
- task: PublishBuildArtifacts@1
|
- task: PublishBuildArtifacts@1
|
||||||
|
|
@ -263,35 +234,6 @@ stages:
|
||||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
||||||
ArtifactName: '${{parameters.PublishFolder}}'
|
ArtifactName: '${{parameters.PublishFolder}}'
|
||||||
|
|
||||||
- task: PowerShell@2
|
|
||||||
displayName: Post Clean-up Agent Folders
|
|
||||||
enabled: false
|
|
||||||
#condition: always()
|
|
||||||
env:
|
|
||||||
BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
|
|
||||||
BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory)
|
|
||||||
BUILD_SOURCESDIRECTORY: $(Build.SourcesDirectory)
|
|
||||||
BUILD_PUBLISHDIRECTORY: "$(Agent.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
|
|
||||||
|
|
||||||
- template: azure-pipelines-clean-agent.yml@self
|
- template: azure-pipelines-clean-agent.yml@self
|
||||||
parameters:
|
parameters:
|
||||||
CleanArtifactsFolder: true
|
CleanArtifactsFolder: true
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@ pool:
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
repositories:
|
repositories:
|
||||||
- repository: GitHubRepo
|
- repository: MasterRepo
|
||||||
type: github
|
type: $(Build.Repository.Provider)
|
||||||
endpoint: Bletch1971
|
endpoint: $(RepositoryEndPoint)
|
||||||
name: Bletch1971/ServerManagers
|
name: $(Build.Repository.Name)
|
||||||
ref: refs/heads/master
|
ref: refs/heads/master
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
|
|
@ -54,27 +54,13 @@ stages:
|
||||||
runOnce:
|
runOnce:
|
||||||
deploy:
|
deploy:
|
||||||
steps:
|
steps:
|
||||||
- task: PowerShell@2
|
- template: azure-pipelines-clean-agent.yml@self
|
||||||
displayName: Pre Clean-up Agent Folders
|
parameters:
|
||||||
env:
|
CleanArtifactsFolder: true
|
||||||
BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
|
CleanBinariesFolder: true
|
||||||
BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory)
|
CleanSourcesFolder: true
|
||||||
BUILD_SOURCESDIRECTORY: $(Build.SourcesDirectory)
|
CleanPublishFolder: false
|
||||||
inputs:
|
PublishFolder: ${{parameters.PublishFolder}}
|
||||||
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
|
|
||||||
}
|
|
||||||
pwsh: true
|
|
||||||
|
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
displayName: Output Environment Variables
|
displayName: Output Environment Variables
|
||||||
|
|
@ -84,35 +70,15 @@ stages:
|
||||||
script: '(gci env:*).GetEnumerator() | Sort-Object Name | Out-String'
|
script: '(gci env:*).GetEnumerator() | Sort-Object Name | Out-String'
|
||||||
pwsh: true
|
pwsh: true
|
||||||
|
|
||||||
- checkout: GitHubRepo
|
- checkout: MasterRepo
|
||||||
|
|
||||||
- task: PowerShell@2
|
- template: azure-pipelines-clean-agent.yml@self
|
||||||
displayName: Post Clean-up Agent Folders
|
parameters:
|
||||||
condition: always()
|
CleanArtifactsFolder: true
|
||||||
env:
|
CleanBinariesFolder: true
|
||||||
BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
|
CleanSourcesFolder: true
|
||||||
BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory)
|
CleanPublishFolder: true
|
||||||
BUILD_SOURCESDIRECTORY: $(Build.SourcesDirectory)
|
PublishFolder: ${{parameters.PublishFolder}}
|
||||||
BUILD_PUBLISHDIRECTORY: "$(Agent.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
|
|
||||||
|
|
||||||
- stage: deployRelease
|
- stage: deployRelease
|
||||||
displayName: Production
|
displayName: Production
|
||||||
|
|
@ -130,28 +96,13 @@ stages:
|
||||||
runOnce:
|
runOnce:
|
||||||
deploy:
|
deploy:
|
||||||
steps:
|
steps:
|
||||||
- task: PowerShell@2
|
- template: azure-pipelines-clean-agent.yml@self
|
||||||
displayName: Pre Clean-up Agent Folders
|
parameters:
|
||||||
condition: always()
|
CleanArtifactsFolder: true
|
||||||
env:
|
CleanBinariesFolder: true
|
||||||
BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
|
CleanSourcesFolder: true
|
||||||
BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory)
|
CleanPublishFolder: false
|
||||||
BUILD_SOURCESDIRECTORY: $(Build.SourcesDirectory)
|
PublishFolder: ${{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
|
|
||||||
}
|
|
||||||
pwsh: true
|
|
||||||
|
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
displayName: Output Environment Variables
|
displayName: Output Environment Variables
|
||||||
|
|
@ -161,32 +112,12 @@ stages:
|
||||||
script: '(gci env:*).GetEnumerator() | Sort-Object Name | Out-String'
|
script: '(gci env:*).GetEnumerator() | Sort-Object Name | Out-String'
|
||||||
pwsh: true
|
pwsh: true
|
||||||
|
|
||||||
- checkout: GitHubRepo
|
- checkout: MasterRepo
|
||||||
|
|
||||||
- task: PowerShell@2
|
- template: azure-pipelines-clean-agent.yml@self
|
||||||
displayName: Post Clean-up Agent Folders
|
parameters:
|
||||||
condition: always()
|
CleanArtifactsFolder: true
|
||||||
env:
|
CleanBinariesFolder: true
|
||||||
BUILD_ARTIFACTSTAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
|
CleanSourcesFolder: true
|
||||||
BUILD_BINARIESDIRECTORY: $(Build.BinariesDirectory)
|
CleanPublishFolder: true
|
||||||
BUILD_SOURCESDIRECTORY: $(Build.SourcesDirectory)
|
PublishFolder: ${{parameters.PublishFolder}}
|
||||||
BUILD_PUBLISHDIRECTORY: "$(Agent.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
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue