diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index 68a2700..d6d68b5 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -40,14 +40,7 @@ stages: variables: ToolVersions: $[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] steps: - - pwsh: | - $NewVersions = "$(ToolVersions)" - if ($NewVersions) { - Write-Host "The following versions were found: $NewVersions" - } else { - throw "No new versions were found" - } - displayName: Check versions + - template: /azure-pipelines/templates/check-versions.yml - stage: Trigger_Builds dependsOn: Check_New_Versions diff --git a/azure-pipelines/templates/check-versions.yml b/azure-pipelines/templates/check-versions.yml new file mode 100644 index 0000000..6cf8969 --- /dev/null +++ b/azure-pipelines/templates/check-versions.yml @@ -0,0 +1,41 @@ +steps: +- task: PowerShell@2 + displayName: Check Versions + condition: and(succeeded(), eq(variables.ToolVersions, '')) + inputs: + TargetType: inline + script: | + throw "No new versions were found" + +- task: PowerShell@2 + displayName: 'Set PIPELINE_URL variable' + inputs: + TargetType: inline + script: | + $ToolName = "$(TOOL_NAME)" + if ($ToolName -eq "Python") { + $PipelineUrl = " " + } else { + $PipelineUrl = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)" + } + Write-Host "##vso[task.setvariable variable=PIPELINE_URL]$PipelineUrl" + +- task: PowerShell@2 + displayName: 'Change build name' + inputs: + TargetType: inline + script: | + $newBuildName = "[FOUND] $(Build.BuildNumber)" + Write-Host "##vso[build.updatebuildnumber]$newBuildName" + +- task: PowerShell@2 + displayName: 'Send Slack notification' + inputs: + targetType: filePath + filePath: './get-new-tool-versions/send-slack-notification.ps1' + arguments: | + -Url "$(SLACK_CHANNEL_URL)" ` + -ToolName "$(TOOL_NAME)" ` + -ToolVersion "$(ToolVersions)" ` + -PipelineUrl "$(PIPELINE_URL)" ` + -ImageUrl "$(IMAGE_URL)" \ No newline at end of file diff --git a/azure-pipelines/templates/get-tool-versions-steps.yml b/azure-pipelines/templates/get-tool-versions-steps.yml index a383931..487e93e 100644 --- a/azure-pipelines/templates/get-tool-versions-steps.yml +++ b/azure-pipelines/templates/get-tool-versions-steps.yml @@ -6,39 +6,4 @@ steps: targetType: filePath filePath: './get-new-tool-versions/get-new-tool-versions.ps1' arguments: | - -ToolName "$(TOOL_NAME)" - -- task: PowerShell@2 - displayName: 'Set PIPELINE_URL variable' - inputs: - TargetType: inline - script: | - $ToolName = "$(TOOL_NAME)" - if ($ToolName -eq "Python") { - $PipelineUrl = " " - } else { - $PipelineUrl = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)" - } - Write-Host "##vso[task.setvariable variable=PIPELINE_URL]$PipelineUrl" - -- task: PowerShell@2 - displayName: 'Change build name' - #condition: and(succeeded(), ne(variables['Get_versions.TOOL_VERSIONS'], '')) - inputs: - TargetType: inline - script: | - $newBuildName = "[FOUND] $(Build.BuildNumber)" - Write-Host "##vso[build.updatebuildnumber]$newBuildName" - -- task: PowerShell@2 - displayName: 'Send Slack notification' - #condition: and(succeeded(), ne(variables['Get_versions.TOOL_VERSIONS'], '')) - inputs: - targetType: filePath - filePath: './get-new-tool-versions/send-slack-notification.ps1' - arguments: | - -Url "$(SLACK_CHANNEL_URL)" ` - -ToolName "$(TOOL_NAME)" ` - -ToolVersion "$(Get_versions.TOOL_VERSIONS)" ` - -PipelineUrl "$(PIPELINE_URL)" ` - -ImageUrl "$(IMAGE_URL)" \ No newline at end of file + -ToolName "$(TOOL_NAME)" \ No newline at end of file