From 840e3a64d3f7ad624b2e0879205250f4059eb0dd Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 10:26:58 +0300 Subject: [PATCH 01/22] Update get-tool-versions-steps.yml --- .../templates/get-tool-versions-steps.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/azure-pipelines/templates/get-tool-versions-steps.yml b/azure-pipelines/templates/get-tool-versions-steps.yml index e6b160e..6a9fdf6 100644 --- a/azure-pipelines/templates/get-tool-versions-steps.yml +++ b/azure-pipelines/templates/get-tool-versions-steps.yml @@ -25,16 +25,3 @@ steps: 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 "${{ variables.PIPELINE_URL }}" ` - -ImageUrl "$(IMAGE_URL)" From 3bfd520dd02a093aca0d3f49ac066f842efd8581 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 10:30:06 +0300 Subject: [PATCH 02/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index d408885..5475427 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -32,7 +32,7 @@ stages: - stage: Trigger_Builds dependsOn: Get_New_Versions - condition: and(succeeded(), ne(stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'], ''), ne(variables['WORKFLOW_FILE_NAME'], '')) + condition: and(succeeded(), ne(stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'], '')) jobs: - deployment: Run_Builds pool: From e9a19e12518ab79ad6398437025af24f8994504d Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 10:31:40 +0300 Subject: [PATCH 03/22] Update get-tool-versions-steps.yml --- azure-pipelines/templates/get-tool-versions-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/templates/get-tool-versions-steps.yml b/azure-pipelines/templates/get-tool-versions-steps.yml index 6a9fdf6..8e436fe 100644 --- a/azure-pipelines/templates/get-tool-versions-steps.yml +++ b/azure-pipelines/templates/get-tool-versions-steps.yml @@ -19,7 +19,7 @@ steps: - task: PowerShell@2 displayName: 'Change build name' - condition: and(succeeded(), ne(variables['Get_versions.TOOL_VERSIONS'], '')) + #condition: and(succeeded(), ne(variables['Get_versions.TOOL_VERSIONS'], '')) inputs: TargetType: inline script: | From d61f870ac7a4fbef00f24c4489b724594868b984 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 10:35:57 +0300 Subject: [PATCH 04/22] Update get-new-tool-versions.ps1 --- get-new-tool-versions/get-new-tool-versions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get-new-tool-versions/get-new-tool-versions.ps1 b/get-new-tool-versions/get-new-tool-versions.ps1 index e2f0474..bce5407 100644 --- a/get-new-tool-versions/get-new-tool-versions.ps1 +++ b/get-new-tool-versions/get-new-tool-versions.ps1 @@ -21,7 +21,7 @@ $VersionsToBuild = $VersionsFromDist | Where-Object { $VersionsFromManifest -not if ($VersionsToBuild) { $availableVersions = $VersionsToBuild -join ", " Write-Host "The following versions are available to build:`n${availableVersions}" - Write-Host "##vso[task.setvariable variable=TOOL_VERSIONS;isOutput=true]${availableVersions}" + Write-Host "##vso[task.setvariable variable=TOOL_VERSIONS;isoutput=true]${availableVersions}" } else { Write-Host "There aren't versions to build" } From e1cbdde483d858e11abafb4d8a720f0fdd4714f2 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 10:40:09 +0300 Subject: [PATCH 05/22] test --- azure-pipelines/get-tool-versions.yml | 2 +- get-new-tool-versions/get-new-tool-versions.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index 5475427..8dba196 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -32,7 +32,6 @@ stages: - stage: Trigger_Builds dependsOn: Get_New_Versions - condition: and(succeeded(), ne(stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'], '')) jobs: - deployment: Run_Builds pool: @@ -40,6 +39,7 @@ stages: vmImage: $(VmImage) variables: ToolVersions: $[ stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] + condition: and(succeeded(), ne(stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'], '')) timeoutInMinutes: 180 environment: 'Get Available Tools Versions - Publishing Approval' strategy: diff --git a/get-new-tool-versions/get-new-tool-versions.ps1 b/get-new-tool-versions/get-new-tool-versions.ps1 index bce5407..e2f0474 100644 --- a/get-new-tool-versions/get-new-tool-versions.ps1 +++ b/get-new-tool-versions/get-new-tool-versions.ps1 @@ -21,7 +21,7 @@ $VersionsToBuild = $VersionsFromDist | Where-Object { $VersionsFromManifest -not if ($VersionsToBuild) { $availableVersions = $VersionsToBuild -join ", " Write-Host "The following versions are available to build:`n${availableVersions}" - Write-Host "##vso[task.setvariable variable=TOOL_VERSIONS;isoutput=true]${availableVersions}" + Write-Host "##vso[task.setvariable variable=TOOL_VERSIONS;isOutput=true]${availableVersions}" } else { Write-Host "There aren't versions to build" } From 84daa05fbce0d4413dac4f0f48cb6f55aee10309 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 10:43:43 +0300 Subject: [PATCH 06/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index 8dba196..7343957 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -39,7 +39,7 @@ stages: vmImage: $(VmImage) variables: ToolVersions: $[ stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] - condition: and(succeeded(), ne(stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'], '')) + condition: and(succeeded(), ne(stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'], ''), ne(variables['WORKFLOW_FILE_NAME'], '')) timeoutInMinutes: 180 environment: 'Get Available Tools Versions - Publishing Approval' strategy: From 6bc823feae115a80e3b66239eb17aeac4e665971 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 10:49:38 +0300 Subject: [PATCH 07/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index 7343957..55cc25a 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -32,14 +32,15 @@ stages: - stage: Trigger_Builds dependsOn: Get_New_Versions + variables: + ToolVersions: $[ stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] + condition: and(succeeded(), ne(variables.ToolVersions, '')) jobs: - deployment: Run_Builds pool: name: $(PoolName) vmImage: $(VmImage) - variables: - ToolVersions: $[ stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] - condition: and(succeeded(), ne(stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'], ''), ne(variables['WORKFLOW_FILE_NAME'], '')) + timeoutInMinutes: 180 environment: 'Get Available Tools Versions - Publishing Approval' strategy: From ea9029b06d1031e133c22ef704d003bb0aa3d7dc Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 10:54:30 +0300 Subject: [PATCH 08/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index 55cc25a..9fc23b5 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -32,9 +32,7 @@ stages: - stage: Trigger_Builds dependsOn: Get_New_Versions - variables: - ToolVersions: $[ stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] - condition: and(succeeded(), ne(variables.ToolVersions, '')) + condition: and(succeeded(), ne($[ stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'] ], '')) jobs: - deployment: Run_Builds pool: From fb5b7794f0fd78f9a7921634f041f8cb9968bcce Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 10:57:27 +0300 Subject: [PATCH 09/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index 9fc23b5..e1bebf6 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -32,8 +32,12 @@ stages: - stage: Trigger_Builds dependsOn: Get_New_Versions - condition: and(succeeded(), ne($[ stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'] ], '')) jobs: + - job: Check_Versions + condition: and(succeeded(), ne(stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'], '')) + steps: + - pwsh: echo "hello" + - deployment: Run_Builds pool: name: $(PoolName) From a5e14313772fe8b5a3adcc7fc6475927a616ef86 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 10:58:06 +0300 Subject: [PATCH 10/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index e1bebf6..21a45d5 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -39,10 +39,10 @@ stages: - pwsh: echo "hello" - deployment: Run_Builds + dependsOn: Check_Versions pool: name: $(PoolName) vmImage: $(VmImage) - timeoutInMinutes: 180 environment: 'Get Available Tools Versions - Publishing Approval' strategy: From 3e3417e8946eb2be4a68bac6916bdfb16b96d306 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 11:24:39 +0300 Subject: [PATCH 11/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index 21a45d5..418e5d0 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -20,29 +20,38 @@ variables: VmImage: 'ubuntu-18.04' stages: -- stage: Get_New_Versions +- stage: Find_New_Versions dependsOn: [] jobs: - - job: Get_Tool_Versions + - job: Find_New_Versions pool: name: $(PoolName) vmImage: $(VmImage) steps: - template: /azure-pipelines/templates/get-tool-versions-steps.yml -- stage: Trigger_Builds - dependsOn: Get_New_Versions +- stage: Check_New_Versions + dependsOn: Find_New_Versions jobs: - - job: Check_Versions - condition: and(succeeded(), ne(stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'], '')) + - job: Check_New_Versions steps: - - pwsh: echo "hello" + - pwsh: | + $NewVersions = "$[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ]".Trim() + if ($NewVersions) { + Write-Host "The following versions were found: $NewVersions" + } else { + throw "No new versions were found" + } +- stage: Trigger_Builds + dependsOn: Check_New_Versions + jobs: - deployment: Run_Builds - dependsOn: Check_Versions pool: name: $(PoolName) vmImage: $(VmImage) + variables: + ToolVersions: $[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] timeoutInMinutes: 180 environment: 'Get Available Tools Versions - Publishing Approval' strategy: From 4a932e134c14b8c95efa9d76bccd7f07aeeeabac Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 11:28:26 +0300 Subject: [PATCH 12/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index 418e5d0..6d19b3b 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -34,6 +34,9 @@ stages: dependsOn: Find_New_Versions jobs: - job: Check_New_Versions + pool: + name: $(PoolName) + vmImage: $(VmImage) steps: - pwsh: | $NewVersions = "$[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ]".Trim() From 1b966031cca8e4f62c3cbc6c429cc1beaa97f77a Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 11:31:23 +0300 Subject: [PATCH 13/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index 6d19b3b..693a09a 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -37,9 +37,12 @@ stages: pool: name: $(PoolName) vmImage: $(VmImage) + variables: + # map the output variable from A into this job + ToolVersions: $[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] steps: - pwsh: | - $NewVersions = "$[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ]".Trim() + $NewVersions = "$(ToolVersions)" if ($NewVersions) { Write-Host "The following versions were found: $NewVersions" } else { From 1575bb86d1ad23e7eb702c0c6bf09e8c6d42795a Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 11:35:33 +0300 Subject: [PATCH 14/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index 693a09a..4313758 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -38,7 +38,6 @@ stages: name: $(PoolName) vmImage: $(VmImage) variables: - # map the output variable from A into this job ToolVersions: $[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] steps: - pwsh: | @@ -48,9 +47,11 @@ stages: } else { throw "No new versions were found" } + displayName: Check versions - stage: Trigger_Builds dependsOn: Check_New_Versions + condition: and(succeeded(), eq(variables['WORKFLOW_FILE_NAME'], '')) jobs: - deployment: Run_Builds pool: From 14f9ca7540091f0bf912b046a5fc2145ce431be2 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 11:36:03 +0300 Subject: [PATCH 15/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index 4313758..bc9421b 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -51,7 +51,7 @@ stages: - stage: Trigger_Builds dependsOn: Check_New_Versions - condition: and(succeeded(), eq(variables['WORKFLOW_FILE_NAME'], '')) + condition: and(succeeded(), eq(variables['WORKFLOW_FILE_NAME'], '')) jobs: - deployment: Run_Builds pool: From 0d478268bb9db81f8a970a0b474823c7666a8b99 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 11:40:43 +0300 Subject: [PATCH 16/22] fix comments --- azure-pipelines/get-tool-versions.yml | 2 +- .../templates/get-tool-versions-steps.yml | 23 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index bc9421b..68a2700 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -51,7 +51,7 @@ stages: - stage: Trigger_Builds dependsOn: Check_New_Versions - condition: and(succeeded(), eq(variables['WORKFLOW_FILE_NAME'], '')) + condition: and(succeeded(), ne(variables['WORKFLOW_FILE_NAME'], '')) jobs: - deployment: Run_Builds pool: diff --git a/azure-pipelines/templates/get-tool-versions-steps.yml b/azure-pipelines/templates/get-tool-versions-steps.yml index 8e436fe..17d0a7d 100644 --- a/azure-pipelines/templates/get-tool-versions-steps.yml +++ b/azure-pipelines/templates/get-tool-versions-steps.yml @@ -10,18 +10,35 @@ steps: - task: PowerShell@2 displayName: 'Set PIPELINE_URL variable' - condition: and(succeeded(), ne(variables['TOOL_NAME'], 'Python')) inputs: TargetType: inline script: | - $PipelineUrl = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)" + $ToolName = "$(ToolName)" + 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'], '')) + 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 "${{ variables.PIPELINE_URL }}" ` + -ImageUrl "$(IMAGE_URL)" \ No newline at end of file From 7e43a351829067759c2da514da179b0c45adb226 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 11:41:58 +0300 Subject: [PATCH 17/22] Update get-tool-versions-steps.yml --- azure-pipelines/templates/get-tool-versions-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/templates/get-tool-versions-steps.yml b/azure-pipelines/templates/get-tool-versions-steps.yml index 17d0a7d..8e199f7 100644 --- a/azure-pipelines/templates/get-tool-versions-steps.yml +++ b/azure-pipelines/templates/get-tool-versions-steps.yml @@ -13,7 +13,7 @@ steps: inputs: TargetType: inline script: | - $ToolName = "$(ToolName)" + $ToolName = "$(TOOL_NAME)" if ($ToolName -eq "Python") { $PipelineUrl = " " } else { From c304390e317a080778e6d2490be7aed2482b5771 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 11:46:22 +0300 Subject: [PATCH 18/22] test --- .../templates/get-tool-versions-steps.yml | 22 +++++++++---------- .../send-slack-notification.ps1 | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/azure-pipelines/templates/get-tool-versions-steps.yml b/azure-pipelines/templates/get-tool-versions-steps.yml index 8e199f7..7cf41a6 100644 --- a/azure-pipelines/templates/get-tool-versions-steps.yml +++ b/azure-pipelines/templates/get-tool-versions-steps.yml @@ -23,7 +23,7 @@ steps: - task: PowerShell@2 displayName: 'Change build name' - condition: and(succeeded(), ne(variables['Get_versions.TOOL_VERSIONS'], '')) + #condition: and(succeeded(), ne(variables['Get_versions.TOOL_VERSIONS'], '')) inputs: TargetType: inline script: | @@ -31,14 +31,14 @@ steps: 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 "${{ variables.PIPELINE_URL }}" ` + 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 "$(PipelineUrl)" ` -ImageUrl "$(IMAGE_URL)" \ No newline at end of file diff --git a/get-new-tool-versions/send-slack-notification.ps1 b/get-new-tool-versions/send-slack-notification.ps1 index 0c6e57e..050af3e 100644 --- a/get-new-tool-versions/send-slack-notification.ps1 +++ b/get-new-tool-versions/send-slack-notification.ps1 @@ -36,7 +36,7 @@ Import-Module $PSScriptRoot/helpers.psm1 -DisableNameChecking # Create JSON body $text = "The following versions of '$toolName' are available to upload: $toolVersion" -if ($PipelineUrl) { +if (-not ([string]::IsNullOrWhiteSpace($PipelineUrl))) { $text += "\nLink to the pipeline: $pipelineUrl" } $jsonBodyMessage = @" From ecc77a65f75164e934f6bc4d6119e72077a217b6 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 11:48:43 +0300 Subject: [PATCH 19/22] Update get-tool-versions-steps.yml --- azure-pipelines/templates/get-tool-versions-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/templates/get-tool-versions-steps.yml b/azure-pipelines/templates/get-tool-versions-steps.yml index 7cf41a6..a383931 100644 --- a/azure-pipelines/templates/get-tool-versions-steps.yml +++ b/azure-pipelines/templates/get-tool-versions-steps.yml @@ -40,5 +40,5 @@ steps: -Url "$(SLACK_CHANNEL_URL)" ` -ToolName "$(TOOL_NAME)" ` -ToolVersion "$(Get_versions.TOOL_VERSIONS)" ` - -PipelineUrl "$(PipelineUrl)" ` + -PipelineUrl "$(PIPELINE_URL)" ` -ImageUrl "$(IMAGE_URL)" \ No newline at end of file From 11360e1ff97bbaa173a288f23c96c62462babab4 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 12:00:18 +0300 Subject: [PATCH 20/22] polish changes --- azure-pipelines/get-tool-versions.yml | 9 +--- azure-pipelines/templates/check-versions.yml | 41 +++++++++++++++++++ .../templates/get-tool-versions-steps.yml | 37 +---------------- 3 files changed, 43 insertions(+), 44 deletions(-) create mode 100644 azure-pipelines/templates/check-versions.yml 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 From 0624df7ce9b23c3c995d14f05987631e1ba63842 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 12:05:05 +0300 Subject: [PATCH 21/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index d6d68b5..454f302 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -38,7 +38,8 @@ stages: name: $(PoolName) vmImage: $(VmImage) variables: - ToolVersions: $[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] + ToolVersions: fake_version + #ToolVersions: $[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] steps: - template: /azure-pipelines/templates/check-versions.yml From c2935ecf46d23656855fd0a97dccd97e1b6a9163 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Dec 2020 12:06:57 +0300 Subject: [PATCH 22/22] Update get-tool-versions.yml --- azure-pipelines/get-tool-versions.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines/get-tool-versions.yml b/azure-pipelines/get-tool-versions.yml index 454f302..d6d68b5 100644 --- a/azure-pipelines/get-tool-versions.yml +++ b/azure-pipelines/get-tool-versions.yml @@ -38,8 +38,7 @@ stages: name: $(PoolName) vmImage: $(VmImage) variables: - ToolVersions: fake_version - #ToolVersions: $[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] + ToolVersions: $[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ] steps: - template: /azure-pipelines/templates/check-versions.yml