From 08b1587ce681771255c9573d41c6a3e5e223e05a Mon Sep 17 00:00:00 2001 From: Shane Date: Tue, 9 Jan 2024 13:37:12 +1000 Subject: [PATCH 01/16] Remove unused dependency --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index a63b81ed..ea9e9d37 100644 --- a/package.json +++ b/package.json @@ -49,8 +49,7 @@ "semver": "^7.3.7", "shlex": "^2.1.2", "typed-rest-client": "1.8.9", - "uuid": "8.3.2", - "vss-web-extension-sdk": "5.141.0" + "uuid": "8.3.2" }, "jest-junit": { "outputDirectory": "reports", From 9dddb0a5e8d1fd74660f7b15e2966aef9750b668 Mon Sep 17 00:00:00 2001 From: Shane Gill Date: Wed, 10 Jan 2024 02:26:48 +0000 Subject: [PATCH 02/16] Octopus Schema Migration to v6 --- .octopus/deployment_process.ocl | 22 ++++++++++++---------- .octopus/deployment_settings.ocl | 3 +-- .octopus/schema_version.ocl | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.octopus/deployment_process.ocl b/.octopus/deployment_process.ocl index c7cc040c..6d9c67b6 100644 --- a/.octopus/deployment_process.ocl +++ b/.octopus/deployment_process.ocl @@ -1,4 +1,5 @@ -step "Push to Azure Marketplace" { +step "push-to-azure-marketplace" { + name = "Push to Azure Marketplace" action { action_type = "Octopus.Script" @@ -45,20 +46,20 @@ step "Push to Azure Marketplace" { new_octopusartifact "/home/Octopus/$artifactFile" "$artifactFile" - EOT + EOT Octopus.Action.Script.ScriptSource = "Inline" Octopus.Action.Script.Syntax = "Bash" } - worker_pool = "Hosted Ubuntu" + worker_pool = "hosted-ubuntu" container { - feed = "Docker Hub" + feed = "docker-hub" image = "node:buster" } packages "OctoTFS.vsix" { acquisition_location = "Server" - feed = "Octopus Server (built-in)" + feed = "octopus-server-built-in" package_id = "OctoTFS.vsix" properties = { Extract = "True" @@ -69,7 +70,7 @@ step "Push to Azure Marketplace" { packages "OctoTFS.publish" { acquisition_location = "Server" - feed = "Octopus Server (built-in)" + feed = "octopus-server-built-in" package_id = "OctoTFS.publish" properties = { Extract = "True" @@ -80,11 +81,12 @@ step "Push to Azure Marketplace" { } } -step "Queue and verify a test build" { +step "queue-and-verify-a-test-build" { + name = "Queue and verify a test build" action { action_type = "Octopus.Script" - environments = ["Test"] + environments = ["test"] properties = { Octopus.Action.Script.ScriptBody = <<-EOT $queueBuildUrl = "https://octopus-deploy-test.visualstudio.com/DefaultCollection/VSTS.Extensions.TestProject/_apis/build/builds?api-version=2.0" @@ -147,10 +149,10 @@ step "Queue and verify a test build" { Write-Error "Build failed or didn't finish within 5 minutes!" } - EOT + EOT Octopus.Action.Script.ScriptSource = "Inline" Octopus.Action.Script.Syntax = "PowerShell" } - worker_pool = "Hosted Ubuntu" + worker_pool = "hosted-ubuntu" } } \ No newline at end of file diff --git a/.octopus/deployment_settings.ocl b/.octopus/deployment_settings.ocl index 3561140e..0e460069 100644 --- a/.octopus/deployment_settings.ocl +++ b/.octopus/deployment_settings.ocl @@ -3,9 +3,8 @@ connectivity_policy { } versioning_strategy { - donor_package { package = "OctoTFS.vsix" - step = "Push to Azure Marketplace" + step = "push-to-azure-marketplace" } } \ No newline at end of file diff --git a/.octopus/schema_version.ocl b/.octopus/schema_version.ocl index dcc0792d..4548a61f 100644 --- a/.octopus/schema_version.ocl +++ b/.octopus/schema_version.ocl @@ -1 +1 @@ -version = 3 \ No newline at end of file +version = 6 \ No newline at end of file From 7c8fe08e9be73ccc0ee227a0a63fced96e929edd Mon Sep 17 00:00:00 2001 From: Shane Gill Date: Wed, 10 Jan 2024 02:26:48 +0000 Subject: [PATCH 03/16] Turn tfx tracing on --- .octopus/deployment_process.ocl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.octopus/deployment_process.ocl b/.octopus/deployment_process.ocl index 6d9c67b6..bbefbd2c 100644 --- a/.octopus/deployment_process.ocl +++ b/.octopus/deployment_process.ocl @@ -29,6 +29,8 @@ step "push-to-azure-marketplace" { npm install -g tfx-cli + export TFX_TRACE=1 + pwsh $publishPath/publish.ps1 -environment $environment -version $version -accessToken $accessToken -packagePath $vsixPath -manifestsPath $publishPath -shareWith "$shareWith" || exit 1 if [ "$environment" == "Test" ] From da9b0d11f6db98ac30c17309ff9f6403a1ef120d Mon Sep 17 00:00:00 2001 From: Shane Gill Date: Wed, 10 Jan 2024 02:39:04 +0000 Subject: [PATCH 04/16] We care more about package version than release version --- .octopus/deployment_process.ocl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.octopus/deployment_process.ocl b/.octopus/deployment_process.ocl index bbefbd2c..a794ea11 100644 --- a/.octopus/deployment_process.ocl +++ b/.octopus/deployment_process.ocl @@ -20,8 +20,9 @@ step "push-to-azure-marketplace" { # Install PowerShell apt-get install -y powershell + environment=$(get_octopusvariable "Octopus.Environment.Name") - version=$(get_octopusvariable "Octopus.Release.Number") + version=$(get_octopusvariable "Octopus.Action.Package[OctoTFS.vsix].PackageVersion") accessToken=$(get_octopusvariable "AccessToken") shareWith=$(get_octopusvariable "ShareWith") vsixPath=$(get_octopusvariable "Octopus.Action.Package[OctoTFS.vsix].ExtractedPath") From e578e4ade7e466e394a30602935a9d297ba527e1 Mon Sep 17 00:00:00 2001 From: Shane Date: Wed, 10 Jan 2024 12:22:05 +1000 Subject: [PATCH 05/16] Revert "Remove unused dependency" This reverts commit 08b1587ce681771255c9573d41c6a3e5e223e05a. --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ea9e9d37..a63b81ed 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,8 @@ "semver": "^7.3.7", "shlex": "^2.1.2", "typed-rest-client": "1.8.9", - "uuid": "8.3.2" + "uuid": "8.3.2", + "vss-web-extension-sdk": "5.141.0" }, "jest-junit": { "outputDirectory": "reports", From 9ae59ce79d2f8fc446af102b3313e7977d4770e6 Mon Sep 17 00:00:00 2001 From: Shane Date: Wed, 10 Jan 2024 13:04:44 +1000 Subject: [PATCH 06/16] Just publish it... --- publish.ps1 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/publish.ps1 b/publish.ps1 index 1d96d307..5c71810c 100644 --- a/publish.ps1 +++ b/publish.ps1 @@ -38,11 +38,6 @@ function PublishVSIX($vsixFile, $environment) { throw "The valid environments are 'Test' and 'Production'" } - if(!(IsPublishRequired $manifest)){ - Write-Host "Version already published. Skipping publishing." - return; - } - if ($environment -eq "Production") { Write-Host "Publishing $vsixFile to everyone (public extension)..." & tfx extension publish --vsix $vsixFile --token $accessToken --no-prompt From f23458707ebe80932fad7c85c9e78e724ad3649b Mon Sep 17 00:00:00 2001 From: Shane Date: Wed, 10 Jan 2024 14:54:08 +1000 Subject: [PATCH 07/16] Can I publish this thing? --- source/extension-manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/extension-manifest.json b/source/extension-manifest.json index 506bdf26..433b5bce 100644 --- a/source/extension-manifest.json +++ b/source/extension-manifest.json @@ -3,7 +3,7 @@ "id": "set-by-extension-manifest.environment.json", "name": "set-by-extension-manifest.environment.json", "version": "set-by-extension-manifest.environment.json", - "publisher": "octopusdeploy", + "publisher": "octo-shane", "targets": [ { "id": "Microsoft.VisualStudio.Services.Cloud" From e744c2c11214f42a2b0d752fd00a8a360f64f7e9 Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 11 Jan 2024 08:22:32 +1000 Subject: [PATCH 08/16] Try update pipelines task lib --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a63b81ed..358d92cc 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "dependencies": { "@octopusdeploy/api-client": "^3.0.8", "azure-devops-node-api": "11.2.0", - "azure-pipelines-task-lib": "3.3.1", + "azure-pipelines-task-lib": "4.7.0", "azure-pipelines-tool-lib": "1.3.2", "command-line-args": "^5.2.1", "fp-ts": "1.19.5", From e1b6aa46f84a32d54efb108a824b4f4fde23a10f Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 11 Jan 2024 08:25:25 +1000 Subject: [PATCH 09/16] Update tool lib --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 358d92cc..2e298475 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@octopusdeploy/api-client": "^3.0.8", "azure-devops-node-api": "11.2.0", "azure-pipelines-task-lib": "4.7.0", - "azure-pipelines-tool-lib": "1.3.2", + "azure-pipelines-tool-lib": "2.0.7", "command-line-args": "^5.2.1", "fp-ts": "1.19.5", "glob": "7.2.0", From 0408c064826873d5ed528e06f19f4d1162a0ddf5 Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 11 Jan 2024 08:58:39 +1000 Subject: [PATCH 10/16] Update package lock --- package-lock.json | 600 ++++++++++++++++------------------------------ 1 file changed, 208 insertions(+), 392 deletions(-) diff --git a/package-lock.json b/package-lock.json index cc2a71af..41c359df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,8 +7,8 @@ "dependencies": { "@octopusdeploy/api-client": "^3.0.8", "azure-devops-node-api": "11.2.0", - "azure-pipelines-task-lib": "3.3.1", - "azure-pipelines-tool-lib": "1.3.2", + "azure-pipelines-task-lib": "4.7.0", + "azure-pipelines-tool-lib": "2.0.7", "command-line-args": "^5.2.1", "fp-ts": "1.19.5", "glob": "7.2.0", @@ -1295,14 +1295,6 @@ "integrity": "sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA==", "dev": true }, - "node_modules/@types/concat-stream": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.1.tgz", - "integrity": "sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -1335,14 +1327,6 @@ "@types/range-parser": "*" } }, - "node_modules/@types/form-data": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-0.0.33.tgz", - "integrity": "sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", @@ -1443,7 +1427,8 @@ "node_modules/@types/node": { "version": "18.0.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.4.tgz", - "integrity": "sha512-M0+G6V0Y4YV8cqzHssZpaNCqvYwlCiulmm0PwpNLF55r/+cT8Ol42CHRU1SEaYFH2rTwiiE1aYg/2g2rrtGdPA==" + "integrity": "sha512-M0+G6V0Y4YV8cqzHssZpaNCqvYwlCiulmm0PwpNLF55r/+cT8Ol42CHRU1SEaYFH2rTwiiE1aYg/2g2rrtGdPA==", + "dev": true }, "node_modules/@types/prettier": { "version": "2.6.3", @@ -1459,7 +1444,8 @@ "node_modules/@types/qs": { "version": "6.9.7", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", - "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==" + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", + "dev": true }, "node_modules/@types/ramda": { "version": "0.28.15", @@ -1765,6 +1751,17 @@ "node": ">=6.0" } }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1969,11 +1966,6 @@ "node": ">=8" } }, - "node_modules/asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" - }, "node_modules/async": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", @@ -2005,16 +1997,17 @@ } }, "node_modules/azure-pipelines-task-lib": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-3.3.1.tgz", - "integrity": "sha512-56ZAr4MHIoa24VNVuwPL4iUQ5MKaigPoYXkBG8E8fiVmh8yZdatUo25meNoQwg77vDY22F63Q44UzXoMWmy7ag==", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-4.7.0.tgz", + "integrity": "sha512-5MctDC1Bt7eFi9tQTXlikuWRDc2MenCNruMsEwcKuXqBj1ZY+fA/D+E1DbE0Qi2u8kl1p6szT0we8k6RHSOe/w==", "dependencies": { + "adm-zip": "^0.5.10", + "deasync": "^0.1.28", "minimatch": "3.0.5", - "mockery": "^1.7.0", + "nodejs-file-downloader": "^4.11.1", "q": "^1.5.1", "semver": "^5.1.0", "shelljs": "^0.8.5", - "sync-request": "6.1.0", "uuid": "^3.0.1" } }, @@ -2047,13 +2040,13 @@ } }, "node_modules/azure-pipelines-tool-lib": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/azure-pipelines-tool-lib/-/azure-pipelines-tool-lib-1.3.2.tgz", - "integrity": "sha512-PtYcd3E2ouwZhLuaOpWA00FYoLjRuJs1V8mNu3u6lBnqeYd4jh/8VL/of6nchm8f2NM6Div+EEnbOcmWvcptPg==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/azure-pipelines-tool-lib/-/azure-pipelines-tool-lib-2.0.7.tgz", + "integrity": "sha512-1FN67ypNwNhgZllYSm4/pAQdffSfEZJhwW8YeNvm/cKDTS6t6bukTBIkt04c1CsaQe7Ot+eDOVMn41wX1ketXw==", "dependencies": { "@types/semver": "^5.3.0", "@types/uuid": "^3.4.5", - "azure-pipelines-task-lib": "^3.1.10", + "azure-pipelines-task-lib": "^4.1.0", "semver": "^5.7.0", "semver-compare": "^1.0.0", "typed-rest-client": "^1.8.6", @@ -2198,6 +2191,14 @@ } ] }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -2354,7 +2355,8 @@ "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true }, "node_modules/bytes": { "version": "3.1.2", @@ -2411,11 +2413,6 @@ } ] }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2543,47 +2540,6 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, - "node_modules/concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "engines": [ - "node >= 0.8" - ], - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "node_modules/concat-stream/node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/concat-stream/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/concat-stream/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -2638,7 +2594,8 @@ "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true }, "node_modules/crc-32": { "version": "1.2.2", @@ -2685,11 +2642,23 @@ "node": ">= 8" } }, + "node_modules/deasync": { + "version": "0.1.29", + "resolved": "https://registry.npmjs.org/deasync/-/deasync-0.1.29.tgz", + "integrity": "sha512-EBtfUhVX23CE9GR6m+F8WPeImEE4hR/FW9RkK0PMl9V1t283s0elqsTD8EZjaKX28SY1BW2rYfCgNsAYdpamUw==", + "hasInstallScript": true, + "dependencies": { + "bindings": "^1.5.0", + "node-addon-api": "^1.7.1" + }, + "engines": { + "node": ">=0.11.0" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -3685,6 +3654,11 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -3904,14 +3878,6 @@ "node": ">=8.0.0" } }, - "node_modules/get-port": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz", - "integrity": "sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg==", - "engines": { - "node": ">=4" - } - }, "node_modules/get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", @@ -4033,20 +3999,6 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "node_modules/http-basic": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/http-basic/-/http-basic-8.1.3.tgz", - "integrity": "sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw==", - "dependencies": { - "caseless": "^0.12.0", - "concat-stream": "^1.6.2", - "http-response-object": "^3.0.1", - "parse-cache-control": "^1.0.1" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -4063,19 +4015,18 @@ "node": ">= 0.8" } }, - "node_modules/http-response-object": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/http-response-object/-/http-response-object-3.0.2.tgz", - "integrity": "sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA==", + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "dependencies": { - "@types/node": "^10.0.3" + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" } }, - "node_modules/http-response-object/node_modules/@types/node": { - "version": "10.17.60", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", - "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==" - }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -4281,7 +4232,8 @@ "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true }, "node_modules/isexe": { "version": "2.0.0", @@ -5342,16 +5294,10 @@ "node": ">=10" } }, - "node_modules/mockery": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/mockery/-/mockery-1.7.0.tgz", - "integrity": "sha512-gUQA33ayi0tuAhr/rJNZPr7Q7uvlBt4gyJPbi0CDcAfIzIrDu1YgGMFgmAu3stJqBpK57m7+RxUbcS+pt59fKQ==" - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "node_modules/natural-compare": { "version": "1.4.0", @@ -5368,6 +5314,11 @@ "node": ">= 0.6" } }, + "node_modules/node-addon-api": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", + "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==" + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -5380,6 +5331,17 @@ "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", "dev": true }, + "node_modules/nodejs-file-downloader": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/nodejs-file-downloader/-/nodejs-file-downloader-4.12.1.tgz", + "integrity": "sha512-LpfCTNhh805AlLnJnzt1PuEj+RmbrccbAQZ6hBRw2e6QPVR0Qntuo6qqyvPHG5s77/0w0IEKgRAD4nbSnr/X4w==", + "dependencies": { + "follow-redirects": "^1.15.1", + "https-proxy-agent": "^5.0.0", + "mime-types": "^2.1.27", + "sanitize-filename": "^1.6.3" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -5524,11 +5486,6 @@ "node": ">=6" } }, - "node_modules/parse-cache-control": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", - "integrity": "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==" - }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -5707,15 +5664,8 @@ "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "node_modules/promise": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/promise/-/promise-8.1.0.tgz", - "integrity": "sha512-W04AqnILOL/sPRXziNicCjSNRruLAuIHEOVBazepu0545DDNGYHz7ar9ZgZ1fMU8/MA4mVxp5rkBWRi6OXIy3Q==", - "dependencies": { - "asap": "~2.0.6" - } + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true }, "node_modules/prompts": { "version": "2.4.2", @@ -6064,6 +6014,14 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "node_modules/sanitize-filename": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", + "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", + "dependencies": { + "truncate-utf8-bytes": "^1.0.0" + } + }, "node_modules/semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -6413,27 +6371,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/sync-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/sync-request/-/sync-request-6.1.0.tgz", - "integrity": "sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw==", - "dependencies": { - "http-response-object": "^3.0.1", - "sync-rpc": "^1.2.1", - "then-request": "^6.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/sync-rpc": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/sync-rpc/-/sync-rpc-1.3.6.tgz", - "integrity": "sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw==", - "dependencies": { - "get-port": "^3.1.0" - } - }, "node_modules/tar-stream": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", @@ -6512,45 +6449,6 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, - "node_modules/then-request": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/then-request/-/then-request-6.0.2.tgz", - "integrity": "sha512-3ZBiG7JvP3wbDzA9iNY5zJQcHL4jn/0BWtXIkagfz7QgOL/LqjCEOBQuJNZfu0XYnv5JhKh+cDxCPM4ILrqruA==", - "dependencies": { - "@types/concat-stream": "^1.6.0", - "@types/form-data": "0.0.33", - "@types/node": "^8.0.0", - "@types/qs": "^6.2.31", - "caseless": "~0.12.0", - "concat-stream": "^1.6.0", - "form-data": "^2.2.0", - "http-basic": "^8.1.1", - "http-response-object": "^3.0.1", - "promise": "^8.0.0", - "qs": "^6.4.0" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/then-request/node_modules/@types/node": { - "version": "8.10.66", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz", - "integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==" - }, - "node_modules/then-request/node_modules/form-data": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -6587,6 +6485,14 @@ "node": ">=0.6" } }, + "node_modules/truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==", + "dependencies": { + "utf8-byte-length": "^1.0.1" + } + }, "node_modules/ts-jest": { "version": "28.0.5", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-28.0.5.tgz", @@ -6769,11 +6675,6 @@ "underscore": "^1.12.1" } }, - "node_modules/typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" - }, "node_modules/typescript": { "version": "4.7.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", @@ -6849,10 +6750,16 @@ "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==" }, + "node_modules/utf8-byte-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz", + "integrity": "sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA==" + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true }, "node_modules/utils-merge": { "version": "1.0.1", @@ -8074,14 +7981,6 @@ "integrity": "sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA==", "dev": true }, - "@types/concat-stream": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.1.tgz", - "integrity": "sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA==", - "requires": { - "@types/node": "*" - } - }, "@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -8114,14 +8013,6 @@ "@types/range-parser": "*" } }, - "@types/form-data": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-0.0.33.tgz", - "integrity": "sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw==", - "requires": { - "@types/node": "*" - } - }, "@types/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", @@ -8222,7 +8113,8 @@ "@types/node": { "version": "18.0.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.4.tgz", - "integrity": "sha512-M0+G6V0Y4YV8cqzHssZpaNCqvYwlCiulmm0PwpNLF55r/+cT8Ol42CHRU1SEaYFH2rTwiiE1aYg/2g2rrtGdPA==" + "integrity": "sha512-M0+G6V0Y4YV8cqzHssZpaNCqvYwlCiulmm0PwpNLF55r/+cT8Ol42CHRU1SEaYFH2rTwiiE1aYg/2g2rrtGdPA==", + "dev": true }, "@types/prettier": { "version": "2.6.3", @@ -8238,7 +8130,8 @@ "@types/qs": { "version": "6.9.7", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", - "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==" + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", + "dev": true }, "@types/ramda": { "version": "0.28.15", @@ -8441,6 +8334,14 @@ "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz", "integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==" }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + } + }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -8603,11 +8504,6 @@ "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true }, - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" - }, "async": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", @@ -8639,16 +8535,17 @@ } }, "azure-pipelines-task-lib": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-3.3.1.tgz", - "integrity": "sha512-56ZAr4MHIoa24VNVuwPL4iUQ5MKaigPoYXkBG8E8fiVmh8yZdatUo25meNoQwg77vDY22F63Q44UzXoMWmy7ag==", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-4.7.0.tgz", + "integrity": "sha512-5MctDC1Bt7eFi9tQTXlikuWRDc2MenCNruMsEwcKuXqBj1ZY+fA/D+E1DbE0Qi2u8kl1p6szT0we8k6RHSOe/w==", "requires": { + "adm-zip": "^0.5.10", + "deasync": "^0.1.28", "minimatch": "3.0.5", - "mockery": "^1.7.0", + "nodejs-file-downloader": "^4.11.1", "q": "^1.5.1", "semver": "^5.1.0", "shelljs": "^0.8.5", - "sync-request": "6.1.0", "uuid": "^3.0.1" }, "dependencies": { @@ -8673,13 +8570,13 @@ } }, "azure-pipelines-tool-lib": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/azure-pipelines-tool-lib/-/azure-pipelines-tool-lib-1.3.2.tgz", - "integrity": "sha512-PtYcd3E2ouwZhLuaOpWA00FYoLjRuJs1V8mNu3u6lBnqeYd4jh/8VL/of6nchm8f2NM6Div+EEnbOcmWvcptPg==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/azure-pipelines-tool-lib/-/azure-pipelines-tool-lib-2.0.7.tgz", + "integrity": "sha512-1FN67ypNwNhgZllYSm4/pAQdffSfEZJhwW8YeNvm/cKDTS6t6bukTBIkt04c1CsaQe7Ot+eDOVMn41wX1ketXw==", "requires": { "@types/semver": "^5.3.0", "@types/uuid": "^3.4.5", - "azure-pipelines-task-lib": "^3.1.10", + "azure-pipelines-task-lib": "^4.1.0", "semver": "^5.7.0", "semver-compare": "^1.0.0", "typed-rest-client": "^1.8.6", @@ -8784,6 +8681,14 @@ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "dev": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -8899,7 +8804,8 @@ "buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true }, "bytes": { "version": "3.1.2", @@ -8934,11 +8840,6 @@ "integrity": "sha512-yy7XLWCubDobokgzudpkKux8e0UOOnLHE6mlNJBzT3lZJz6s5atSEzjoL+fsCPkI0G8MP5uVdDx1ur/fXEWkZA==", "dev": true }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" - }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -9041,46 +8942,6 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -9128,7 +8989,8 @@ "core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true }, "crc-32": { "version": "1.2.2", @@ -9163,11 +9025,19 @@ "which": "^2.0.1" } }, + "deasync": { + "version": "0.1.29", + "resolved": "https://registry.npmjs.org/deasync/-/deasync-0.1.29.tgz", + "integrity": "sha512-EBtfUhVX23CE9GR6m+F8WPeImEE4hR/FW9RkK0PMl9V1t283s0elqsTD8EZjaKX28SY1BW2rYfCgNsAYdpamUw==", + "requires": { + "bindings": "^1.5.0", + "node-addon-api": "^1.7.1" + } + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, "requires": { "ms": "2.1.2" } @@ -9829,6 +9699,11 @@ "flat-cache": "^3.0.4" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -9993,11 +9868,6 @@ "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", "dev": true }, - "get-port": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz", - "integrity": "sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg==" - }, "get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", @@ -10080,17 +9950,6 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "http-basic": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/http-basic/-/http-basic-8.1.3.tgz", - "integrity": "sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw==", - "requires": { - "caseless": "^0.12.0", - "concat-stream": "^1.6.2", - "http-response-object": "^3.0.1", - "parse-cache-control": "^1.0.1" - } - }, "http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -10104,19 +9963,13 @@ "toidentifier": "1.0.1" } }, - "http-response-object": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/http-response-object/-/http-response-object-3.0.2.tgz", - "integrity": "sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA==", + "https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "requires": { - "@types/node": "^10.0.3" - }, - "dependencies": { - "@types/node": { - "version": "10.17.60", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", - "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==" - } + "agent-base": "6", + "debug": "4" } }, "human-signals": { @@ -10253,7 +10106,8 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true }, "isexe": { "version": "2.0.0", @@ -11084,16 +10938,10 @@ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true }, - "mockery": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/mockery/-/mockery-1.7.0.tgz", - "integrity": "sha512-gUQA33ayi0tuAhr/rJNZPr7Q7uvlBt4gyJPbi0CDcAfIzIrDu1YgGMFgmAu3stJqBpK57m7+RxUbcS+pt59fKQ==" - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "natural-compare": { "version": "1.4.0", @@ -11107,6 +10955,11 @@ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "dev": true }, + "node-addon-api": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", + "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==" + }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -11119,6 +10972,17 @@ "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", "dev": true }, + "nodejs-file-downloader": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/nodejs-file-downloader/-/nodejs-file-downloader-4.12.1.tgz", + "integrity": "sha512-LpfCTNhh805AlLnJnzt1PuEj+RmbrccbAQZ6hBRw2e6QPVR0Qntuo6qqyvPHG5s77/0w0IEKgRAD4nbSnr/X4w==", + "requires": { + "follow-redirects": "^1.15.1", + "https-proxy-agent": "^5.0.0", + "mime-types": "^2.1.27", + "sanitize-filename": "^1.6.3" + } + }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -11223,11 +11087,6 @@ "callsites": "^3.0.0" } }, - "parse-cache-control": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", - "integrity": "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==" - }, "parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -11351,15 +11210,8 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "promise": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/promise/-/promise-8.1.0.tgz", - "integrity": "sha512-W04AqnILOL/sPRXziNicCjSNRruLAuIHEOVBazepu0545DDNGYHz7ar9ZgZ1fMU8/MA4mVxp5rkBWRi6OXIy3Q==", - "requires": { - "asap": "~2.0.6" - } + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true }, "prompts": { "version": "2.4.2", @@ -11591,6 +11443,14 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "sanitize-filename": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", + "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", + "requires": { + "truncate-utf8-bytes": "^1.0.0" + } + }, "semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -11867,24 +11727,6 @@ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" }, - "sync-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/sync-request/-/sync-request-6.1.0.tgz", - "integrity": "sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw==", - "requires": { - "http-response-object": "^3.0.1", - "sync-rpc": "^1.2.1", - "then-request": "^6.0.0" - } - }, - "sync-rpc": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/sync-rpc/-/sync-rpc-1.3.6.tgz", - "integrity": "sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw==", - "requires": { - "get-port": "^3.1.0" - } - }, "tar-stream": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", @@ -11947,41 +11789,6 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, - "then-request": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/then-request/-/then-request-6.0.2.tgz", - "integrity": "sha512-3ZBiG7JvP3wbDzA9iNY5zJQcHL4jn/0BWtXIkagfz7QgOL/LqjCEOBQuJNZfu0XYnv5JhKh+cDxCPM4ILrqruA==", - "requires": { - "@types/concat-stream": "^1.6.0", - "@types/form-data": "0.0.33", - "@types/node": "^8.0.0", - "@types/qs": "^6.2.31", - "caseless": "~0.12.0", - "concat-stream": "^1.6.0", - "form-data": "^2.2.0", - "http-basic": "^8.1.1", - "http-response-object": "^3.0.1", - "promise": "^8.0.0", - "qs": "^6.4.0" - }, - "dependencies": { - "@types/node": { - "version": "8.10.66", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz", - "integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==" - }, - "form-data": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - } - } - }, "tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -12009,6 +11816,14 @@ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "dev": true }, + "truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==", + "requires": { + "utf8-byte-length": "^1.0.1" + } + }, "ts-jest": { "version": "28.0.5", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-28.0.5.tgz", @@ -12121,11 +11936,6 @@ "underscore": "^1.12.1" } }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" - }, "typescript": { "version": "4.7.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", @@ -12172,10 +11982,16 @@ "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==" }, + "utf8-byte-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz", + "integrity": "sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true }, "utils-merge": { "version": "1.0.1", From e3c79458d12d668c4d629f16581d5de1f45aff94 Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 11 Jan 2024 13:36:52 +1000 Subject: [PATCH 11/16] Prune deasync before pack --- pack.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pack.ps1 b/pack.ps1 index 08ac4bb1..d824e94e 100644 --- a/pack.ps1 +++ b/pack.ps1 @@ -54,6 +54,23 @@ function UpdateTaskManifests($workingDirectory, $version, $envName) { } } + +function IsUnsupportedNode($directory) { + $result = $directory | Select-String -Pattern 'node-(\d+)' + foreach ($r in $result) { + if ([int] $r.Matches.Groups[1].Value -gt 9) { + return $false + } + } + return $true +} + +function PruneDeasync($moduleDirectory) { + Get-ChildItem $moduleDirectory\deasync\bin -Filter "*-ia32-*" -Directory | Remove-Item -Recurse + + Get-ChildItem $moduleDirectory\deasync\bin -Directory | Where-Object {IsUnsupportedNode $_.FullName} | Remove-Item -Recurse +} + function SetupTaskDependencies($workingDirectory) { $tempPath = "$basePath/modules"; @@ -66,6 +83,7 @@ function SetupTaskDependencies($workingDirectory) { $command = "$goPath/bin/node-prune" Invoke-Expression "$command $tempPath/node_modules" + PruneDeasync "$tempPath/node_modules" $taskManifestFiles = Get-ChildItem $workingDirectory -Include "task.json" -Recurse From 9524e86f2d4553a2d21a04a4276686a20e0df017 Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 11 Jan 2024 15:44:44 +1000 Subject: [PATCH 12/16] Remove legacy tasks --- .../CreateOctopusReleaseV3/icon.png | Bin 343 -> 0 bytes .../CreateOctopusReleaseV3/icon.svg | 1 - .../CreateOctopusReleaseV3/index.ts | 75 ----- .../CreateOctopusReleaseV3/task.json | 223 --------------- .../CreateOctopusReleaseV4/icon.png | Bin 343 -> 0 bytes .../CreateOctopusReleaseV4/icon.svg | 1 - .../CreateOctopusReleaseV4/index.ts | 83 ------ .../CreateOctopusReleaseV4/task.json | 266 ------------------ source/tasksLegacy/Deploy/DeployV3/icon.png | Bin 454 -> 0 bytes source/tasksLegacy/Deploy/DeployV3/icon.svg | 1 - source/tasksLegacy/Deploy/DeployV3/index.ts | 59 ---- source/tasksLegacy/Deploy/DeployV3/task.json | 164 ----------- source/tasksLegacy/Deploy/DeployV4/icon.png | Bin 454 -> 0 bytes source/tasksLegacy/Deploy/DeployV4/icon.svg | 1 - source/tasksLegacy/Deploy/DeployV4/index.ts | 59 ---- source/tasksLegacy/Deploy/DeployV4/task.json | 182 ------------ source/tasksLegacy/OctoCli/OctoCliV4/icon.png | Bin 481 -> 0 bytes source/tasksLegacy/OctoCli/OctoCliV4/icon.svg | 1 - source/tasksLegacy/OctoCli/OctoCliV4/index.ts | 33 --- .../tasksLegacy/OctoCli/OctoCliV4/task.json | 56 ---- .../OctoInstaller/OctoInstallerV4/icon.png | Bin 600 -> 0 bytes .../OctoInstaller/OctoInstallerV4/icon.svg | 1 - .../OctoInstaller/OctoInstallerV4/index.ts | 43 --- .../OctoInstaller/OctoInstallerV4/task.json | 49 ---- .../OctopusMetadataV4/icon.png | Bin 481 -> 0 bytes .../OctopusMetadataV4/icon.svg | 1 - .../OctopusMetadataV4/index.ts | 97 ------- .../OctopusMetadataV4/task.json | 97 ------- source/tasksLegacy/Pack/PackV4/icon.png | Bin 399 -> 0 bytes source/tasksLegacy/Pack/PackV4/icon.svg | 1 - source/tasksLegacy/Pack/PackV4/index.ts | 115 -------- source/tasksLegacy/Pack/PackV4/task.json | 179 ------------ source/tasksLegacy/Promote/PromoteV3/icon.png | Bin 621 -> 0 bytes source/tasksLegacy/Promote/PromoteV3/icon.svg | 1 - source/tasksLegacy/Promote/PromoteV3/index.ts | 55 ---- .../tasksLegacy/Promote/PromoteV3/task.json | 173 ------------ source/tasksLegacy/Promote/PromoteV4/icon.png | Bin 621 -> 0 bytes source/tasksLegacy/Promote/PromoteV4/icon.svg | 1 - source/tasksLegacy/Promote/PromoteV4/index.ts | 55 ---- .../tasksLegacy/Promote/PromoteV4/task.json | 195 ------------- source/tasksLegacy/Push/PushV3/icon.png | Bin 481 -> 0 bytes source/tasksLegacy/Push/PushV3/icon.svg | 1 - source/tasksLegacy/Push/PushV3/index.ts | 47 ---- source/tasksLegacy/Push/PushV3/task.json | 76 ----- source/tasksLegacy/Push/PushV4/icon.png | Bin 481 -> 0 bytes source/tasksLegacy/Push/PushV4/icon.svg | 1 - source/tasksLegacy/Push/PushV4/index.ts | 49 ---- source/tasksLegacy/Push/PushV4/task.json | 89 ------ source/tasksLegacy/Utils/OctoApiKeyHandler.ts | 26 -- source/tasksLegacy/Utils/connection.ts | 57 ---- source/tasksLegacy/Utils/environment.ts | 243 ---------------- source/tasksLegacy/Utils/inputs.ts | 74 ----- source/tasksLegacy/Utils/install.ts | 192 ------------- source/tasksLegacy/Utils/tool.ts | 174 ------------ 54 files changed, 3297 deletions(-) delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/icon.png delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/icon.svg delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/task.json delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/icon.png delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/icon.svg delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/task.json delete mode 100644 source/tasksLegacy/Deploy/DeployV3/icon.png delete mode 100644 source/tasksLegacy/Deploy/DeployV3/icon.svg delete mode 100644 source/tasksLegacy/Deploy/DeployV3/index.ts delete mode 100644 source/tasksLegacy/Deploy/DeployV3/task.json delete mode 100644 source/tasksLegacy/Deploy/DeployV4/icon.png delete mode 100644 source/tasksLegacy/Deploy/DeployV4/icon.svg delete mode 100644 source/tasksLegacy/Deploy/DeployV4/index.ts delete mode 100644 source/tasksLegacy/Deploy/DeployV4/task.json delete mode 100644 source/tasksLegacy/OctoCli/OctoCliV4/icon.png delete mode 100644 source/tasksLegacy/OctoCli/OctoCliV4/icon.svg delete mode 100644 source/tasksLegacy/OctoCli/OctoCliV4/index.ts delete mode 100644 source/tasksLegacy/OctoCli/OctoCliV4/task.json delete mode 100644 source/tasksLegacy/OctoInstaller/OctoInstallerV4/icon.png delete mode 100644 source/tasksLegacy/OctoInstaller/OctoInstallerV4/icon.svg delete mode 100644 source/tasksLegacy/OctoInstaller/OctoInstallerV4/index.ts delete mode 100644 source/tasksLegacy/OctoInstaller/OctoInstallerV4/task.json delete mode 100644 source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/icon.png delete mode 100644 source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/icon.svg delete mode 100644 source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/index.ts delete mode 100644 source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/task.json delete mode 100644 source/tasksLegacy/Pack/PackV4/icon.png delete mode 100644 source/tasksLegacy/Pack/PackV4/icon.svg delete mode 100644 source/tasksLegacy/Pack/PackV4/index.ts delete mode 100644 source/tasksLegacy/Pack/PackV4/task.json delete mode 100644 source/tasksLegacy/Promote/PromoteV3/icon.png delete mode 100644 source/tasksLegacy/Promote/PromoteV3/icon.svg delete mode 100644 source/tasksLegacy/Promote/PromoteV3/index.ts delete mode 100644 source/tasksLegacy/Promote/PromoteV3/task.json delete mode 100644 source/tasksLegacy/Promote/PromoteV4/icon.png delete mode 100644 source/tasksLegacy/Promote/PromoteV4/icon.svg delete mode 100644 source/tasksLegacy/Promote/PromoteV4/index.ts delete mode 100644 source/tasksLegacy/Promote/PromoteV4/task.json delete mode 100644 source/tasksLegacy/Push/PushV3/icon.png delete mode 100644 source/tasksLegacy/Push/PushV3/icon.svg delete mode 100644 source/tasksLegacy/Push/PushV3/index.ts delete mode 100644 source/tasksLegacy/Push/PushV3/task.json delete mode 100644 source/tasksLegacy/Push/PushV4/icon.png delete mode 100644 source/tasksLegacy/Push/PushV4/icon.svg delete mode 100644 source/tasksLegacy/Push/PushV4/index.ts delete mode 100644 source/tasksLegacy/Push/PushV4/task.json delete mode 100644 source/tasksLegacy/Utils/OctoApiKeyHandler.ts delete mode 100644 source/tasksLegacy/Utils/connection.ts delete mode 100644 source/tasksLegacy/Utils/environment.ts delete mode 100644 source/tasksLegacy/Utils/inputs.ts delete mode 100644 source/tasksLegacy/Utils/install.ts delete mode 100644 source/tasksLegacy/Utils/tool.ts diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/icon.png b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/icon.png deleted file mode 100644 index cae677b4a2420bebbc5556e566c85dd97e529b39..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 343 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XECYN(T=geE`2YWZ^12t(Prjdi^26yT-)&|++IRP>=fWqo zd){;%diUwa->~J+o__kh@%rZ_7e3y2{j*@}E1(w3Ig)RHh6tAg`2_>HXnF!PcEP4V^-u~4G3VIZ+!XR|KrmRniXDrm9s1J{V|t57U9<4N*mbj`92ao zU}Dd9+~1)9e6mCMS!2@Ionj`y9`Z?x?9gWgx*PExan|>FX6z;!bOZB z%-25K-r(V=XR1Evoctopus \ No newline at end of file diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts deleted file mode 100644 index ebab652b..00000000 --- a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { multiArgument, connectionArguments, includeAdditionalArgumentsAndProxyConfig, flag, argumentEnquote, argumentIfSet, getOrInstallOctoCommandRunner } from "../../Utils/tool"; -import { createReleaseNotesFile, createVstsConnection, generateReleaseNotesContent, getLinkedReleaseNotes, getVstsEnvironmentVariables } from "../../Utils/environment"; -import { getDefaultOctopusConnectionDetailsOrThrow, resolveProjectName } from "../../Utils/connection"; -import { getOptionalCsvInput } from "../../Utils/inputs"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const environmentVariables = getVstsEnvironmentVariables(); - const vstsConnection = createVstsConnection(environmentVariables); - const octoConnection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - // @ts-expect-error - const project = await resolveProjectName(octoConnection, tasks.getInput("ProjectName", true)).then((x) => x.value); - const releaseNumber = tasks.getInput("ReleaseNumber"); - const channel = tasks.getInput("Channel"); - const changesetCommentReleaseNotes = tasks.getBoolInput("ChangesetCommentReleaseNotes"); - const workItemReleaseNotes = tasks.getBoolInput("WorkItemReleaseNotes"); - const customReleaseNotes = tasks.getInput("CustomReleaseNotes"); - const deployToEnvironments = getOptionalCsvInput("DeployToEnvironment"); - const deployForTenants = getOptionalCsvInput("DeployForTenants"); - const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); - const deploymentProgress = tasks.getBoolInput("DeploymentProgress"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - - const octo = await getOrInstallOctoCommandRunner("create-release"); - - let linkedReleaseNotes = ""; - if (workItemReleaseNotes || changesetCommentReleaseNotes) { - linkedReleaseNotes = await getLinkedReleaseNotes(vstsConnection, changesetCommentReleaseNotes, workItemReleaseNotes); - } - - const releaseNotesFile = createReleaseNotesFile(() => { - // @ts-expect-error - return generateReleaseNotesContent(environmentVariables, linkedReleaseNotes, customReleaseNotes); - }, environmentVariables.defaultWorkingDirectory); - - const configure = [ - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - argumentEnquote("project", project), - // @ts-expect-error - argumentIfSet(argumentEnquote, "releaseNumber", releaseNumber), - // @ts-expect-error - argumentIfSet(argumentEnquote, "channel", channel), - connectionArguments(octoConnection), - flag("enableServiceMessages", true), - multiArgument(argumentEnquote, "deployTo", deployToEnvironments), - flag("progress", deployToEnvironments.length > 0 && deploymentProgress), - multiArgument(argumentEnquote, "tenant", deployForTenants), - multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), - argumentEnquote("releaseNotesFile", releaseNotesFile), - // @ts-expect-error - includeAdditionalArgumentsAndProxyConfig(octoConnection.url, additionalArguments), - ]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(release;create;v3)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Create octopus release succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to create release. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/task.json b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/task.json deleted file mode 100644 index 331361a0..00000000 --- a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/task.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "id": "4E131B60-5532-4362-95B6-7C67D9841B4F", - "name": "OctopusCreateRelease", - "friendlyName": "Create Octopus Release", - "description": "There is a later version of this task, we recommend using the latest version. Create a Release in Octopus Deploy", - "helpMarkDown": "set-by-pack.ps1", - "category": "Deploy", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 3, - "Minor": 1, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "releasenotes", - "displayName": "Release Notes", - "isExpanded": true - }, - { - "name": "deployment", - "displayName": "Deployment", - "isExpanded": false - }, - { - "name": "tenant", - "displayName": "Tenants", - "isExpanded": false - }, - { - "name": "additional", - "displayName": "Additional Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "string", - "label": "Space (Legacy - Use version 4 of this task)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "False" - }, - "helpMarkDown": "Version 3 of this task has limited support for spaces. We recommend using version 4 of this task for a better experience." - }, - { - "name": "ProjectGroup", - "type": "pickList", - "label": "Project Group", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." - }, - { - "name": "ProjectName", - "type": "pickList", - "label": "Project Name", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Octopus Deploy Project Name" - }, - { - "name": "ReleaseNumber", - "type": "string", - "label": "Release Number", - "defaultValue": "", - "required": false, - "helpMarkDown": "The number to use for this release. You can leave this blank if the release number is calculated by Octopus." - }, - { - "name": "Channel", - "type": "pickList", - "label": "Channel", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The [channel](https://g.octopushq.com/Channels) to use for the release." - }, - { - "name": "ChangesetCommentReleaseNotes", - "type": "boolean", - "label": "Include Changeset Comments", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Whether to include linked Changeset comments in Octopus Release notes.", - "groupName": "releasenotes" - }, - { - "name": "WorkItemReleaseNotes", - "type": "boolean", - "label": "Include Work Items", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Whether to include linked Work Item Titles in Octopus Release notes.", - "groupName": "releasenotes" - }, - { - "name": "CustomReleaseNotes", - "type": "string", - "label": "Custom Notes", - "defaultValue": "", - "required": false, - "helpMarkDown": "Custom notes appended to Octopus Release notes. This field supports markdown. To include newlines, you can use HTML linebreaks.", - "groupName": "releasenotes" - }, - { - "name": "DeployToEnvironment", - "type": "pickList", - "label": "To Environment", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Deploy the release to this environment after creating it.", - "groupName": "deployment" - }, - { - "name": "DeployForTenants", - "type": "pickList", - "label": "Tenant(s)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Deploy the release for this comma-delimited list of tenants after creating it. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", - "groupName": "tenant" - }, - { - "name": "DeployForTenantTags", - "type": "string", - "label": "Tenant tag(s)", - "defaultValue": "", - "required": false, - "helpMarkDown": "Deploy the release for tenants who match these tags and are ready to deploy to the provided environment.", - "groupName": "tenant" - }, - { - "name": "DeploymentProgress", - "type": "boolean", - "label": "Show Deployment Progress", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Output from the deployment will appear in the log. If checked, the task will only succeed if the deployment is successful.", - "groupName": "deployment" - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExeCreateRelease) for available parameters.", - "groupName": "additional" - } - ], - "dataSourceBindings": [ - { - "target": "ProjectGroup", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllProjectGroups", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "ProjectName", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusListProjectsInProjectGroup", - "parameters": { - "ProjectGroupId": "$(ProjectGroup)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployToEnvironment", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllEnvironments", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Channel", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectChannels", - "parameters": { - "ProjectName": "$(ProjectName)" - }, - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployForTenants", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllTenants", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Create Octopus Release: $(ProjectName)", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/icon.png b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/icon.png deleted file mode 100644 index cae677b4a2420bebbc5556e566c85dd97e529b39..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 343 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XECYN(T=geE`2YWZ^12t(Prjdi^26yT-)&|++IRP>=fWqo zd){;%diUwa->~J+o__kh@%rZ_7e3y2{j*@}E1(w3Ig)RHh6tAg`2_>HXnF!PcEP4V^-u~4G3VIZ+!XR|KrmRniXDrm9s1J{V|t57U9<4N*mbj`92ao zU}Dd9+~1)9e6mCMS!2@Ionj`y9`Z?x?9gWgx*PExan|>FX6z;!bOZB z%-25K-r(V=XR1Evoctopus \ No newline at end of file diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts deleted file mode 100644 index b9f2fc0a..00000000 --- a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { createReleaseNotesFile, createVstsConnection, generateReleaseNotesContent, getLinkedReleaseNotes, getVstsEnvironmentVariables } from "../../Utils/environment"; -import { argumentEnquote, argumentIfSet, assertOctoVersionAcceptsIds, connectionArguments, flag, getOrInstallOctoCommandRunner, includeAdditionalArgumentsAndProxyConfig, multiArgument } from "../../Utils/tool"; -import { getOptionalCsvInput } from "../../Utils/inputs"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const environmentVariables = getVstsEnvironmentVariables(); - const vstsConnection = createVstsConnection(environmentVariables); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - const project = tasks.getInput("ProjectName", true); - const releaseNumber = tasks.getInput("ReleaseNumber"); - const channel = tasks.getInput("Channel"); - const changesetCommentReleaseNotes = tasks.getBoolInput("ChangesetCommentReleaseNotes"); - const workItemReleaseNotes = tasks.getBoolInput("WorkItemReleaseNotes"); - const customReleaseNotes = tasks.getInput("CustomReleaseNotes"); - const deployToEnvironments = getOptionalCsvInput("DeployToEnvironment"); - const deployForTenants = getOptionalCsvInput("DeployForTenants"); - const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); - const deploymentProgress = tasks.getBoolInput("DeploymentProgress"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - const gitRef = tasks.getInput("GitRef"); - const gitCommit = tasks.getInput("GitCommit"); - - await assertOctoVersionAcceptsIds(); - const octo = await getOrInstallOctoCommandRunner("create-release"); - - const configure = [ - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - // @ts-expect-error - argumentEnquote("project", project), - // @ts-expect-error - argumentIfSet(argumentEnquote, "releaseNumber", releaseNumber), - // @ts-expect-error - argumentIfSet(argumentEnquote, "channel", channel), - connectionArguments(connection), - flag("enableServiceMessages", true), - multiArgument(argumentEnquote, "deployTo", deployToEnvironments), - // @ts-expect-error - argumentIfSet(argumentEnquote, "gitRef", gitRef), - // @ts-expect-error - argumentIfSet(argumentEnquote, "gitCommit", gitCommit), - flag("progress", deployToEnvironments.length > 0 && deploymentProgress), - multiArgument(argumentEnquote, "tenant", deployForTenants), - multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), - ]; - - if (workItemReleaseNotes || changesetCommentReleaseNotes || (customReleaseNotes && /[^\s]/.test(customReleaseNotes))) { - const linkedReleaseNotes = workItemReleaseNotes || changesetCommentReleaseNotes ? await getLinkedReleaseNotes(vstsConnection, changesetCommentReleaseNotes, workItemReleaseNotes) : ""; - - const releaseNotesFile = createReleaseNotesFile(() => { - // @ts-expect-error - return generateReleaseNotesContent(environmentVariables, linkedReleaseNotes, customReleaseNotes); - }, environmentVariables.defaultWorkingDirectory); - - configure.push(argumentEnquote("releaseNotesFile", releaseNotesFile)); - } - - // @ts-expect-error - configure.push(includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments)); - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(release;create;v4)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Create octopus release succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to create release. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/task.json b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/task.json deleted file mode 100644 index bbcc3df2..00000000 --- a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/task.json +++ /dev/null @@ -1,266 +0,0 @@ -{ - "id": "4E131B60-5532-4362-95B6-7C67D9841B4F", - "name": "OctopusCreateRelease", - "friendlyName": "Create Octopus Release", - "description": "There is a later version of this task, we recommend using the latest version. Create a Release in Octopus Deploy", - "helpMarkDown": "set-by-pack.ps1", - "category": "Deploy", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "releasenotes", - "displayName": "Release Notes (Legacy)", - "isExpanded": true - }, - { - "name": "deployment", - "displayName": "Deployment", - "isExpanded": false - }, - { - "name": "tenant", - "displayName": "Tenants", - "isExpanded": false - }, - { - "name": "versionControl", - "displayName": "Version Control", - "isExpanded": false - }, - { - "name": "additional", - "displayName": "Additional Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "pickList", - "label": "Space", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The space within Octopus." - }, - { - "name": "ProjectGroup", - "type": "pickList", - "label": "Project Group", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." - }, - { - "name": "ProjectName", - "type": "pickList", - "label": "Project", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project within Octopus." - }, - { - "name": "ReleaseNumber", - "type": "string", - "label": "Release Number", - "defaultValue": "", - "required": false, - "helpMarkDown": "The number to use for this release. You can leave this blank if the release number is calculated by Octopus." - }, - { - "name": "Channel", - "type": "pickList", - "label": "Channel", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The [channel](https://g.octopushq.com/Channels) to use for the release." - }, - { - "name": "ChangesetCommentReleaseNotes", - "type": "boolean", - "label": "Include Changeset Comments", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Whether to add linked changeset comments to Octopus Release notes.\n\n*Note: These Release Notes options are considered legacy. We recommend clearing them and pushing [Build Information](https://g.octopushq.com/BuildInformation) alongside your packages, which allows the customizable [Release Notes Template](https://g.octopushq.com/ReleaseNotesTemplate) to generate automatic release notes.*", - "groupName": "releasenotes" - }, - { - "name": "WorkItemReleaseNotes", - "type": "boolean", - "label": "Include Work Items", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Whether to add linked Work Item titles to Octopus Release notes.\n\n*Note: These Release Notes options are considered legacy. We recommend clearing them and pushing [Build Information](https://g.octopushq.com/BuildInformation) alongside your packages, which allows the customizable [Release Notes Template](https://g.octopushq.com/ReleaseNotesTemplate) to generate automatic release notes.*", - "groupName": "releasenotes" - }, - { - "name": "CustomReleaseNotes", - "type": "string", - "label": "Custom Notes", - "defaultValue": "", - "required": false, - "helpMarkDown": "Custom notes appended to Octopus Release notes. This field supports markdown. To include newlines, you can use HTML linebreaks.\n\n*Note: These Release Notes options are considered legacy. We recommend clearing them and pushing [Build Information](https://g.octopushq.com/BuildInformation) alongside your packages, which allows the customizable [Release Notes Template](https://g.octopushq.com/ReleaseNotesTemplate) to generate automatic release notes.*", - "groupName": "releasenotes" - }, - { - "name": "DeployToEnvironment", - "type": "pickList", - "label": "To Environment", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Deploy the release to this environment after creating it.", - "groupName": "deployment" - }, - { - "name": "DeployForTenants", - "type": "pickList", - "label": "Tenant(s)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Deploy the release for this comma-delimited list of tenants after creating it. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", - "groupName": "tenant" - }, - { - "name": "DeployForTenantTags", - "type": "string", - "label": "Tenant tag(s)", - "defaultValue": "", - "required": false, - "helpMarkDown": "Deploy the release for tenants who match these tags and are ready to deploy to the provided environment.", - "groupName": "tenant" - }, - { - "name": "DeploymentProgress", - "type": "boolean", - "label": "Show Deployment Progress", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Output from the deployment will appear in the log. If checked, the task will only succeed if the deployment is successful.", - "groupName": "deployment" - }, - { - "name": "GitRef", - "type": "string", - "label": "Git Reference", - "defaultValue": "", - "required": false, - "helpMarkDown": "Git branch reference to use when creating the release for version controlled Projects.", - "groupName": "versionControl" - }, - { - "name": "GitCommit", - "type": "string", - "label": "Git Commit", - "defaultValue": "", - "required": false, - "helpMarkDown": "Git commit to use when creating the release for version controlled Projects. Use in conjunction with the gitRef parameter to select any previous commit.", - "groupName": "versionControl" - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExeCreateRelease) for available parameters.", - "groupName": "additional" - } - ], - "dataSourceBindings": [ - { - "target": "Space", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllSpaces", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "ProjectGroup", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllProjectGroupsInSpace", - "parameters": { - "SpaceId": "$(Space)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "ProjectName", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusListProjectsInProjectGroupInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectGroupId": "$(ProjectGroup)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployToEnvironment", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectChannelEnvironmentsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectId": "$(ProjectName)", - "ChannelId": "$(Channel)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Channel", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectChannelsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectName": "$(ProjectName)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployForTenants", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectTenantsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectName": "$(ProjectName)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Create Octopus Release", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Deploy/DeployV3/icon.png b/source/tasksLegacy/Deploy/DeployV3/icon.png deleted file mode 100644 index 591f4d253f95a8bc45cc879a1d1532641d20b54e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 454 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xk^_7~T=geEn11qoNK$_Cx)-OPeEgNJ8k}z z8@KDbCWkG5wsOOEn^})GUjO{@)8`wne`;ELA3J@%u(ti_r{AA`{PkS;WctYuU5DOT zc!byPd9&og$45_}yM-nfY<;!w?pL6Je18_l0j*Ok3GxdDa`6I&`3Em30u`U}ba4!+ zxOL|8O};}40<0GbPen}&+Pz)x@Bj58T3I1i_RaXRk4KSxMhnjwd#2S5rzaJbZ)i>_ zyUpxY%dWh%lzYLsdy?LM`3=8(CR{aPei3_LrIGbAn}Zd{Q%MW{V+{5Uc6S11v#vO) zl@;gkTxVm-PDj&R-`(5grkuR>_W#j(N9ReIc@4=+1yz&&#q8ME#Qfapn5Kq=_M=Y< zB}>H{iZxH|I4uwvBlkJzleWgBgcI$xTN!jG`+FSJ7Mv|p@V@%fa(UO5Lt*^yx5uzZ ZF!au`45>Q*R~hIp22WQ%mvv4FO#t+soctopus \ No newline at end of file diff --git a/source/tasksLegacy/Deploy/DeployV3/index.ts b/source/tasksLegacy/Deploy/DeployV3/index.ts deleted file mode 100644 index e99444b5..00000000 --- a/source/tasksLegacy/Deploy/DeployV3/index.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { multiArgument, connectionArguments, includeAdditionalArgumentsAndProxyConfig, flag, argumentEnquote, argumentIfSet, getOrInstallOctoCommandRunner } from "../../Utils/tool"; -import { getDefaultOctopusConnectionDetailsOrThrow, resolveProjectName } from "../../Utils/connection"; -import { getOptionalCsvInput, getRequiredCsvInput } from "../../Utils/inputs"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - const releaseNumber = tasks.getInput("ReleaseNumber", true); - const environments = getRequiredCsvInput("Environments"); - const showProgress = tasks.getBoolInput("ShowProgress"); - const deploymentForTenants = getOptionalCsvInput("DeployForTenants"); - const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - // @ts-ignore - const project = await resolveProjectName(connection, tasks.getInput("Project", true)).then((x) => x.value); - - const octo = await getOrInstallOctoCommandRunner("deploy-release"); - - const configure = [ - // @ts-ignore - argumentIfSet(argumentEnquote, "space", space), - argumentEnquote("project", project), - // @ts-ignore - argumentEnquote("releaseNumber", releaseNumber), - connectionArguments(connection), - multiArgument(argumentEnquote, "deployTo", environments), - multiArgument(argumentEnquote, "tenant", deploymentForTenants), - multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), - flag("progress", showProgress), - // @ts-ignore - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - let stepIdentifier = "(release;deploy;v3)"; - if (deploymentForTenants.length > 0 || deployForTenantTags.length > 0) { - stepIdentifier = "(release;deploy-tenanted;v3)"; - } - - const code: number = await octo - .map((x) => x.launchOcto(configure, stepIdentifier)) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Deploy succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to deploy release. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Deploy/DeployV3/task.json b/source/tasksLegacy/Deploy/DeployV3/task.json deleted file mode 100644 index 3274fe57..00000000 --- a/source/tasksLegacy/Deploy/DeployV3/task.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "id": "8ca1d96a-151d-44b7-bc4f-9251e2ea6971", - "name": "OctopusDeployRelease", - "friendlyName": "Deploy Octopus Release", - "description": "There is a later version of this task, we recommend using the latest version. Deploy an Octopus Deploy Release", - "helpMarkDown": "set-by-pack.ps1", - "category": "Deploy", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 3, - "Minor": 1, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "tenant", - "displayName": "Tenants", - "isExpanded": false - }, - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "string", - "label": "Space (Legacy - Use version 4 of this task)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "False" - }, - "helpMarkDown": "Version 3 of this task has limited support for spaces. We recommend using version 4 of this task for a better experience." - }, - { - "name": "ProjectGroup", - "type": "pickList", - "label": "Project Group", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." - }, - { - "name": "Project", - "type": "pickList", - "label": "Project", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Octopus Deploy Project Name" - }, - { - "name": "ReleaseNumber", - "type": "string", - "label": "Release Number", - "defaultValue": "latest", - "required": true, - "helpMarkDown": "The number of the release to deploy. Use 'latest' to deploy the latest release." - }, - { - "name": "Environments", - "type": "pickList", - "label": "Deploy to Environments", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Comma separated list of environments to deploy to." - }, - { - "name": "ShowProgress", - "type": "boolean", - "label": "Show Deployment Progress", - "defaultValue": "False", - "required": false, - "helpMarkDown": "If checked, the build process will only succeed if the deployment is successful." - }, - { - "name": "DeployForTenants", - "type": "pickList", - "label": "Tenant(s)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Deploy the release for this comma delimited list of tenants. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", - "groupName": "tenant" - }, - { - "name": "DeployForTenantTags", - "type": "string", - "label": "Tenant tag(s)", - "defaultValue": "", - "required": false, - "helpMarkDown": "Deploy the release for tenants who match these tags and are ready to deploy to the provided environment.", - "groupName": "tenant" - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExeDeployRelease) for available parameters.", - "groupName": "advanced" - } - ], - "dataSourceBindings": [ - { - "target": "ProjectGroup", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllProjectGroups", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Project", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusListProjectsInProjectGroup", - "parameters": { - "ProjectGroupId": "$(ProjectGroup)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Environments", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllEnvironments", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployForTenants", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllTenants", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Deploy Octopus Release: $(Project) to $(Environments)", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Deploy/DeployV4/icon.png b/source/tasksLegacy/Deploy/DeployV4/icon.png deleted file mode 100644 index 591f4d253f95a8bc45cc879a1d1532641d20b54e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 454 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xk^_7~T=geEn11qoNK$_Cx)-OPeEgNJ8k}z z8@KDbCWkG5wsOOEn^})GUjO{@)8`wne`;ELA3J@%u(ti_r{AA`{PkS;WctYuU5DOT zc!byPd9&og$45_}yM-nfY<;!w?pL6Je18_l0j*Ok3GxdDa`6I&`3Em30u`U}ba4!+ zxOL|8O};}40<0GbPen}&+Pz)x@Bj58T3I1i_RaXRk4KSxMhnjwd#2S5rzaJbZ)i>_ zyUpxY%dWh%lzYLsdy?LM`3=8(CR{aPei3_LrIGbAn}Zd{Q%MW{V+{5Uc6S11v#vO) zl@;gkTxVm-PDj&R-`(5grkuR>_W#j(N9ReIc@4=+1yz&&#q8ME#Qfapn5Kq=_M=Y< zB}>H{iZxH|I4uwvBlkJzleWgBgcI$xTN!jG`+FSJ7Mv|p@V@%fa(UO5Lt*^yx5uzZ ZF!au`45>Q*R~hIp22WQ%mvv4FO#t+soctopus \ No newline at end of file diff --git a/source/tasksLegacy/Deploy/DeployV4/index.ts b/source/tasksLegacy/Deploy/DeployV4/index.ts deleted file mode 100644 index d2dd6cec..00000000 --- a/source/tasksLegacy/Deploy/DeployV4/index.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { argumentEnquote, argumentIfSet, assertOctoVersionAcceptsIds, connectionArguments, flag, getOrInstallOctoCommandRunner, includeAdditionalArgumentsAndProxyConfig, multiArgument } from "../../Utils/tool"; -import { getOptionalCsvInput, getRequiredCsvInput } from "../../Utils/inputs"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - const project = tasks.getInput("Project", true); - const releaseNumber = tasks.getInput("ReleaseNumber", true); - const deployToEnvironments = getRequiredCsvInput("Environments"); - const deployForTenants = getOptionalCsvInput("DeployForTenants"); - const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); - const showProgress = tasks.getBoolInput("ShowProgress"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - await assertOctoVersionAcceptsIds(); - const octo = await getOrInstallOctoCommandRunner("deploy-release"); - - const configure = [ - // @ts-ignore - argumentIfSet(argumentEnquote, "space", space), - // @ts-ignore - argumentEnquote("project", project), - // @ts-ignore - argumentEnquote("releaseNumber", releaseNumber), - connectionArguments(connection), - multiArgument(argumentEnquote, "deployTo", deployToEnvironments), - multiArgument(argumentEnquote, "tenant", deployForTenants), - multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), - flag("progress", showProgress), - // @ts-ignore - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - let stepIdentifier = "(release;deploy;v4)"; - if (deployForTenants.length > 0 || deployForTenantTags.length > 0) { - stepIdentifier = "(release;deploy-tenanted;v4)"; - } - - const code: number = await octo - .map((x) => x.launchOcto(configure, stepIdentifier)) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Deploy succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to deploy release. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Deploy/DeployV4/task.json b/source/tasksLegacy/Deploy/DeployV4/task.json deleted file mode 100644 index eec3f330..00000000 --- a/source/tasksLegacy/Deploy/DeployV4/task.json +++ /dev/null @@ -1,182 +0,0 @@ -{ - "id": "8ca1d96a-151d-44b7-bc4f-9251e2ea6971", - "name": "OctopusDeployRelease", - "friendlyName": "Deploy Octopus Release", - "description": "There is a later version of this task, we recommend using the latest version. Deploy an Octopus Deploy Release", - "helpMarkDown": "set-by-pack.ps1", - "category": "Deploy", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "tenant", - "displayName": "Tenants", - "isExpanded": false - }, - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "pickList", - "label": "Space", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The space within Octopus." - }, - { - "name": "ProjectGroup", - "type": "pickList", - "label": "Project Group", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." - }, - { - "name": "Project", - "type": "pickList", - "label": "Project", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project within Octopus." - }, - { - "name": "ReleaseNumber", - "type": "string", - "label": "Release Number", - "defaultValue": "latest", - "required": true, - "helpMarkDown": "The number of the release to deploy. Use 'latest' to deploy the latest release." - }, - { - "name": "Environments", - "type": "pickList", - "label": "Deploy to Environments", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Comma separated list of environments to deploy to." - }, - { - "name": "ShowProgress", - "type": "boolean", - "label": "Show Deployment Progress", - "defaultValue": "False", - "required": false, - "helpMarkDown": "If checked, the build process will only succeed if the deployment is successful." - }, - { - "name": "DeployForTenants", - "type": "pickList", - "label": "Tenant(s)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Deploy the release for this comma delimited list of tenants. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", - "groupName": "tenant" - }, - { - "name": "DeployForTenantTags", - "type": "string", - "label": "Tenant tag(s)", - "defaultValue": "", - "required": false, - "helpMarkDown": "Deploy the release for tenants who match these tags and are ready to deploy to the provided environment.", - "groupName": "tenant" - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExeDeployRelease) for available parameters.", - "groupName": "advanced" - } - ], - "dataSourceBindings": [ - { - "target": "Space", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllSpaces", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "ProjectGroup", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllProjectGroupsInSpace", - "parameters": { - "SpaceId": "$(Space)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Project", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusListProjectsInProjectGroupInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectGroupId": "$(ProjectGroup)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Environments", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectEnvironmentsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectId": "$(Project)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployForTenants", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectTenantsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectName": "$(Project)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Deploy Octopus Release", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/OctoCli/OctoCliV4/icon.png b/source/tasksLegacy/OctoCli/OctoCliV4/icon.png deleted file mode 100644 index 236566a308c71c4b35ce91fa54e6914d05fb8d7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 481 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X5(0ceT=geE`2YXEw4QzPx)(OH9^H8T^V5&NwR_$iJAMB2 zlkd|{z7JdeY{`X>D>rQ4clWDC?vm|$4|^_rGX3O-f~~JMUjO{`<8KR(@UBDe9zA_7 zW8(Sr({J6jGn&@kn#Jq<8&?5MzN-Gj8RWW>AirQB7aw4ViIIK_RQuY~#WAGf)|JUO zg_;dGToq^cx@BK|*Zu$hbk@acQL?{p++$Bya%U26DRcg?yrHafN@ijhgZ4r1rD>cV z3NIEYFVJzex!AERaEc521I41Md6xGQ)F%rjx;bztnH<-Cb9A{1o6Eh}1U819ca*nG zm+fZUxZM1v#PO~^%`NJJE-iDIgrXGHTDTmJtv%Q9TK0{={z`MZhK=0Z+>-MIj5Y|y z9A0xm?Mgz*b=ND;xTpNT7s&dg{Nhgm$)%1_;l&3Qg-X3%IeF*&R+q&G0y|G#y{PkN zL&dCBCvNy}vz?b_|L$w;kE+Gn%0G$!U$dQonSt+$*N$DY75)Id&EVoctopus \ No newline at end of file diff --git a/source/tasksLegacy/OctoCli/OctoCliV4/index.ts b/source/tasksLegacy/OctoCli/OctoCliV4/index.ts deleted file mode 100644 index fcf7a196..00000000 --- a/source/tasksLegacy/OctoCli/OctoCliV4/index.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { connectionArguments, getOrInstallOctoCommandRunner, includeAdditionalArguments } from "../../Utils/tool"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - const args = tasks.getInput("args", false); - const command = tasks.getInput("command", true); - // @ts-ignore - const octo = await getOrInstallOctoCommandRunner(command); - - // @ts-ignore - const configure = [connectionArguments(connection), includeAdditionalArguments(args)]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(cli;run;v4)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, `Succeeded executing octo command ${command} with code ${code}`); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to execute octo command. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/OctoCli/OctoCliV4/task.json b/source/tasksLegacy/OctoCli/OctoCliV4/task.json deleted file mode 100644 index 4553a726..00000000 --- a/source/tasksLegacy/OctoCli/OctoCliV4/task.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "id": "25fee290-e578-491b-b1db-dbc3980df1d0", - "name": "OctoCli", - "friendlyName": "Invoke Octopus CLI command", - "description": "There is a later version of this task, we recommend using the latest version. Invoke an Octopus CLI command", - "helpMarkDown": "set-by-pack.ps1", - "category": "Tool", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "command", - "type": "string", - "label": "command", - "defaultValue": "", - "required": true, - "helpMarkDown": "The Octopus CLI command to execute." - }, - { - "name": "args", - "type": "string", - "label": "arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "The arguments to use for the command." - } - ], - "instanceNameFormat": "Invoke an Octopus CLI command", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/icon.png b/source/tasksLegacy/OctoInstaller/OctoInstallerV4/icon.png deleted file mode 100644 index d54551d79a45027401d3d149af2619b6a48be11d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 600 zcmV-e0;m0nP)}VKg|3!E0NBpaa)2rh(A899 zhzjx2Gs_$CSwT1v;&KGY za#;2w*K(p9fXxvg%R#{p0$Y(B01_v~au5JFNCec(4lpn<*b`C=O3k2x2Ndi_HZ6r% z>KBco23NFT0S7command-line \ No newline at end of file diff --git a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/index.ts b/source/tasksLegacy/OctoInstaller/OctoInstallerV4/index.ts deleted file mode 100644 index b8079c09..00000000 --- a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { getOrDownloadOcto, resolvePublishedOctoVersion, addToolToPath, getEmbeddedOcto } from "../../Utils/install"; -import * as tasks from "azure-pipelines-task-lib/task"; -import * as os from "os"; - -async function run() { - tasks.warning("This task is deprecated, please use latest version instead."); - const version = tasks.getInput("version"); - // @ts-ignore - const forceEmbedded = /embedded/i.test(version); - - try { - if (forceEmbedded) { - console.log("Forcing the use of the embedded Octopus CLI tool."); - await getEmbeddedOcto(tasks.resolve(__dirname, "embedded")).then(addToolToPath); - } else { - const option = await resolvePublishedOctoVersion(version); - console.log(`Using Octopus CLI tool version ${option.version}`); - await getOrDownloadOcto(option).then(addToolToPath); - } - - tasks.setResult(tasks.TaskResult.Succeeded, ""); - } catch (error: unknown) { - if (error instanceof Error) { - if (forceEmbedded) { - tasks.setResult(tasks.TaskResult.Failed, `${error.message}${os.EOL}${error.stack}`, true); - return; - } - - console.log(`Failed to resolve Octopus CLI tool version ${version}. Using the embedded version. ${error}`); - - try { - await getEmbeddedOcto(tasks.resolve(__dirname, "embedded")).then(addToolToPath); - } catch (embeddedOctoError: unknown) { - if (embeddedOctoError instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `${embeddedOctoError.message}${os.EOL}${embeddedOctoError.stack}`, true); - } - } - } - } -} - -run(); diff --git a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/task.json b/source/tasksLegacy/OctoInstaller/OctoInstallerV4/task.json deleted file mode 100644 index a1df9e46..00000000 --- a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/task.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "id": "57342b23-3a76-490a-8e78-25d4ade2f2e3", - "name": "OctoInstaller", - "friendlyName": "[DEPRECATED] Octopus CLI Installer", - "description": "This task is deprecated, please use latest version instead. Install a specific version of the Octopus CLI", - "helpMarkDown": "Install a specific version of the Octopus CLI", - "category": "Tool", - "runsOn": [ - "Agent", - "DeploymentGroup" - ], - "visibility": [ - "Build", - "Release" - ], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "deprecated": true, - "satisfies": ["Octo"], - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "version", - "type": "string", - "label": "Octopus CLI Version", - "defaultValue": "embedded", - "required": true, - "helpMarkDown": "Specify `latest` or the version number to download. If you specify `embedded`, or the download fails, a built-in copy of the tool will be used." - } - ], - "instanceNameFormat": "[DEPRECATED] Use Octopus CLI tool version $(version)", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/icon.png b/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/icon.png deleted file mode 100644 index 236566a308c71c4b35ce91fa54e6914d05fb8d7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 481 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X5(0ceT=geE`2YXEw4QzPx)(OH9^H8T^V5&NwR_$iJAMB2 zlkd|{z7JdeY{`X>D>rQ4clWDC?vm|$4|^_rGX3O-f~~JMUjO{`<8KR(@UBDe9zA_7 zW8(Sr({J6jGn&@kn#Jq<8&?5MzN-Gj8RWW>AirQB7aw4ViIIK_RQuY~#WAGf)|JUO zg_;dGToq^cx@BK|*Zu$hbk@acQL?{p++$Bya%U26DRcg?yrHafN@ijhgZ4r1rD>cV z3NIEYFVJzex!AERaEc521I41Md6xGQ)F%rjx;bztnH<-Cb9A{1o6Eh}1U819ca*nG zm+fZUxZM1v#PO~^%`NJJE-iDIgrXGHTDTmJtv%Q9TK0{={z`MZhK=0Z+>-MIj5Y|y z9A0xm?Mgz*b=ND;xTpNT7s&dg{Nhgm$)%1_;l&3Qg-X3%IeF*&R+q&G0y|G#y{PkN zL&dCBCvNy}vz?b_|L$w;kE+Gn%0G$!U$dQonSt+$*N$DY75)Id&EVoctopus \ No newline at end of file diff --git a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/index.ts b/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/index.ts deleted file mode 100644 index 973ac51a..00000000 --- a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/index.ts +++ /dev/null @@ -1,97 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { ToolRunner } from "azure-pipelines-task-lib/toolrunner"; -import * as path from "path"; -import { createVstsConnection, getBuildBranch, getBuildChanges, getVcsTypeFromProvider, getVstsEnvironmentVariables } from "../../Utils/environment"; -import { getLineSeparatedItems, getOverwriteModeFromReplaceInput } from "../../Utils/inputs"; -import { assertOctoVersionAcceptsIds, getOrInstallOctoCommandRunner, connectionArguments, includeAdditionalArgumentsAndProxyConfig, argument, argumentEnquote, argumentIfSet, multiArgument } from "../../Utils/tool"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -export interface IOctopusBuildInformation { - BuildEnvironment: string; - BuildNumber: string; - BuildUrl: string; - Branch: string; - VcsType: string; - VcsRoot: string; - VcsCommitNumber: string; - Commits: IOctopusBuildInformationCommit[]; -} - -export interface IOctopusBuildInformationCommit { - Id: string; - Comment: string; -} - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const environment = getVstsEnvironmentVariables(); - const vstsConnection = createVstsConnection(environment); - - const space = tasks.getInput("Space"); - // @ts-expect-error - const packageIds = getLineSeparatedItems(tasks.getInput("PackageId", true)); - const packageVersion = tasks.getInput("PackageVersion", true); - // @ts-expect-error - const overwriteMode = getOverwriteModeFromReplaceInput(tasks.getInput("Replace", true)); - const additionalArguments = tasks.getInput("AdditionalArguments"); - - const branch = await getBuildBranch(vstsConnection); - const commits = await getBuildChanges(vstsConnection); - - const buildInformation: IOctopusBuildInformation = { - BuildEnvironment: "Azure DevOps", - BuildNumber: environment.buildNumber, - BuildUrl: environment.teamCollectionUri.replace(/\/$/, "") + "/" + environment.projectName + "/_build/results?buildId=" + environment.buildId, - // @ts-expect-error - Branch: branch, - VcsType: getVcsTypeFromProvider(environment.buildRepositoryProvider), - VcsRoot: environment.buildRepositoryUri, - VcsCommitNumber: environment.buildSourceVersion, - // @ts-expect-error - Commits: commits.map((change) => ({ Id: change.id, Comment: change.message })), - }; - - if (!environment.agentBuildDirectory) { - tasks.error("The Build Information step requires build information and therefore is not compatible with use in a Release pipeline."); - return; - } - - const buildInformationDir = path.join(environment.agentBuildDirectory, "octo"); - const buildInformationFile = path.join(buildInformationDir, `${environment.buildId}-buildinformation.json`); - await tasks.mkdirP(buildInformationDir); - await tasks.writeFile(buildInformationFile, JSON.stringify(buildInformation, null, 2)); - - await assertOctoVersionAcceptsIds(); - const octo = await getOrInstallOctoCommandRunner("build-information"); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - const configure: Array<(tool: ToolRunner) => ToolRunner> = [ - connectionArguments(connection), - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - multiArgument(argumentEnquote, "package-id", packageIds), - // @ts-expect-error - argument("version", packageVersion), - argumentEnquote("file", buildInformationFile), - argument("overwrite-mode", overwriteMode), - // @ts-expect-error - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(build-information;push;v4)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to push build information. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/task.json b/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/task.json deleted file mode 100644 index 3fe3f3fb..00000000 --- a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/task.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "id": "b1861ef4-b62e-40c1-bcb0-be00d454a8a7", - "name": "OctopusMetadata", - "friendlyName": "Push Package Build Information to Octopus (legacy)", - "description": "(legacy) There is a later version of this task, we recommend using the latest version. Collect information related to the build, including work items from commit messages, and push to your Octopus Deploy Server.", - "helpMarkDown": "set-by-pack.ps1", - "category": "Package", - "visibility": ["Build"], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "pickList", - "label": "Space", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The space within Octopus." - }, - { - "name": "PackageId", - "type": "multiLine", - "label": "Package IDs", - "defaultValue": "", - "required": true, - "helpMarkDown": "Newline-separated package IDs; e.g.\nMyCompany.MyApp\nMyCompany.MyApp2" - }, - { - "name": "PackageVersion", - "type": "string", - "label": "Package Version", - "defaultValue": "", - "required": true, - "helpMarkDown": "The version of the package; must be a valid [SemVer](http://semver.org/) version." - }, - { - "name": "Replace", - "type": "pickList", - "label": "Overwrite Mode", - "defaultValue": "false", - "required": true, - "helpMarkDown": "Normally, if the same package build information already exists on the server, the server will reject the package build information push. This is a good practice as it ensures build information isn't accidentally overwritten or ignored. Use this setting to override this behavior.", - "options": { - "false": "Fail if exists", - "true": "Overwrite existing", - "IgnoreIfExists": "Ignore if exists" - } - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctopusCliBuildInformation) for available parameters.", - "groupName": "advanced" - } - ], - "dataSourceBindings": [ - { - "target": "Space", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllSpaces", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Push Package Build Information to Octopus (legacy)", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Pack/PackV4/icon.png b/source/tasksLegacy/Pack/PackV4/icon.png deleted file mode 100644 index aae79512bdbe636d02f29e0df2ce1e022a9bf14e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 399 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XyaRkfT=geE`2YWZ^12tNpM0Nw^1Za4y@GrCjn_XzlJYk&O9__pP)pOyKjn_XNY%KN!@l^rhOoW^09)+pR`;?VM02NMt7JTf6n z?~{m0@HdHz6R(`j`I6Drs>%OxOKOG3TA!SwQ|>pLzvXwk)MWF2S*_rW{dW1jKe!AS Y-Y$}SQ}F9jD$oNAp00i_>zopr03iIossI20 diff --git a/source/tasksLegacy/Pack/PackV4/icon.svg b/source/tasksLegacy/Pack/PackV4/icon.svg deleted file mode 100644 index d9d027bc..00000000 --- a/source/tasksLegacy/Pack/PackV4/icon.svg +++ /dev/null @@ -1 +0,0 @@ -octopus \ No newline at end of file diff --git a/source/tasksLegacy/Pack/PackV4/index.ts b/source/tasksLegacy/Pack/PackV4/index.ts deleted file mode 100644 index 1c5b5135..00000000 --- a/source/tasksLegacy/Pack/PackV4/index.ts +++ /dev/null @@ -1,115 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import * as fs from "fs"; -import { ToolRunner } from "azure-pipelines-task-lib/toolrunner"; -import { getLineSeparatedItems, isNullOrWhitespace, removeTrailingSlashes, safeTrim } from "../../Utils/inputs"; -import { argument, argumentEnquote, argumentIfSet, flag, getOrInstallOctoCommandRunner, includeAdditionalArguments, multiArgument } from "../../Utils/tool"; -import os from "os"; - -export interface PackageRequiredInputs { - packageId: string; - packageFormat: string; -} -export interface PackageOptionalInputs { - packageVersion?: string; - outputPath?: string; - sourcePath?: string; - nuGetAuthor?: string; - nuGetTitle?: string; - nuGetDescription?: string; - nuGetReleaseNotes?: string; - nuGetReleaseNotesFile?: string; - include?: string[]; - listFiles: boolean; - overwrite: boolean; - additionalArguments: string; - compressionLevel: string; -} - -export type PackageInputs = PackageRequiredInputs & PackageOptionalInputs; - -export const configure = (inputs: PackageInputs) => { - return [ - argumentEnquote("id", inputs.packageId), - argument("format", inputs.packageFormat), - // @ts-ignore - argumentIfSet(argument, "version", inputs.packageVersion), - argumentIfSet(argument, "compressionlevel", inputs.compressionLevel), - // @ts-ignore - argumentIfSet(argumentEnquote, "outFolder", inputs.outputPath), - // @ts-ignore - argumentIfSet(argumentEnquote, "basePath", inputs.sourcePath), - // @ts-ignore - argumentIfSet(argumentEnquote, "author", inputs.nuGetAuthor), - // @ts-ignore - argumentIfSet(argumentEnquote, "title", inputs.nuGetTitle), - // @ts-ignore - argumentIfSet(argumentEnquote, "description", inputs.nuGetDescription), - // @ts-ignore - argumentIfSet(argumentEnquote, "releaseNotes", inputs.nuGetReleaseNotes), - argument("overwrite", inputs.overwrite.toString()), - includeAdditionalArguments(inputs.additionalArguments), - (tool: ToolRunner) => { - if (!isNullOrWhitespace(inputs.nuGetReleaseNotesFile) && fs.existsSync(inputs.nuGetReleaseNotesFile) && fs.lstatSync(inputs.nuGetReleaseNotesFile).isFile()) { - console.log(`Release notes file: ${inputs.nuGetReleaseNotesFile}`); - argumentEnquote("releaseNotesFile", inputs.nuGetReleaseNotesFile, tool); - } else { - console.log("No release notes file found"); - } - return tool; - }, - multiArgument(argumentEnquote, "include", inputs.include || []), - flag("verbose", inputs.listFiles), - ]; -}; - -export const getInputs = (): PackageInputs => { - return { - // @ts-ignore - packageId: tasks.getInput("PackageId", true), - // @ts-ignore - packageFormat: tasks.getInput("PackageFormat", true), - packageVersion: tasks.getInput("PackageVersion"), - outputPath: removeTrailingSlashes(safeTrim(tasks.getPathInput("OutputPath"))) || undefined, - sourcePath: removeTrailingSlashes(safeTrim(tasks.getPathInput("SourcePath"))) || undefined, - nuGetAuthor: tasks.getInput("NuGetAuthor"), - nuGetTitle: tasks.getInput("NuGetTitle"), - nuGetDescription: tasks.getInput("NuGetDescription"), - nuGetReleaseNotes: tasks.getInput("NuGetReleaseNotes"), - nuGetReleaseNotesFile: tasks.getInput("NuGetReleaseNotesFile", false), - overwrite: tasks.getBoolInput("Overwrite"), - // @ts-ignore - include: getLineSeparatedItems(tasks.getInput("Include")), - listFiles: tasks.getBoolInput("ListFiles"), - // @ts-ignore - additionalArguments: tasks.getInput("AdditionalArguments"), - // @ts-ignore - compressionLevel: tasks.getInput("CompressionLevel"), - }; -}; - -async function run() { - try { - tasks.warning(`This task is supported, but it no longer actively maintained. -It was originally created for the Octopus CLI when Octopus Deploy only supported NuGet packages. -It is recommended to migrate to the built-in 'Archive Files' task (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/archive-files). -Alternatively, if NuGet package metadata is required, consider using the 'NuGet' task (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/package/nuget) or the 'dotnet pack' task (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli).`); - - const octo = await getOrInstallOctoCommandRunner("pack"); - const configureTool = configure(getInputs()); - - const code: number = await octo - .map((x) => x.launchOcto(configureTool, "(package;pack;v4)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Pack succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to execute octo pack command. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Pack/PackV4/task.json b/source/tasksLegacy/Pack/PackV4/task.json deleted file mode 100644 index b53988f6..00000000 --- a/source/tasksLegacy/Pack/PackV4/task.json +++ /dev/null @@ -1,179 +0,0 @@ -{ - "id": "179fac12-2402-486e-80cf-5a6a8571f7c0", - "name": "OctopusPack", - "friendlyName": "Package Application for Octopus", - "description": "Package your application into a NuPkg or Zip file.", - "helpMarkDown": "set-by-pack.ps1", - "category": "Package", - "visibility": [ - "Build", - "Release" - ], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "nuget", - "displayName": "NuGet", - "isExpanded": false - }, - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "PackageId", - "type": "string", - "label": "Package ID", - "defaultValue": "", - "required": true, - "helpMarkDown": "The ID of the package. e.g. MyCompany.App" - }, - { - "name": "PackageFormat", - "type": "pickList", - "label": "Package Format", - "required": true, - "defaultValue": "NuPkg", - "options": { - "NuPkg": "NuPkg", - "Zip": "Zip" - }, - "helpMarkDown": "Package format. Must be either NuPkg or Zip." - }, - { - "name": "PackageVersion", - "type": "string", - "label": "Package Version", - "defaultValue": "", - "required": false, - "helpMarkDown": "The version of the package; must be a valid [SemVer](http://semver.org/) version; defaults to a timestamp-based version." - }, - { - "name": "SourcePath", - "type": "filePath", - "label": "Source Path", - "defaultValue": "", - "required": false, - "helpMarkDown": "The folder containing the files and folders to package. Defaults to working directory." - }, - { - "name": "OutputPath", - "type": "filePath", - "label": "Output Path", - "defaultValue": "", - "required": false, - "helpMarkDown": "The directory into which the generated package will be written. Defaults to working directory." - }, - { - "name": "NuGetAuthor", - "type": "string", - "label": "Author", - "defaultValue": "", - "required": false, - "helpMarkDown": "Add an author to the NuGet package metadata.", - "groupName": "nuget" - }, - { - "name": "NuGetTitle", - "type": "string", - "label": "Title", - "defaultValue": "", - "required": false, - "helpMarkDown": "Add a title to the NuGet package metadata.", - "groupName": "nuget" - }, - { - "name": "NuGetDescription", - "type": "string", - "label": "Description", - "defaultValue": "", - "required": false, - "helpMarkDown": "Add a description to the NuGet package metadata.", - "groupName": "nuget" - }, - { - "name": "NuGetReleaseNotes", - "type": "string", - "label": "Release Notes", - "defaultValue": "", - "required": false, - "helpMarkDown": "Add release notes to the NuGet package metadata.", - "groupName": "nuget" - }, - { - "name": "NuGetReleaseNotesFile", - "type": "filePath", - "label": "Release Notes File", - "defaultValue": "", - "required": false, - "helpMarkDown": "A file containing release notes to be added to the NuGet package metadata.", - "groupName": "nuget" - }, - { - "name": "Include", - "type": "multiLine", - "label": "Include", - "defaultValue": "", - "required": false, - "helpMarkDown": "File patterns to include, relative to the root path. e.g. /bin/*.dll", - "groupName": "advanced" - }, - { - "name": "Overwrite", - "type": "boolean", - "label": "Overwrite", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Allow an existing package of the same ID and version to be overwritten.", - "groupName": "advanced" - }, - { - "name": "ListFiles", - "type": "boolean", - "label": "Log Added Files", - "defaultValue": "false", - "required": "false", - "helpMarkDown": "Write a list of all files added to the build log.", - "groupName": "advanced" - }, - { - "name": "CompressionLevel", - "type": "pickList", - "label": "Compression Level", - "defaultValue": "optimal", - "required": false, - "helpMarkDown": "Set the compression level.", - "groupName": "advanced", - "options": { - "none": "None", - "fast": "Fast", - "optimal": "Optimal" - } - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctopusCliPack) for available parameters.", - "groupName": "advanced" - } - ], - "instanceNameFormat": "Package $(PackageId)", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Promote/PromoteV3/icon.png b/source/tasksLegacy/Promote/PromoteV3/icon.png deleted file mode 100644 index 0f1c1a7aa10ce39e27a6d85e44c9f440914e3bc3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 621 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XCI|S0xav=SAgyQr|NsB#C*LQpdto!{k#@r&857S>KmK|y zeA0F3-RURaYxlg-s@f5@{8_=)S9-nI6#WW6e)_DMI6=WZec#=$H(vkL$Xzo1b}US(G$pd5Hfjc=L##jy>z%tgnYz3J z2NpRo>s)V?YEWLZ;`OdahfT62*MFLx$MT>h>?*^SmarLDUNro<%d|b2ovV_m`W=Iw z&IFw|535(4XDH;idAP#gDsbDS1DjVr&YASISyzs~qmGYv#aiP6A-f5Vm1zd$pR10X znSbc4ac6UkDRfqa6 z=_HXVv(wc_)&`|aseii93Ax|&iGyn5Pmw#V> d{ZBA~f%lnJ$_HM<-@veE@O1TaS?83{1ONl5HsSyP diff --git a/source/tasksLegacy/Promote/PromoteV3/icon.svg b/source/tasksLegacy/Promote/PromoteV3/icon.svg deleted file mode 100644 index 94905963..00000000 --- a/source/tasksLegacy/Promote/PromoteV3/icon.svg +++ /dev/null @@ -1 +0,0 @@ -octopus \ No newline at end of file diff --git a/source/tasksLegacy/Promote/PromoteV3/index.ts b/source/tasksLegacy/Promote/PromoteV3/index.ts deleted file mode 100644 index 53b5eb44..00000000 --- a/source/tasksLegacy/Promote/PromoteV3/index.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { multiArgument, connectionArguments, includeAdditionalArgumentsAndProxyConfig, flag, argumentEnquote, argumentIfSet, getOrInstallOctoCommandRunner } from "../../Utils/tool"; -import { getOptionalCsvInput, getRequiredCsvInput } from "../../Utils/inputs"; -import { getDefaultOctopusConnectionDetailsOrThrow, resolveProjectName } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - // @ts-expect-error - const project = await resolveProjectName(connection, tasks.getInput("Project", true)).then((x) => x.value); - - const from = tasks.getInput("From", true); - const to = getRequiredCsvInput("To"); - const showProgress = tasks.getBoolInput("ShowProgress"); - const deploymentForTenants = getOptionalCsvInput("DeployForTenants"); - const deployForTenantTags = getOptionalCsvInput("DeployForTentantTags"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - - const octo = await getOrInstallOctoCommandRunner("promote-release"); - - const configure = [ - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - argumentEnquote("project", project), - connectionArguments(connection), - // @ts-expect-error - argumentEnquote("from", from), - multiArgument(argumentEnquote, "to", to), - multiArgument(argumentEnquote, "tenant", deploymentForTenants), - multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), - flag("progress", showProgress), - // @ts-expect-error - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(release;promote;v3)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded promoting release with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to promote release. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Promote/PromoteV3/task.json b/source/tasksLegacy/Promote/PromoteV3/task.json deleted file mode 100644 index 83b24410..00000000 --- a/source/tasksLegacy/Promote/PromoteV3/task.json +++ /dev/null @@ -1,173 +0,0 @@ -{ - "id": "1627fcfe-f292-4904-adac-26cfb14bdb07", - "name": "OctopusPromote", - "friendlyName": "Promote Octopus Release", - "description": "There is a later version of this task, we recommend using the latest version. Promote an Octopus release from one environment to another", - "helpMarkDown": "set-by-pack.ps1", - "category": "Deploy", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 3, - "Minor": 1, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "tenant", - "displayName": "Tenants", - "isExpanded": false - }, - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "string", - "label": "Space (Legacy - Use version 4 of this task)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "False" - }, - "helpMarkDown": "Version 3 of this task has limited support for spaces. We recommend using version 4 of this task for a better experience." - }, - { - "name": "ProjectGroup", - "type": "pickList", - "label": "Project Group", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." - }, - { - "name": "Project", - "type": "pickList", - "label": "Project", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Octopus Deploy Project Name" - }, - { - "name": "From", - "type": "pickList", - "label": "Promote From", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The environment the release is currently deployed to. e.g. 'Staging'" - }, - { - "name": "To", - "type": "pickList", - "label": "Promote To", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Comma separated list of environments to deploy to" - }, - { - "name": "ShowProgress", - "type": "boolean", - "label": "Show Deployment Progress", - "defaultValue": "False", - "required": false, - "helpMarkDown": "If checked, the build process will only succeed if the deployment is successful." - }, - { - "name": "DeployForTenants", - "type": "pickList", - "label": "Tenant(s)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Promote the release for this comma delimited list of tenants. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", - "groupName": "tenant" - }, - { - "name": "DeployForTenantTags", - "type": "string", - "label": "Tenant Tag(s)", - "defaultValue": "", - "required": false, - "helpMarkDown": "Promote the release for tenants who match these tags and are ready to deploy to the provided environment.", - "groupName": "tenant" - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExePromoteRelease) for available parameters.", - "groupName": "advanced" - } - ], - "dataSourceBindings": [ - { - "target": "ProjectGroup", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllProjectGroups", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Project", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusListProjectsInProjectGroup", - "parameters": { - "ProjectGroupId": "$(ProjectGroup)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "From", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllEnvironments", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "To", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllEnvironments", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployForTenants", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllTenants", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Promote $(Project) from $(From) to $(To)", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Promote/PromoteV4/icon.png b/source/tasksLegacy/Promote/PromoteV4/icon.png deleted file mode 100644 index 0f1c1a7aa10ce39e27a6d85e44c9f440914e3bc3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 621 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XCI|S0xav=SAgyQr|NsB#C*LQpdto!{k#@r&857S>KmK|y zeA0F3-RURaYxlg-s@f5@{8_=)S9-nI6#WW6e)_DMI6=WZec#=$H(vkL$Xzo1b}US(G$pd5Hfjc=L##jy>z%tgnYz3J z2NpRo>s)V?YEWLZ;`OdahfT62*MFLx$MT>h>?*^SmarLDUNro<%d|b2ovV_m`W=Iw z&IFw|535(4XDH;idAP#gDsbDS1DjVr&YASISyzs~qmGYv#aiP6A-f5Vm1zd$pR10X znSbc4ac6UkDRfqa6 z=_HXVv(wc_)&`|aseii93Ax|&iGyn5Pmw#V> d{ZBA~f%lnJ$_HM<-@veE@O1TaS?83{1ONl5HsSyP diff --git a/source/tasksLegacy/Promote/PromoteV4/icon.svg b/source/tasksLegacy/Promote/PromoteV4/icon.svg deleted file mode 100644 index 94905963..00000000 --- a/source/tasksLegacy/Promote/PromoteV4/icon.svg +++ /dev/null @@ -1 +0,0 @@ -octopus \ No newline at end of file diff --git a/source/tasksLegacy/Promote/PromoteV4/index.ts b/source/tasksLegacy/Promote/PromoteV4/index.ts deleted file mode 100644 index 672fc0bd..00000000 --- a/source/tasksLegacy/Promote/PromoteV4/index.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { argumentEnquote, argumentIfSet, assertOctoVersionAcceptsIds, connectionArguments, flag, getOrInstallOctoCommandRunner, includeAdditionalArgumentsAndProxyConfig, multiArgument } from "../../Utils/tool"; -import { getOptionalCsvInput, getRequiredCsvInput } from "../../Utils/inputs"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - const project = tasks.getInput("Project", true); - const from = tasks.getInput("From", true); - const to = getRequiredCsvInput("To"); - const deployForTenants = getOptionalCsvInput("DeployForTenants"); - const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); - const showProgress = tasks.getBoolInput("ShowProgress"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - - await assertOctoVersionAcceptsIds(); - const octo = await getOrInstallOctoCommandRunner("promote-release"); - - const configure = [ - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - // @ts-expect-error - argumentEnquote("project", project), - connectionArguments(connection), - // @ts-expect-error - argumentEnquote("from", from), - multiArgument(argumentEnquote, "to", to), - multiArgument(argumentEnquote, "tenant", deployForTenants), - multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), - flag("progress", showProgress), - // @ts-expect-error - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(release;promote;v4)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded promoting release with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to promote release. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Promote/PromoteV4/task.json b/source/tasksLegacy/Promote/PromoteV4/task.json deleted file mode 100644 index d29b100f..00000000 --- a/source/tasksLegacy/Promote/PromoteV4/task.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "id": "1627fcfe-f292-4904-adac-26cfb14bdb07", - "name": "OctopusPromote", - "friendlyName": "Promote Octopus Release", - "description": "There is a later version of this task, we recommend using the latest version. Promote an Octopus release from one environment to another", - "helpMarkDown": "set-by-pack.ps1", - "category": "Deploy", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "tenant", - "displayName": "Tenants", - "isExpanded": false - }, - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "pickList", - "label": "Space", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The space within Octopus." - }, - { - "name": "ProjectGroup", - "type": "pickList", - "label": "Project Group", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." - }, - { - "name": "Project", - "type": "pickList", - "label": "Project", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project within Octopus." - }, - { - "name": "From", - "type": "pickList", - "label": "Promote From", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The environment the release is currently deployed to. e.g. 'Staging'" - }, - { - "name": "To", - "type": "pickList", - "label": "Promote To", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Comma separated list of environments to deploy to" - }, - { - "name": "ShowProgress", - "type": "boolean", - "label": "Show Deployment Progress", - "defaultValue": "False", - "required": false, - "helpMarkDown": "If checked, the build process will only succeed if the deployment is successful." - }, - { - "name": "DeployForTenants", - "type": "pickList", - "label": "Tenant(s)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Promote the release for this comma delimited list of tenants. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", - "groupName": "tenant" - }, - { - "name": "DeployForTenantTags", - "type": "string", - "label": "Tenant Tag(s)", - "defaultValue": "", - "required": false, - "helpMarkDown": "Promote the release for tenants who match these tags and are ready to deploy to the provided environment.", - "groupName": "tenant" - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExePromoteRelease) for available parameters.", - "groupName": "advanced" - } - ], - "dataSourceBindings": [ - { - "target": "Space", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllSpaces", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "ProjectGroup", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllProjectGroupsInSpace", - "parameters": { - "SpaceId": "$(Space)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Project", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusListProjectsInProjectGroupInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectGroupId": "$(ProjectGroup)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "From", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectEnvironmentsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectId": "$(Project)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "To", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectEnvironmentsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectId": "$(Project)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployForTenants", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectTenantsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectName": "$(Project)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Promote Project in Octopus", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Push/PushV3/icon.png b/source/tasksLegacy/Push/PushV3/icon.png deleted file mode 100644 index 236566a308c71c4b35ce91fa54e6914d05fb8d7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 481 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X5(0ceT=geE`2YXEw4QzPx)(OH9^H8T^V5&NwR_$iJAMB2 zlkd|{z7JdeY{`X>D>rQ4clWDC?vm|$4|^_rGX3O-f~~JMUjO{`<8KR(@UBDe9zA_7 zW8(Sr({J6jGn&@kn#Jq<8&?5MzN-Gj8RWW>AirQB7aw4ViIIK_RQuY~#WAGf)|JUO zg_;dGToq^cx@BK|*Zu$hbk@acQL?{p++$Bya%U26DRcg?yrHafN@ijhgZ4r1rD>cV z3NIEYFVJzex!AERaEc521I41Md6xGQ)F%rjx;bztnH<-Cb9A{1o6Eh}1U819ca*nG zm+fZUxZM1v#PO~^%`NJJE-iDIgrXGHTDTmJtv%Q9TK0{={z`MZhK=0Z+>-MIj5Y|y z9A0xm?Mgz*b=ND;xTpNT7s&dg{Nhgm$)%1_;l&3Qg-X3%IeF*&R+q&G0y|G#y{PkN zL&dCBCvNy}vz?b_|L$w;kE+Gn%0G$!U$dQonSt+$*N$DY75)Id&EVoctopus \ No newline at end of file diff --git a/source/tasksLegacy/Push/PushV3/index.ts b/source/tasksLegacy/Push/PushV3/index.ts deleted file mode 100644 index e002e3a0..00000000 --- a/source/tasksLegacy/Push/PushV3/index.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; - -import { multiArgument, connectionArguments, includeAdditionalArgumentsAndProxyConfig, flag, argumentEnquote, argumentIfSet, getOrInstallOctoCommandRunner } from "../../Utils/tool"; -import { getLineSeparatedItems, resolveGlobs } from "../../Utils/inputs"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - // @ts-expect-error - const packages = getLineSeparatedItems(tasks.getInput("Package", true)); - const replace = tasks.getBoolInput("Replace"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - - const octo = await getOrInstallOctoCommandRunner("push"); - const matchedPackages = await resolveGlobs(packages); - - const configure = [ - connectionArguments(connection), - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - multiArgument(argumentEnquote, "package", matchedPackages), - flag("replace-existing", replace), - // @ts-expect-error - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(package;push;v3)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to push package. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Push/PushV3/task.json b/source/tasksLegacy/Push/PushV3/task.json deleted file mode 100644 index 5d6384ad..00000000 --- a/source/tasksLegacy/Push/PushV3/task.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "id": "d05ad9a2-5d9e-4a1c-a887-14034334d6f2", - "name": "OctopusPush", - "friendlyName": "Push Package(s) to Octopus", - "description": "There is a later version of this task, we recommend using the latest version. Push your NuGet or Zip package to your Octopus Deploy Server", - "helpMarkDown": "set-by-pack.ps1", - "category": "Package", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 3, - "Minor": 1, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "string", - "label": "Space (Legacy - Use version 4 of this task)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "False" - }, - "helpMarkDown": "Version 3 of this task has limited support for spaces. We recommend using version 4 of this task for a better experience." - }, - { - "name": "Package", - "type": "multiLine", - "label": "Package", - "defaultValue": "", - "required": true, - "helpMarkDown": "Package file to push. To push multiple packages, enter on multiple lines." - }, - { - "name": "Replace", - "type": "boolean", - "label": "Replace Existing", - "defaultValue": "False", - "required": true, - "helpMarkDown": "If the package already exists in the repository, the default behavior is to reject the new package being pushed. Set this flag to 'True' to overwrite the existing package." - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExePush) for available parameters.", - "groupName": "advanced" - } - ], - "instanceNameFormat": "Push Packages to Octopus", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Push/PushV4/icon.png b/source/tasksLegacy/Push/PushV4/icon.png deleted file mode 100644 index 236566a308c71c4b35ce91fa54e6914d05fb8d7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 481 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X5(0ceT=geE`2YXEw4QzPx)(OH9^H8T^V5&NwR_$iJAMB2 zlkd|{z7JdeY{`X>D>rQ4clWDC?vm|$4|^_rGX3O-f~~JMUjO{`<8KR(@UBDe9zA_7 zW8(Sr({J6jGn&@kn#Jq<8&?5MzN-Gj8RWW>AirQB7aw4ViIIK_RQuY~#WAGf)|JUO zg_;dGToq^cx@BK|*Zu$hbk@acQL?{p++$Bya%U26DRcg?yrHafN@ijhgZ4r1rD>cV z3NIEYFVJzex!AERaEc521I41Md6xGQ)F%rjx;bztnH<-Cb9A{1o6Eh}1U819ca*nG zm+fZUxZM1v#PO~^%`NJJE-iDIgrXGHTDTmJtv%Q9TK0{={z`MZhK=0Z+>-MIj5Y|y z9A0xm?Mgz*b=ND;xTpNT7s&dg{Nhgm$)%1_;l&3Qg-X3%IeF*&R+q&G0y|G#y{PkN zL&dCBCvNy}vz?b_|L$w;kE+Gn%0G$!U$dQonSt+$*N$DY75)Id&EVoctopus \ No newline at end of file diff --git a/source/tasksLegacy/Push/PushV4/index.ts b/source/tasksLegacy/Push/PushV4/index.ts deleted file mode 100644 index bd8d0671..00000000 --- a/source/tasksLegacy/Push/PushV4/index.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; - -import { getLineSeparatedItems, getOverwriteModeFromReplaceInput, resolveGlobs } from "../../Utils/inputs"; -import { argument, argumentEnquote, argumentIfSet, assertOctoVersionAcceptsIds, connectionArguments, getOrInstallOctoCommandRunner, includeAdditionalArgumentsAndProxyConfig, multiArgument } from "../../Utils/tool"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - // @ts-expect-error - const packages = getLineSeparatedItems(tasks.getInput("Package", true)); - // @ts-expect-error - const overwriteMode = getOverwriteModeFromReplaceInput(tasks.getInput("Replace", true)); - const additionalArguments = tasks.getInput("AdditionalArguments"); - - await assertOctoVersionAcceptsIds(); - const octo = await getOrInstallOctoCommandRunner("push"); - const matchedPackages = await resolveGlobs(packages); - - const configure = [ - connectionArguments(connection), - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - multiArgument(argumentEnquote, "package", matchedPackages), - argument("overwrite-mode", overwriteMode), - // @ts-expect-error - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(package;push;v4)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to push package. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Push/PushV4/task.json b/source/tasksLegacy/Push/PushV4/task.json deleted file mode 100644 index f9aceb43..00000000 --- a/source/tasksLegacy/Push/PushV4/task.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "id": "d05ad9a2-5d9e-4a1c-a887-14034334d6f2", - "name": "OctopusPush", - "friendlyName": "Push Package(s) to Octopus", - "description": "There is a later version of this task, we recommend using the latest version. Push your NuGet or Zip package to your Octopus Deploy Server", - "helpMarkDown": "set-by-pack.ps1", - "category": "Package", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "pickList", - "label": "Space", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The space within Octopus." - }, - { - "name": "Package", - "type": "multiLine", - "label": "Package", - "defaultValue": "", - "required": true, - "helpMarkDown": "Package file to push. To push multiple packages, enter on multiple lines." - }, - { - "name": "Replace", - "type": "pickList", - "label": "Overwrite Mode", - "defaultValue": "false", - "required": true, - "helpMarkDown": "Normally, if the same package already exists on the server, the server will reject the package push. This is a good practice as it ensures a package isn't accidentally overwritten or ignored. Use this setting to override this behavior.", - "options": { - "false": "Fail if exists", - "true": "Overwrite existing", - "IgnoreIfExists": "Ignore if exists" - } - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExePush) for available parameters.", - "groupName": "advanced" - } - ], - "dataSourceBindings": [ - { - "target": "Space", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllSpaces", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Push Packages to Octopus", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Utils/OctoApiKeyHandler.ts b/source/tasksLegacy/Utils/OctoApiKeyHandler.ts deleted file mode 100644 index 64d7f4c9..00000000 --- a/source/tasksLegacy/Utils/OctoApiKeyHandler.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { IRequestHandler, IHttpClientResponse } from "typed-rest-client/Interfaces"; -import * as http from "http"; - -export class OctoApiKeyHandler implements IRequestHandler { - key: string; - - constructor(key: string) { - this.key = key; - } - - prepareRequest(options: http.RequestOptions): void { - // @ts-expect-error - options.headers["X-Octopus-ApiKey"] = this.key; - } - - canHandleAuthentication(): boolean { - return false; - } - - handleAuthentication(): Promise { - throw "This handler does not handle authentication."; - } -} - -export default OctoApiKeyHandler; diff --git a/source/tasksLegacy/Utils/connection.ts b/source/tasksLegacy/Utils/connection.ts deleted file mode 100644 index 54234a33..00000000 --- a/source/tasksLegacy/Utils/connection.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { RestClient } from "typed-rest-client/RestClient"; -import { getDefaultOctoConnectionInputValue } from "./inputs"; -import { either } from "fp-ts"; -import OctoApiKeyHandler from "./OctoApiKeyHandler"; - -export interface OctoServerConnectionDetails { - url: string; - apiKey: string; - ignoreSslErrors: boolean; -} - -export function getDefaultOctopusConnectionDetailsOrThrow() { - const result = getDefaultOctoConnectionInputValue().map(getOctopusConnectionDetails).toNullable(); - if (!result) { - throw new Error("Could not retrieve default Octo connection information"); - } - return result; -} - -export function getOctopusConnectionDetails(name: string): OctoServerConnectionDetails { - const octoEndpointAuthorization = tasks.getEndpointAuthorization(name, false); - const ignoreSSL = tasks.getEndpointDataParameter(name, "ignoreSslErrors", true); - return { - // @ts-expect-error - url: tasks.getEndpointUrl(name, false), - // @ts-expect-error - apiKey: octoEndpointAuthorization.parameters["apitoken"], - ignoreSslErrors: !!ignoreSSL && ignoreSSL.toLowerCase() === "true", - }; -} - -export function fetchProjectName(details: OctoServerConnectionDetails, projectId: string) { - console.log("Ignore SSL: " + details.ignoreSslErrors); - const client = new RestClient("OctoTFS", details.url, [new OctoApiKeyHandler(details.apiKey)], { ignoreSslError: details.ignoreSslErrors }); - return client - .get<{ Name: string }>(`api/projects/${projectId}`) - .then((x) => { - if (x.result) { - return either.right(x.result.Name); - } - - return either.left(`Could not resolve project name given id "${projectId}". Server returned status code: ${x.statusCode}`); - }) - .catch((error) => either.left(error)); -} - -export const isProjectId = (projectNameOrId: string) => /\w*Projects-\d*/.test(projectNameOrId); - -export function resolveProjectName(connection: OctoServerConnectionDetails, projectNameOrId: string) { - if (isProjectId(projectNameOrId)) { - return fetchProjectName(connection, projectNameOrId); - } - - return Promise.resolve(either.right(projectNameOrId)); -} diff --git a/source/tasksLegacy/Utils/environment.ts b/source/tasksLegacy/Utils/environment.ts deleted file mode 100644 index fdf704d5..00000000 --- a/source/tasksLegacy/Utils/environment.ts +++ /dev/null @@ -1,243 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as path from "path"; -import { v4 as uuidv4 } from "uuid"; -import * as vsts from "azure-devops-node-api/WebApi"; -import * as wit from "azure-devops-node-api/interfaces/WorkItemTrackingInterfaces"; -import * as bi from "azure-devops-node-api/interfaces/BuildInterfaces"; -import * as tasks from "azure-pipelines-task-lib"; -import { isNullOrWhitespace } from "./inputs"; - -export interface ReleaseEnvironmentVariables { - releaseName: string; - releaseId: string; - releaseUri: string; -} - -export interface BuildEnvironmentVariables { - buildNumber: string; - buildId: number; - buildName: string; - buildRepositoryName: string; - buildRepositoryProvider: string; - buildRepositoryUri: string; - buildSourceVersion: string; -} - -export interface AgentEnvironmentVariables { - agentBuildDirectory: string; -} - -export interface SystemEnvironmentVariables { - projectName: string; - projectId: string; - teamCollectionUri: string; - defaultWorkingDirectory: string; -} - -export type VstsEnvironmentVariables = ReleaseEnvironmentVariables & BuildEnvironmentVariables & AgentEnvironmentVariables & SystemEnvironmentVariables; - -export const getVstsEnvironmentVariables = (): VstsEnvironmentVariables => { - return { - projectId: process.env["SYSTEM_TEAMPROJECTID"] || "", - projectName: process.env["SYSTEM_TEAMPROJECT"] || "", - buildNumber: process.env["BUILD_BUILDNUMBER"] || "", - buildId: Number(process.env["BUILD_BUILDID"]), - buildName: process.env["BUILD_DEFINITIONNAME"] || "", - buildRepositoryName: process.env["BUILD_REPOSITORY_NAME"] || "", - releaseName: process.env["RELEASE_RELEASENAME"] || "", - releaseUri: process.env["RELEASE_RELEASEWEBURL"] || "", - releaseId: process.env["RELEASE_RELEASEID"] || "", - teamCollectionUri: process.env["SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"] || "", - defaultWorkingDirectory: process.env["SYSTEM_DEFAULTWORKINGDIRECTORY"] || "", - buildRepositoryProvider: process.env["BUILD_REPOSITORY_PROVIDER"] || "", - buildRepositoryUri: process.env["BUILD_REPOSITORY_URI"] || "", - buildSourceVersion: process.env["BUILD_SOURCEVERSION"] || "", - agentBuildDirectory: process.env["AGENT_BUILDDIRECTORY"] || "", - }; -}; - -export const generateReleaseNotesContent = (environment: VstsEnvironmentVariables, linkedItemReleaseNote: string, customReleaseNotes: string) => { - let notes = "Release created by "; - const buildUri = `${environment.teamCollectionUri}${encodeURIComponent(environment.projectName)}/_build/index?_a=summary&buildId=${environment.buildId}`; - - if (!isNullOrWhitespace(environment.releaseId)) { - notes += `Release Management Release [${environment.releaseName} #${environment.releaseId}](${environment.releaseUri}) `; - } - - if (environment.buildId) { - notes += `Build [${environment.buildName} #${environment.buildNumber}](${buildUri}) from the ${environment.buildRepositoryName} repository `; - } - - notes += `in Team Project ${environment.projectName}`; - if (!isNullOrWhitespace(linkedItemReleaseNote)) { - notes += `\r\n\r\n${linkedItemReleaseNote}`; - } - - if (!isNullOrWhitespace(customReleaseNotes)) { - notes += `\r\n\r\n**Custom Notes:**`; - notes += `\r\n\r\n${customReleaseNotes}`; - } - - return notes; -}; - -export const createReleaseNotesFile = (content: () => string, directory: string): string => { - const filePath = path.join(directory, `release-notes-${uuidv4()}.md`); - tasks.writeFile(filePath, content(), { encoding: "utf8" }); - return filePath; -}; - -export const getWorkItemState = (workItem: wit.WorkItem) => { - return `${workItem && workItem.fields ? workItem.fields["System.State"] : ""}`; -}; - -export const getWorkItemTags = (workItem: wit.WorkItem) => { - if (workItem && workItem.fields && !isNullOrWhitespace(workItem.fields["System.Tags"])) { - const tags = workItem.fields["System.Tags"].split(";"); - return tags.reduce((prev: string, current: string) => { - return (prev += `${current}`); - }, ""); - } - - return ""; -}; - -export const getLinkedReleaseNotes = async (client: vsts.WebApi, includeComments: boolean, includeWorkItems: boolean) => { - const environment = getVstsEnvironmentVariables(); - console.log(`Environment = ${environment.buildRepositoryProvider}`); - console.log(`Comments = ${includeComments}, WorkItems = ${includeWorkItems}`); - - try { - const changes = await client.getBuildApi().then((x) => x.getBuildChanges(environment.projectName, environment.buildId)); - - let releaseNotes = ""; - const newLine = "\r\n\r\n"; - - if (includeComments) { - if (environment.buildRepositoryProvider === "TfsVersionControl") { - console.log("Adding changeset comments to release notes"); - releaseNotes += changes.reduce((prev, current) => { - // @ts-expect-error - return prev + `* [${current.id} - ${current.author.displayName}](${getChangesetUrl(environment, current.location)}): ${current.message}${newLine}`; - }, `**Changeset Comments:**${newLine}`); - } else if (environment.buildRepositoryProvider === "TfsGit") { - /* - TfsGit repo has a known URL that individual commits can be linked to, - so the release notes have markdown URLs - */ - console.log("Adding commit message to release notes"); - releaseNotes += changes.reduce((prev, current) => { - // @ts-expect-error - return prev + `* [${current.id} - ${current.author.displayName}](${getCommitUrl(environment, current)}): ${current.message}${newLine}`; - }, `**Commit Messages:**${newLine}`); - } else { - /* - This could be any other git repo like Git, GitHub, SVN etc. We don't know - how to link to the commits here, so leave out the URLs. - */ - console.log("Adding commit message to release notes"); - releaseNotes += changes.reduce((prev, current) => { - // @ts-expect-error - return prev + `* ${current.id} - ${current.author.displayName}: ${current.message}${newLine}`; - }, `**Commit Messages:**${newLine}`); - } - } - - if (includeWorkItems) { - console.log("adding work items to release notes"); - releaseNotes += `**Work Items:**${newLine}`; - - const workItemRefs = await client.getBuildApi().then((x) => x.getBuildWorkItemsRefs(environment.projectName, environment.buildId)); - - if (workItemRefs.length > 0) { - const workItems = await client.getWorkItemTrackingApi().then((x) => x.getWorkItems(workItemRefs.map((x) => Number(x.id)))); - - const workItemEditBaseUri = `${environment.teamCollectionUri}${environment.projectId}/_workitems/edit`; - releaseNotes += workItems.reduce((prev, current) => { - // @ts-expect-error - return (prev += `* [${current.id}](${workItemEditBaseUri}/${current.id}): ${current.fields["System.Title"]} ${getWorkItemState(current)} ${getWorkItemTags(current)} ${newLine}`); - }, ""); - } - } - - console.log(`Release notes:\r\n${releaseNotes}`); - return releaseNotes; - } catch (ex) { - console.log("An exception was thrown while building the release notes."); - console.log(ex); - console.log("See https://github.com/OctopusDeploy/OctoTFS/issues/107 for more details."); - console.log("The release notes will be empty."); - return ""; - } -}; - -const getChangesetUrl = (environment: VstsEnvironmentVariables, apiUrl: string) => { - const workItemId = apiUrl.substr(apiUrl.lastIndexOf("/") + 1); - return `${environment.teamCollectionUri}${environment.projectId}/_versionControl/changeset/${workItemId}`; -}; - -const getCommitUrl = (environment: VstsEnvironmentVariables, change: bi.Change) => { - const commitId = change.id; - // @ts-expect-error - const segments = change.location.split("/"); - const repositoryId = segments[segments.length - 3]; - return `${environment.teamCollectionUri}${environment.projectId}/_git/${repositoryId}/commit/${commitId}`; -}; - -export const createVstsConnection = (environment: SystemEnvironmentVariables) => { - const vstsAuthorization = tasks.getEndpointAuthorization("SystemVssConnection", true); - // @ts-expect-error - const token = vstsAuthorization.parameters["AccessToken"]; - const authHandler = vsts.getPersonalAccessTokenHandler(token); - return new vsts.WebApi(environment.teamCollectionUri, authHandler); -}; - -export const getVcsTypeFromProvider = (buildRepositoryProvider: string) => { - switch (buildRepositoryProvider) { - case "TfsGit": - case "GitHub": - return "Git"; - case "TfsVersionControl": - return "TFVC"; - default: - return buildRepositoryProvider; - } -}; - -export const getBuildBranch = async (client: vsts.WebApi) => { - const environment = getVstsEnvironmentVariables(); - const api = await client.getBuildApi(); - return (await api.getBuild(environment.projectName, environment.buildId)).sourceBranch; -}; - -export const getBuildChanges = async (client: vsts.WebApi) => { - const environment = getVstsEnvironmentVariables(); - const api = await client.getBuildApi(); - const gitApi = await client.getGitApi(); - - const changes = await api.getBuildChanges(environment.projectName, environment.buildId, undefined, 100000); - - if (environment.buildRepositoryProvider === "TfsGit") { - const promises = changes.map(async (x) => { - if (x.messageTruncated) { - // @ts-expect-error - const segments = x.location.split("/"); - const repositoryId = segments[segments.length - 3]; - - try { - // @ts-expect-error - const commit = await gitApi.getCommit(x.id, repositoryId); - x.message = commit.comment; - } catch (err) { - tasks.warning(`Using a truncated commit message for commit ${x.id}, because an error occurred while fetching the full message. ${err}`); - } - } - - return x; - }); - - await Promise.all(promises); - } - - return changes; -}; diff --git a/source/tasksLegacy/Utils/inputs.ts b/source/tasksLegacy/Utils/inputs.ts deleted file mode 100644 index ac8cb1b5..00000000 --- a/source/tasksLegacy/Utils/inputs.ts +++ /dev/null @@ -1,74 +0,0 @@ -import * as tasks from "azure-pipelines-task-lib/task"; -import { option } from "fp-ts"; -import glob from "glob"; -import { flatten } from "ramda"; - -export enum ReplaceOverwriteMode { - false = "FailIfExists", - true = "OverwriteExisting", - IgnoreIfExists = "IgnoreIfExists", -} - -export function getOverwriteModeFromReplaceInput(replace: string): ReplaceOverwriteMode { - return ReplaceOverwriteMode[replace as keyof typeof ReplaceOverwriteMode] || ReplaceOverwriteMode.false; -} - -export const DefaultOctoConnectionInputName = "OctoConnectedServiceName"; - -export const pGlobNoNull = (pattern: string): Promise => { - return new Promise((resolve, reject) => { - glob(pattern, { nonull: true }, (err, matches) => { - if (err) { - reject(err); - return; - } - resolve(matches); - }); - }); -}; - -export function isNullOrWhitespace(value: string | null | undefined): value is null | undefined { - return !value || !/\S/.test(value); -} - -export function safeTrim(value: string | null | undefined): string | null | undefined { - return value ? value.trim() : value; -} - -export function removeTrailingSlashes(value: string | null | undefined): string | null | undefined { - return value ? value.replace(/[/\\]+(?=\s*)$/, "") : value; -} - -export function getLineSeparatedItems(value: string): Array { - return value ? value.split(/[\r\n]+/g).map((x) => x.trim()) : []; -} - -const getRequiredInput = (name: string) => { - return option.fromNullable(tasks.getInput(name, true)); -}; - -const splitComma = (x: string) => x.split(",").map((x) => x.trim()); - -const getOptionalInput = (name: string) => { - return option.fromNullable(tasks.getInput(name, false)); -}; - -export const getOptionalCsvInput = (name: string) => { - return getOptionalInput(name).map(splitComma).getOrElse([]); -}; - -export const getRequiredCsvInput = (name: string) => { - return getRequiredInput(name).map(splitComma).getOrElse([]); -}; - -export { getRequiredInput, getOptionalInput }; - -export function getDefaultOctoConnectionInputValue() { - return getRequiredInput(DefaultOctoConnectionInputName); -} - -export const resolveGlobs = (globs: string[]): Promise => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - return Promise.all(globs.map(pGlobNoNull)).then((x) => flatten(x)); -}; diff --git a/source/tasksLegacy/Utils/install.ts b/source/tasksLegacy/Utils/install.ts deleted file mode 100644 index 2c2e00ef..00000000 --- a/source/tasksLegacy/Utils/install.ts +++ /dev/null @@ -1,192 +0,0 @@ -import * as path from "path"; -import * as fs from "fs"; -import * as tasks from "azure-pipelines-task-lib/task"; -import * as tools from "azure-pipelines-tool-lib/tool"; -import * as TypedRestClient from "typed-rest-client/RestClient"; -import { head, filter } from "ramda"; -import { IProxyConfiguration } from "typed-rest-client/Interfaces"; -import { ToolName, ToolNameBeforeV7 } from "./tool"; - -interface LatestResponse { - latest: string; - downloads: DownloadOption[]; -} - -type DownloadOption = { - version: string; - template: string; - location: string; - extension: string; - platform?: string; - architecture?: string; -}; - -type Primitive = undefined | null | boolean | number | string; - -interface Dictionary { - [key: string]: Primitive; -} - -const RestClient = TypedRestClient.RestClient; -const OctopurlsUrl = "https://g.octopushq.com"; - -const applyTemplate = (dictionary: Dictionary, template: string) => { - return Object.keys(dictionary).reduce((result, key) => result.replace(new RegExp(`{${key}}`, "g"), dictionary[key] ? String(dictionary[key]) : ""), template); -}; - -const isPortableDownloadOption = (option: DownloadOption) => { - return option.platform === "portable" && option.extension === ".zip"; -}; - -const filterPortableDownload = (options: DownloadOption[]) => head(filter(isPortableDownloadOption, options)); - -const extract = (archivePath: string) => { - return tools.extractZip(archivePath); -}; - -function getExecutableExtension(): string { - return ".dll"; -} - -function getLocalTool(version: string): string { - console.log("Checking local tool cache"); - return tools.findLocalTool(ToolName, version) || tools.findLocalTool(ToolNameBeforeV7, version); -} - -function findOcto(rootFolder: string) { - const octoPath = [path.join(rootFolder, "*" + ToolName + getExecutableExtension()), path.join(rootFolder, "*" + ToolNameBeforeV7 + getExecutableExtension())]; - console.log(`Looking for ${octoPath}`); - const allPaths = tasks.find(rootFolder); - const matches = tasks.match(allPaths, octoPath, rootFolder); - return matches[0]; -} - -async function getOrDownloadOcto(option: DownloadOption, download?: (option: DownloadOption) => Promise, extractTool = true): Promise { - let cachedToolPath = getLocalTool(option.version); - - if (!cachedToolPath) { - try { - console.log("Attempting to download the Octopus CLI tool"); - const downloadPath = await (download !== undefined && download != null ? download(option) : tools.downloadTool(option.location)); - const toolPath = extractTool ? await extract(downloadPath) : downloadPath; - - tools.debug(`Adding ${ToolName} ${option.version} to cache`); - tasks.writeFile(path.join(toolPath, `${ToolName}.cmd`), `dotnet "%~dp0/${ToolName}.dll" %*`); - cachedToolPath = await tools.cacheDir(toolPath, ToolName, option.version); - } catch (exception) { - throw new Error(`Failed to download Octopus CLI tool version ${option.version}. ${exception}`); - } - } - - const octoPath = findOcto(cachedToolPath); - if (!octoPath) { - throw new Error("The Octopus CLI tool wasn't found in tools directory"); - } - - tools.debug(`Found ${ToolName} at ${octoPath}`); - - fs.chmodSync(octoPath, "777"); - - tools.debug(`chmod for ${octoPath} applied`); - - return octoPath; -} - -async function resolvePublishedOctoVersion(version?: string): Promise { - if (!version) { - version = "latest"; - } - console.log(`Attempting to contact ${OctopurlsUrl} to find Octopus CLI tool version ${version}`); - - const proxyConfiguration = tasks.getHttpProxyConfiguration(OctopurlsUrl); - let proxySettings: IProxyConfiguration | undefined = undefined; - - if (proxyConfiguration) { - console.log( - "Using agent configured proxy. If this command should not be sent via the agent's proxy, you might need to add or modify the agent's .proxybypass file. See https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/proxy#specify-proxy-bypass-urls." - ); - proxySettings = { - proxyUrl: proxyConfiguration.proxyUrl, - proxyUsername: proxyConfiguration.proxyUsername, - proxyPassword: proxyConfiguration.proxyPassword, - proxyBypassHosts: proxyConfiguration.proxyBypassHosts, - }; - } - - const octopurls = new RestClient("OctoTFS/Tasks", OctopurlsUrl, undefined, { proxy: proxySettings }); - - const response = await octopurls.get("LatestTools"); - - if (response.result === null || response.result === undefined) { - throw Error(`Failed to resolve Octopus CLI tool version ${version}. Endpoint returned status code ${response.statusCode})`); - } - - const option = filterPortableDownload(response.result.downloads); - - if (option === null || option === undefined) { - throw Error(`Failed to resolve the Octopus CLI tool portable download location. The result did not contain the download location.`); - } - - if (version === "latest" || version === response.result.latest) { - return option; - } - - //Adjust the version and location to point to the specified version - const result = { ...option, version }; - result.location = applyTemplate(result, result.template); - - return result; -} - -function addToolToPath(toolPath: string) { - if (!process.env["PATH"]?.startsWith(path.dirname(toolPath))) { - tools.debug(`Adding ${ToolName} to path`); - tools.prependPath(path.dirname(toolPath)); - } - - return toolPath; -} - -async function getEmbeddedOcto(folderPath: string): Promise { - const versionPath = path.join(folderPath, "version.json"); - const option = JSON.parse(await readFile(versionPath)); - const tempDirectory = getAgentTempDirectory(); - - tasks.cp(folderPath, tempDirectory, "-rf"); - - if (!option) { - throw "Could not resolve the original download location of the embedded Octopus CLI tool."; - } - - console.log(`Using the embedded Octopus CLI tool (version ${option.version}).`); - - return getOrDownloadOcto( - option, - () => { - return new Promise((resolve) => resolve(path.join(tempDirectory, path.basename(folderPath), "bin"))); - }, - false - ); -} - -async function readFile(path: string, encoding: BufferEncoding = "utf8"): Promise { - return new Promise((resolve, reject) => { - fs.readFile(path, { encoding: encoding }, (err, data) => { - if (err) { - reject(err); - } else { - resolve(data); - } - }); - }); -} - -function getAgentTempDirectory() { - const tempDirectory = tasks.getVariable("Agent.TempDirectory"); - if (!tempDirectory) { - throw new Error("Agent.TempDirectory is not set"); - } - return tempDirectory; -} - -export { resolvePublishedOctoVersion, getOrDownloadOcto, addToolToPath, getEmbeddedOcto }; diff --git a/source/tasksLegacy/Utils/tool.ts b/source/tasksLegacy/Utils/tool.ts deleted file mode 100644 index e892e3e7..00000000 --- a/source/tasksLegacy/Utils/tool.ts +++ /dev/null @@ -1,174 +0,0 @@ -import * as tasks from "azure-pipelines-task-lib/task"; -import { ToolRunner, IExecSyncResult, IExecOptions } from "azure-pipelines-task-lib/toolrunner"; -import { OctoServerConnectionDetails } from "./connection"; -import { curry } from "ramda"; -import { isNullOrWhitespace } from "./inputs"; -import { Option, some, none } from "fp-ts/lib/Option"; -import { Either, right, fromOption } from "fp-ts/lib/Either"; -import { getOrDownloadOcto, addToolToPath, resolvePublishedOctoVersion } from "./install"; - -export const ToolName = "octo"; -export const ToolNameBeforeV7 = "Octo"; - -export interface ArgFormatter { - (name: string, value: string, tool: ToolRunner): ToolRunner; -} - -function stringOption(value?: string): Option { - return isNullOrWhitespace(value) ? none : some(value); -} - -export class OctoLauncher { - runner: ToolRunner; - - constructor(runner: ToolRunner) { - this.runner = runner; - } - - private getExecOptions(stepIdentifier: string): IExecOptions { - return { env: { OCTOEXTENSION: `${process.env.EXTENSION_VERSION} ${stepIdentifier}`, ...process.env } }; - } - - public launchOcto(configurations: Array<(tool: ToolRunner) => ToolRunner>, stepIdentifier: string): Q.Promise { - configureTool(configurations)(this.runner); - - return this.runner.exec(this.getExecOptions(stepIdentifier)); - } - - public launchOctoSync(configurations: Array<(tool: ToolRunner) => ToolRunner>, stepIdentifier: string): IExecSyncResult { - configureTool(configurations)(this.runner); - - return this.runner.execSync(this.getExecOptions(stepIdentifier)); - } -} - -export async function getOrInstallOctoCommandRunner(command: string): Promise> { - //If we can't find octo then it hasn't been added as an installer task - //or it hasn't been added to the path. - const octo = getOctoCommandRunner(command); - if (octo.isSome()) { - return right(new OctoLauncher(octo.value)); - } - - return resolvePublishedOctoVersion("latest") - .then(getOrDownloadOcto) - .catch((err) => { - tasks.error(err); - throw Error("Unable to locate and download the latest Octopus CLI tool. To use the embedded copy" + " or another specific version, add the Octopus CLI installer task to the build pipeline" + " before this task."); - }) - .then(addToolToPath) - .then(() => getOctoCommandRunner(command).map((x) => new OctoLauncher(x))) - .then(fromOption("Unable to run the Octopus CLI tool.")); -} - -export function getOctoCommandRunner(command: string): Option { - const isWindows = /windows/i.test(tasks.osType()); - if (isWindows) { - return stringOption(tasks.which(`${ToolName}`, false) || tasks.which(`${ToolNameBeforeV7}`, false)) - .map(tasks.tool) - .map((x) => x.arg(command)); - } - - return getPortableOctoCommandRunner(command); -} - -export function getPortableOctoCommandRunner(command: string): Option { - const octo = stringOption(tasks.which(`${ToolName}.dll`, false) || tasks.which(`${ToolNameBeforeV7}.dll`, false)); - const dotnet = tasks.which("dotnet", false); - - if (isNullOrWhitespace(dotnet)) { - tasks.warning("dotnet runtime was not found and this task will most likely fail. Target an agent which has the appropriate capability or add a DotNet core installer task to the start of you build definition to fix this problem."); - } - - const tool = tasks.tool(tasks.which("dotnet", true)); - - const result = octo.map((x) => tool.arg(`${x}`).arg(command)); - - return result; -} - -export const assertOctoVersionAcceptsIds = async function (): Promise { - const octo = await getOrInstallOctoCommandRunner("version"); - const result = octo - .map((x) => x.launchOctoSync([], "version")) - .getOrElseL((x) => { - throw new Error(x); - }); - - const outputLastLine = result.stdout.trim().split(/\r?\n/).pop() || ""; - const [, major, minor, patch] = outputLastLine.trim().match(/^(\d+)\.(\d+)\.(\d+)\b/) || [0, 0, 0, 0]; - const compatible = - `${major}.${minor}.${patch}` == "1.0.0" || // allow dev versions - major > 6 || - (major == 6 && minor > 10) || - (major == 6 && minor == 10 && patch >= 0); - if (!compatible) { - throw new Error("The Octopus CLI tool is too old to run this task. Please use version 6.10.0 or newer, or downgrade the task to version 3.*."); - } -}; - -export const connectionArguments = curry(({ url, apiKey, ignoreSslErrors }: OctoServerConnectionDetails, tool: ToolRunner) => { - let tr = tool.arg(`--server=${url}`).arg(`--apiKey=${apiKey}`); - if (ignoreSslErrors) { - tr = tr.arg(`--ignoreSslErrors`); - } - return tr; -}); - -export const multiArgument = curry((arg: ArgFormatter, name: string, values: string[], tool: ToolRunner) => { - values.forEach((value) => arg(name, value, tool)); - return tool; -}); - -export const argument = curry((name: string, value: string | null | undefined, tool: ToolRunner) => { - return tool.line(`--${name}=${value}`); -}); - -export const argumentEnquote = curry((name: string, value: string | null | undefined, tool: ToolRunner) => { - return argument(name, `"${value}"`, tool); -}); - -export const includeAdditionalArgumentsAndProxyConfig = curry((url: string, value: string, tool: ToolRunner) => { - const proxyRegex = /-proxy=/; - - const proxyConfig = tasks.getHttpProxyConfiguration(url); - - if (proxyConfig) { - if (!proxyRegex.test(value)) { - console.log( - "Using agent configured proxy. If this command should not be sent via the agent's proxy, you might need to add or modify the agent's .proxybypass file. See https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/proxy#specify-proxy-bypass-urls." - ); - argument("proxy", proxyConfig.proxyUrl, tool); - if (proxyConfig.proxyUsername) { - argument("proxyUser", proxyConfig.proxyUsername, tool); - } - if (proxyConfig.proxyPassword) { - argument("proxyPass", proxyConfig.proxyPassword, tool); - } - } - } - - return includeAdditionalArguments(value, tool); -}); - -export const includeAdditionalArguments = curry((value: string, tool: ToolRunner) => { - return tool.line(value); -}); - -export const configureTool = curry((configurations: Array<(tool: ToolRunner) => ToolRunner>, tool: ToolRunner) => { - configurations.forEach((x) => x(tool)); - return tool; -}); - -export const flag = curry((name: string, value: boolean, tool: ToolRunner) => { - return value ? tool.arg(`--${name}`) : tool; -}); - -export const argumentIf = curry((predicate: (value: string | null | undefined) => boolean, arg: ArgFormatter, name: string, value: string | null | undefined, tool: ToolRunner): ToolRunner => { - if (predicate(value)) { - return arg(name, value || "", tool); - } - return tool; -}); - -export const argumentIfSet = argumentIf((val) => !isNullOrWhitespace(val)); From b8327e46e4e89a3912cebdce6b6ceee5ab1d4ac9 Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 11 Jan 2024 15:56:30 +1000 Subject: [PATCH 13/16] Revert "Remove legacy tasks" This reverts commit 9524e86f2d4553a2d21a04a4276686a20e0df017. --- .../CreateOctopusReleaseV3/icon.png | Bin 0 -> 343 bytes .../CreateOctopusReleaseV3/icon.svg | 1 + .../CreateOctopusReleaseV3/index.ts | 75 +++++ .../CreateOctopusReleaseV3/task.json | 223 +++++++++++++++ .../CreateOctopusReleaseV4/icon.png | Bin 0 -> 343 bytes .../CreateOctopusReleaseV4/icon.svg | 1 + .../CreateOctopusReleaseV4/index.ts | 83 ++++++ .../CreateOctopusReleaseV4/task.json | 266 ++++++++++++++++++ source/tasksLegacy/Deploy/DeployV3/icon.png | Bin 0 -> 454 bytes source/tasksLegacy/Deploy/DeployV3/icon.svg | 1 + source/tasksLegacy/Deploy/DeployV3/index.ts | 59 ++++ source/tasksLegacy/Deploy/DeployV3/task.json | 164 +++++++++++ source/tasksLegacy/Deploy/DeployV4/icon.png | Bin 0 -> 454 bytes source/tasksLegacy/Deploy/DeployV4/icon.svg | 1 + source/tasksLegacy/Deploy/DeployV4/index.ts | 59 ++++ source/tasksLegacy/Deploy/DeployV4/task.json | 182 ++++++++++++ source/tasksLegacy/OctoCli/OctoCliV4/icon.png | Bin 0 -> 481 bytes source/tasksLegacy/OctoCli/OctoCliV4/icon.svg | 1 + source/tasksLegacy/OctoCli/OctoCliV4/index.ts | 33 +++ .../tasksLegacy/OctoCli/OctoCliV4/task.json | 56 ++++ .../OctoInstaller/OctoInstallerV4/icon.png | Bin 0 -> 600 bytes .../OctoInstaller/OctoInstallerV4/icon.svg | 1 + .../OctoInstaller/OctoInstallerV4/index.ts | 43 +++ .../OctoInstaller/OctoInstallerV4/task.json | 49 ++++ .../OctopusMetadataV4/icon.png | Bin 0 -> 481 bytes .../OctopusMetadataV4/icon.svg | 1 + .../OctopusMetadataV4/index.ts | 97 +++++++ .../OctopusMetadataV4/task.json | 97 +++++++ source/tasksLegacy/Pack/PackV4/icon.png | Bin 0 -> 399 bytes source/tasksLegacy/Pack/PackV4/icon.svg | 1 + source/tasksLegacy/Pack/PackV4/index.ts | 115 ++++++++ source/tasksLegacy/Pack/PackV4/task.json | 179 ++++++++++++ source/tasksLegacy/Promote/PromoteV3/icon.png | Bin 0 -> 621 bytes source/tasksLegacy/Promote/PromoteV3/icon.svg | 1 + source/tasksLegacy/Promote/PromoteV3/index.ts | 55 ++++ .../tasksLegacy/Promote/PromoteV3/task.json | 173 ++++++++++++ source/tasksLegacy/Promote/PromoteV4/icon.png | Bin 0 -> 621 bytes source/tasksLegacy/Promote/PromoteV4/icon.svg | 1 + source/tasksLegacy/Promote/PromoteV4/index.ts | 55 ++++ .../tasksLegacy/Promote/PromoteV4/task.json | 195 +++++++++++++ source/tasksLegacy/Push/PushV3/icon.png | Bin 0 -> 481 bytes source/tasksLegacy/Push/PushV3/icon.svg | 1 + source/tasksLegacy/Push/PushV3/index.ts | 47 ++++ source/tasksLegacy/Push/PushV3/task.json | 76 +++++ source/tasksLegacy/Push/PushV4/icon.png | Bin 0 -> 481 bytes source/tasksLegacy/Push/PushV4/icon.svg | 1 + source/tasksLegacy/Push/PushV4/index.ts | 49 ++++ source/tasksLegacy/Push/PushV4/task.json | 89 ++++++ source/tasksLegacy/Utils/OctoApiKeyHandler.ts | 26 ++ source/tasksLegacy/Utils/connection.ts | 57 ++++ source/tasksLegacy/Utils/environment.ts | 243 ++++++++++++++++ source/tasksLegacy/Utils/inputs.ts | 74 +++++ source/tasksLegacy/Utils/install.ts | 192 +++++++++++++ source/tasksLegacy/Utils/tool.ts | 174 ++++++++++++ 54 files changed, 3297 insertions(+) create mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/icon.png create mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/icon.svg create mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts create mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/task.json create mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/icon.png create mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/icon.svg create mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts create mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/task.json create mode 100644 source/tasksLegacy/Deploy/DeployV3/icon.png create mode 100644 source/tasksLegacy/Deploy/DeployV3/icon.svg create mode 100644 source/tasksLegacy/Deploy/DeployV3/index.ts create mode 100644 source/tasksLegacy/Deploy/DeployV3/task.json create mode 100644 source/tasksLegacy/Deploy/DeployV4/icon.png create mode 100644 source/tasksLegacy/Deploy/DeployV4/icon.svg create mode 100644 source/tasksLegacy/Deploy/DeployV4/index.ts create mode 100644 source/tasksLegacy/Deploy/DeployV4/task.json create mode 100644 source/tasksLegacy/OctoCli/OctoCliV4/icon.png create mode 100644 source/tasksLegacy/OctoCli/OctoCliV4/icon.svg create mode 100644 source/tasksLegacy/OctoCli/OctoCliV4/index.ts create mode 100644 source/tasksLegacy/OctoCli/OctoCliV4/task.json create mode 100644 source/tasksLegacy/OctoInstaller/OctoInstallerV4/icon.png create mode 100644 source/tasksLegacy/OctoInstaller/OctoInstallerV4/icon.svg create mode 100644 source/tasksLegacy/OctoInstaller/OctoInstallerV4/index.ts create mode 100644 source/tasksLegacy/OctoInstaller/OctoInstallerV4/task.json create mode 100644 source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/icon.png create mode 100644 source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/icon.svg create mode 100644 source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/index.ts create mode 100644 source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/task.json create mode 100644 source/tasksLegacy/Pack/PackV4/icon.png create mode 100644 source/tasksLegacy/Pack/PackV4/icon.svg create mode 100644 source/tasksLegacy/Pack/PackV4/index.ts create mode 100644 source/tasksLegacy/Pack/PackV4/task.json create mode 100644 source/tasksLegacy/Promote/PromoteV3/icon.png create mode 100644 source/tasksLegacy/Promote/PromoteV3/icon.svg create mode 100644 source/tasksLegacy/Promote/PromoteV3/index.ts create mode 100644 source/tasksLegacy/Promote/PromoteV3/task.json create mode 100644 source/tasksLegacy/Promote/PromoteV4/icon.png create mode 100644 source/tasksLegacy/Promote/PromoteV4/icon.svg create mode 100644 source/tasksLegacy/Promote/PromoteV4/index.ts create mode 100644 source/tasksLegacy/Promote/PromoteV4/task.json create mode 100644 source/tasksLegacy/Push/PushV3/icon.png create mode 100644 source/tasksLegacy/Push/PushV3/icon.svg create mode 100644 source/tasksLegacy/Push/PushV3/index.ts create mode 100644 source/tasksLegacy/Push/PushV3/task.json create mode 100644 source/tasksLegacy/Push/PushV4/icon.png create mode 100644 source/tasksLegacy/Push/PushV4/icon.svg create mode 100644 source/tasksLegacy/Push/PushV4/index.ts create mode 100644 source/tasksLegacy/Push/PushV4/task.json create mode 100644 source/tasksLegacy/Utils/OctoApiKeyHandler.ts create mode 100644 source/tasksLegacy/Utils/connection.ts create mode 100644 source/tasksLegacy/Utils/environment.ts create mode 100644 source/tasksLegacy/Utils/inputs.ts create mode 100644 source/tasksLegacy/Utils/install.ts create mode 100644 source/tasksLegacy/Utils/tool.ts diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/icon.png b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cae677b4a2420bebbc5556e566c85dd97e529b39 GIT binary patch literal 343 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XECYN(T=geE`2YWZ^12t(Prjdi^26yT-)&|++IRP>=fWqo zd){;%diUwa->~J+o__kh@%rZ_7e3y2{j*@}E1(w3Ig)RHh6tAg`2_>HXnF!PcEP4V^-u~4G3VIZ+!XR|KrmRniXDrm9s1J{V|t57U9<4N*mbj`92ao zU}Dd9+~1)9e6mCMS!2@Ionj`y9`Z?x?9gWgx*PExan|>FX6z;!bOZB z%-25K-r(V=XR1Evoctopus \ No newline at end of file diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts new file mode 100644 index 00000000..ebab652b --- /dev/null +++ b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts @@ -0,0 +1,75 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as tasks from "azure-pipelines-task-lib/task"; +import { multiArgument, connectionArguments, includeAdditionalArgumentsAndProxyConfig, flag, argumentEnquote, argumentIfSet, getOrInstallOctoCommandRunner } from "../../Utils/tool"; +import { createReleaseNotesFile, createVstsConnection, generateReleaseNotesContent, getLinkedReleaseNotes, getVstsEnvironmentVariables } from "../../Utils/environment"; +import { getDefaultOctopusConnectionDetailsOrThrow, resolveProjectName } from "../../Utils/connection"; +import { getOptionalCsvInput } from "../../Utils/inputs"; +import os from "os"; + +async function run() { + try { + tasks.warning("There is a later version of this task, we recommend using the latest version."); + const environmentVariables = getVstsEnvironmentVariables(); + const vstsConnection = createVstsConnection(environmentVariables); + const octoConnection = getDefaultOctopusConnectionDetailsOrThrow(); + + const space = tasks.getInput("Space"); + // @ts-expect-error + const project = await resolveProjectName(octoConnection, tasks.getInput("ProjectName", true)).then((x) => x.value); + const releaseNumber = tasks.getInput("ReleaseNumber"); + const channel = tasks.getInput("Channel"); + const changesetCommentReleaseNotes = tasks.getBoolInput("ChangesetCommentReleaseNotes"); + const workItemReleaseNotes = tasks.getBoolInput("WorkItemReleaseNotes"); + const customReleaseNotes = tasks.getInput("CustomReleaseNotes"); + const deployToEnvironments = getOptionalCsvInput("DeployToEnvironment"); + const deployForTenants = getOptionalCsvInput("DeployForTenants"); + const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); + const deploymentProgress = tasks.getBoolInput("DeploymentProgress"); + const additionalArguments = tasks.getInput("AdditionalArguments"); + + const octo = await getOrInstallOctoCommandRunner("create-release"); + + let linkedReleaseNotes = ""; + if (workItemReleaseNotes || changesetCommentReleaseNotes) { + linkedReleaseNotes = await getLinkedReleaseNotes(vstsConnection, changesetCommentReleaseNotes, workItemReleaseNotes); + } + + const releaseNotesFile = createReleaseNotesFile(() => { + // @ts-expect-error + return generateReleaseNotesContent(environmentVariables, linkedReleaseNotes, customReleaseNotes); + }, environmentVariables.defaultWorkingDirectory); + + const configure = [ + // @ts-expect-error + argumentIfSet(argumentEnquote, "space", space), + argumentEnquote("project", project), + // @ts-expect-error + argumentIfSet(argumentEnquote, "releaseNumber", releaseNumber), + // @ts-expect-error + argumentIfSet(argumentEnquote, "channel", channel), + connectionArguments(octoConnection), + flag("enableServiceMessages", true), + multiArgument(argumentEnquote, "deployTo", deployToEnvironments), + flag("progress", deployToEnvironments.length > 0 && deploymentProgress), + multiArgument(argumentEnquote, "tenant", deployForTenants), + multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), + argumentEnquote("releaseNotesFile", releaseNotesFile), + // @ts-expect-error + includeAdditionalArgumentsAndProxyConfig(octoConnection.url, additionalArguments), + ]; + + const code: number = await octo + .map((x) => x.launchOcto(configure, "(release;create;v3)")) + .getOrElseL((x) => { + throw new Error(x); + }); + + tasks.setResult(tasks.TaskResult.Succeeded, "Create octopus release succeeded with code " + code); + } catch (error: unknown) { + if (error instanceof Error) { + tasks.setResult(tasks.TaskResult.Failed, `"Failed to create release. ${error.message}${os.EOL}${error.stack}`, true); + } + } +} + +run(); diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/task.json b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/task.json new file mode 100644 index 00000000..331361a0 --- /dev/null +++ b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/task.json @@ -0,0 +1,223 @@ +{ + "id": "4E131B60-5532-4362-95B6-7C67D9841B4F", + "name": "OctopusCreateRelease", + "friendlyName": "Create Octopus Release", + "description": "There is a later version of this task, we recommend using the latest version. Create a Release in Octopus Deploy", + "helpMarkDown": "set-by-pack.ps1", + "category": "Deploy", + "visibility": ["Build", "Release"], + "author": "Octopus Deploy", + "version": { + "Major": 3, + "Minor": 1, + "Patch": 0 + }, + "demands": [], + "minimumAgentVersion": "2.144.0", + "groups": [ + { + "name": "releasenotes", + "displayName": "Release Notes", + "isExpanded": true + }, + { + "name": "deployment", + "displayName": "Deployment", + "isExpanded": false + }, + { + "name": "tenant", + "displayName": "Tenants", + "isExpanded": false + }, + { + "name": "additional", + "displayName": "Additional Options", + "isExpanded": false + } + ], + "inputs": [ + { + "name": "OctoConnectedServiceName", + "type": "connectedService:OctopusEndpoint", + "label": "Octopus Deploy Server", + "defaultValue": "", + "required": true, + "helpMarkDown": "Octopus Deploy server connection" + }, + { + "name": "Space", + "type": "string", + "label": "Space (Legacy - Use version 4 of this task)", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "False" + }, + "helpMarkDown": "Version 3 of this task has limited support for spaces. We recommend using version 4 of this task for a better experience." + }, + { + "name": "ProjectGroup", + "type": "pickList", + "label": "Project Group", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." + }, + { + "name": "ProjectName", + "type": "pickList", + "label": "Project Name", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Octopus Deploy Project Name" + }, + { + "name": "ReleaseNumber", + "type": "string", + "label": "Release Number", + "defaultValue": "", + "required": false, + "helpMarkDown": "The number to use for this release. You can leave this blank if the release number is calculated by Octopus." + }, + { + "name": "Channel", + "type": "pickList", + "label": "Channel", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The [channel](https://g.octopushq.com/Channels) to use for the release." + }, + { + "name": "ChangesetCommentReleaseNotes", + "type": "boolean", + "label": "Include Changeset Comments", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Whether to include linked Changeset comments in Octopus Release notes.", + "groupName": "releasenotes" + }, + { + "name": "WorkItemReleaseNotes", + "type": "boolean", + "label": "Include Work Items", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Whether to include linked Work Item Titles in Octopus Release notes.", + "groupName": "releasenotes" + }, + { + "name": "CustomReleaseNotes", + "type": "string", + "label": "Custom Notes", + "defaultValue": "", + "required": false, + "helpMarkDown": "Custom notes appended to Octopus Release notes. This field supports markdown. To include newlines, you can use HTML linebreaks.", + "groupName": "releasenotes" + }, + { + "name": "DeployToEnvironment", + "type": "pickList", + "label": "To Environment", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Deploy the release to this environment after creating it.", + "groupName": "deployment" + }, + { + "name": "DeployForTenants", + "type": "pickList", + "label": "Tenant(s)", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Deploy the release for this comma-delimited list of tenants after creating it. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", + "groupName": "tenant" + }, + { + "name": "DeployForTenantTags", + "type": "string", + "label": "Tenant tag(s)", + "defaultValue": "", + "required": false, + "helpMarkDown": "Deploy the release for tenants who match these tags and are ready to deploy to the provided environment.", + "groupName": "tenant" + }, + { + "name": "DeploymentProgress", + "type": "boolean", + "label": "Show Deployment Progress", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Output from the deployment will appear in the log. If checked, the task will only succeed if the deployment is successful.", + "groupName": "deployment" + }, + { + "name": "AdditionalArguments", + "type": "string", + "label": "Additional Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExeCreateRelease) for available parameters.", + "groupName": "additional" + } + ], + "dataSourceBindings": [ + { + "target": "ProjectGroup", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllProjectGroups", + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "ProjectName", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusListProjectsInProjectGroup", + "parameters": { + "ProjectGroupId": "$(ProjectGroup)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "DeployToEnvironment", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllEnvironments", + "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "Channel", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusProjectChannels", + "parameters": { + "ProjectName": "$(ProjectName)" + }, + "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "DeployForTenants", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllTenants", + "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + } + ], + "instanceNameFormat": "Create Octopus Release: $(ProjectName)", + "execution": { + "Node10": { + "target": "index.js" + } + } +} diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/icon.png b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cae677b4a2420bebbc5556e566c85dd97e529b39 GIT binary patch literal 343 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XECYN(T=geE`2YWZ^12t(Prjdi^26yT-)&|++IRP>=fWqo zd){;%diUwa->~J+o__kh@%rZ_7e3y2{j*@}E1(w3Ig)RHh6tAg`2_>HXnF!PcEP4V^-u~4G3VIZ+!XR|KrmRniXDrm9s1J{V|t57U9<4N*mbj`92ao zU}Dd9+~1)9e6mCMS!2@Ionj`y9`Z?x?9gWgx*PExan|>FX6z;!bOZB z%-25K-r(V=XR1Evoctopus \ No newline at end of file diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts new file mode 100644 index 00000000..b9f2fc0a --- /dev/null +++ b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts @@ -0,0 +1,83 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as tasks from "azure-pipelines-task-lib/task"; +import { createReleaseNotesFile, createVstsConnection, generateReleaseNotesContent, getLinkedReleaseNotes, getVstsEnvironmentVariables } from "../../Utils/environment"; +import { argumentEnquote, argumentIfSet, assertOctoVersionAcceptsIds, connectionArguments, flag, getOrInstallOctoCommandRunner, includeAdditionalArgumentsAndProxyConfig, multiArgument } from "../../Utils/tool"; +import { getOptionalCsvInput } from "../../Utils/inputs"; +import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; +import os from "os"; + +async function run() { + try { + tasks.warning("There is a later version of this task, we recommend using the latest version."); + const environmentVariables = getVstsEnvironmentVariables(); + const vstsConnection = createVstsConnection(environmentVariables); + const connection = getDefaultOctopusConnectionDetailsOrThrow(); + + const space = tasks.getInput("Space"); + const project = tasks.getInput("ProjectName", true); + const releaseNumber = tasks.getInput("ReleaseNumber"); + const channel = tasks.getInput("Channel"); + const changesetCommentReleaseNotes = tasks.getBoolInput("ChangesetCommentReleaseNotes"); + const workItemReleaseNotes = tasks.getBoolInput("WorkItemReleaseNotes"); + const customReleaseNotes = tasks.getInput("CustomReleaseNotes"); + const deployToEnvironments = getOptionalCsvInput("DeployToEnvironment"); + const deployForTenants = getOptionalCsvInput("DeployForTenants"); + const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); + const deploymentProgress = tasks.getBoolInput("DeploymentProgress"); + const additionalArguments = tasks.getInput("AdditionalArguments"); + const gitRef = tasks.getInput("GitRef"); + const gitCommit = tasks.getInput("GitCommit"); + + await assertOctoVersionAcceptsIds(); + const octo = await getOrInstallOctoCommandRunner("create-release"); + + const configure = [ + // @ts-expect-error + argumentIfSet(argumentEnquote, "space", space), + // @ts-expect-error + argumentEnquote("project", project), + // @ts-expect-error + argumentIfSet(argumentEnquote, "releaseNumber", releaseNumber), + // @ts-expect-error + argumentIfSet(argumentEnquote, "channel", channel), + connectionArguments(connection), + flag("enableServiceMessages", true), + multiArgument(argumentEnquote, "deployTo", deployToEnvironments), + // @ts-expect-error + argumentIfSet(argumentEnquote, "gitRef", gitRef), + // @ts-expect-error + argumentIfSet(argumentEnquote, "gitCommit", gitCommit), + flag("progress", deployToEnvironments.length > 0 && deploymentProgress), + multiArgument(argumentEnquote, "tenant", deployForTenants), + multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), + ]; + + if (workItemReleaseNotes || changesetCommentReleaseNotes || (customReleaseNotes && /[^\s]/.test(customReleaseNotes))) { + const linkedReleaseNotes = workItemReleaseNotes || changesetCommentReleaseNotes ? await getLinkedReleaseNotes(vstsConnection, changesetCommentReleaseNotes, workItemReleaseNotes) : ""; + + const releaseNotesFile = createReleaseNotesFile(() => { + // @ts-expect-error + return generateReleaseNotesContent(environmentVariables, linkedReleaseNotes, customReleaseNotes); + }, environmentVariables.defaultWorkingDirectory); + + configure.push(argumentEnquote("releaseNotesFile", releaseNotesFile)); + } + + // @ts-expect-error + configure.push(includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments)); + + const code: number = await octo + .map((x) => x.launchOcto(configure, "(release;create;v4)")) + .getOrElseL((x) => { + throw new Error(x); + }); + + tasks.setResult(tasks.TaskResult.Succeeded, "Create octopus release succeeded with code " + code); + } catch (error: unknown) { + if (error instanceof Error) { + tasks.setResult(tasks.TaskResult.Failed, `"Failed to create release. ${error.message}${os.EOL}${error.stack}`, true); + } + } +} + +run(); diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/task.json b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/task.json new file mode 100644 index 00000000..bbcc3df2 --- /dev/null +++ b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/task.json @@ -0,0 +1,266 @@ +{ + "id": "4E131B60-5532-4362-95B6-7C67D9841B4F", + "name": "OctopusCreateRelease", + "friendlyName": "Create Octopus Release", + "description": "There is a later version of this task, we recommend using the latest version. Create a Release in Octopus Deploy", + "helpMarkDown": "set-by-pack.ps1", + "category": "Deploy", + "visibility": ["Build", "Release"], + "author": "Octopus Deploy", + "version": { + "Major": 4, + "Minor": 3, + "Patch": 0 + }, + "demands": [], + "minimumAgentVersion": "2.144.0", + "groups": [ + { + "name": "releasenotes", + "displayName": "Release Notes (Legacy)", + "isExpanded": true + }, + { + "name": "deployment", + "displayName": "Deployment", + "isExpanded": false + }, + { + "name": "tenant", + "displayName": "Tenants", + "isExpanded": false + }, + { + "name": "versionControl", + "displayName": "Version Control", + "isExpanded": false + }, + { + "name": "additional", + "displayName": "Additional Options", + "isExpanded": false + } + ], + "inputs": [ + { + "name": "OctoConnectedServiceName", + "type": "connectedService:OctopusEndpoint", + "label": "Octopus Deploy Server", + "defaultValue": "", + "required": true, + "helpMarkDown": "Octopus Deploy server connection" + }, + { + "name": "Space", + "type": "pickList", + "label": "Space", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The space within Octopus." + }, + { + "name": "ProjectGroup", + "type": "pickList", + "label": "Project Group", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." + }, + { + "name": "ProjectName", + "type": "pickList", + "label": "Project", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The project within Octopus." + }, + { + "name": "ReleaseNumber", + "type": "string", + "label": "Release Number", + "defaultValue": "", + "required": false, + "helpMarkDown": "The number to use for this release. You can leave this blank if the release number is calculated by Octopus." + }, + { + "name": "Channel", + "type": "pickList", + "label": "Channel", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The [channel](https://g.octopushq.com/Channels) to use for the release." + }, + { + "name": "ChangesetCommentReleaseNotes", + "type": "boolean", + "label": "Include Changeset Comments", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Whether to add linked changeset comments to Octopus Release notes.\n\n*Note: These Release Notes options are considered legacy. We recommend clearing them and pushing [Build Information](https://g.octopushq.com/BuildInformation) alongside your packages, which allows the customizable [Release Notes Template](https://g.octopushq.com/ReleaseNotesTemplate) to generate automatic release notes.*", + "groupName": "releasenotes" + }, + { + "name": "WorkItemReleaseNotes", + "type": "boolean", + "label": "Include Work Items", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Whether to add linked Work Item titles to Octopus Release notes.\n\n*Note: These Release Notes options are considered legacy. We recommend clearing them and pushing [Build Information](https://g.octopushq.com/BuildInformation) alongside your packages, which allows the customizable [Release Notes Template](https://g.octopushq.com/ReleaseNotesTemplate) to generate automatic release notes.*", + "groupName": "releasenotes" + }, + { + "name": "CustomReleaseNotes", + "type": "string", + "label": "Custom Notes", + "defaultValue": "", + "required": false, + "helpMarkDown": "Custom notes appended to Octopus Release notes. This field supports markdown. To include newlines, you can use HTML linebreaks.\n\n*Note: These Release Notes options are considered legacy. We recommend clearing them and pushing [Build Information](https://g.octopushq.com/BuildInformation) alongside your packages, which allows the customizable [Release Notes Template](https://g.octopushq.com/ReleaseNotesTemplate) to generate automatic release notes.*", + "groupName": "releasenotes" + }, + { + "name": "DeployToEnvironment", + "type": "pickList", + "label": "To Environment", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Deploy the release to this environment after creating it.", + "groupName": "deployment" + }, + { + "name": "DeployForTenants", + "type": "pickList", + "label": "Tenant(s)", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Deploy the release for this comma-delimited list of tenants after creating it. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", + "groupName": "tenant" + }, + { + "name": "DeployForTenantTags", + "type": "string", + "label": "Tenant tag(s)", + "defaultValue": "", + "required": false, + "helpMarkDown": "Deploy the release for tenants who match these tags and are ready to deploy to the provided environment.", + "groupName": "tenant" + }, + { + "name": "DeploymentProgress", + "type": "boolean", + "label": "Show Deployment Progress", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Output from the deployment will appear in the log. If checked, the task will only succeed if the deployment is successful.", + "groupName": "deployment" + }, + { + "name": "GitRef", + "type": "string", + "label": "Git Reference", + "defaultValue": "", + "required": false, + "helpMarkDown": "Git branch reference to use when creating the release for version controlled Projects.", + "groupName": "versionControl" + }, + { + "name": "GitCommit", + "type": "string", + "label": "Git Commit", + "defaultValue": "", + "required": false, + "helpMarkDown": "Git commit to use when creating the release for version controlled Projects. Use in conjunction with the gitRef parameter to select any previous commit.", + "groupName": "versionControl" + }, + { + "name": "AdditionalArguments", + "type": "string", + "label": "Additional Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExeCreateRelease) for available parameters.", + "groupName": "additional" + } + ], + "dataSourceBindings": [ + { + "target": "Space", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllSpaces", + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "ProjectGroup", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllProjectGroupsInSpace", + "parameters": { + "SpaceId": "$(Space)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "ProjectName", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusListProjectsInProjectGroupInSpace", + "parameters": { + "SpaceId": "$(Space)", + "ProjectGroupId": "$(ProjectGroup)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "DeployToEnvironment", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusProjectChannelEnvironmentsInSpace", + "parameters": { + "SpaceId": "$(Space)", + "ProjectId": "$(ProjectName)", + "ChannelId": "$(Channel)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "Channel", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusProjectChannelsInSpace", + "parameters": { + "SpaceId": "$(Space)", + "ProjectName": "$(ProjectName)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "DeployForTenants", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusProjectTenantsInSpace", + "parameters": { + "SpaceId": "$(Space)", + "ProjectName": "$(ProjectName)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + } + ], + "instanceNameFormat": "Create Octopus Release", + "execution": { + "Node10": { + "target": "index.js" + } + } +} diff --git a/source/tasksLegacy/Deploy/DeployV3/icon.png b/source/tasksLegacy/Deploy/DeployV3/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..591f4d253f95a8bc45cc879a1d1532641d20b54e GIT binary patch literal 454 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xk^_7~T=geEn11qoNK$_Cx)-OPeEgNJ8k}z z8@KDbCWkG5wsOOEn^})GUjO{@)8`wne`;ELA3J@%u(ti_r{AA`{PkS;WctYuU5DOT zc!byPd9&og$45_}yM-nfY<;!w?pL6Je18_l0j*Ok3GxdDa`6I&`3Em30u`U}ba4!+ zxOL|8O};}40<0GbPen}&+Pz)x@Bj58T3I1i_RaXRk4KSxMhnjwd#2S5rzaJbZ)i>_ zyUpxY%dWh%lzYLsdy?LM`3=8(CR{aPei3_LrIGbAn}Zd{Q%MW{V+{5Uc6S11v#vO) zl@;gkTxVm-PDj&R-`(5grkuR>_W#j(N9ReIc@4=+1yz&&#q8ME#Qfapn5Kq=_M=Y< zB}>H{iZxH|I4uwvBlkJzleWgBgcI$xTN!jG`+FSJ7Mv|p@V@%fa(UO5Lt*^yx5uzZ ZF!au`45>Q*R~hIp22WQ%mvv4FO#t+soctopus \ No newline at end of file diff --git a/source/tasksLegacy/Deploy/DeployV3/index.ts b/source/tasksLegacy/Deploy/DeployV3/index.ts new file mode 100644 index 00000000..e99444b5 --- /dev/null +++ b/source/tasksLegacy/Deploy/DeployV3/index.ts @@ -0,0 +1,59 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as tasks from "azure-pipelines-task-lib/task"; +import { multiArgument, connectionArguments, includeAdditionalArgumentsAndProxyConfig, flag, argumentEnquote, argumentIfSet, getOrInstallOctoCommandRunner } from "../../Utils/tool"; +import { getDefaultOctopusConnectionDetailsOrThrow, resolveProjectName } from "../../Utils/connection"; +import { getOptionalCsvInput, getRequiredCsvInput } from "../../Utils/inputs"; +import os from "os"; + +async function run() { + try { + tasks.warning("There is a later version of this task, we recommend using the latest version."); + const connection = getDefaultOctopusConnectionDetailsOrThrow(); + + const space = tasks.getInput("Space"); + const releaseNumber = tasks.getInput("ReleaseNumber", true); + const environments = getRequiredCsvInput("Environments"); + const showProgress = tasks.getBoolInput("ShowProgress"); + const deploymentForTenants = getOptionalCsvInput("DeployForTenants"); + const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); + const additionalArguments = tasks.getInput("AdditionalArguments"); + // @ts-ignore + const project = await resolveProjectName(connection, tasks.getInput("Project", true)).then((x) => x.value); + + const octo = await getOrInstallOctoCommandRunner("deploy-release"); + + const configure = [ + // @ts-ignore + argumentIfSet(argumentEnquote, "space", space), + argumentEnquote("project", project), + // @ts-ignore + argumentEnquote("releaseNumber", releaseNumber), + connectionArguments(connection), + multiArgument(argumentEnquote, "deployTo", environments), + multiArgument(argumentEnquote, "tenant", deploymentForTenants), + multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), + flag("progress", showProgress), + // @ts-ignore + includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), + ]; + + let stepIdentifier = "(release;deploy;v3)"; + if (deploymentForTenants.length > 0 || deployForTenantTags.length > 0) { + stepIdentifier = "(release;deploy-tenanted;v3)"; + } + + const code: number = await octo + .map((x) => x.launchOcto(configure, stepIdentifier)) + .getOrElseL((x) => { + throw new Error(x); + }); + + tasks.setResult(tasks.TaskResult.Succeeded, "Deploy succeeded with code " + code); + } catch (error: unknown) { + if (error instanceof Error) { + tasks.setResult(tasks.TaskResult.Failed, `"Failed to deploy release. ${error.message}${os.EOL}${error.stack}`, true); + } + } +} + +run(); diff --git a/source/tasksLegacy/Deploy/DeployV3/task.json b/source/tasksLegacy/Deploy/DeployV3/task.json new file mode 100644 index 00000000..3274fe57 --- /dev/null +++ b/source/tasksLegacy/Deploy/DeployV3/task.json @@ -0,0 +1,164 @@ +{ + "id": "8ca1d96a-151d-44b7-bc4f-9251e2ea6971", + "name": "OctopusDeployRelease", + "friendlyName": "Deploy Octopus Release", + "description": "There is a later version of this task, we recommend using the latest version. Deploy an Octopus Deploy Release", + "helpMarkDown": "set-by-pack.ps1", + "category": "Deploy", + "visibility": ["Build", "Release"], + "author": "Octopus Deploy", + "version": { + "Major": 3, + "Minor": 1, + "Patch": 0 + }, + "demands": [], + "minimumAgentVersion": "2.144.0", + "groups": [ + { + "name": "tenant", + "displayName": "Tenants", + "isExpanded": false + }, + { + "name": "advanced", + "displayName": "Advanced Options", + "isExpanded": false + } + ], + "inputs": [ + { + "name": "OctoConnectedServiceName", + "type": "connectedService:OctopusEndpoint", + "label": "Octopus Deploy Server", + "defaultValue": "", + "required": true, + "helpMarkDown": "Octopus Deploy server connection" + }, + { + "name": "Space", + "type": "string", + "label": "Space (Legacy - Use version 4 of this task)", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "False" + }, + "helpMarkDown": "Version 3 of this task has limited support for spaces. We recommend using version 4 of this task for a better experience." + }, + { + "name": "ProjectGroup", + "type": "pickList", + "label": "Project Group", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." + }, + { + "name": "Project", + "type": "pickList", + "label": "Project", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Octopus Deploy Project Name" + }, + { + "name": "ReleaseNumber", + "type": "string", + "label": "Release Number", + "defaultValue": "latest", + "required": true, + "helpMarkDown": "The number of the release to deploy. Use 'latest' to deploy the latest release." + }, + { + "name": "Environments", + "type": "pickList", + "label": "Deploy to Environments", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Comma separated list of environments to deploy to." + }, + { + "name": "ShowProgress", + "type": "boolean", + "label": "Show Deployment Progress", + "defaultValue": "False", + "required": false, + "helpMarkDown": "If checked, the build process will only succeed if the deployment is successful." + }, + { + "name": "DeployForTenants", + "type": "pickList", + "label": "Tenant(s)", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Deploy the release for this comma delimited list of tenants. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", + "groupName": "tenant" + }, + { + "name": "DeployForTenantTags", + "type": "string", + "label": "Tenant tag(s)", + "defaultValue": "", + "required": false, + "helpMarkDown": "Deploy the release for tenants who match these tags and are ready to deploy to the provided environment.", + "groupName": "tenant" + }, + { + "name": "AdditionalArguments", + "type": "string", + "label": "Additional Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExeDeployRelease) for available parameters.", + "groupName": "advanced" + } + ], + "dataSourceBindings": [ + { + "target": "ProjectGroup", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllProjectGroups", + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "Project", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusListProjectsInProjectGroup", + "parameters": { + "ProjectGroupId": "$(ProjectGroup)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "Environments", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllEnvironments", + "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "DeployForTenants", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllTenants", + "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + } + ], + "instanceNameFormat": "Deploy Octopus Release: $(Project) to $(Environments)", + "execution": { + "Node10": { + "target": "index.js" + } + } +} diff --git a/source/tasksLegacy/Deploy/DeployV4/icon.png b/source/tasksLegacy/Deploy/DeployV4/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..591f4d253f95a8bc45cc879a1d1532641d20b54e GIT binary patch literal 454 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xk^_7~T=geEn11qoNK$_Cx)-OPeEgNJ8k}z z8@KDbCWkG5wsOOEn^})GUjO{@)8`wne`;ELA3J@%u(ti_r{AA`{PkS;WctYuU5DOT zc!byPd9&og$45_}yM-nfY<;!w?pL6Je18_l0j*Ok3GxdDa`6I&`3Em30u`U}ba4!+ zxOL|8O};}40<0GbPen}&+Pz)x@Bj58T3I1i_RaXRk4KSxMhnjwd#2S5rzaJbZ)i>_ zyUpxY%dWh%lzYLsdy?LM`3=8(CR{aPei3_LrIGbAn}Zd{Q%MW{V+{5Uc6S11v#vO) zl@;gkTxVm-PDj&R-`(5grkuR>_W#j(N9ReIc@4=+1yz&&#q8ME#Qfapn5Kq=_M=Y< zB}>H{iZxH|I4uwvBlkJzleWgBgcI$xTN!jG`+FSJ7Mv|p@V@%fa(UO5Lt*^yx5uzZ ZF!au`45>Q*R~hIp22WQ%mvv4FO#t+soctopus \ No newline at end of file diff --git a/source/tasksLegacy/Deploy/DeployV4/index.ts b/source/tasksLegacy/Deploy/DeployV4/index.ts new file mode 100644 index 00000000..d2dd6cec --- /dev/null +++ b/source/tasksLegacy/Deploy/DeployV4/index.ts @@ -0,0 +1,59 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as tasks from "azure-pipelines-task-lib/task"; +import { argumentEnquote, argumentIfSet, assertOctoVersionAcceptsIds, connectionArguments, flag, getOrInstallOctoCommandRunner, includeAdditionalArgumentsAndProxyConfig, multiArgument } from "../../Utils/tool"; +import { getOptionalCsvInput, getRequiredCsvInput } from "../../Utils/inputs"; +import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; +import os from "os"; + +async function run() { + try { + tasks.warning("There is a later version of this task, we recommend using the latest version."); + const connection = getDefaultOctopusConnectionDetailsOrThrow(); + + const space = tasks.getInput("Space"); + const project = tasks.getInput("Project", true); + const releaseNumber = tasks.getInput("ReleaseNumber", true); + const deployToEnvironments = getRequiredCsvInput("Environments"); + const deployForTenants = getOptionalCsvInput("DeployForTenants"); + const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); + const showProgress = tasks.getBoolInput("ShowProgress"); + const additionalArguments = tasks.getInput("AdditionalArguments"); + await assertOctoVersionAcceptsIds(); + const octo = await getOrInstallOctoCommandRunner("deploy-release"); + + const configure = [ + // @ts-ignore + argumentIfSet(argumentEnquote, "space", space), + // @ts-ignore + argumentEnquote("project", project), + // @ts-ignore + argumentEnquote("releaseNumber", releaseNumber), + connectionArguments(connection), + multiArgument(argumentEnquote, "deployTo", deployToEnvironments), + multiArgument(argumentEnquote, "tenant", deployForTenants), + multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), + flag("progress", showProgress), + // @ts-ignore + includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), + ]; + + let stepIdentifier = "(release;deploy;v4)"; + if (deployForTenants.length > 0 || deployForTenantTags.length > 0) { + stepIdentifier = "(release;deploy-tenanted;v4)"; + } + + const code: number = await octo + .map((x) => x.launchOcto(configure, stepIdentifier)) + .getOrElseL((x) => { + throw new Error(x); + }); + + tasks.setResult(tasks.TaskResult.Succeeded, "Deploy succeeded with code " + code); + } catch (error: unknown) { + if (error instanceof Error) { + tasks.setResult(tasks.TaskResult.Failed, `"Failed to deploy release. ${error.message}${os.EOL}${error.stack}`, true); + } + } +} + +run(); diff --git a/source/tasksLegacy/Deploy/DeployV4/task.json b/source/tasksLegacy/Deploy/DeployV4/task.json new file mode 100644 index 00000000..eec3f330 --- /dev/null +++ b/source/tasksLegacy/Deploy/DeployV4/task.json @@ -0,0 +1,182 @@ +{ + "id": "8ca1d96a-151d-44b7-bc4f-9251e2ea6971", + "name": "OctopusDeployRelease", + "friendlyName": "Deploy Octopus Release", + "description": "There is a later version of this task, we recommend using the latest version. Deploy an Octopus Deploy Release", + "helpMarkDown": "set-by-pack.ps1", + "category": "Deploy", + "visibility": ["Build", "Release"], + "author": "Octopus Deploy", + "version": { + "Major": 4, + "Minor": 3, + "Patch": 0 + }, + "demands": [], + "minimumAgentVersion": "2.144.0", + "groups": [ + { + "name": "tenant", + "displayName": "Tenants", + "isExpanded": false + }, + { + "name": "advanced", + "displayName": "Advanced Options", + "isExpanded": false + } + ], + "inputs": [ + { + "name": "OctoConnectedServiceName", + "type": "connectedService:OctopusEndpoint", + "label": "Octopus Deploy Server", + "defaultValue": "", + "required": true, + "helpMarkDown": "Octopus Deploy server connection" + }, + { + "name": "Space", + "type": "pickList", + "label": "Space", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The space within Octopus." + }, + { + "name": "ProjectGroup", + "type": "pickList", + "label": "Project Group", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." + }, + { + "name": "Project", + "type": "pickList", + "label": "Project", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The project within Octopus." + }, + { + "name": "ReleaseNumber", + "type": "string", + "label": "Release Number", + "defaultValue": "latest", + "required": true, + "helpMarkDown": "The number of the release to deploy. Use 'latest' to deploy the latest release." + }, + { + "name": "Environments", + "type": "pickList", + "label": "Deploy to Environments", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Comma separated list of environments to deploy to." + }, + { + "name": "ShowProgress", + "type": "boolean", + "label": "Show Deployment Progress", + "defaultValue": "False", + "required": false, + "helpMarkDown": "If checked, the build process will only succeed if the deployment is successful." + }, + { + "name": "DeployForTenants", + "type": "pickList", + "label": "Tenant(s)", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Deploy the release for this comma delimited list of tenants. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", + "groupName": "tenant" + }, + { + "name": "DeployForTenantTags", + "type": "string", + "label": "Tenant tag(s)", + "defaultValue": "", + "required": false, + "helpMarkDown": "Deploy the release for tenants who match these tags and are ready to deploy to the provided environment.", + "groupName": "tenant" + }, + { + "name": "AdditionalArguments", + "type": "string", + "label": "Additional Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExeDeployRelease) for available parameters.", + "groupName": "advanced" + } + ], + "dataSourceBindings": [ + { + "target": "Space", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllSpaces", + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "ProjectGroup", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllProjectGroupsInSpace", + "parameters": { + "SpaceId": "$(Space)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "Project", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusListProjectsInProjectGroupInSpace", + "parameters": { + "SpaceId": "$(Space)", + "ProjectGroupId": "$(ProjectGroup)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "Environments", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusProjectEnvironmentsInSpace", + "parameters": { + "SpaceId": "$(Space)", + "ProjectId": "$(Project)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "DeployForTenants", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusProjectTenantsInSpace", + "parameters": { + "SpaceId": "$(Space)", + "ProjectName": "$(Project)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + } + ], + "instanceNameFormat": "Deploy Octopus Release", + "execution": { + "Node10": { + "target": "index.js" + } + } +} diff --git a/source/tasksLegacy/OctoCli/OctoCliV4/icon.png b/source/tasksLegacy/OctoCli/OctoCliV4/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..236566a308c71c4b35ce91fa54e6914d05fb8d7b GIT binary patch literal 481 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X5(0ceT=geE`2YXEw4QzPx)(OH9^H8T^V5&NwR_$iJAMB2 zlkd|{z7JdeY{`X>D>rQ4clWDC?vm|$4|^_rGX3O-f~~JMUjO{`<8KR(@UBDe9zA_7 zW8(Sr({J6jGn&@kn#Jq<8&?5MzN-Gj8RWW>AirQB7aw4ViIIK_RQuY~#WAGf)|JUO zg_;dGToq^cx@BK|*Zu$hbk@acQL?{p++$Bya%U26DRcg?yrHafN@ijhgZ4r1rD>cV z3NIEYFVJzex!AERaEc521I41Md6xGQ)F%rjx;bztnH<-Cb9A{1o6Eh}1U819ca*nG zm+fZUxZM1v#PO~^%`NJJE-iDIgrXGHTDTmJtv%Q9TK0{={z`MZhK=0Z+>-MIj5Y|y z9A0xm?Mgz*b=ND;xTpNT7s&dg{Nhgm$)%1_;l&3Qg-X3%IeF*&R+q&G0y|G#y{PkN zL&dCBCvNy}vz?b_|L$w;kE+Gn%0G$!U$dQonSt+$*N$DY75)Id&EVoctopus \ No newline at end of file diff --git a/source/tasksLegacy/OctoCli/OctoCliV4/index.ts b/source/tasksLegacy/OctoCli/OctoCliV4/index.ts new file mode 100644 index 00000000..fcf7a196 --- /dev/null +++ b/source/tasksLegacy/OctoCli/OctoCliV4/index.ts @@ -0,0 +1,33 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as tasks from "azure-pipelines-task-lib/task"; +import { connectionArguments, getOrInstallOctoCommandRunner, includeAdditionalArguments } from "../../Utils/tool"; +import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; +import os from "os"; + +async function run() { + try { + tasks.warning("There is a later version of this task, we recommend using the latest version."); + const connection = getDefaultOctopusConnectionDetailsOrThrow(); + const args = tasks.getInput("args", false); + const command = tasks.getInput("command", true); + // @ts-ignore + const octo = await getOrInstallOctoCommandRunner(command); + + // @ts-ignore + const configure = [connectionArguments(connection), includeAdditionalArguments(args)]; + + const code: number = await octo + .map((x) => x.launchOcto(configure, "(cli;run;v4)")) + .getOrElseL((x) => { + throw new Error(x); + }); + + tasks.setResult(tasks.TaskResult.Succeeded, `Succeeded executing octo command ${command} with code ${code}`); + } catch (error: unknown) { + if (error instanceof Error) { + tasks.setResult(tasks.TaskResult.Failed, `"Failed to execute octo command. ${error.message}${os.EOL}${error.stack}`, true); + } + } +} + +run(); diff --git a/source/tasksLegacy/OctoCli/OctoCliV4/task.json b/source/tasksLegacy/OctoCli/OctoCliV4/task.json new file mode 100644 index 00000000..4553a726 --- /dev/null +++ b/source/tasksLegacy/OctoCli/OctoCliV4/task.json @@ -0,0 +1,56 @@ +{ + "id": "25fee290-e578-491b-b1db-dbc3980df1d0", + "name": "OctoCli", + "friendlyName": "Invoke Octopus CLI command", + "description": "There is a later version of this task, we recommend using the latest version. Invoke an Octopus CLI command", + "helpMarkDown": "set-by-pack.ps1", + "category": "Tool", + "visibility": ["Build", "Release"], + "author": "Octopus Deploy", + "version": { + "Major": 4, + "Minor": 3, + "Patch": 0 + }, + "demands": [], + "minimumAgentVersion": "2.144.0", + "groups": [ + { + "name": "advanced", + "displayName": "Advanced Options", + "isExpanded": false + } + ], + "inputs": [ + { + "name": "OctoConnectedServiceName", + "type": "connectedService:OctopusEndpoint", + "label": "Octopus Deploy Server", + "defaultValue": "", + "required": true, + "helpMarkDown": "Octopus Deploy server connection" + }, + { + "name": "command", + "type": "string", + "label": "command", + "defaultValue": "", + "required": true, + "helpMarkDown": "The Octopus CLI command to execute." + }, + { + "name": "args", + "type": "string", + "label": "arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "The arguments to use for the command." + } + ], + "instanceNameFormat": "Invoke an Octopus CLI command", + "execution": { + "Node10": { + "target": "index.js" + } + } +} diff --git a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/icon.png b/source/tasksLegacy/OctoInstaller/OctoInstallerV4/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..d54551d79a45027401d3d149af2619b6a48be11d GIT binary patch literal 600 zcmV-e0;m0nP)}VKg|3!E0NBpaa)2rh(A899 zhzjx2Gs_$CSwT1v;&KGY za#;2w*K(p9fXxvg%R#{p0$Y(B01_v~au5JFNCec(4lpn<*b`C=O3k2x2Ndi_HZ6r% z>KBco23NFT0S7command-line \ No newline at end of file diff --git a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/index.ts b/source/tasksLegacy/OctoInstaller/OctoInstallerV4/index.ts new file mode 100644 index 00000000..b8079c09 --- /dev/null +++ b/source/tasksLegacy/OctoInstaller/OctoInstallerV4/index.ts @@ -0,0 +1,43 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { getOrDownloadOcto, resolvePublishedOctoVersion, addToolToPath, getEmbeddedOcto } from "../../Utils/install"; +import * as tasks from "azure-pipelines-task-lib/task"; +import * as os from "os"; + +async function run() { + tasks.warning("This task is deprecated, please use latest version instead."); + const version = tasks.getInput("version"); + // @ts-ignore + const forceEmbedded = /embedded/i.test(version); + + try { + if (forceEmbedded) { + console.log("Forcing the use of the embedded Octopus CLI tool."); + await getEmbeddedOcto(tasks.resolve(__dirname, "embedded")).then(addToolToPath); + } else { + const option = await resolvePublishedOctoVersion(version); + console.log(`Using Octopus CLI tool version ${option.version}`); + await getOrDownloadOcto(option).then(addToolToPath); + } + + tasks.setResult(tasks.TaskResult.Succeeded, ""); + } catch (error: unknown) { + if (error instanceof Error) { + if (forceEmbedded) { + tasks.setResult(tasks.TaskResult.Failed, `${error.message}${os.EOL}${error.stack}`, true); + return; + } + + console.log(`Failed to resolve Octopus CLI tool version ${version}. Using the embedded version. ${error}`); + + try { + await getEmbeddedOcto(tasks.resolve(__dirname, "embedded")).then(addToolToPath); + } catch (embeddedOctoError: unknown) { + if (embeddedOctoError instanceof Error) { + tasks.setResult(tasks.TaskResult.Failed, `${embeddedOctoError.message}${os.EOL}${embeddedOctoError.stack}`, true); + } + } + } + } +} + +run(); diff --git a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/task.json b/source/tasksLegacy/OctoInstaller/OctoInstallerV4/task.json new file mode 100644 index 00000000..a1df9e46 --- /dev/null +++ b/source/tasksLegacy/OctoInstaller/OctoInstallerV4/task.json @@ -0,0 +1,49 @@ +{ + "id": "57342b23-3a76-490a-8e78-25d4ade2f2e3", + "name": "OctoInstaller", + "friendlyName": "[DEPRECATED] Octopus CLI Installer", + "description": "This task is deprecated, please use latest version instead. Install a specific version of the Octopus CLI", + "helpMarkDown": "Install a specific version of the Octopus CLI", + "category": "Tool", + "runsOn": [ + "Agent", + "DeploymentGroup" + ], + "visibility": [ + "Build", + "Release" + ], + "author": "Octopus Deploy", + "version": { + "Major": 4, + "Minor": 3, + "Patch": 0 + }, + "deprecated": true, + "satisfies": ["Octo"], + "demands": [], + "minimumAgentVersion": "2.144.0", + "groups": [ + { + "name": "advanced", + "displayName": "Advanced Options", + "isExpanded": false + } + ], + "inputs": [ + { + "name": "version", + "type": "string", + "label": "Octopus CLI Version", + "defaultValue": "embedded", + "required": true, + "helpMarkDown": "Specify `latest` or the version number to download. If you specify `embedded`, or the download fails, a built-in copy of the tool will be used." + } + ], + "instanceNameFormat": "[DEPRECATED] Use Octopus CLI tool version $(version)", + "execution": { + "Node10": { + "target": "index.js" + } + } +} diff --git a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/icon.png b/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..236566a308c71c4b35ce91fa54e6914d05fb8d7b GIT binary patch literal 481 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X5(0ceT=geE`2YXEw4QzPx)(OH9^H8T^V5&NwR_$iJAMB2 zlkd|{z7JdeY{`X>D>rQ4clWDC?vm|$4|^_rGX3O-f~~JMUjO{`<8KR(@UBDe9zA_7 zW8(Sr({J6jGn&@kn#Jq<8&?5MzN-Gj8RWW>AirQB7aw4ViIIK_RQuY~#WAGf)|JUO zg_;dGToq^cx@BK|*Zu$hbk@acQL?{p++$Bya%U26DRcg?yrHafN@ijhgZ4r1rD>cV z3NIEYFVJzex!AERaEc521I41Md6xGQ)F%rjx;bztnH<-Cb9A{1o6Eh}1U819ca*nG zm+fZUxZM1v#PO~^%`NJJE-iDIgrXGHTDTmJtv%Q9TK0{={z`MZhK=0Z+>-MIj5Y|y z9A0xm?Mgz*b=ND;xTpNT7s&dg{Nhgm$)%1_;l&3Qg-X3%IeF*&R+q&G0y|G#y{PkN zL&dCBCvNy}vz?b_|L$w;kE+Gn%0G$!U$dQonSt+$*N$DY75)Id&EVoctopus \ No newline at end of file diff --git a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/index.ts b/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/index.ts new file mode 100644 index 00000000..973ac51a --- /dev/null +++ b/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/index.ts @@ -0,0 +1,97 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as tasks from "azure-pipelines-task-lib/task"; +import { ToolRunner } from "azure-pipelines-task-lib/toolrunner"; +import * as path from "path"; +import { createVstsConnection, getBuildBranch, getBuildChanges, getVcsTypeFromProvider, getVstsEnvironmentVariables } from "../../Utils/environment"; +import { getLineSeparatedItems, getOverwriteModeFromReplaceInput } from "../../Utils/inputs"; +import { assertOctoVersionAcceptsIds, getOrInstallOctoCommandRunner, connectionArguments, includeAdditionalArgumentsAndProxyConfig, argument, argumentEnquote, argumentIfSet, multiArgument } from "../../Utils/tool"; +import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; +import os from "os"; + +export interface IOctopusBuildInformation { + BuildEnvironment: string; + BuildNumber: string; + BuildUrl: string; + Branch: string; + VcsType: string; + VcsRoot: string; + VcsCommitNumber: string; + Commits: IOctopusBuildInformationCommit[]; +} + +export interface IOctopusBuildInformationCommit { + Id: string; + Comment: string; +} + +async function run() { + try { + tasks.warning("There is a later version of this task, we recommend using the latest version."); + const environment = getVstsEnvironmentVariables(); + const vstsConnection = createVstsConnection(environment); + + const space = tasks.getInput("Space"); + // @ts-expect-error + const packageIds = getLineSeparatedItems(tasks.getInput("PackageId", true)); + const packageVersion = tasks.getInput("PackageVersion", true); + // @ts-expect-error + const overwriteMode = getOverwriteModeFromReplaceInput(tasks.getInput("Replace", true)); + const additionalArguments = tasks.getInput("AdditionalArguments"); + + const branch = await getBuildBranch(vstsConnection); + const commits = await getBuildChanges(vstsConnection); + + const buildInformation: IOctopusBuildInformation = { + BuildEnvironment: "Azure DevOps", + BuildNumber: environment.buildNumber, + BuildUrl: environment.teamCollectionUri.replace(/\/$/, "") + "/" + environment.projectName + "/_build/results?buildId=" + environment.buildId, + // @ts-expect-error + Branch: branch, + VcsType: getVcsTypeFromProvider(environment.buildRepositoryProvider), + VcsRoot: environment.buildRepositoryUri, + VcsCommitNumber: environment.buildSourceVersion, + // @ts-expect-error + Commits: commits.map((change) => ({ Id: change.id, Comment: change.message })), + }; + + if (!environment.agentBuildDirectory) { + tasks.error("The Build Information step requires build information and therefore is not compatible with use in a Release pipeline."); + return; + } + + const buildInformationDir = path.join(environment.agentBuildDirectory, "octo"); + const buildInformationFile = path.join(buildInformationDir, `${environment.buildId}-buildinformation.json`); + await tasks.mkdirP(buildInformationDir); + await tasks.writeFile(buildInformationFile, JSON.stringify(buildInformation, null, 2)); + + await assertOctoVersionAcceptsIds(); + const octo = await getOrInstallOctoCommandRunner("build-information"); + const connection = getDefaultOctopusConnectionDetailsOrThrow(); + const configure: Array<(tool: ToolRunner) => ToolRunner> = [ + connectionArguments(connection), + // @ts-expect-error + argumentIfSet(argumentEnquote, "space", space), + multiArgument(argumentEnquote, "package-id", packageIds), + // @ts-expect-error + argument("version", packageVersion), + argumentEnquote("file", buildInformationFile), + argument("overwrite-mode", overwriteMode), + // @ts-expect-error + includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), + ]; + + const code: number = await octo + .map((x) => x.launchOcto(configure, "(build-information;push;v4)")) + .getOrElseL((x) => { + throw new Error(x); + }); + + tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded with code " + code); + } catch (error: unknown) { + if (error instanceof Error) { + tasks.setResult(tasks.TaskResult.Failed, `"Failed to push build information. ${error.message}${os.EOL}${error.stack}`, true); + } + } +} + +run(); diff --git a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/task.json b/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/task.json new file mode 100644 index 00000000..3fe3f3fb --- /dev/null +++ b/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/task.json @@ -0,0 +1,97 @@ +{ + "id": "b1861ef4-b62e-40c1-bcb0-be00d454a8a7", + "name": "OctopusMetadata", + "friendlyName": "Push Package Build Information to Octopus (legacy)", + "description": "(legacy) There is a later version of this task, we recommend using the latest version. Collect information related to the build, including work items from commit messages, and push to your Octopus Deploy Server.", + "helpMarkDown": "set-by-pack.ps1", + "category": "Package", + "visibility": ["Build"], + "author": "Octopus Deploy", + "version": { + "Major": 4, + "Minor": 3, + "Patch": 0 + }, + "demands": [], + "minimumAgentVersion": "2.144.0", + "groups": [ + { + "name": "advanced", + "displayName": "Advanced Options", + "isExpanded": false + } + ], + "inputs": [ + { + "name": "OctoConnectedServiceName", + "type": "connectedService:OctopusEndpoint", + "label": "Octopus Deploy Server", + "defaultValue": "", + "required": true, + "helpMarkDown": "Octopus Deploy server connection" + }, + { + "name": "Space", + "type": "pickList", + "label": "Space", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The space within Octopus." + }, + { + "name": "PackageId", + "type": "multiLine", + "label": "Package IDs", + "defaultValue": "", + "required": true, + "helpMarkDown": "Newline-separated package IDs; e.g.\nMyCompany.MyApp\nMyCompany.MyApp2" + }, + { + "name": "PackageVersion", + "type": "string", + "label": "Package Version", + "defaultValue": "", + "required": true, + "helpMarkDown": "The version of the package; must be a valid [SemVer](http://semver.org/) version." + }, + { + "name": "Replace", + "type": "pickList", + "label": "Overwrite Mode", + "defaultValue": "false", + "required": true, + "helpMarkDown": "Normally, if the same package build information already exists on the server, the server will reject the package build information push. This is a good practice as it ensures build information isn't accidentally overwritten or ignored. Use this setting to override this behavior.", + "options": { + "false": "Fail if exists", + "true": "Overwrite existing", + "IgnoreIfExists": "Ignore if exists" + } + }, + { + "name": "AdditionalArguments", + "type": "string", + "label": "Additional Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctopusCliBuildInformation) for available parameters.", + "groupName": "advanced" + } + ], + "dataSourceBindings": [ + { + "target": "Space", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllSpaces", + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + } + ], + "instanceNameFormat": "Push Package Build Information to Octopus (legacy)", + "execution": { + "Node10": { + "target": "index.js" + } + } +} diff --git a/source/tasksLegacy/Pack/PackV4/icon.png b/source/tasksLegacy/Pack/PackV4/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..aae79512bdbe636d02f29e0df2ce1e022a9bf14e GIT binary patch literal 399 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XyaRkfT=geE`2YWZ^12tNpM0Nw^1Za4y@GrCjn_XzlJYk&O9__pP)pOyKjn_XNY%KN!@l^rhOoW^09)+pR`;?VM02NMt7JTf6n z?~{m0@HdHz6R(`j`I6Drs>%OxOKOG3TA!SwQ|>pLzvXwk)MWF2S*_rW{dW1jKe!AS Y-Y$}SQ}F9jD$oNAp00i_>zopr03iIossI20 literal 0 HcmV?d00001 diff --git a/source/tasksLegacy/Pack/PackV4/icon.svg b/source/tasksLegacy/Pack/PackV4/icon.svg new file mode 100644 index 00000000..d9d027bc --- /dev/null +++ b/source/tasksLegacy/Pack/PackV4/icon.svg @@ -0,0 +1 @@ +octopus \ No newline at end of file diff --git a/source/tasksLegacy/Pack/PackV4/index.ts b/source/tasksLegacy/Pack/PackV4/index.ts new file mode 100644 index 00000000..1c5b5135 --- /dev/null +++ b/source/tasksLegacy/Pack/PackV4/index.ts @@ -0,0 +1,115 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as tasks from "azure-pipelines-task-lib/task"; +import * as fs from "fs"; +import { ToolRunner } from "azure-pipelines-task-lib/toolrunner"; +import { getLineSeparatedItems, isNullOrWhitespace, removeTrailingSlashes, safeTrim } from "../../Utils/inputs"; +import { argument, argumentEnquote, argumentIfSet, flag, getOrInstallOctoCommandRunner, includeAdditionalArguments, multiArgument } from "../../Utils/tool"; +import os from "os"; + +export interface PackageRequiredInputs { + packageId: string; + packageFormat: string; +} +export interface PackageOptionalInputs { + packageVersion?: string; + outputPath?: string; + sourcePath?: string; + nuGetAuthor?: string; + nuGetTitle?: string; + nuGetDescription?: string; + nuGetReleaseNotes?: string; + nuGetReleaseNotesFile?: string; + include?: string[]; + listFiles: boolean; + overwrite: boolean; + additionalArguments: string; + compressionLevel: string; +} + +export type PackageInputs = PackageRequiredInputs & PackageOptionalInputs; + +export const configure = (inputs: PackageInputs) => { + return [ + argumentEnquote("id", inputs.packageId), + argument("format", inputs.packageFormat), + // @ts-ignore + argumentIfSet(argument, "version", inputs.packageVersion), + argumentIfSet(argument, "compressionlevel", inputs.compressionLevel), + // @ts-ignore + argumentIfSet(argumentEnquote, "outFolder", inputs.outputPath), + // @ts-ignore + argumentIfSet(argumentEnquote, "basePath", inputs.sourcePath), + // @ts-ignore + argumentIfSet(argumentEnquote, "author", inputs.nuGetAuthor), + // @ts-ignore + argumentIfSet(argumentEnquote, "title", inputs.nuGetTitle), + // @ts-ignore + argumentIfSet(argumentEnquote, "description", inputs.nuGetDescription), + // @ts-ignore + argumentIfSet(argumentEnquote, "releaseNotes", inputs.nuGetReleaseNotes), + argument("overwrite", inputs.overwrite.toString()), + includeAdditionalArguments(inputs.additionalArguments), + (tool: ToolRunner) => { + if (!isNullOrWhitespace(inputs.nuGetReleaseNotesFile) && fs.existsSync(inputs.nuGetReleaseNotesFile) && fs.lstatSync(inputs.nuGetReleaseNotesFile).isFile()) { + console.log(`Release notes file: ${inputs.nuGetReleaseNotesFile}`); + argumentEnquote("releaseNotesFile", inputs.nuGetReleaseNotesFile, tool); + } else { + console.log("No release notes file found"); + } + return tool; + }, + multiArgument(argumentEnquote, "include", inputs.include || []), + flag("verbose", inputs.listFiles), + ]; +}; + +export const getInputs = (): PackageInputs => { + return { + // @ts-ignore + packageId: tasks.getInput("PackageId", true), + // @ts-ignore + packageFormat: tasks.getInput("PackageFormat", true), + packageVersion: tasks.getInput("PackageVersion"), + outputPath: removeTrailingSlashes(safeTrim(tasks.getPathInput("OutputPath"))) || undefined, + sourcePath: removeTrailingSlashes(safeTrim(tasks.getPathInput("SourcePath"))) || undefined, + nuGetAuthor: tasks.getInput("NuGetAuthor"), + nuGetTitle: tasks.getInput("NuGetTitle"), + nuGetDescription: tasks.getInput("NuGetDescription"), + nuGetReleaseNotes: tasks.getInput("NuGetReleaseNotes"), + nuGetReleaseNotesFile: tasks.getInput("NuGetReleaseNotesFile", false), + overwrite: tasks.getBoolInput("Overwrite"), + // @ts-ignore + include: getLineSeparatedItems(tasks.getInput("Include")), + listFiles: tasks.getBoolInput("ListFiles"), + // @ts-ignore + additionalArguments: tasks.getInput("AdditionalArguments"), + // @ts-ignore + compressionLevel: tasks.getInput("CompressionLevel"), + }; +}; + +async function run() { + try { + tasks.warning(`This task is supported, but it no longer actively maintained. +It was originally created for the Octopus CLI when Octopus Deploy only supported NuGet packages. +It is recommended to migrate to the built-in 'Archive Files' task (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/archive-files). +Alternatively, if NuGet package metadata is required, consider using the 'NuGet' task (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/package/nuget) or the 'dotnet pack' task (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli).`); + + const octo = await getOrInstallOctoCommandRunner("pack"); + const configureTool = configure(getInputs()); + + const code: number = await octo + .map((x) => x.launchOcto(configureTool, "(package;pack;v4)")) + .getOrElseL((x) => { + throw new Error(x); + }); + + tasks.setResult(tasks.TaskResult.Succeeded, "Pack succeeded with code " + code); + } catch (error: unknown) { + if (error instanceof Error) { + tasks.setResult(tasks.TaskResult.Failed, `"Failed to execute octo pack command. ${error.message}${os.EOL}${error.stack}`, true); + } + } +} + +run(); diff --git a/source/tasksLegacy/Pack/PackV4/task.json b/source/tasksLegacy/Pack/PackV4/task.json new file mode 100644 index 00000000..b53988f6 --- /dev/null +++ b/source/tasksLegacy/Pack/PackV4/task.json @@ -0,0 +1,179 @@ +{ + "id": "179fac12-2402-486e-80cf-5a6a8571f7c0", + "name": "OctopusPack", + "friendlyName": "Package Application for Octopus", + "description": "Package your application into a NuPkg or Zip file.", + "helpMarkDown": "set-by-pack.ps1", + "category": "Package", + "visibility": [ + "Build", + "Release" + ], + "author": "Octopus Deploy", + "version": { + "Major": 4, + "Minor": 3, + "Patch": 0 + }, + "demands": [], + "minimumAgentVersion": "2.144.0", + "groups": [ + { + "name": "nuget", + "displayName": "NuGet", + "isExpanded": false + }, + { + "name": "advanced", + "displayName": "Advanced Options", + "isExpanded": false + } + ], + "inputs": [ + { + "name": "PackageId", + "type": "string", + "label": "Package ID", + "defaultValue": "", + "required": true, + "helpMarkDown": "The ID of the package. e.g. MyCompany.App" + }, + { + "name": "PackageFormat", + "type": "pickList", + "label": "Package Format", + "required": true, + "defaultValue": "NuPkg", + "options": { + "NuPkg": "NuPkg", + "Zip": "Zip" + }, + "helpMarkDown": "Package format. Must be either NuPkg or Zip." + }, + { + "name": "PackageVersion", + "type": "string", + "label": "Package Version", + "defaultValue": "", + "required": false, + "helpMarkDown": "The version of the package; must be a valid [SemVer](http://semver.org/) version; defaults to a timestamp-based version." + }, + { + "name": "SourcePath", + "type": "filePath", + "label": "Source Path", + "defaultValue": "", + "required": false, + "helpMarkDown": "The folder containing the files and folders to package. Defaults to working directory." + }, + { + "name": "OutputPath", + "type": "filePath", + "label": "Output Path", + "defaultValue": "", + "required": false, + "helpMarkDown": "The directory into which the generated package will be written. Defaults to working directory." + }, + { + "name": "NuGetAuthor", + "type": "string", + "label": "Author", + "defaultValue": "", + "required": false, + "helpMarkDown": "Add an author to the NuGet package metadata.", + "groupName": "nuget" + }, + { + "name": "NuGetTitle", + "type": "string", + "label": "Title", + "defaultValue": "", + "required": false, + "helpMarkDown": "Add a title to the NuGet package metadata.", + "groupName": "nuget" + }, + { + "name": "NuGetDescription", + "type": "string", + "label": "Description", + "defaultValue": "", + "required": false, + "helpMarkDown": "Add a description to the NuGet package metadata.", + "groupName": "nuget" + }, + { + "name": "NuGetReleaseNotes", + "type": "string", + "label": "Release Notes", + "defaultValue": "", + "required": false, + "helpMarkDown": "Add release notes to the NuGet package metadata.", + "groupName": "nuget" + }, + { + "name": "NuGetReleaseNotesFile", + "type": "filePath", + "label": "Release Notes File", + "defaultValue": "", + "required": false, + "helpMarkDown": "A file containing release notes to be added to the NuGet package metadata.", + "groupName": "nuget" + }, + { + "name": "Include", + "type": "multiLine", + "label": "Include", + "defaultValue": "", + "required": false, + "helpMarkDown": "File patterns to include, relative to the root path. e.g. /bin/*.dll", + "groupName": "advanced" + }, + { + "name": "Overwrite", + "type": "boolean", + "label": "Overwrite", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Allow an existing package of the same ID and version to be overwritten.", + "groupName": "advanced" + }, + { + "name": "ListFiles", + "type": "boolean", + "label": "Log Added Files", + "defaultValue": "false", + "required": "false", + "helpMarkDown": "Write a list of all files added to the build log.", + "groupName": "advanced" + }, + { + "name": "CompressionLevel", + "type": "pickList", + "label": "Compression Level", + "defaultValue": "optimal", + "required": false, + "helpMarkDown": "Set the compression level.", + "groupName": "advanced", + "options": { + "none": "None", + "fast": "Fast", + "optimal": "Optimal" + } + }, + { + "name": "AdditionalArguments", + "type": "string", + "label": "Additional Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctopusCliPack) for available parameters.", + "groupName": "advanced" + } + ], + "instanceNameFormat": "Package $(PackageId)", + "execution": { + "Node10": { + "target": "index.js" + } + } +} diff --git a/source/tasksLegacy/Promote/PromoteV3/icon.png b/source/tasksLegacy/Promote/PromoteV3/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..0f1c1a7aa10ce39e27a6d85e44c9f440914e3bc3 GIT binary patch literal 621 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XCI|S0xav=SAgyQr|NsB#C*LQpdto!{k#@r&857S>KmK|y zeA0F3-RURaYxlg-s@f5@{8_=)S9-nI6#WW6e)_DMI6=WZec#=$H(vkL$Xzo1b}US(G$pd5Hfjc=L##jy>z%tgnYz3J z2NpRo>s)V?YEWLZ;`OdahfT62*MFLx$MT>h>?*^SmarLDUNro<%d|b2ovV_m`W=Iw z&IFw|535(4XDH;idAP#gDsbDS1DjVr&YASISyzs~qmGYv#aiP6A-f5Vm1zd$pR10X znSbc4ac6UkDRfqa6 z=_HXVv(wc_)&`|aseii93Ax|&iGyn5Pmw#V> d{ZBA~f%lnJ$_HM<-@veE@O1TaS?83{1ONl5HsSyP literal 0 HcmV?d00001 diff --git a/source/tasksLegacy/Promote/PromoteV3/icon.svg b/source/tasksLegacy/Promote/PromoteV3/icon.svg new file mode 100644 index 00000000..94905963 --- /dev/null +++ b/source/tasksLegacy/Promote/PromoteV3/icon.svg @@ -0,0 +1 @@ +octopus \ No newline at end of file diff --git a/source/tasksLegacy/Promote/PromoteV3/index.ts b/source/tasksLegacy/Promote/PromoteV3/index.ts new file mode 100644 index 00000000..53b5eb44 --- /dev/null +++ b/source/tasksLegacy/Promote/PromoteV3/index.ts @@ -0,0 +1,55 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as tasks from "azure-pipelines-task-lib/task"; +import { multiArgument, connectionArguments, includeAdditionalArgumentsAndProxyConfig, flag, argumentEnquote, argumentIfSet, getOrInstallOctoCommandRunner } from "../../Utils/tool"; +import { getOptionalCsvInput, getRequiredCsvInput } from "../../Utils/inputs"; +import { getDefaultOctopusConnectionDetailsOrThrow, resolveProjectName } from "../../Utils/connection"; +import os from "os"; + +async function run() { + try { + tasks.warning("There is a later version of this task, we recommend using the latest version."); + const connection = getDefaultOctopusConnectionDetailsOrThrow(); + + const space = tasks.getInput("Space"); + // @ts-expect-error + const project = await resolveProjectName(connection, tasks.getInput("Project", true)).then((x) => x.value); + + const from = tasks.getInput("From", true); + const to = getRequiredCsvInput("To"); + const showProgress = tasks.getBoolInput("ShowProgress"); + const deploymentForTenants = getOptionalCsvInput("DeployForTenants"); + const deployForTenantTags = getOptionalCsvInput("DeployForTentantTags"); + const additionalArguments = tasks.getInput("AdditionalArguments"); + + const octo = await getOrInstallOctoCommandRunner("promote-release"); + + const configure = [ + // @ts-expect-error + argumentIfSet(argumentEnquote, "space", space), + argumentEnquote("project", project), + connectionArguments(connection), + // @ts-expect-error + argumentEnquote("from", from), + multiArgument(argumentEnquote, "to", to), + multiArgument(argumentEnquote, "tenant", deploymentForTenants), + multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), + flag("progress", showProgress), + // @ts-expect-error + includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), + ]; + + const code: number = await octo + .map((x) => x.launchOcto(configure, "(release;promote;v3)")) + .getOrElseL((x) => { + throw new Error(x); + }); + + tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded promoting release with code " + code); + } catch (error: unknown) { + if (error instanceof Error) { + tasks.setResult(tasks.TaskResult.Failed, `"Failed to promote release. ${error.message}${os.EOL}${error.stack}`, true); + } + } +} + +run(); diff --git a/source/tasksLegacy/Promote/PromoteV3/task.json b/source/tasksLegacy/Promote/PromoteV3/task.json new file mode 100644 index 00000000..83b24410 --- /dev/null +++ b/source/tasksLegacy/Promote/PromoteV3/task.json @@ -0,0 +1,173 @@ +{ + "id": "1627fcfe-f292-4904-adac-26cfb14bdb07", + "name": "OctopusPromote", + "friendlyName": "Promote Octopus Release", + "description": "There is a later version of this task, we recommend using the latest version. Promote an Octopus release from one environment to another", + "helpMarkDown": "set-by-pack.ps1", + "category": "Deploy", + "visibility": ["Build", "Release"], + "author": "Octopus Deploy", + "version": { + "Major": 3, + "Minor": 1, + "Patch": 0 + }, + "demands": [], + "minimumAgentVersion": "2.144.0", + "groups": [ + { + "name": "tenant", + "displayName": "Tenants", + "isExpanded": false + }, + { + "name": "advanced", + "displayName": "Advanced Options", + "isExpanded": false + } + ], + "inputs": [ + { + "name": "OctoConnectedServiceName", + "type": "connectedService:OctopusEndpoint", + "label": "Octopus Deploy Server", + "defaultValue": "", + "required": true, + "helpMarkDown": "Octopus Deploy server connection" + }, + { + "name": "Space", + "type": "string", + "label": "Space (Legacy - Use version 4 of this task)", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "False" + }, + "helpMarkDown": "Version 3 of this task has limited support for spaces. We recommend using version 4 of this task for a better experience." + }, + { + "name": "ProjectGroup", + "type": "pickList", + "label": "Project Group", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." + }, + { + "name": "Project", + "type": "pickList", + "label": "Project", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Octopus Deploy Project Name" + }, + { + "name": "From", + "type": "pickList", + "label": "Promote From", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The environment the release is currently deployed to. e.g. 'Staging'" + }, + { + "name": "To", + "type": "pickList", + "label": "Promote To", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Comma separated list of environments to deploy to" + }, + { + "name": "ShowProgress", + "type": "boolean", + "label": "Show Deployment Progress", + "defaultValue": "False", + "required": false, + "helpMarkDown": "If checked, the build process will only succeed if the deployment is successful." + }, + { + "name": "DeployForTenants", + "type": "pickList", + "label": "Tenant(s)", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Promote the release for this comma delimited list of tenants. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", + "groupName": "tenant" + }, + { + "name": "DeployForTenantTags", + "type": "string", + "label": "Tenant Tag(s)", + "defaultValue": "", + "required": false, + "helpMarkDown": "Promote the release for tenants who match these tags and are ready to deploy to the provided environment.", + "groupName": "tenant" + }, + { + "name": "AdditionalArguments", + "type": "string", + "label": "Additional Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExePromoteRelease) for available parameters.", + "groupName": "advanced" + } + ], + "dataSourceBindings": [ + { + "target": "ProjectGroup", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllProjectGroups", + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "Project", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusListProjectsInProjectGroup", + "parameters": { + "ProjectGroupId": "$(ProjectGroup)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "From", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllEnvironments", + "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "To", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllEnvironments", + "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "DeployForTenants", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllTenants", + "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + } + ], + "instanceNameFormat": "Promote $(Project) from $(From) to $(To)", + "execution": { + "Node10": { + "target": "index.js" + } + } +} diff --git a/source/tasksLegacy/Promote/PromoteV4/icon.png b/source/tasksLegacy/Promote/PromoteV4/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..0f1c1a7aa10ce39e27a6d85e44c9f440914e3bc3 GIT binary patch literal 621 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XCI|S0xav=SAgyQr|NsB#C*LQpdto!{k#@r&857S>KmK|y zeA0F3-RURaYxlg-s@f5@{8_=)S9-nI6#WW6e)_DMI6=WZec#=$H(vkL$Xzo1b}US(G$pd5Hfjc=L##jy>z%tgnYz3J z2NpRo>s)V?YEWLZ;`OdahfT62*MFLx$MT>h>?*^SmarLDUNro<%d|b2ovV_m`W=Iw z&IFw|535(4XDH;idAP#gDsbDS1DjVr&YASISyzs~qmGYv#aiP6A-f5Vm1zd$pR10X znSbc4ac6UkDRfqa6 z=_HXVv(wc_)&`|aseii93Ax|&iGyn5Pmw#V> d{ZBA~f%lnJ$_HM<-@veE@O1TaS?83{1ONl5HsSyP literal 0 HcmV?d00001 diff --git a/source/tasksLegacy/Promote/PromoteV4/icon.svg b/source/tasksLegacy/Promote/PromoteV4/icon.svg new file mode 100644 index 00000000..94905963 --- /dev/null +++ b/source/tasksLegacy/Promote/PromoteV4/icon.svg @@ -0,0 +1 @@ +octopus \ No newline at end of file diff --git a/source/tasksLegacy/Promote/PromoteV4/index.ts b/source/tasksLegacy/Promote/PromoteV4/index.ts new file mode 100644 index 00000000..672fc0bd --- /dev/null +++ b/source/tasksLegacy/Promote/PromoteV4/index.ts @@ -0,0 +1,55 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as tasks from "azure-pipelines-task-lib/task"; +import { argumentEnquote, argumentIfSet, assertOctoVersionAcceptsIds, connectionArguments, flag, getOrInstallOctoCommandRunner, includeAdditionalArgumentsAndProxyConfig, multiArgument } from "../../Utils/tool"; +import { getOptionalCsvInput, getRequiredCsvInput } from "../../Utils/inputs"; +import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; +import os from "os"; + +async function run() { + try { + tasks.warning("There is a later version of this task, we recommend using the latest version."); + const connection = getDefaultOctopusConnectionDetailsOrThrow(); + + const space = tasks.getInput("Space"); + const project = tasks.getInput("Project", true); + const from = tasks.getInput("From", true); + const to = getRequiredCsvInput("To"); + const deployForTenants = getOptionalCsvInput("DeployForTenants"); + const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); + const showProgress = tasks.getBoolInput("ShowProgress"); + const additionalArguments = tasks.getInput("AdditionalArguments"); + + await assertOctoVersionAcceptsIds(); + const octo = await getOrInstallOctoCommandRunner("promote-release"); + + const configure = [ + // @ts-expect-error + argumentIfSet(argumentEnquote, "space", space), + // @ts-expect-error + argumentEnquote("project", project), + connectionArguments(connection), + // @ts-expect-error + argumentEnquote("from", from), + multiArgument(argumentEnquote, "to", to), + multiArgument(argumentEnquote, "tenant", deployForTenants), + multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), + flag("progress", showProgress), + // @ts-expect-error + includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), + ]; + + const code: number = await octo + .map((x) => x.launchOcto(configure, "(release;promote;v4)")) + .getOrElseL((x) => { + throw new Error(x); + }); + + tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded promoting release with code " + code); + } catch (error: unknown) { + if (error instanceof Error) { + tasks.setResult(tasks.TaskResult.Failed, `"Failed to promote release. ${error.message}${os.EOL}${error.stack}`, true); + } + } +} + +run(); diff --git a/source/tasksLegacy/Promote/PromoteV4/task.json b/source/tasksLegacy/Promote/PromoteV4/task.json new file mode 100644 index 00000000..d29b100f --- /dev/null +++ b/source/tasksLegacy/Promote/PromoteV4/task.json @@ -0,0 +1,195 @@ +{ + "id": "1627fcfe-f292-4904-adac-26cfb14bdb07", + "name": "OctopusPromote", + "friendlyName": "Promote Octopus Release", + "description": "There is a later version of this task, we recommend using the latest version. Promote an Octopus release from one environment to another", + "helpMarkDown": "set-by-pack.ps1", + "category": "Deploy", + "visibility": ["Build", "Release"], + "author": "Octopus Deploy", + "version": { + "Major": 4, + "Minor": 3, + "Patch": 0 + }, + "demands": [], + "minimumAgentVersion": "2.144.0", + "groups": [ + { + "name": "tenant", + "displayName": "Tenants", + "isExpanded": false + }, + { + "name": "advanced", + "displayName": "Advanced Options", + "isExpanded": false + } + ], + "inputs": [ + { + "name": "OctoConnectedServiceName", + "type": "connectedService:OctopusEndpoint", + "label": "Octopus Deploy Server", + "defaultValue": "", + "required": true, + "helpMarkDown": "Octopus Deploy server connection" + }, + { + "name": "Space", + "type": "pickList", + "label": "Space", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The space within Octopus." + }, + { + "name": "ProjectGroup", + "type": "pickList", + "label": "Project Group", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." + }, + { + "name": "Project", + "type": "pickList", + "label": "Project", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The project within Octopus." + }, + { + "name": "From", + "type": "pickList", + "label": "Promote From", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The environment the release is currently deployed to. e.g. 'Staging'" + }, + { + "name": "To", + "type": "pickList", + "label": "Promote To", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Comma separated list of environments to deploy to" + }, + { + "name": "ShowProgress", + "type": "boolean", + "label": "Show Deployment Progress", + "defaultValue": "False", + "required": false, + "helpMarkDown": "If checked, the build process will only succeed if the deployment is successful." + }, + { + "name": "DeployForTenants", + "type": "pickList", + "label": "Tenant(s)", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "Promote the release for this comma delimited list of tenants. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", + "groupName": "tenant" + }, + { + "name": "DeployForTenantTags", + "type": "string", + "label": "Tenant Tag(s)", + "defaultValue": "", + "required": false, + "helpMarkDown": "Promote the release for tenants who match these tags and are ready to deploy to the provided environment.", + "groupName": "tenant" + }, + { + "name": "AdditionalArguments", + "type": "string", + "label": "Additional Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExePromoteRelease) for available parameters.", + "groupName": "advanced" + } + ], + "dataSourceBindings": [ + { + "target": "Space", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllSpaces", + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "ProjectGroup", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllProjectGroupsInSpace", + "parameters": { + "SpaceId": "$(Space)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "Project", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusListProjectsInProjectGroupInSpace", + "parameters": { + "SpaceId": "$(Space)", + "ProjectGroupId": "$(ProjectGroup)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "From", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusProjectEnvironmentsInSpace", + "parameters": { + "SpaceId": "$(Space)", + "ProjectId": "$(Project)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "To", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusProjectEnvironmentsInSpace", + "parameters": { + "SpaceId": "$(Space)", + "ProjectId": "$(Project)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + }, + { + "target": "DeployForTenants", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusProjectTenantsInSpace", + "parameters": { + "SpaceId": "$(Space)", + "ProjectName": "$(Project)" + }, + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + } + ], + "instanceNameFormat": "Promote Project in Octopus", + "execution": { + "Node10": { + "target": "index.js" + } + } +} diff --git a/source/tasksLegacy/Push/PushV3/icon.png b/source/tasksLegacy/Push/PushV3/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..236566a308c71c4b35ce91fa54e6914d05fb8d7b GIT binary patch literal 481 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X5(0ceT=geE`2YXEw4QzPx)(OH9^H8T^V5&NwR_$iJAMB2 zlkd|{z7JdeY{`X>D>rQ4clWDC?vm|$4|^_rGX3O-f~~JMUjO{`<8KR(@UBDe9zA_7 zW8(Sr({J6jGn&@kn#Jq<8&?5MzN-Gj8RWW>AirQB7aw4ViIIK_RQuY~#WAGf)|JUO zg_;dGToq^cx@BK|*Zu$hbk@acQL?{p++$Bya%U26DRcg?yrHafN@ijhgZ4r1rD>cV z3NIEYFVJzex!AERaEc521I41Md6xGQ)F%rjx;bztnH<-Cb9A{1o6Eh}1U819ca*nG zm+fZUxZM1v#PO~^%`NJJE-iDIgrXGHTDTmJtv%Q9TK0{={z`MZhK=0Z+>-MIj5Y|y z9A0xm?Mgz*b=ND;xTpNT7s&dg{Nhgm$)%1_;l&3Qg-X3%IeF*&R+q&G0y|G#y{PkN zL&dCBCvNy}vz?b_|L$w;kE+Gn%0G$!U$dQonSt+$*N$DY75)Id&EVoctopus \ No newline at end of file diff --git a/source/tasksLegacy/Push/PushV3/index.ts b/source/tasksLegacy/Push/PushV3/index.ts new file mode 100644 index 00000000..e002e3a0 --- /dev/null +++ b/source/tasksLegacy/Push/PushV3/index.ts @@ -0,0 +1,47 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as tasks from "azure-pipelines-task-lib/task"; + +import { multiArgument, connectionArguments, includeAdditionalArgumentsAndProxyConfig, flag, argumentEnquote, argumentIfSet, getOrInstallOctoCommandRunner } from "../../Utils/tool"; +import { getLineSeparatedItems, resolveGlobs } from "../../Utils/inputs"; +import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; +import os from "os"; + +async function run() { + try { + tasks.warning("There is a later version of this task, we recommend using the latest version."); + const connection = getDefaultOctopusConnectionDetailsOrThrow(); + + const space = tasks.getInput("Space"); + // @ts-expect-error + const packages = getLineSeparatedItems(tasks.getInput("Package", true)); + const replace = tasks.getBoolInput("Replace"); + const additionalArguments = tasks.getInput("AdditionalArguments"); + + const octo = await getOrInstallOctoCommandRunner("push"); + const matchedPackages = await resolveGlobs(packages); + + const configure = [ + connectionArguments(connection), + // @ts-expect-error + argumentIfSet(argumentEnquote, "space", space), + multiArgument(argumentEnquote, "package", matchedPackages), + flag("replace-existing", replace), + // @ts-expect-error + includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), + ]; + + const code: number = await octo + .map((x) => x.launchOcto(configure, "(package;push;v3)")) + .getOrElseL((x) => { + throw new Error(x); + }); + + tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded with code " + code); + } catch (error: unknown) { + if (error instanceof Error) { + tasks.setResult(tasks.TaskResult.Failed, `"Failed to push package. ${error.message}${os.EOL}${error.stack}`, true); + } + } +} + +run(); diff --git a/source/tasksLegacy/Push/PushV3/task.json b/source/tasksLegacy/Push/PushV3/task.json new file mode 100644 index 00000000..5d6384ad --- /dev/null +++ b/source/tasksLegacy/Push/PushV3/task.json @@ -0,0 +1,76 @@ +{ + "id": "d05ad9a2-5d9e-4a1c-a887-14034334d6f2", + "name": "OctopusPush", + "friendlyName": "Push Package(s) to Octopus", + "description": "There is a later version of this task, we recommend using the latest version. Push your NuGet or Zip package to your Octopus Deploy Server", + "helpMarkDown": "set-by-pack.ps1", + "category": "Package", + "visibility": ["Build", "Release"], + "author": "Octopus Deploy", + "version": { + "Major": 3, + "Minor": 1, + "Patch": 0 + }, + "demands": [], + "minimumAgentVersion": "2.144.0", + "groups": [ + { + "name": "advanced", + "displayName": "Advanced Options", + "isExpanded": false + } + ], + "inputs": [ + { + "name": "OctoConnectedServiceName", + "type": "connectedService:OctopusEndpoint", + "label": "Octopus Deploy Server", + "defaultValue": "", + "required": true, + "helpMarkDown": "Octopus Deploy server connection" + }, + { + "name": "Space", + "type": "string", + "label": "Space (Legacy - Use version 4 of this task)", + "defaultValue": "", + "required": false, + "properties": { + "EditableOptions": "False" + }, + "helpMarkDown": "Version 3 of this task has limited support for spaces. We recommend using version 4 of this task for a better experience." + }, + { + "name": "Package", + "type": "multiLine", + "label": "Package", + "defaultValue": "", + "required": true, + "helpMarkDown": "Package file to push. To push multiple packages, enter on multiple lines." + }, + { + "name": "Replace", + "type": "boolean", + "label": "Replace Existing", + "defaultValue": "False", + "required": true, + "helpMarkDown": "If the package already exists in the repository, the default behavior is to reject the new package being pushed. Set this flag to 'True' to overwrite the existing package." + }, + { + "name": "AdditionalArguments", + "type": "string", + "label": "Additional Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExePush) for available parameters.", + "groupName": "advanced" + } + ], + "instanceNameFormat": "Push Packages to Octopus", + "execution": { + "Node10": { + "target": "index.js" + } + } +} diff --git a/source/tasksLegacy/Push/PushV4/icon.png b/source/tasksLegacy/Push/PushV4/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..236566a308c71c4b35ce91fa54e6914d05fb8d7b GIT binary patch literal 481 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X5(0ceT=geE`2YXEw4QzPx)(OH9^H8T^V5&NwR_$iJAMB2 zlkd|{z7JdeY{`X>D>rQ4clWDC?vm|$4|^_rGX3O-f~~JMUjO{`<8KR(@UBDe9zA_7 zW8(Sr({J6jGn&@kn#Jq<8&?5MzN-Gj8RWW>AirQB7aw4ViIIK_RQuY~#WAGf)|JUO zg_;dGToq^cx@BK|*Zu$hbk@acQL?{p++$Bya%U26DRcg?yrHafN@ijhgZ4r1rD>cV z3NIEYFVJzex!AERaEc521I41Md6xGQ)F%rjx;bztnH<-Cb9A{1o6Eh}1U819ca*nG zm+fZUxZM1v#PO~^%`NJJE-iDIgrXGHTDTmJtv%Q9TK0{={z`MZhK=0Z+>-MIj5Y|y z9A0xm?Mgz*b=ND;xTpNT7s&dg{Nhgm$)%1_;l&3Qg-X3%IeF*&R+q&G0y|G#y{PkN zL&dCBCvNy}vz?b_|L$w;kE+Gn%0G$!U$dQonSt+$*N$DY75)Id&EVoctopus \ No newline at end of file diff --git a/source/tasksLegacy/Push/PushV4/index.ts b/source/tasksLegacy/Push/PushV4/index.ts new file mode 100644 index 00000000..bd8d0671 --- /dev/null +++ b/source/tasksLegacy/Push/PushV4/index.ts @@ -0,0 +1,49 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as tasks from "azure-pipelines-task-lib/task"; + +import { getLineSeparatedItems, getOverwriteModeFromReplaceInput, resolveGlobs } from "../../Utils/inputs"; +import { argument, argumentEnquote, argumentIfSet, assertOctoVersionAcceptsIds, connectionArguments, getOrInstallOctoCommandRunner, includeAdditionalArgumentsAndProxyConfig, multiArgument } from "../../Utils/tool"; +import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; +import os from "os"; + +async function run() { + try { + tasks.warning("There is a later version of this task, we recommend using the latest version."); + const connection = getDefaultOctopusConnectionDetailsOrThrow(); + + const space = tasks.getInput("Space"); + // @ts-expect-error + const packages = getLineSeparatedItems(tasks.getInput("Package", true)); + // @ts-expect-error + const overwriteMode = getOverwriteModeFromReplaceInput(tasks.getInput("Replace", true)); + const additionalArguments = tasks.getInput("AdditionalArguments"); + + await assertOctoVersionAcceptsIds(); + const octo = await getOrInstallOctoCommandRunner("push"); + const matchedPackages = await resolveGlobs(packages); + + const configure = [ + connectionArguments(connection), + // @ts-expect-error + argumentIfSet(argumentEnquote, "space", space), + multiArgument(argumentEnquote, "package", matchedPackages), + argument("overwrite-mode", overwriteMode), + // @ts-expect-error + includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), + ]; + + const code: number = await octo + .map((x) => x.launchOcto(configure, "(package;push;v4)")) + .getOrElseL((x) => { + throw new Error(x); + }); + + tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded with code " + code); + } catch (error: unknown) { + if (error instanceof Error) { + tasks.setResult(tasks.TaskResult.Failed, `"Failed to push package. ${error.message}${os.EOL}${error.stack}`, true); + } + } +} + +run(); diff --git a/source/tasksLegacy/Push/PushV4/task.json b/source/tasksLegacy/Push/PushV4/task.json new file mode 100644 index 00000000..f9aceb43 --- /dev/null +++ b/source/tasksLegacy/Push/PushV4/task.json @@ -0,0 +1,89 @@ +{ + "id": "d05ad9a2-5d9e-4a1c-a887-14034334d6f2", + "name": "OctopusPush", + "friendlyName": "Push Package(s) to Octopus", + "description": "There is a later version of this task, we recommend using the latest version. Push your NuGet or Zip package to your Octopus Deploy Server", + "helpMarkDown": "set-by-pack.ps1", + "category": "Package", + "visibility": ["Build", "Release"], + "author": "Octopus Deploy", + "version": { + "Major": 4, + "Minor": 3, + "Patch": 0 + }, + "demands": [], + "minimumAgentVersion": "2.144.0", + "groups": [ + { + "name": "advanced", + "displayName": "Advanced Options", + "isExpanded": false + } + ], + "inputs": [ + { + "name": "OctoConnectedServiceName", + "type": "connectedService:OctopusEndpoint", + "label": "Octopus Deploy Server", + "defaultValue": "", + "required": true, + "helpMarkDown": "Octopus Deploy server connection" + }, + { + "name": "Space", + "type": "pickList", + "label": "Space", + "defaultValue": "", + "required": true, + "properties": { + "EditableOptions": "True" + }, + "helpMarkDown": "The space within Octopus." + }, + { + "name": "Package", + "type": "multiLine", + "label": "Package", + "defaultValue": "", + "required": true, + "helpMarkDown": "Package file to push. To push multiple packages, enter on multiple lines." + }, + { + "name": "Replace", + "type": "pickList", + "label": "Overwrite Mode", + "defaultValue": "false", + "required": true, + "helpMarkDown": "Normally, if the same package already exists on the server, the server will reject the package push. This is a good practice as it ensures a package isn't accidentally overwritten or ignored. Use this setting to override this behavior.", + "options": { + "false": "Fail if exists", + "true": "Overwrite existing", + "IgnoreIfExists": "Ignore if exists" + } + }, + { + "name": "AdditionalArguments", + "type": "string", + "label": "Additional Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExePush) for available parameters.", + "groupName": "advanced" + } + ], + "dataSourceBindings": [ + { + "target": "Space", + "endpointId": "$(OctoConnectedServiceName)", + "dataSourceName": "OctopusAllSpaces", + "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" + } + ], + "instanceNameFormat": "Push Packages to Octopus", + "execution": { + "Node10": { + "target": "index.js" + } + } +} diff --git a/source/tasksLegacy/Utils/OctoApiKeyHandler.ts b/source/tasksLegacy/Utils/OctoApiKeyHandler.ts new file mode 100644 index 00000000..64d7f4c9 --- /dev/null +++ b/source/tasksLegacy/Utils/OctoApiKeyHandler.ts @@ -0,0 +1,26 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { IRequestHandler, IHttpClientResponse } from "typed-rest-client/Interfaces"; +import * as http from "http"; + +export class OctoApiKeyHandler implements IRequestHandler { + key: string; + + constructor(key: string) { + this.key = key; + } + + prepareRequest(options: http.RequestOptions): void { + // @ts-expect-error + options.headers["X-Octopus-ApiKey"] = this.key; + } + + canHandleAuthentication(): boolean { + return false; + } + + handleAuthentication(): Promise { + throw "This handler does not handle authentication."; + } +} + +export default OctoApiKeyHandler; diff --git a/source/tasksLegacy/Utils/connection.ts b/source/tasksLegacy/Utils/connection.ts new file mode 100644 index 00000000..54234a33 --- /dev/null +++ b/source/tasksLegacy/Utils/connection.ts @@ -0,0 +1,57 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as tasks from "azure-pipelines-task-lib/task"; +import { RestClient } from "typed-rest-client/RestClient"; +import { getDefaultOctoConnectionInputValue } from "./inputs"; +import { either } from "fp-ts"; +import OctoApiKeyHandler from "./OctoApiKeyHandler"; + +export interface OctoServerConnectionDetails { + url: string; + apiKey: string; + ignoreSslErrors: boolean; +} + +export function getDefaultOctopusConnectionDetailsOrThrow() { + const result = getDefaultOctoConnectionInputValue().map(getOctopusConnectionDetails).toNullable(); + if (!result) { + throw new Error("Could not retrieve default Octo connection information"); + } + return result; +} + +export function getOctopusConnectionDetails(name: string): OctoServerConnectionDetails { + const octoEndpointAuthorization = tasks.getEndpointAuthorization(name, false); + const ignoreSSL = tasks.getEndpointDataParameter(name, "ignoreSslErrors", true); + return { + // @ts-expect-error + url: tasks.getEndpointUrl(name, false), + // @ts-expect-error + apiKey: octoEndpointAuthorization.parameters["apitoken"], + ignoreSslErrors: !!ignoreSSL && ignoreSSL.toLowerCase() === "true", + }; +} + +export function fetchProjectName(details: OctoServerConnectionDetails, projectId: string) { + console.log("Ignore SSL: " + details.ignoreSslErrors); + const client = new RestClient("OctoTFS", details.url, [new OctoApiKeyHandler(details.apiKey)], { ignoreSslError: details.ignoreSslErrors }); + return client + .get<{ Name: string }>(`api/projects/${projectId}`) + .then((x) => { + if (x.result) { + return either.right(x.result.Name); + } + + return either.left(`Could not resolve project name given id "${projectId}". Server returned status code: ${x.statusCode}`); + }) + .catch((error) => either.left(error)); +} + +export const isProjectId = (projectNameOrId: string) => /\w*Projects-\d*/.test(projectNameOrId); + +export function resolveProjectName(connection: OctoServerConnectionDetails, projectNameOrId: string) { + if (isProjectId(projectNameOrId)) { + return fetchProjectName(connection, projectNameOrId); + } + + return Promise.resolve(either.right(projectNameOrId)); +} diff --git a/source/tasksLegacy/Utils/environment.ts b/source/tasksLegacy/Utils/environment.ts new file mode 100644 index 00000000..fdf704d5 --- /dev/null +++ b/source/tasksLegacy/Utils/environment.ts @@ -0,0 +1,243 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as path from "path"; +import { v4 as uuidv4 } from "uuid"; +import * as vsts from "azure-devops-node-api/WebApi"; +import * as wit from "azure-devops-node-api/interfaces/WorkItemTrackingInterfaces"; +import * as bi from "azure-devops-node-api/interfaces/BuildInterfaces"; +import * as tasks from "azure-pipelines-task-lib"; +import { isNullOrWhitespace } from "./inputs"; + +export interface ReleaseEnvironmentVariables { + releaseName: string; + releaseId: string; + releaseUri: string; +} + +export interface BuildEnvironmentVariables { + buildNumber: string; + buildId: number; + buildName: string; + buildRepositoryName: string; + buildRepositoryProvider: string; + buildRepositoryUri: string; + buildSourceVersion: string; +} + +export interface AgentEnvironmentVariables { + agentBuildDirectory: string; +} + +export interface SystemEnvironmentVariables { + projectName: string; + projectId: string; + teamCollectionUri: string; + defaultWorkingDirectory: string; +} + +export type VstsEnvironmentVariables = ReleaseEnvironmentVariables & BuildEnvironmentVariables & AgentEnvironmentVariables & SystemEnvironmentVariables; + +export const getVstsEnvironmentVariables = (): VstsEnvironmentVariables => { + return { + projectId: process.env["SYSTEM_TEAMPROJECTID"] || "", + projectName: process.env["SYSTEM_TEAMPROJECT"] || "", + buildNumber: process.env["BUILD_BUILDNUMBER"] || "", + buildId: Number(process.env["BUILD_BUILDID"]), + buildName: process.env["BUILD_DEFINITIONNAME"] || "", + buildRepositoryName: process.env["BUILD_REPOSITORY_NAME"] || "", + releaseName: process.env["RELEASE_RELEASENAME"] || "", + releaseUri: process.env["RELEASE_RELEASEWEBURL"] || "", + releaseId: process.env["RELEASE_RELEASEID"] || "", + teamCollectionUri: process.env["SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"] || "", + defaultWorkingDirectory: process.env["SYSTEM_DEFAULTWORKINGDIRECTORY"] || "", + buildRepositoryProvider: process.env["BUILD_REPOSITORY_PROVIDER"] || "", + buildRepositoryUri: process.env["BUILD_REPOSITORY_URI"] || "", + buildSourceVersion: process.env["BUILD_SOURCEVERSION"] || "", + agentBuildDirectory: process.env["AGENT_BUILDDIRECTORY"] || "", + }; +}; + +export const generateReleaseNotesContent = (environment: VstsEnvironmentVariables, linkedItemReleaseNote: string, customReleaseNotes: string) => { + let notes = "Release created by "; + const buildUri = `${environment.teamCollectionUri}${encodeURIComponent(environment.projectName)}/_build/index?_a=summary&buildId=${environment.buildId}`; + + if (!isNullOrWhitespace(environment.releaseId)) { + notes += `Release Management Release [${environment.releaseName} #${environment.releaseId}](${environment.releaseUri}) `; + } + + if (environment.buildId) { + notes += `Build [${environment.buildName} #${environment.buildNumber}](${buildUri}) from the ${environment.buildRepositoryName} repository `; + } + + notes += `in Team Project ${environment.projectName}`; + if (!isNullOrWhitespace(linkedItemReleaseNote)) { + notes += `\r\n\r\n${linkedItemReleaseNote}`; + } + + if (!isNullOrWhitespace(customReleaseNotes)) { + notes += `\r\n\r\n**Custom Notes:**`; + notes += `\r\n\r\n${customReleaseNotes}`; + } + + return notes; +}; + +export const createReleaseNotesFile = (content: () => string, directory: string): string => { + const filePath = path.join(directory, `release-notes-${uuidv4()}.md`); + tasks.writeFile(filePath, content(), { encoding: "utf8" }); + return filePath; +}; + +export const getWorkItemState = (workItem: wit.WorkItem) => { + return `${workItem && workItem.fields ? workItem.fields["System.State"] : ""}`; +}; + +export const getWorkItemTags = (workItem: wit.WorkItem) => { + if (workItem && workItem.fields && !isNullOrWhitespace(workItem.fields["System.Tags"])) { + const tags = workItem.fields["System.Tags"].split(";"); + return tags.reduce((prev: string, current: string) => { + return (prev += `${current}`); + }, ""); + } + + return ""; +}; + +export const getLinkedReleaseNotes = async (client: vsts.WebApi, includeComments: boolean, includeWorkItems: boolean) => { + const environment = getVstsEnvironmentVariables(); + console.log(`Environment = ${environment.buildRepositoryProvider}`); + console.log(`Comments = ${includeComments}, WorkItems = ${includeWorkItems}`); + + try { + const changes = await client.getBuildApi().then((x) => x.getBuildChanges(environment.projectName, environment.buildId)); + + let releaseNotes = ""; + const newLine = "\r\n\r\n"; + + if (includeComments) { + if (environment.buildRepositoryProvider === "TfsVersionControl") { + console.log("Adding changeset comments to release notes"); + releaseNotes += changes.reduce((prev, current) => { + // @ts-expect-error + return prev + `* [${current.id} - ${current.author.displayName}](${getChangesetUrl(environment, current.location)}): ${current.message}${newLine}`; + }, `**Changeset Comments:**${newLine}`); + } else if (environment.buildRepositoryProvider === "TfsGit") { + /* + TfsGit repo has a known URL that individual commits can be linked to, + so the release notes have markdown URLs + */ + console.log("Adding commit message to release notes"); + releaseNotes += changes.reduce((prev, current) => { + // @ts-expect-error + return prev + `* [${current.id} - ${current.author.displayName}](${getCommitUrl(environment, current)}): ${current.message}${newLine}`; + }, `**Commit Messages:**${newLine}`); + } else { + /* + This could be any other git repo like Git, GitHub, SVN etc. We don't know + how to link to the commits here, so leave out the URLs. + */ + console.log("Adding commit message to release notes"); + releaseNotes += changes.reduce((prev, current) => { + // @ts-expect-error + return prev + `* ${current.id} - ${current.author.displayName}: ${current.message}${newLine}`; + }, `**Commit Messages:**${newLine}`); + } + } + + if (includeWorkItems) { + console.log("adding work items to release notes"); + releaseNotes += `**Work Items:**${newLine}`; + + const workItemRefs = await client.getBuildApi().then((x) => x.getBuildWorkItemsRefs(environment.projectName, environment.buildId)); + + if (workItemRefs.length > 0) { + const workItems = await client.getWorkItemTrackingApi().then((x) => x.getWorkItems(workItemRefs.map((x) => Number(x.id)))); + + const workItemEditBaseUri = `${environment.teamCollectionUri}${environment.projectId}/_workitems/edit`; + releaseNotes += workItems.reduce((prev, current) => { + // @ts-expect-error + return (prev += `* [${current.id}](${workItemEditBaseUri}/${current.id}): ${current.fields["System.Title"]} ${getWorkItemState(current)} ${getWorkItemTags(current)} ${newLine}`); + }, ""); + } + } + + console.log(`Release notes:\r\n${releaseNotes}`); + return releaseNotes; + } catch (ex) { + console.log("An exception was thrown while building the release notes."); + console.log(ex); + console.log("See https://github.com/OctopusDeploy/OctoTFS/issues/107 for more details."); + console.log("The release notes will be empty."); + return ""; + } +}; + +const getChangesetUrl = (environment: VstsEnvironmentVariables, apiUrl: string) => { + const workItemId = apiUrl.substr(apiUrl.lastIndexOf("/") + 1); + return `${environment.teamCollectionUri}${environment.projectId}/_versionControl/changeset/${workItemId}`; +}; + +const getCommitUrl = (environment: VstsEnvironmentVariables, change: bi.Change) => { + const commitId = change.id; + // @ts-expect-error + const segments = change.location.split("/"); + const repositoryId = segments[segments.length - 3]; + return `${environment.teamCollectionUri}${environment.projectId}/_git/${repositoryId}/commit/${commitId}`; +}; + +export const createVstsConnection = (environment: SystemEnvironmentVariables) => { + const vstsAuthorization = tasks.getEndpointAuthorization("SystemVssConnection", true); + // @ts-expect-error + const token = vstsAuthorization.parameters["AccessToken"]; + const authHandler = vsts.getPersonalAccessTokenHandler(token); + return new vsts.WebApi(environment.teamCollectionUri, authHandler); +}; + +export const getVcsTypeFromProvider = (buildRepositoryProvider: string) => { + switch (buildRepositoryProvider) { + case "TfsGit": + case "GitHub": + return "Git"; + case "TfsVersionControl": + return "TFVC"; + default: + return buildRepositoryProvider; + } +}; + +export const getBuildBranch = async (client: vsts.WebApi) => { + const environment = getVstsEnvironmentVariables(); + const api = await client.getBuildApi(); + return (await api.getBuild(environment.projectName, environment.buildId)).sourceBranch; +}; + +export const getBuildChanges = async (client: vsts.WebApi) => { + const environment = getVstsEnvironmentVariables(); + const api = await client.getBuildApi(); + const gitApi = await client.getGitApi(); + + const changes = await api.getBuildChanges(environment.projectName, environment.buildId, undefined, 100000); + + if (environment.buildRepositoryProvider === "TfsGit") { + const promises = changes.map(async (x) => { + if (x.messageTruncated) { + // @ts-expect-error + const segments = x.location.split("/"); + const repositoryId = segments[segments.length - 3]; + + try { + // @ts-expect-error + const commit = await gitApi.getCommit(x.id, repositoryId); + x.message = commit.comment; + } catch (err) { + tasks.warning(`Using a truncated commit message for commit ${x.id}, because an error occurred while fetching the full message. ${err}`); + } + } + + return x; + }); + + await Promise.all(promises); + } + + return changes; +}; diff --git a/source/tasksLegacy/Utils/inputs.ts b/source/tasksLegacy/Utils/inputs.ts new file mode 100644 index 00000000..ac8cb1b5 --- /dev/null +++ b/source/tasksLegacy/Utils/inputs.ts @@ -0,0 +1,74 @@ +import * as tasks from "azure-pipelines-task-lib/task"; +import { option } from "fp-ts"; +import glob from "glob"; +import { flatten } from "ramda"; + +export enum ReplaceOverwriteMode { + false = "FailIfExists", + true = "OverwriteExisting", + IgnoreIfExists = "IgnoreIfExists", +} + +export function getOverwriteModeFromReplaceInput(replace: string): ReplaceOverwriteMode { + return ReplaceOverwriteMode[replace as keyof typeof ReplaceOverwriteMode] || ReplaceOverwriteMode.false; +} + +export const DefaultOctoConnectionInputName = "OctoConnectedServiceName"; + +export const pGlobNoNull = (pattern: string): Promise => { + return new Promise((resolve, reject) => { + glob(pattern, { nonull: true }, (err, matches) => { + if (err) { + reject(err); + return; + } + resolve(matches); + }); + }); +}; + +export function isNullOrWhitespace(value: string | null | undefined): value is null | undefined { + return !value || !/\S/.test(value); +} + +export function safeTrim(value: string | null | undefined): string | null | undefined { + return value ? value.trim() : value; +} + +export function removeTrailingSlashes(value: string | null | undefined): string | null | undefined { + return value ? value.replace(/[/\\]+(?=\s*)$/, "") : value; +} + +export function getLineSeparatedItems(value: string): Array { + return value ? value.split(/[\r\n]+/g).map((x) => x.trim()) : []; +} + +const getRequiredInput = (name: string) => { + return option.fromNullable(tasks.getInput(name, true)); +}; + +const splitComma = (x: string) => x.split(",").map((x) => x.trim()); + +const getOptionalInput = (name: string) => { + return option.fromNullable(tasks.getInput(name, false)); +}; + +export const getOptionalCsvInput = (name: string) => { + return getOptionalInput(name).map(splitComma).getOrElse([]); +}; + +export const getRequiredCsvInput = (name: string) => { + return getRequiredInput(name).map(splitComma).getOrElse([]); +}; + +export { getRequiredInput, getOptionalInput }; + +export function getDefaultOctoConnectionInputValue() { + return getRequiredInput(DefaultOctoConnectionInputName); +} + +export const resolveGlobs = (globs: string[]): Promise => { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + return Promise.all(globs.map(pGlobNoNull)).then((x) => flatten(x)); +}; diff --git a/source/tasksLegacy/Utils/install.ts b/source/tasksLegacy/Utils/install.ts new file mode 100644 index 00000000..2c2e00ef --- /dev/null +++ b/source/tasksLegacy/Utils/install.ts @@ -0,0 +1,192 @@ +import * as path from "path"; +import * as fs from "fs"; +import * as tasks from "azure-pipelines-task-lib/task"; +import * as tools from "azure-pipelines-tool-lib/tool"; +import * as TypedRestClient from "typed-rest-client/RestClient"; +import { head, filter } from "ramda"; +import { IProxyConfiguration } from "typed-rest-client/Interfaces"; +import { ToolName, ToolNameBeforeV7 } from "./tool"; + +interface LatestResponse { + latest: string; + downloads: DownloadOption[]; +} + +type DownloadOption = { + version: string; + template: string; + location: string; + extension: string; + platform?: string; + architecture?: string; +}; + +type Primitive = undefined | null | boolean | number | string; + +interface Dictionary { + [key: string]: Primitive; +} + +const RestClient = TypedRestClient.RestClient; +const OctopurlsUrl = "https://g.octopushq.com"; + +const applyTemplate = (dictionary: Dictionary, template: string) => { + return Object.keys(dictionary).reduce((result, key) => result.replace(new RegExp(`{${key}}`, "g"), dictionary[key] ? String(dictionary[key]) : ""), template); +}; + +const isPortableDownloadOption = (option: DownloadOption) => { + return option.platform === "portable" && option.extension === ".zip"; +}; + +const filterPortableDownload = (options: DownloadOption[]) => head(filter(isPortableDownloadOption, options)); + +const extract = (archivePath: string) => { + return tools.extractZip(archivePath); +}; + +function getExecutableExtension(): string { + return ".dll"; +} + +function getLocalTool(version: string): string { + console.log("Checking local tool cache"); + return tools.findLocalTool(ToolName, version) || tools.findLocalTool(ToolNameBeforeV7, version); +} + +function findOcto(rootFolder: string) { + const octoPath = [path.join(rootFolder, "*" + ToolName + getExecutableExtension()), path.join(rootFolder, "*" + ToolNameBeforeV7 + getExecutableExtension())]; + console.log(`Looking for ${octoPath}`); + const allPaths = tasks.find(rootFolder); + const matches = tasks.match(allPaths, octoPath, rootFolder); + return matches[0]; +} + +async function getOrDownloadOcto(option: DownloadOption, download?: (option: DownloadOption) => Promise, extractTool = true): Promise { + let cachedToolPath = getLocalTool(option.version); + + if (!cachedToolPath) { + try { + console.log("Attempting to download the Octopus CLI tool"); + const downloadPath = await (download !== undefined && download != null ? download(option) : tools.downloadTool(option.location)); + const toolPath = extractTool ? await extract(downloadPath) : downloadPath; + + tools.debug(`Adding ${ToolName} ${option.version} to cache`); + tasks.writeFile(path.join(toolPath, `${ToolName}.cmd`), `dotnet "%~dp0/${ToolName}.dll" %*`); + cachedToolPath = await tools.cacheDir(toolPath, ToolName, option.version); + } catch (exception) { + throw new Error(`Failed to download Octopus CLI tool version ${option.version}. ${exception}`); + } + } + + const octoPath = findOcto(cachedToolPath); + if (!octoPath) { + throw new Error("The Octopus CLI tool wasn't found in tools directory"); + } + + tools.debug(`Found ${ToolName} at ${octoPath}`); + + fs.chmodSync(octoPath, "777"); + + tools.debug(`chmod for ${octoPath} applied`); + + return octoPath; +} + +async function resolvePublishedOctoVersion(version?: string): Promise { + if (!version) { + version = "latest"; + } + console.log(`Attempting to contact ${OctopurlsUrl} to find Octopus CLI tool version ${version}`); + + const proxyConfiguration = tasks.getHttpProxyConfiguration(OctopurlsUrl); + let proxySettings: IProxyConfiguration | undefined = undefined; + + if (proxyConfiguration) { + console.log( + "Using agent configured proxy. If this command should not be sent via the agent's proxy, you might need to add or modify the agent's .proxybypass file. See https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/proxy#specify-proxy-bypass-urls." + ); + proxySettings = { + proxyUrl: proxyConfiguration.proxyUrl, + proxyUsername: proxyConfiguration.proxyUsername, + proxyPassword: proxyConfiguration.proxyPassword, + proxyBypassHosts: proxyConfiguration.proxyBypassHosts, + }; + } + + const octopurls = new RestClient("OctoTFS/Tasks", OctopurlsUrl, undefined, { proxy: proxySettings }); + + const response = await octopurls.get("LatestTools"); + + if (response.result === null || response.result === undefined) { + throw Error(`Failed to resolve Octopus CLI tool version ${version}. Endpoint returned status code ${response.statusCode})`); + } + + const option = filterPortableDownload(response.result.downloads); + + if (option === null || option === undefined) { + throw Error(`Failed to resolve the Octopus CLI tool portable download location. The result did not contain the download location.`); + } + + if (version === "latest" || version === response.result.latest) { + return option; + } + + //Adjust the version and location to point to the specified version + const result = { ...option, version }; + result.location = applyTemplate(result, result.template); + + return result; +} + +function addToolToPath(toolPath: string) { + if (!process.env["PATH"]?.startsWith(path.dirname(toolPath))) { + tools.debug(`Adding ${ToolName} to path`); + tools.prependPath(path.dirname(toolPath)); + } + + return toolPath; +} + +async function getEmbeddedOcto(folderPath: string): Promise { + const versionPath = path.join(folderPath, "version.json"); + const option = JSON.parse(await readFile(versionPath)); + const tempDirectory = getAgentTempDirectory(); + + tasks.cp(folderPath, tempDirectory, "-rf"); + + if (!option) { + throw "Could not resolve the original download location of the embedded Octopus CLI tool."; + } + + console.log(`Using the embedded Octopus CLI tool (version ${option.version}).`); + + return getOrDownloadOcto( + option, + () => { + return new Promise((resolve) => resolve(path.join(tempDirectory, path.basename(folderPath), "bin"))); + }, + false + ); +} + +async function readFile(path: string, encoding: BufferEncoding = "utf8"): Promise { + return new Promise((resolve, reject) => { + fs.readFile(path, { encoding: encoding }, (err, data) => { + if (err) { + reject(err); + } else { + resolve(data); + } + }); + }); +} + +function getAgentTempDirectory() { + const tempDirectory = tasks.getVariable("Agent.TempDirectory"); + if (!tempDirectory) { + throw new Error("Agent.TempDirectory is not set"); + } + return tempDirectory; +} + +export { resolvePublishedOctoVersion, getOrDownloadOcto, addToolToPath, getEmbeddedOcto }; diff --git a/source/tasksLegacy/Utils/tool.ts b/source/tasksLegacy/Utils/tool.ts new file mode 100644 index 00000000..e892e3e7 --- /dev/null +++ b/source/tasksLegacy/Utils/tool.ts @@ -0,0 +1,174 @@ +import * as tasks from "azure-pipelines-task-lib/task"; +import { ToolRunner, IExecSyncResult, IExecOptions } from "azure-pipelines-task-lib/toolrunner"; +import { OctoServerConnectionDetails } from "./connection"; +import { curry } from "ramda"; +import { isNullOrWhitespace } from "./inputs"; +import { Option, some, none } from "fp-ts/lib/Option"; +import { Either, right, fromOption } from "fp-ts/lib/Either"; +import { getOrDownloadOcto, addToolToPath, resolvePublishedOctoVersion } from "./install"; + +export const ToolName = "octo"; +export const ToolNameBeforeV7 = "Octo"; + +export interface ArgFormatter { + (name: string, value: string, tool: ToolRunner): ToolRunner; +} + +function stringOption(value?: string): Option { + return isNullOrWhitespace(value) ? none : some(value); +} + +export class OctoLauncher { + runner: ToolRunner; + + constructor(runner: ToolRunner) { + this.runner = runner; + } + + private getExecOptions(stepIdentifier: string): IExecOptions { + return { env: { OCTOEXTENSION: `${process.env.EXTENSION_VERSION} ${stepIdentifier}`, ...process.env } }; + } + + public launchOcto(configurations: Array<(tool: ToolRunner) => ToolRunner>, stepIdentifier: string): Q.Promise { + configureTool(configurations)(this.runner); + + return this.runner.exec(this.getExecOptions(stepIdentifier)); + } + + public launchOctoSync(configurations: Array<(tool: ToolRunner) => ToolRunner>, stepIdentifier: string): IExecSyncResult { + configureTool(configurations)(this.runner); + + return this.runner.execSync(this.getExecOptions(stepIdentifier)); + } +} + +export async function getOrInstallOctoCommandRunner(command: string): Promise> { + //If we can't find octo then it hasn't been added as an installer task + //or it hasn't been added to the path. + const octo = getOctoCommandRunner(command); + if (octo.isSome()) { + return right(new OctoLauncher(octo.value)); + } + + return resolvePublishedOctoVersion("latest") + .then(getOrDownloadOcto) + .catch((err) => { + tasks.error(err); + throw Error("Unable to locate and download the latest Octopus CLI tool. To use the embedded copy" + " or another specific version, add the Octopus CLI installer task to the build pipeline" + " before this task."); + }) + .then(addToolToPath) + .then(() => getOctoCommandRunner(command).map((x) => new OctoLauncher(x))) + .then(fromOption("Unable to run the Octopus CLI tool.")); +} + +export function getOctoCommandRunner(command: string): Option { + const isWindows = /windows/i.test(tasks.osType()); + if (isWindows) { + return stringOption(tasks.which(`${ToolName}`, false) || tasks.which(`${ToolNameBeforeV7}`, false)) + .map(tasks.tool) + .map((x) => x.arg(command)); + } + + return getPortableOctoCommandRunner(command); +} + +export function getPortableOctoCommandRunner(command: string): Option { + const octo = stringOption(tasks.which(`${ToolName}.dll`, false) || tasks.which(`${ToolNameBeforeV7}.dll`, false)); + const dotnet = tasks.which("dotnet", false); + + if (isNullOrWhitespace(dotnet)) { + tasks.warning("dotnet runtime was not found and this task will most likely fail. Target an agent which has the appropriate capability or add a DotNet core installer task to the start of you build definition to fix this problem."); + } + + const tool = tasks.tool(tasks.which("dotnet", true)); + + const result = octo.map((x) => tool.arg(`${x}`).arg(command)); + + return result; +} + +export const assertOctoVersionAcceptsIds = async function (): Promise { + const octo = await getOrInstallOctoCommandRunner("version"); + const result = octo + .map((x) => x.launchOctoSync([], "version")) + .getOrElseL((x) => { + throw new Error(x); + }); + + const outputLastLine = result.stdout.trim().split(/\r?\n/).pop() || ""; + const [, major, minor, patch] = outputLastLine.trim().match(/^(\d+)\.(\d+)\.(\d+)\b/) || [0, 0, 0, 0]; + const compatible = + `${major}.${minor}.${patch}` == "1.0.0" || // allow dev versions + major > 6 || + (major == 6 && minor > 10) || + (major == 6 && minor == 10 && patch >= 0); + if (!compatible) { + throw new Error("The Octopus CLI tool is too old to run this task. Please use version 6.10.0 or newer, or downgrade the task to version 3.*."); + } +}; + +export const connectionArguments = curry(({ url, apiKey, ignoreSslErrors }: OctoServerConnectionDetails, tool: ToolRunner) => { + let tr = tool.arg(`--server=${url}`).arg(`--apiKey=${apiKey}`); + if (ignoreSslErrors) { + tr = tr.arg(`--ignoreSslErrors`); + } + return tr; +}); + +export const multiArgument = curry((arg: ArgFormatter, name: string, values: string[], tool: ToolRunner) => { + values.forEach((value) => arg(name, value, tool)); + return tool; +}); + +export const argument = curry((name: string, value: string | null | undefined, tool: ToolRunner) => { + return tool.line(`--${name}=${value}`); +}); + +export const argumentEnquote = curry((name: string, value: string | null | undefined, tool: ToolRunner) => { + return argument(name, `"${value}"`, tool); +}); + +export const includeAdditionalArgumentsAndProxyConfig = curry((url: string, value: string, tool: ToolRunner) => { + const proxyRegex = /-proxy=/; + + const proxyConfig = tasks.getHttpProxyConfiguration(url); + + if (proxyConfig) { + if (!proxyRegex.test(value)) { + console.log( + "Using agent configured proxy. If this command should not be sent via the agent's proxy, you might need to add or modify the agent's .proxybypass file. See https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/proxy#specify-proxy-bypass-urls." + ); + argument("proxy", proxyConfig.proxyUrl, tool); + if (proxyConfig.proxyUsername) { + argument("proxyUser", proxyConfig.proxyUsername, tool); + } + if (proxyConfig.proxyPassword) { + argument("proxyPass", proxyConfig.proxyPassword, tool); + } + } + } + + return includeAdditionalArguments(value, tool); +}); + +export const includeAdditionalArguments = curry((value: string, tool: ToolRunner) => { + return tool.line(value); +}); + +export const configureTool = curry((configurations: Array<(tool: ToolRunner) => ToolRunner>, tool: ToolRunner) => { + configurations.forEach((x) => x(tool)); + return tool; +}); + +export const flag = curry((name: string, value: boolean, tool: ToolRunner) => { + return value ? tool.arg(`--${name}`) : tool; +}); + +export const argumentIf = curry((predicate: (value: string | null | undefined) => boolean, arg: ArgFormatter, name: string, value: string | null | undefined, tool: ToolRunner): ToolRunner => { + if (predicate(value)) { + return arg(name, value || "", tool); + } + return tool; +}); + +export const argumentIfSet = argumentIf((val) => !isNullOrWhitespace(val)); From e44bb7162933add1e2dfb51243b4a1449379f3e2 Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 11 Jan 2024 15:57:01 +1000 Subject: [PATCH 14/16] Back off a little... --- .../CreateOctopusReleaseV3/icon.png | Bin 343 -> 0 bytes .../CreateOctopusReleaseV3/icon.svg | 1 - .../CreateOctopusReleaseV3/index.ts | 75 ----- .../CreateOctopusReleaseV3/task.json | 223 --------------- .../CreateOctopusReleaseV4/icon.png | Bin 343 -> 0 bytes .../CreateOctopusReleaseV4/icon.svg | 1 - .../CreateOctopusReleaseV4/index.ts | 83 ------ .../CreateOctopusReleaseV4/task.json | 266 ------------------ source/tasksLegacy/Deploy/DeployV3/icon.png | Bin 454 -> 0 bytes source/tasksLegacy/Deploy/DeployV3/icon.svg | 1 - source/tasksLegacy/Deploy/DeployV3/index.ts | 59 ---- source/tasksLegacy/Deploy/DeployV3/task.json | 164 ----------- source/tasksLegacy/Deploy/DeployV4/icon.png | Bin 454 -> 0 bytes source/tasksLegacy/Deploy/DeployV4/icon.svg | 1 - source/tasksLegacy/Deploy/DeployV4/index.ts | 59 ---- source/tasksLegacy/Deploy/DeployV4/task.json | 182 ------------ source/tasksLegacy/OctoCli/OctoCliV4/icon.png | Bin 481 -> 0 bytes source/tasksLegacy/OctoCli/OctoCliV4/icon.svg | 1 - source/tasksLegacy/OctoCli/OctoCliV4/index.ts | 33 --- .../tasksLegacy/OctoCli/OctoCliV4/task.json | 56 ---- .../OctoInstaller/OctoInstallerV4/icon.png | Bin 600 -> 0 bytes .../OctoInstaller/OctoInstallerV4/icon.svg | 1 - .../OctoInstaller/OctoInstallerV4/index.ts | 43 --- .../OctoInstaller/OctoInstallerV4/task.json | 49 ---- .../OctopusMetadataV4/icon.png | Bin 481 -> 0 bytes .../OctopusMetadataV4/icon.svg | 1 - .../OctopusMetadataV4/index.ts | 97 ------- .../OctopusMetadataV4/task.json | 97 ------- source/tasksLegacy/Pack/PackV4/icon.png | Bin 399 -> 0 bytes source/tasksLegacy/Pack/PackV4/icon.svg | 1 - source/tasksLegacy/Pack/PackV4/index.ts | 115 -------- source/tasksLegacy/Pack/PackV4/task.json | 179 ------------ source/tasksLegacy/Promote/PromoteV3/icon.png | Bin 621 -> 0 bytes source/tasksLegacy/Promote/PromoteV3/icon.svg | 1 - source/tasksLegacy/Promote/PromoteV3/index.ts | 55 ---- .../tasksLegacy/Promote/PromoteV3/task.json | 173 ------------ source/tasksLegacy/Promote/PromoteV4/icon.png | Bin 621 -> 0 bytes source/tasksLegacy/Promote/PromoteV4/icon.svg | 1 - source/tasksLegacy/Promote/PromoteV4/index.ts | 55 ---- .../tasksLegacy/Promote/PromoteV4/task.json | 195 ------------- source/tasksLegacy/Push/PushV3/icon.png | Bin 481 -> 0 bytes source/tasksLegacy/Push/PushV3/icon.svg | 1 - source/tasksLegacy/Push/PushV3/index.ts | 47 ---- source/tasksLegacy/Push/PushV3/task.json | 76 ----- source/tasksLegacy/Push/PushV4/icon.png | Bin 481 -> 0 bytes source/tasksLegacy/Push/PushV4/icon.svg | 1 - source/tasksLegacy/Push/PushV4/index.ts | 49 ---- source/tasksLegacy/Push/PushV4/task.json | 89 ------ 48 files changed, 2531 deletions(-) delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/icon.png delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/icon.svg delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/task.json delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/icon.png delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/icon.svg delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts delete mode 100644 source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/task.json delete mode 100644 source/tasksLegacy/Deploy/DeployV3/icon.png delete mode 100644 source/tasksLegacy/Deploy/DeployV3/icon.svg delete mode 100644 source/tasksLegacy/Deploy/DeployV3/index.ts delete mode 100644 source/tasksLegacy/Deploy/DeployV3/task.json delete mode 100644 source/tasksLegacy/Deploy/DeployV4/icon.png delete mode 100644 source/tasksLegacy/Deploy/DeployV4/icon.svg delete mode 100644 source/tasksLegacy/Deploy/DeployV4/index.ts delete mode 100644 source/tasksLegacy/Deploy/DeployV4/task.json delete mode 100644 source/tasksLegacy/OctoCli/OctoCliV4/icon.png delete mode 100644 source/tasksLegacy/OctoCli/OctoCliV4/icon.svg delete mode 100644 source/tasksLegacy/OctoCli/OctoCliV4/index.ts delete mode 100644 source/tasksLegacy/OctoCli/OctoCliV4/task.json delete mode 100644 source/tasksLegacy/OctoInstaller/OctoInstallerV4/icon.png delete mode 100644 source/tasksLegacy/OctoInstaller/OctoInstallerV4/icon.svg delete mode 100644 source/tasksLegacy/OctoInstaller/OctoInstallerV4/index.ts delete mode 100644 source/tasksLegacy/OctoInstaller/OctoInstallerV4/task.json delete mode 100644 source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/icon.png delete mode 100644 source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/icon.svg delete mode 100644 source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/index.ts delete mode 100644 source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/task.json delete mode 100644 source/tasksLegacy/Pack/PackV4/icon.png delete mode 100644 source/tasksLegacy/Pack/PackV4/icon.svg delete mode 100644 source/tasksLegacy/Pack/PackV4/index.ts delete mode 100644 source/tasksLegacy/Pack/PackV4/task.json delete mode 100644 source/tasksLegacy/Promote/PromoteV3/icon.png delete mode 100644 source/tasksLegacy/Promote/PromoteV3/icon.svg delete mode 100644 source/tasksLegacy/Promote/PromoteV3/index.ts delete mode 100644 source/tasksLegacy/Promote/PromoteV3/task.json delete mode 100644 source/tasksLegacy/Promote/PromoteV4/icon.png delete mode 100644 source/tasksLegacy/Promote/PromoteV4/icon.svg delete mode 100644 source/tasksLegacy/Promote/PromoteV4/index.ts delete mode 100644 source/tasksLegacy/Promote/PromoteV4/task.json delete mode 100644 source/tasksLegacy/Push/PushV3/icon.png delete mode 100644 source/tasksLegacy/Push/PushV3/icon.svg delete mode 100644 source/tasksLegacy/Push/PushV3/index.ts delete mode 100644 source/tasksLegacy/Push/PushV3/task.json delete mode 100644 source/tasksLegacy/Push/PushV4/icon.png delete mode 100644 source/tasksLegacy/Push/PushV4/icon.svg delete mode 100644 source/tasksLegacy/Push/PushV4/index.ts delete mode 100644 source/tasksLegacy/Push/PushV4/task.json diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/icon.png b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/icon.png deleted file mode 100644 index cae677b4a2420bebbc5556e566c85dd97e529b39..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 343 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XECYN(T=geE`2YWZ^12t(Prjdi^26yT-)&|++IRP>=fWqo zd){;%diUwa->~J+o__kh@%rZ_7e3y2{j*@}E1(w3Ig)RHh6tAg`2_>HXnF!PcEP4V^-u~4G3VIZ+!XR|KrmRniXDrm9s1J{V|t57U9<4N*mbj`92ao zU}Dd9+~1)9e6mCMS!2@Ionj`y9`Z?x?9gWgx*PExan|>FX6z;!bOZB z%-25K-r(V=XR1Evoctopus \ No newline at end of file diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts deleted file mode 100644 index ebab652b..00000000 --- a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { multiArgument, connectionArguments, includeAdditionalArgumentsAndProxyConfig, flag, argumentEnquote, argumentIfSet, getOrInstallOctoCommandRunner } from "../../Utils/tool"; -import { createReleaseNotesFile, createVstsConnection, generateReleaseNotesContent, getLinkedReleaseNotes, getVstsEnvironmentVariables } from "../../Utils/environment"; -import { getDefaultOctopusConnectionDetailsOrThrow, resolveProjectName } from "../../Utils/connection"; -import { getOptionalCsvInput } from "../../Utils/inputs"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const environmentVariables = getVstsEnvironmentVariables(); - const vstsConnection = createVstsConnection(environmentVariables); - const octoConnection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - // @ts-expect-error - const project = await resolveProjectName(octoConnection, tasks.getInput("ProjectName", true)).then((x) => x.value); - const releaseNumber = tasks.getInput("ReleaseNumber"); - const channel = tasks.getInput("Channel"); - const changesetCommentReleaseNotes = tasks.getBoolInput("ChangesetCommentReleaseNotes"); - const workItemReleaseNotes = tasks.getBoolInput("WorkItemReleaseNotes"); - const customReleaseNotes = tasks.getInput("CustomReleaseNotes"); - const deployToEnvironments = getOptionalCsvInput("DeployToEnvironment"); - const deployForTenants = getOptionalCsvInput("DeployForTenants"); - const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); - const deploymentProgress = tasks.getBoolInput("DeploymentProgress"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - - const octo = await getOrInstallOctoCommandRunner("create-release"); - - let linkedReleaseNotes = ""; - if (workItemReleaseNotes || changesetCommentReleaseNotes) { - linkedReleaseNotes = await getLinkedReleaseNotes(vstsConnection, changesetCommentReleaseNotes, workItemReleaseNotes); - } - - const releaseNotesFile = createReleaseNotesFile(() => { - // @ts-expect-error - return generateReleaseNotesContent(environmentVariables, linkedReleaseNotes, customReleaseNotes); - }, environmentVariables.defaultWorkingDirectory); - - const configure = [ - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - argumentEnquote("project", project), - // @ts-expect-error - argumentIfSet(argumentEnquote, "releaseNumber", releaseNumber), - // @ts-expect-error - argumentIfSet(argumentEnquote, "channel", channel), - connectionArguments(octoConnection), - flag("enableServiceMessages", true), - multiArgument(argumentEnquote, "deployTo", deployToEnvironments), - flag("progress", deployToEnvironments.length > 0 && deploymentProgress), - multiArgument(argumentEnquote, "tenant", deployForTenants), - multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), - argumentEnquote("releaseNotesFile", releaseNotesFile), - // @ts-expect-error - includeAdditionalArgumentsAndProxyConfig(octoConnection.url, additionalArguments), - ]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(release;create;v3)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Create octopus release succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to create release. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/task.json b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/task.json deleted file mode 100644 index 331361a0..00000000 --- a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/task.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "id": "4E131B60-5532-4362-95B6-7C67D9841B4F", - "name": "OctopusCreateRelease", - "friendlyName": "Create Octopus Release", - "description": "There is a later version of this task, we recommend using the latest version. Create a Release in Octopus Deploy", - "helpMarkDown": "set-by-pack.ps1", - "category": "Deploy", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 3, - "Minor": 1, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "releasenotes", - "displayName": "Release Notes", - "isExpanded": true - }, - { - "name": "deployment", - "displayName": "Deployment", - "isExpanded": false - }, - { - "name": "tenant", - "displayName": "Tenants", - "isExpanded": false - }, - { - "name": "additional", - "displayName": "Additional Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "string", - "label": "Space (Legacy - Use version 4 of this task)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "False" - }, - "helpMarkDown": "Version 3 of this task has limited support for spaces. We recommend using version 4 of this task for a better experience." - }, - { - "name": "ProjectGroup", - "type": "pickList", - "label": "Project Group", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." - }, - { - "name": "ProjectName", - "type": "pickList", - "label": "Project Name", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Octopus Deploy Project Name" - }, - { - "name": "ReleaseNumber", - "type": "string", - "label": "Release Number", - "defaultValue": "", - "required": false, - "helpMarkDown": "The number to use for this release. You can leave this blank if the release number is calculated by Octopus." - }, - { - "name": "Channel", - "type": "pickList", - "label": "Channel", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The [channel](https://g.octopushq.com/Channels) to use for the release." - }, - { - "name": "ChangesetCommentReleaseNotes", - "type": "boolean", - "label": "Include Changeset Comments", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Whether to include linked Changeset comments in Octopus Release notes.", - "groupName": "releasenotes" - }, - { - "name": "WorkItemReleaseNotes", - "type": "boolean", - "label": "Include Work Items", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Whether to include linked Work Item Titles in Octopus Release notes.", - "groupName": "releasenotes" - }, - { - "name": "CustomReleaseNotes", - "type": "string", - "label": "Custom Notes", - "defaultValue": "", - "required": false, - "helpMarkDown": "Custom notes appended to Octopus Release notes. This field supports markdown. To include newlines, you can use HTML linebreaks.", - "groupName": "releasenotes" - }, - { - "name": "DeployToEnvironment", - "type": "pickList", - "label": "To Environment", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Deploy the release to this environment after creating it.", - "groupName": "deployment" - }, - { - "name": "DeployForTenants", - "type": "pickList", - "label": "Tenant(s)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Deploy the release for this comma-delimited list of tenants after creating it. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", - "groupName": "tenant" - }, - { - "name": "DeployForTenantTags", - "type": "string", - "label": "Tenant tag(s)", - "defaultValue": "", - "required": false, - "helpMarkDown": "Deploy the release for tenants who match these tags and are ready to deploy to the provided environment.", - "groupName": "tenant" - }, - { - "name": "DeploymentProgress", - "type": "boolean", - "label": "Show Deployment Progress", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Output from the deployment will appear in the log. If checked, the task will only succeed if the deployment is successful.", - "groupName": "deployment" - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExeCreateRelease) for available parameters.", - "groupName": "additional" - } - ], - "dataSourceBindings": [ - { - "target": "ProjectGroup", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllProjectGroups", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "ProjectName", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusListProjectsInProjectGroup", - "parameters": { - "ProjectGroupId": "$(ProjectGroup)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployToEnvironment", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllEnvironments", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Channel", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectChannels", - "parameters": { - "ProjectName": "$(ProjectName)" - }, - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployForTenants", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllTenants", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Create Octopus Release: $(ProjectName)", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/icon.png b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/icon.png deleted file mode 100644 index cae677b4a2420bebbc5556e566c85dd97e529b39..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 343 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XECYN(T=geE`2YWZ^12t(Prjdi^26yT-)&|++IRP>=fWqo zd){;%diUwa->~J+o__kh@%rZ_7e3y2{j*@}E1(w3Ig)RHh6tAg`2_>HXnF!PcEP4V^-u~4G3VIZ+!XR|KrmRniXDrm9s1J{V|t57U9<4N*mbj`92ao zU}Dd9+~1)9e6mCMS!2@Ionj`y9`Z?x?9gWgx*PExan|>FX6z;!bOZB z%-25K-r(V=XR1Evoctopus \ No newline at end of file diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts deleted file mode 100644 index b9f2fc0a..00000000 --- a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { createReleaseNotesFile, createVstsConnection, generateReleaseNotesContent, getLinkedReleaseNotes, getVstsEnvironmentVariables } from "../../Utils/environment"; -import { argumentEnquote, argumentIfSet, assertOctoVersionAcceptsIds, connectionArguments, flag, getOrInstallOctoCommandRunner, includeAdditionalArgumentsAndProxyConfig, multiArgument } from "../../Utils/tool"; -import { getOptionalCsvInput } from "../../Utils/inputs"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const environmentVariables = getVstsEnvironmentVariables(); - const vstsConnection = createVstsConnection(environmentVariables); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - const project = tasks.getInput("ProjectName", true); - const releaseNumber = tasks.getInput("ReleaseNumber"); - const channel = tasks.getInput("Channel"); - const changesetCommentReleaseNotes = tasks.getBoolInput("ChangesetCommentReleaseNotes"); - const workItemReleaseNotes = tasks.getBoolInput("WorkItemReleaseNotes"); - const customReleaseNotes = tasks.getInput("CustomReleaseNotes"); - const deployToEnvironments = getOptionalCsvInput("DeployToEnvironment"); - const deployForTenants = getOptionalCsvInput("DeployForTenants"); - const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); - const deploymentProgress = tasks.getBoolInput("DeploymentProgress"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - const gitRef = tasks.getInput("GitRef"); - const gitCommit = tasks.getInput("GitCommit"); - - await assertOctoVersionAcceptsIds(); - const octo = await getOrInstallOctoCommandRunner("create-release"); - - const configure = [ - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - // @ts-expect-error - argumentEnquote("project", project), - // @ts-expect-error - argumentIfSet(argumentEnquote, "releaseNumber", releaseNumber), - // @ts-expect-error - argumentIfSet(argumentEnquote, "channel", channel), - connectionArguments(connection), - flag("enableServiceMessages", true), - multiArgument(argumentEnquote, "deployTo", deployToEnvironments), - // @ts-expect-error - argumentIfSet(argumentEnquote, "gitRef", gitRef), - // @ts-expect-error - argumentIfSet(argumentEnquote, "gitCommit", gitCommit), - flag("progress", deployToEnvironments.length > 0 && deploymentProgress), - multiArgument(argumentEnquote, "tenant", deployForTenants), - multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), - ]; - - if (workItemReleaseNotes || changesetCommentReleaseNotes || (customReleaseNotes && /[^\s]/.test(customReleaseNotes))) { - const linkedReleaseNotes = workItemReleaseNotes || changesetCommentReleaseNotes ? await getLinkedReleaseNotes(vstsConnection, changesetCommentReleaseNotes, workItemReleaseNotes) : ""; - - const releaseNotesFile = createReleaseNotesFile(() => { - // @ts-expect-error - return generateReleaseNotesContent(environmentVariables, linkedReleaseNotes, customReleaseNotes); - }, environmentVariables.defaultWorkingDirectory); - - configure.push(argumentEnquote("releaseNotesFile", releaseNotesFile)); - } - - // @ts-expect-error - configure.push(includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments)); - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(release;create;v4)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Create octopus release succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to create release. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/task.json b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/task.json deleted file mode 100644 index bbcc3df2..00000000 --- a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/task.json +++ /dev/null @@ -1,266 +0,0 @@ -{ - "id": "4E131B60-5532-4362-95B6-7C67D9841B4F", - "name": "OctopusCreateRelease", - "friendlyName": "Create Octopus Release", - "description": "There is a later version of this task, we recommend using the latest version. Create a Release in Octopus Deploy", - "helpMarkDown": "set-by-pack.ps1", - "category": "Deploy", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "releasenotes", - "displayName": "Release Notes (Legacy)", - "isExpanded": true - }, - { - "name": "deployment", - "displayName": "Deployment", - "isExpanded": false - }, - { - "name": "tenant", - "displayName": "Tenants", - "isExpanded": false - }, - { - "name": "versionControl", - "displayName": "Version Control", - "isExpanded": false - }, - { - "name": "additional", - "displayName": "Additional Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "pickList", - "label": "Space", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The space within Octopus." - }, - { - "name": "ProjectGroup", - "type": "pickList", - "label": "Project Group", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." - }, - { - "name": "ProjectName", - "type": "pickList", - "label": "Project", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project within Octopus." - }, - { - "name": "ReleaseNumber", - "type": "string", - "label": "Release Number", - "defaultValue": "", - "required": false, - "helpMarkDown": "The number to use for this release. You can leave this blank if the release number is calculated by Octopus." - }, - { - "name": "Channel", - "type": "pickList", - "label": "Channel", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The [channel](https://g.octopushq.com/Channels) to use for the release." - }, - { - "name": "ChangesetCommentReleaseNotes", - "type": "boolean", - "label": "Include Changeset Comments", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Whether to add linked changeset comments to Octopus Release notes.\n\n*Note: These Release Notes options are considered legacy. We recommend clearing them and pushing [Build Information](https://g.octopushq.com/BuildInformation) alongside your packages, which allows the customizable [Release Notes Template](https://g.octopushq.com/ReleaseNotesTemplate) to generate automatic release notes.*", - "groupName": "releasenotes" - }, - { - "name": "WorkItemReleaseNotes", - "type": "boolean", - "label": "Include Work Items", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Whether to add linked Work Item titles to Octopus Release notes.\n\n*Note: These Release Notes options are considered legacy. We recommend clearing them and pushing [Build Information](https://g.octopushq.com/BuildInformation) alongside your packages, which allows the customizable [Release Notes Template](https://g.octopushq.com/ReleaseNotesTemplate) to generate automatic release notes.*", - "groupName": "releasenotes" - }, - { - "name": "CustomReleaseNotes", - "type": "string", - "label": "Custom Notes", - "defaultValue": "", - "required": false, - "helpMarkDown": "Custom notes appended to Octopus Release notes. This field supports markdown. To include newlines, you can use HTML linebreaks.\n\n*Note: These Release Notes options are considered legacy. We recommend clearing them and pushing [Build Information](https://g.octopushq.com/BuildInformation) alongside your packages, which allows the customizable [Release Notes Template](https://g.octopushq.com/ReleaseNotesTemplate) to generate automatic release notes.*", - "groupName": "releasenotes" - }, - { - "name": "DeployToEnvironment", - "type": "pickList", - "label": "To Environment", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Deploy the release to this environment after creating it.", - "groupName": "deployment" - }, - { - "name": "DeployForTenants", - "type": "pickList", - "label": "Tenant(s)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Deploy the release for this comma-delimited list of tenants after creating it. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", - "groupName": "tenant" - }, - { - "name": "DeployForTenantTags", - "type": "string", - "label": "Tenant tag(s)", - "defaultValue": "", - "required": false, - "helpMarkDown": "Deploy the release for tenants who match these tags and are ready to deploy to the provided environment.", - "groupName": "tenant" - }, - { - "name": "DeploymentProgress", - "type": "boolean", - "label": "Show Deployment Progress", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Output from the deployment will appear in the log. If checked, the task will only succeed if the deployment is successful.", - "groupName": "deployment" - }, - { - "name": "GitRef", - "type": "string", - "label": "Git Reference", - "defaultValue": "", - "required": false, - "helpMarkDown": "Git branch reference to use when creating the release for version controlled Projects.", - "groupName": "versionControl" - }, - { - "name": "GitCommit", - "type": "string", - "label": "Git Commit", - "defaultValue": "", - "required": false, - "helpMarkDown": "Git commit to use when creating the release for version controlled Projects. Use in conjunction with the gitRef parameter to select any previous commit.", - "groupName": "versionControl" - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExeCreateRelease) for available parameters.", - "groupName": "additional" - } - ], - "dataSourceBindings": [ - { - "target": "Space", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllSpaces", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "ProjectGroup", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllProjectGroupsInSpace", - "parameters": { - "SpaceId": "$(Space)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "ProjectName", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusListProjectsInProjectGroupInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectGroupId": "$(ProjectGroup)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployToEnvironment", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectChannelEnvironmentsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectId": "$(ProjectName)", - "ChannelId": "$(Channel)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Channel", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectChannelsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectName": "$(ProjectName)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployForTenants", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectTenantsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectName": "$(ProjectName)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Create Octopus Release", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Deploy/DeployV3/icon.png b/source/tasksLegacy/Deploy/DeployV3/icon.png deleted file mode 100644 index 591f4d253f95a8bc45cc879a1d1532641d20b54e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 454 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xk^_7~T=geEn11qoNK$_Cx)-OPeEgNJ8k}z z8@KDbCWkG5wsOOEn^})GUjO{@)8`wne`;ELA3J@%u(ti_r{AA`{PkS;WctYuU5DOT zc!byPd9&og$45_}yM-nfY<;!w?pL6Je18_l0j*Ok3GxdDa`6I&`3Em30u`U}ba4!+ zxOL|8O};}40<0GbPen}&+Pz)x@Bj58T3I1i_RaXRk4KSxMhnjwd#2S5rzaJbZ)i>_ zyUpxY%dWh%lzYLsdy?LM`3=8(CR{aPei3_LrIGbAn}Zd{Q%MW{V+{5Uc6S11v#vO) zl@;gkTxVm-PDj&R-`(5grkuR>_W#j(N9ReIc@4=+1yz&&#q8ME#Qfapn5Kq=_M=Y< zB}>H{iZxH|I4uwvBlkJzleWgBgcI$xTN!jG`+FSJ7Mv|p@V@%fa(UO5Lt*^yx5uzZ ZF!au`45>Q*R~hIp22WQ%mvv4FO#t+soctopus \ No newline at end of file diff --git a/source/tasksLegacy/Deploy/DeployV3/index.ts b/source/tasksLegacy/Deploy/DeployV3/index.ts deleted file mode 100644 index e99444b5..00000000 --- a/source/tasksLegacy/Deploy/DeployV3/index.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { multiArgument, connectionArguments, includeAdditionalArgumentsAndProxyConfig, flag, argumentEnquote, argumentIfSet, getOrInstallOctoCommandRunner } from "../../Utils/tool"; -import { getDefaultOctopusConnectionDetailsOrThrow, resolveProjectName } from "../../Utils/connection"; -import { getOptionalCsvInput, getRequiredCsvInput } from "../../Utils/inputs"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - const releaseNumber = tasks.getInput("ReleaseNumber", true); - const environments = getRequiredCsvInput("Environments"); - const showProgress = tasks.getBoolInput("ShowProgress"); - const deploymentForTenants = getOptionalCsvInput("DeployForTenants"); - const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - // @ts-ignore - const project = await resolveProjectName(connection, tasks.getInput("Project", true)).then((x) => x.value); - - const octo = await getOrInstallOctoCommandRunner("deploy-release"); - - const configure = [ - // @ts-ignore - argumentIfSet(argumentEnquote, "space", space), - argumentEnquote("project", project), - // @ts-ignore - argumentEnquote("releaseNumber", releaseNumber), - connectionArguments(connection), - multiArgument(argumentEnquote, "deployTo", environments), - multiArgument(argumentEnquote, "tenant", deploymentForTenants), - multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), - flag("progress", showProgress), - // @ts-ignore - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - let stepIdentifier = "(release;deploy;v3)"; - if (deploymentForTenants.length > 0 || deployForTenantTags.length > 0) { - stepIdentifier = "(release;deploy-tenanted;v3)"; - } - - const code: number = await octo - .map((x) => x.launchOcto(configure, stepIdentifier)) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Deploy succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to deploy release. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Deploy/DeployV3/task.json b/source/tasksLegacy/Deploy/DeployV3/task.json deleted file mode 100644 index 3274fe57..00000000 --- a/source/tasksLegacy/Deploy/DeployV3/task.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "id": "8ca1d96a-151d-44b7-bc4f-9251e2ea6971", - "name": "OctopusDeployRelease", - "friendlyName": "Deploy Octopus Release", - "description": "There is a later version of this task, we recommend using the latest version. Deploy an Octopus Deploy Release", - "helpMarkDown": "set-by-pack.ps1", - "category": "Deploy", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 3, - "Minor": 1, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "tenant", - "displayName": "Tenants", - "isExpanded": false - }, - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "string", - "label": "Space (Legacy - Use version 4 of this task)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "False" - }, - "helpMarkDown": "Version 3 of this task has limited support for spaces. We recommend using version 4 of this task for a better experience." - }, - { - "name": "ProjectGroup", - "type": "pickList", - "label": "Project Group", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." - }, - { - "name": "Project", - "type": "pickList", - "label": "Project", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Octopus Deploy Project Name" - }, - { - "name": "ReleaseNumber", - "type": "string", - "label": "Release Number", - "defaultValue": "latest", - "required": true, - "helpMarkDown": "The number of the release to deploy. Use 'latest' to deploy the latest release." - }, - { - "name": "Environments", - "type": "pickList", - "label": "Deploy to Environments", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Comma separated list of environments to deploy to." - }, - { - "name": "ShowProgress", - "type": "boolean", - "label": "Show Deployment Progress", - "defaultValue": "False", - "required": false, - "helpMarkDown": "If checked, the build process will only succeed if the deployment is successful." - }, - { - "name": "DeployForTenants", - "type": "pickList", - "label": "Tenant(s)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Deploy the release for this comma delimited list of tenants. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", - "groupName": "tenant" - }, - { - "name": "DeployForTenantTags", - "type": "string", - "label": "Tenant tag(s)", - "defaultValue": "", - "required": false, - "helpMarkDown": "Deploy the release for tenants who match these tags and are ready to deploy to the provided environment.", - "groupName": "tenant" - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExeDeployRelease) for available parameters.", - "groupName": "advanced" - } - ], - "dataSourceBindings": [ - { - "target": "ProjectGroup", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllProjectGroups", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Project", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusListProjectsInProjectGroup", - "parameters": { - "ProjectGroupId": "$(ProjectGroup)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Environments", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllEnvironments", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployForTenants", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllTenants", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Deploy Octopus Release: $(Project) to $(Environments)", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Deploy/DeployV4/icon.png b/source/tasksLegacy/Deploy/DeployV4/icon.png deleted file mode 100644 index 591f4d253f95a8bc45cc879a1d1532641d20b54e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 454 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xk^_7~T=geEn11qoNK$_Cx)-OPeEgNJ8k}z z8@KDbCWkG5wsOOEn^})GUjO{@)8`wne`;ELA3J@%u(ti_r{AA`{PkS;WctYuU5DOT zc!byPd9&og$45_}yM-nfY<;!w?pL6Je18_l0j*Ok3GxdDa`6I&`3Em30u`U}ba4!+ zxOL|8O};}40<0GbPen}&+Pz)x@Bj58T3I1i_RaXRk4KSxMhnjwd#2S5rzaJbZ)i>_ zyUpxY%dWh%lzYLsdy?LM`3=8(CR{aPei3_LrIGbAn}Zd{Q%MW{V+{5Uc6S11v#vO) zl@;gkTxVm-PDj&R-`(5grkuR>_W#j(N9ReIc@4=+1yz&&#q8ME#Qfapn5Kq=_M=Y< zB}>H{iZxH|I4uwvBlkJzleWgBgcI$xTN!jG`+FSJ7Mv|p@V@%fa(UO5Lt*^yx5uzZ ZF!au`45>Q*R~hIp22WQ%mvv4FO#t+soctopus \ No newline at end of file diff --git a/source/tasksLegacy/Deploy/DeployV4/index.ts b/source/tasksLegacy/Deploy/DeployV4/index.ts deleted file mode 100644 index d2dd6cec..00000000 --- a/source/tasksLegacy/Deploy/DeployV4/index.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { argumentEnquote, argumentIfSet, assertOctoVersionAcceptsIds, connectionArguments, flag, getOrInstallOctoCommandRunner, includeAdditionalArgumentsAndProxyConfig, multiArgument } from "../../Utils/tool"; -import { getOptionalCsvInput, getRequiredCsvInput } from "../../Utils/inputs"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - const project = tasks.getInput("Project", true); - const releaseNumber = tasks.getInput("ReleaseNumber", true); - const deployToEnvironments = getRequiredCsvInput("Environments"); - const deployForTenants = getOptionalCsvInput("DeployForTenants"); - const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); - const showProgress = tasks.getBoolInput("ShowProgress"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - await assertOctoVersionAcceptsIds(); - const octo = await getOrInstallOctoCommandRunner("deploy-release"); - - const configure = [ - // @ts-ignore - argumentIfSet(argumentEnquote, "space", space), - // @ts-ignore - argumentEnquote("project", project), - // @ts-ignore - argumentEnquote("releaseNumber", releaseNumber), - connectionArguments(connection), - multiArgument(argumentEnquote, "deployTo", deployToEnvironments), - multiArgument(argumentEnquote, "tenant", deployForTenants), - multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), - flag("progress", showProgress), - // @ts-ignore - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - let stepIdentifier = "(release;deploy;v4)"; - if (deployForTenants.length > 0 || deployForTenantTags.length > 0) { - stepIdentifier = "(release;deploy-tenanted;v4)"; - } - - const code: number = await octo - .map((x) => x.launchOcto(configure, stepIdentifier)) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Deploy succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to deploy release. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Deploy/DeployV4/task.json b/source/tasksLegacy/Deploy/DeployV4/task.json deleted file mode 100644 index eec3f330..00000000 --- a/source/tasksLegacy/Deploy/DeployV4/task.json +++ /dev/null @@ -1,182 +0,0 @@ -{ - "id": "8ca1d96a-151d-44b7-bc4f-9251e2ea6971", - "name": "OctopusDeployRelease", - "friendlyName": "Deploy Octopus Release", - "description": "There is a later version of this task, we recommend using the latest version. Deploy an Octopus Deploy Release", - "helpMarkDown": "set-by-pack.ps1", - "category": "Deploy", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "tenant", - "displayName": "Tenants", - "isExpanded": false - }, - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "pickList", - "label": "Space", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The space within Octopus." - }, - { - "name": "ProjectGroup", - "type": "pickList", - "label": "Project Group", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." - }, - { - "name": "Project", - "type": "pickList", - "label": "Project", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project within Octopus." - }, - { - "name": "ReleaseNumber", - "type": "string", - "label": "Release Number", - "defaultValue": "latest", - "required": true, - "helpMarkDown": "The number of the release to deploy. Use 'latest' to deploy the latest release." - }, - { - "name": "Environments", - "type": "pickList", - "label": "Deploy to Environments", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Comma separated list of environments to deploy to." - }, - { - "name": "ShowProgress", - "type": "boolean", - "label": "Show Deployment Progress", - "defaultValue": "False", - "required": false, - "helpMarkDown": "If checked, the build process will only succeed if the deployment is successful." - }, - { - "name": "DeployForTenants", - "type": "pickList", - "label": "Tenant(s)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Deploy the release for this comma delimited list of tenants. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", - "groupName": "tenant" - }, - { - "name": "DeployForTenantTags", - "type": "string", - "label": "Tenant tag(s)", - "defaultValue": "", - "required": false, - "helpMarkDown": "Deploy the release for tenants who match these tags and are ready to deploy to the provided environment.", - "groupName": "tenant" - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExeDeployRelease) for available parameters.", - "groupName": "advanced" - } - ], - "dataSourceBindings": [ - { - "target": "Space", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllSpaces", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "ProjectGroup", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllProjectGroupsInSpace", - "parameters": { - "SpaceId": "$(Space)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Project", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusListProjectsInProjectGroupInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectGroupId": "$(ProjectGroup)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Environments", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectEnvironmentsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectId": "$(Project)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployForTenants", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectTenantsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectName": "$(Project)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Deploy Octopus Release", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/OctoCli/OctoCliV4/icon.png b/source/tasksLegacy/OctoCli/OctoCliV4/icon.png deleted file mode 100644 index 236566a308c71c4b35ce91fa54e6914d05fb8d7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 481 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X5(0ceT=geE`2YXEw4QzPx)(OH9^H8T^V5&NwR_$iJAMB2 zlkd|{z7JdeY{`X>D>rQ4clWDC?vm|$4|^_rGX3O-f~~JMUjO{`<8KR(@UBDe9zA_7 zW8(Sr({J6jGn&@kn#Jq<8&?5MzN-Gj8RWW>AirQB7aw4ViIIK_RQuY~#WAGf)|JUO zg_;dGToq^cx@BK|*Zu$hbk@acQL?{p++$Bya%U26DRcg?yrHafN@ijhgZ4r1rD>cV z3NIEYFVJzex!AERaEc521I41Md6xGQ)F%rjx;bztnH<-Cb9A{1o6Eh}1U819ca*nG zm+fZUxZM1v#PO~^%`NJJE-iDIgrXGHTDTmJtv%Q9TK0{={z`MZhK=0Z+>-MIj5Y|y z9A0xm?Mgz*b=ND;xTpNT7s&dg{Nhgm$)%1_;l&3Qg-X3%IeF*&R+q&G0y|G#y{PkN zL&dCBCvNy}vz?b_|L$w;kE+Gn%0G$!U$dQonSt+$*N$DY75)Id&EVoctopus \ No newline at end of file diff --git a/source/tasksLegacy/OctoCli/OctoCliV4/index.ts b/source/tasksLegacy/OctoCli/OctoCliV4/index.ts deleted file mode 100644 index fcf7a196..00000000 --- a/source/tasksLegacy/OctoCli/OctoCliV4/index.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { connectionArguments, getOrInstallOctoCommandRunner, includeAdditionalArguments } from "../../Utils/tool"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - const args = tasks.getInput("args", false); - const command = tasks.getInput("command", true); - // @ts-ignore - const octo = await getOrInstallOctoCommandRunner(command); - - // @ts-ignore - const configure = [connectionArguments(connection), includeAdditionalArguments(args)]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(cli;run;v4)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, `Succeeded executing octo command ${command} with code ${code}`); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to execute octo command. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/OctoCli/OctoCliV4/task.json b/source/tasksLegacy/OctoCli/OctoCliV4/task.json deleted file mode 100644 index 4553a726..00000000 --- a/source/tasksLegacy/OctoCli/OctoCliV4/task.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "id": "25fee290-e578-491b-b1db-dbc3980df1d0", - "name": "OctoCli", - "friendlyName": "Invoke Octopus CLI command", - "description": "There is a later version of this task, we recommend using the latest version. Invoke an Octopus CLI command", - "helpMarkDown": "set-by-pack.ps1", - "category": "Tool", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "command", - "type": "string", - "label": "command", - "defaultValue": "", - "required": true, - "helpMarkDown": "The Octopus CLI command to execute." - }, - { - "name": "args", - "type": "string", - "label": "arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "The arguments to use for the command." - } - ], - "instanceNameFormat": "Invoke an Octopus CLI command", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/icon.png b/source/tasksLegacy/OctoInstaller/OctoInstallerV4/icon.png deleted file mode 100644 index d54551d79a45027401d3d149af2619b6a48be11d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 600 zcmV-e0;m0nP)}VKg|3!E0NBpaa)2rh(A899 zhzjx2Gs_$CSwT1v;&KGY za#;2w*K(p9fXxvg%R#{p0$Y(B01_v~au5JFNCec(4lpn<*b`C=O3k2x2Ndi_HZ6r% z>KBco23NFT0S7command-line \ No newline at end of file diff --git a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/index.ts b/source/tasksLegacy/OctoInstaller/OctoInstallerV4/index.ts deleted file mode 100644 index b8079c09..00000000 --- a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { getOrDownloadOcto, resolvePublishedOctoVersion, addToolToPath, getEmbeddedOcto } from "../../Utils/install"; -import * as tasks from "azure-pipelines-task-lib/task"; -import * as os from "os"; - -async function run() { - tasks.warning("This task is deprecated, please use latest version instead."); - const version = tasks.getInput("version"); - // @ts-ignore - const forceEmbedded = /embedded/i.test(version); - - try { - if (forceEmbedded) { - console.log("Forcing the use of the embedded Octopus CLI tool."); - await getEmbeddedOcto(tasks.resolve(__dirname, "embedded")).then(addToolToPath); - } else { - const option = await resolvePublishedOctoVersion(version); - console.log(`Using Octopus CLI tool version ${option.version}`); - await getOrDownloadOcto(option).then(addToolToPath); - } - - tasks.setResult(tasks.TaskResult.Succeeded, ""); - } catch (error: unknown) { - if (error instanceof Error) { - if (forceEmbedded) { - tasks.setResult(tasks.TaskResult.Failed, `${error.message}${os.EOL}${error.stack}`, true); - return; - } - - console.log(`Failed to resolve Octopus CLI tool version ${version}. Using the embedded version. ${error}`); - - try { - await getEmbeddedOcto(tasks.resolve(__dirname, "embedded")).then(addToolToPath); - } catch (embeddedOctoError: unknown) { - if (embeddedOctoError instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `${embeddedOctoError.message}${os.EOL}${embeddedOctoError.stack}`, true); - } - } - } - } -} - -run(); diff --git a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/task.json b/source/tasksLegacy/OctoInstaller/OctoInstallerV4/task.json deleted file mode 100644 index a1df9e46..00000000 --- a/source/tasksLegacy/OctoInstaller/OctoInstallerV4/task.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "id": "57342b23-3a76-490a-8e78-25d4ade2f2e3", - "name": "OctoInstaller", - "friendlyName": "[DEPRECATED] Octopus CLI Installer", - "description": "This task is deprecated, please use latest version instead. Install a specific version of the Octopus CLI", - "helpMarkDown": "Install a specific version of the Octopus CLI", - "category": "Tool", - "runsOn": [ - "Agent", - "DeploymentGroup" - ], - "visibility": [ - "Build", - "Release" - ], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "deprecated": true, - "satisfies": ["Octo"], - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "version", - "type": "string", - "label": "Octopus CLI Version", - "defaultValue": "embedded", - "required": true, - "helpMarkDown": "Specify `latest` or the version number to download. If you specify `embedded`, or the download fails, a built-in copy of the tool will be used." - } - ], - "instanceNameFormat": "[DEPRECATED] Use Octopus CLI tool version $(version)", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/icon.png b/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/icon.png deleted file mode 100644 index 236566a308c71c4b35ce91fa54e6914d05fb8d7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 481 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X5(0ceT=geE`2YXEw4QzPx)(OH9^H8T^V5&NwR_$iJAMB2 zlkd|{z7JdeY{`X>D>rQ4clWDC?vm|$4|^_rGX3O-f~~JMUjO{`<8KR(@UBDe9zA_7 zW8(Sr({J6jGn&@kn#Jq<8&?5MzN-Gj8RWW>AirQB7aw4ViIIK_RQuY~#WAGf)|JUO zg_;dGToq^cx@BK|*Zu$hbk@acQL?{p++$Bya%U26DRcg?yrHafN@ijhgZ4r1rD>cV z3NIEYFVJzex!AERaEc521I41Md6xGQ)F%rjx;bztnH<-Cb9A{1o6Eh}1U819ca*nG zm+fZUxZM1v#PO~^%`NJJE-iDIgrXGHTDTmJtv%Q9TK0{={z`MZhK=0Z+>-MIj5Y|y z9A0xm?Mgz*b=ND;xTpNT7s&dg{Nhgm$)%1_;l&3Qg-X3%IeF*&R+q&G0y|G#y{PkN zL&dCBCvNy}vz?b_|L$w;kE+Gn%0G$!U$dQonSt+$*N$DY75)Id&EVoctopus \ No newline at end of file diff --git a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/index.ts b/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/index.ts deleted file mode 100644 index 973ac51a..00000000 --- a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/index.ts +++ /dev/null @@ -1,97 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { ToolRunner } from "azure-pipelines-task-lib/toolrunner"; -import * as path from "path"; -import { createVstsConnection, getBuildBranch, getBuildChanges, getVcsTypeFromProvider, getVstsEnvironmentVariables } from "../../Utils/environment"; -import { getLineSeparatedItems, getOverwriteModeFromReplaceInput } from "../../Utils/inputs"; -import { assertOctoVersionAcceptsIds, getOrInstallOctoCommandRunner, connectionArguments, includeAdditionalArgumentsAndProxyConfig, argument, argumentEnquote, argumentIfSet, multiArgument } from "../../Utils/tool"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -export interface IOctopusBuildInformation { - BuildEnvironment: string; - BuildNumber: string; - BuildUrl: string; - Branch: string; - VcsType: string; - VcsRoot: string; - VcsCommitNumber: string; - Commits: IOctopusBuildInformationCommit[]; -} - -export interface IOctopusBuildInformationCommit { - Id: string; - Comment: string; -} - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const environment = getVstsEnvironmentVariables(); - const vstsConnection = createVstsConnection(environment); - - const space = tasks.getInput("Space"); - // @ts-expect-error - const packageIds = getLineSeparatedItems(tasks.getInput("PackageId", true)); - const packageVersion = tasks.getInput("PackageVersion", true); - // @ts-expect-error - const overwriteMode = getOverwriteModeFromReplaceInput(tasks.getInput("Replace", true)); - const additionalArguments = tasks.getInput("AdditionalArguments"); - - const branch = await getBuildBranch(vstsConnection); - const commits = await getBuildChanges(vstsConnection); - - const buildInformation: IOctopusBuildInformation = { - BuildEnvironment: "Azure DevOps", - BuildNumber: environment.buildNumber, - BuildUrl: environment.teamCollectionUri.replace(/\/$/, "") + "/" + environment.projectName + "/_build/results?buildId=" + environment.buildId, - // @ts-expect-error - Branch: branch, - VcsType: getVcsTypeFromProvider(environment.buildRepositoryProvider), - VcsRoot: environment.buildRepositoryUri, - VcsCommitNumber: environment.buildSourceVersion, - // @ts-expect-error - Commits: commits.map((change) => ({ Id: change.id, Comment: change.message })), - }; - - if (!environment.agentBuildDirectory) { - tasks.error("The Build Information step requires build information and therefore is not compatible with use in a Release pipeline."); - return; - } - - const buildInformationDir = path.join(environment.agentBuildDirectory, "octo"); - const buildInformationFile = path.join(buildInformationDir, `${environment.buildId}-buildinformation.json`); - await tasks.mkdirP(buildInformationDir); - await tasks.writeFile(buildInformationFile, JSON.stringify(buildInformation, null, 2)); - - await assertOctoVersionAcceptsIds(); - const octo = await getOrInstallOctoCommandRunner("build-information"); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - const configure: Array<(tool: ToolRunner) => ToolRunner> = [ - connectionArguments(connection), - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - multiArgument(argumentEnquote, "package-id", packageIds), - // @ts-expect-error - argument("version", packageVersion), - argumentEnquote("file", buildInformationFile), - argument("overwrite-mode", overwriteMode), - // @ts-expect-error - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(build-information;push;v4)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to push build information. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/task.json b/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/task.json deleted file mode 100644 index 3fe3f3fb..00000000 --- a/source/tasksLegacy/OctopusMetadata/OctopusMetadataV4/task.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "id": "b1861ef4-b62e-40c1-bcb0-be00d454a8a7", - "name": "OctopusMetadata", - "friendlyName": "Push Package Build Information to Octopus (legacy)", - "description": "(legacy) There is a later version of this task, we recommend using the latest version. Collect information related to the build, including work items from commit messages, and push to your Octopus Deploy Server.", - "helpMarkDown": "set-by-pack.ps1", - "category": "Package", - "visibility": ["Build"], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "pickList", - "label": "Space", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The space within Octopus." - }, - { - "name": "PackageId", - "type": "multiLine", - "label": "Package IDs", - "defaultValue": "", - "required": true, - "helpMarkDown": "Newline-separated package IDs; e.g.\nMyCompany.MyApp\nMyCompany.MyApp2" - }, - { - "name": "PackageVersion", - "type": "string", - "label": "Package Version", - "defaultValue": "", - "required": true, - "helpMarkDown": "The version of the package; must be a valid [SemVer](http://semver.org/) version." - }, - { - "name": "Replace", - "type": "pickList", - "label": "Overwrite Mode", - "defaultValue": "false", - "required": true, - "helpMarkDown": "Normally, if the same package build information already exists on the server, the server will reject the package build information push. This is a good practice as it ensures build information isn't accidentally overwritten or ignored. Use this setting to override this behavior.", - "options": { - "false": "Fail if exists", - "true": "Overwrite existing", - "IgnoreIfExists": "Ignore if exists" - } - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctopusCliBuildInformation) for available parameters.", - "groupName": "advanced" - } - ], - "dataSourceBindings": [ - { - "target": "Space", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllSpaces", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Push Package Build Information to Octopus (legacy)", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Pack/PackV4/icon.png b/source/tasksLegacy/Pack/PackV4/icon.png deleted file mode 100644 index aae79512bdbe636d02f29e0df2ce1e022a9bf14e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 399 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XyaRkfT=geE`2YWZ^12tNpM0Nw^1Za4y@GrCjn_XzlJYk&O9__pP)pOyKjn_XNY%KN!@l^rhOoW^09)+pR`;?VM02NMt7JTf6n z?~{m0@HdHz6R(`j`I6Drs>%OxOKOG3TA!SwQ|>pLzvXwk)MWF2S*_rW{dW1jKe!AS Y-Y$}SQ}F9jD$oNAp00i_>zopr03iIossI20 diff --git a/source/tasksLegacy/Pack/PackV4/icon.svg b/source/tasksLegacy/Pack/PackV4/icon.svg deleted file mode 100644 index d9d027bc..00000000 --- a/source/tasksLegacy/Pack/PackV4/icon.svg +++ /dev/null @@ -1 +0,0 @@ -octopus \ No newline at end of file diff --git a/source/tasksLegacy/Pack/PackV4/index.ts b/source/tasksLegacy/Pack/PackV4/index.ts deleted file mode 100644 index 1c5b5135..00000000 --- a/source/tasksLegacy/Pack/PackV4/index.ts +++ /dev/null @@ -1,115 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import * as fs from "fs"; -import { ToolRunner } from "azure-pipelines-task-lib/toolrunner"; -import { getLineSeparatedItems, isNullOrWhitespace, removeTrailingSlashes, safeTrim } from "../../Utils/inputs"; -import { argument, argumentEnquote, argumentIfSet, flag, getOrInstallOctoCommandRunner, includeAdditionalArguments, multiArgument } from "../../Utils/tool"; -import os from "os"; - -export interface PackageRequiredInputs { - packageId: string; - packageFormat: string; -} -export interface PackageOptionalInputs { - packageVersion?: string; - outputPath?: string; - sourcePath?: string; - nuGetAuthor?: string; - nuGetTitle?: string; - nuGetDescription?: string; - nuGetReleaseNotes?: string; - nuGetReleaseNotesFile?: string; - include?: string[]; - listFiles: boolean; - overwrite: boolean; - additionalArguments: string; - compressionLevel: string; -} - -export type PackageInputs = PackageRequiredInputs & PackageOptionalInputs; - -export const configure = (inputs: PackageInputs) => { - return [ - argumentEnquote("id", inputs.packageId), - argument("format", inputs.packageFormat), - // @ts-ignore - argumentIfSet(argument, "version", inputs.packageVersion), - argumentIfSet(argument, "compressionlevel", inputs.compressionLevel), - // @ts-ignore - argumentIfSet(argumentEnquote, "outFolder", inputs.outputPath), - // @ts-ignore - argumentIfSet(argumentEnquote, "basePath", inputs.sourcePath), - // @ts-ignore - argumentIfSet(argumentEnquote, "author", inputs.nuGetAuthor), - // @ts-ignore - argumentIfSet(argumentEnquote, "title", inputs.nuGetTitle), - // @ts-ignore - argumentIfSet(argumentEnquote, "description", inputs.nuGetDescription), - // @ts-ignore - argumentIfSet(argumentEnquote, "releaseNotes", inputs.nuGetReleaseNotes), - argument("overwrite", inputs.overwrite.toString()), - includeAdditionalArguments(inputs.additionalArguments), - (tool: ToolRunner) => { - if (!isNullOrWhitespace(inputs.nuGetReleaseNotesFile) && fs.existsSync(inputs.nuGetReleaseNotesFile) && fs.lstatSync(inputs.nuGetReleaseNotesFile).isFile()) { - console.log(`Release notes file: ${inputs.nuGetReleaseNotesFile}`); - argumentEnquote("releaseNotesFile", inputs.nuGetReleaseNotesFile, tool); - } else { - console.log("No release notes file found"); - } - return tool; - }, - multiArgument(argumentEnquote, "include", inputs.include || []), - flag("verbose", inputs.listFiles), - ]; -}; - -export const getInputs = (): PackageInputs => { - return { - // @ts-ignore - packageId: tasks.getInput("PackageId", true), - // @ts-ignore - packageFormat: tasks.getInput("PackageFormat", true), - packageVersion: tasks.getInput("PackageVersion"), - outputPath: removeTrailingSlashes(safeTrim(tasks.getPathInput("OutputPath"))) || undefined, - sourcePath: removeTrailingSlashes(safeTrim(tasks.getPathInput("SourcePath"))) || undefined, - nuGetAuthor: tasks.getInput("NuGetAuthor"), - nuGetTitle: tasks.getInput("NuGetTitle"), - nuGetDescription: tasks.getInput("NuGetDescription"), - nuGetReleaseNotes: tasks.getInput("NuGetReleaseNotes"), - nuGetReleaseNotesFile: tasks.getInput("NuGetReleaseNotesFile", false), - overwrite: tasks.getBoolInput("Overwrite"), - // @ts-ignore - include: getLineSeparatedItems(tasks.getInput("Include")), - listFiles: tasks.getBoolInput("ListFiles"), - // @ts-ignore - additionalArguments: tasks.getInput("AdditionalArguments"), - // @ts-ignore - compressionLevel: tasks.getInput("CompressionLevel"), - }; -}; - -async function run() { - try { - tasks.warning(`This task is supported, but it no longer actively maintained. -It was originally created for the Octopus CLI when Octopus Deploy only supported NuGet packages. -It is recommended to migrate to the built-in 'Archive Files' task (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/archive-files). -Alternatively, if NuGet package metadata is required, consider using the 'NuGet' task (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/package/nuget) or the 'dotnet pack' task (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli).`); - - const octo = await getOrInstallOctoCommandRunner("pack"); - const configureTool = configure(getInputs()); - - const code: number = await octo - .map((x) => x.launchOcto(configureTool, "(package;pack;v4)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Pack succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to execute octo pack command. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Pack/PackV4/task.json b/source/tasksLegacy/Pack/PackV4/task.json deleted file mode 100644 index b53988f6..00000000 --- a/source/tasksLegacy/Pack/PackV4/task.json +++ /dev/null @@ -1,179 +0,0 @@ -{ - "id": "179fac12-2402-486e-80cf-5a6a8571f7c0", - "name": "OctopusPack", - "friendlyName": "Package Application for Octopus", - "description": "Package your application into a NuPkg or Zip file.", - "helpMarkDown": "set-by-pack.ps1", - "category": "Package", - "visibility": [ - "Build", - "Release" - ], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "nuget", - "displayName": "NuGet", - "isExpanded": false - }, - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "PackageId", - "type": "string", - "label": "Package ID", - "defaultValue": "", - "required": true, - "helpMarkDown": "The ID of the package. e.g. MyCompany.App" - }, - { - "name": "PackageFormat", - "type": "pickList", - "label": "Package Format", - "required": true, - "defaultValue": "NuPkg", - "options": { - "NuPkg": "NuPkg", - "Zip": "Zip" - }, - "helpMarkDown": "Package format. Must be either NuPkg or Zip." - }, - { - "name": "PackageVersion", - "type": "string", - "label": "Package Version", - "defaultValue": "", - "required": false, - "helpMarkDown": "The version of the package; must be a valid [SemVer](http://semver.org/) version; defaults to a timestamp-based version." - }, - { - "name": "SourcePath", - "type": "filePath", - "label": "Source Path", - "defaultValue": "", - "required": false, - "helpMarkDown": "The folder containing the files and folders to package. Defaults to working directory." - }, - { - "name": "OutputPath", - "type": "filePath", - "label": "Output Path", - "defaultValue": "", - "required": false, - "helpMarkDown": "The directory into which the generated package will be written. Defaults to working directory." - }, - { - "name": "NuGetAuthor", - "type": "string", - "label": "Author", - "defaultValue": "", - "required": false, - "helpMarkDown": "Add an author to the NuGet package metadata.", - "groupName": "nuget" - }, - { - "name": "NuGetTitle", - "type": "string", - "label": "Title", - "defaultValue": "", - "required": false, - "helpMarkDown": "Add a title to the NuGet package metadata.", - "groupName": "nuget" - }, - { - "name": "NuGetDescription", - "type": "string", - "label": "Description", - "defaultValue": "", - "required": false, - "helpMarkDown": "Add a description to the NuGet package metadata.", - "groupName": "nuget" - }, - { - "name": "NuGetReleaseNotes", - "type": "string", - "label": "Release Notes", - "defaultValue": "", - "required": false, - "helpMarkDown": "Add release notes to the NuGet package metadata.", - "groupName": "nuget" - }, - { - "name": "NuGetReleaseNotesFile", - "type": "filePath", - "label": "Release Notes File", - "defaultValue": "", - "required": false, - "helpMarkDown": "A file containing release notes to be added to the NuGet package metadata.", - "groupName": "nuget" - }, - { - "name": "Include", - "type": "multiLine", - "label": "Include", - "defaultValue": "", - "required": false, - "helpMarkDown": "File patterns to include, relative to the root path. e.g. /bin/*.dll", - "groupName": "advanced" - }, - { - "name": "Overwrite", - "type": "boolean", - "label": "Overwrite", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Allow an existing package of the same ID and version to be overwritten.", - "groupName": "advanced" - }, - { - "name": "ListFiles", - "type": "boolean", - "label": "Log Added Files", - "defaultValue": "false", - "required": "false", - "helpMarkDown": "Write a list of all files added to the build log.", - "groupName": "advanced" - }, - { - "name": "CompressionLevel", - "type": "pickList", - "label": "Compression Level", - "defaultValue": "optimal", - "required": false, - "helpMarkDown": "Set the compression level.", - "groupName": "advanced", - "options": { - "none": "None", - "fast": "Fast", - "optimal": "Optimal" - } - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctopusCliPack) for available parameters.", - "groupName": "advanced" - } - ], - "instanceNameFormat": "Package $(PackageId)", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Promote/PromoteV3/icon.png b/source/tasksLegacy/Promote/PromoteV3/icon.png deleted file mode 100644 index 0f1c1a7aa10ce39e27a6d85e44c9f440914e3bc3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 621 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XCI|S0xav=SAgyQr|NsB#C*LQpdto!{k#@r&857S>KmK|y zeA0F3-RURaYxlg-s@f5@{8_=)S9-nI6#WW6e)_DMI6=WZec#=$H(vkL$Xzo1b}US(G$pd5Hfjc=L##jy>z%tgnYz3J z2NpRo>s)V?YEWLZ;`OdahfT62*MFLx$MT>h>?*^SmarLDUNro<%d|b2ovV_m`W=Iw z&IFw|535(4XDH;idAP#gDsbDS1DjVr&YASISyzs~qmGYv#aiP6A-f5Vm1zd$pR10X znSbc4ac6UkDRfqa6 z=_HXVv(wc_)&`|aseii93Ax|&iGyn5Pmw#V> d{ZBA~f%lnJ$_HM<-@veE@O1TaS?83{1ONl5HsSyP diff --git a/source/tasksLegacy/Promote/PromoteV3/icon.svg b/source/tasksLegacy/Promote/PromoteV3/icon.svg deleted file mode 100644 index 94905963..00000000 --- a/source/tasksLegacy/Promote/PromoteV3/icon.svg +++ /dev/null @@ -1 +0,0 @@ -octopus \ No newline at end of file diff --git a/source/tasksLegacy/Promote/PromoteV3/index.ts b/source/tasksLegacy/Promote/PromoteV3/index.ts deleted file mode 100644 index 53b5eb44..00000000 --- a/source/tasksLegacy/Promote/PromoteV3/index.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { multiArgument, connectionArguments, includeAdditionalArgumentsAndProxyConfig, flag, argumentEnquote, argumentIfSet, getOrInstallOctoCommandRunner } from "../../Utils/tool"; -import { getOptionalCsvInput, getRequiredCsvInput } from "../../Utils/inputs"; -import { getDefaultOctopusConnectionDetailsOrThrow, resolveProjectName } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - // @ts-expect-error - const project = await resolveProjectName(connection, tasks.getInput("Project", true)).then((x) => x.value); - - const from = tasks.getInput("From", true); - const to = getRequiredCsvInput("To"); - const showProgress = tasks.getBoolInput("ShowProgress"); - const deploymentForTenants = getOptionalCsvInput("DeployForTenants"); - const deployForTenantTags = getOptionalCsvInput("DeployForTentantTags"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - - const octo = await getOrInstallOctoCommandRunner("promote-release"); - - const configure = [ - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - argumentEnquote("project", project), - connectionArguments(connection), - // @ts-expect-error - argumentEnquote("from", from), - multiArgument(argumentEnquote, "to", to), - multiArgument(argumentEnquote, "tenant", deploymentForTenants), - multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), - flag("progress", showProgress), - // @ts-expect-error - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(release;promote;v3)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded promoting release with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to promote release. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Promote/PromoteV3/task.json b/source/tasksLegacy/Promote/PromoteV3/task.json deleted file mode 100644 index 83b24410..00000000 --- a/source/tasksLegacy/Promote/PromoteV3/task.json +++ /dev/null @@ -1,173 +0,0 @@ -{ - "id": "1627fcfe-f292-4904-adac-26cfb14bdb07", - "name": "OctopusPromote", - "friendlyName": "Promote Octopus Release", - "description": "There is a later version of this task, we recommend using the latest version. Promote an Octopus release from one environment to another", - "helpMarkDown": "set-by-pack.ps1", - "category": "Deploy", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 3, - "Minor": 1, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "tenant", - "displayName": "Tenants", - "isExpanded": false - }, - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "string", - "label": "Space (Legacy - Use version 4 of this task)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "False" - }, - "helpMarkDown": "Version 3 of this task has limited support for spaces. We recommend using version 4 of this task for a better experience." - }, - { - "name": "ProjectGroup", - "type": "pickList", - "label": "Project Group", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." - }, - { - "name": "Project", - "type": "pickList", - "label": "Project", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Octopus Deploy Project Name" - }, - { - "name": "From", - "type": "pickList", - "label": "Promote From", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The environment the release is currently deployed to. e.g. 'Staging'" - }, - { - "name": "To", - "type": "pickList", - "label": "Promote To", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Comma separated list of environments to deploy to" - }, - { - "name": "ShowProgress", - "type": "boolean", - "label": "Show Deployment Progress", - "defaultValue": "False", - "required": false, - "helpMarkDown": "If checked, the build process will only succeed if the deployment is successful." - }, - { - "name": "DeployForTenants", - "type": "pickList", - "label": "Tenant(s)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Promote the release for this comma delimited list of tenants. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", - "groupName": "tenant" - }, - { - "name": "DeployForTenantTags", - "type": "string", - "label": "Tenant Tag(s)", - "defaultValue": "", - "required": false, - "helpMarkDown": "Promote the release for tenants who match these tags and are ready to deploy to the provided environment.", - "groupName": "tenant" - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExePromoteRelease) for available parameters.", - "groupName": "advanced" - } - ], - "dataSourceBindings": [ - { - "target": "ProjectGroup", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllProjectGroups", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Project", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusListProjectsInProjectGroup", - "parameters": { - "ProjectGroupId": "$(ProjectGroup)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "From", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllEnvironments", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "To", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllEnvironments", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployForTenants", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllTenants", - "resultTemplate": "{\"Value\":\"{{{Name}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Promote $(Project) from $(From) to $(To)", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Promote/PromoteV4/icon.png b/source/tasksLegacy/Promote/PromoteV4/icon.png deleted file mode 100644 index 0f1c1a7aa10ce39e27a6d85e44c9f440914e3bc3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 621 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XCI|S0xav=SAgyQr|NsB#C*LQpdto!{k#@r&857S>KmK|y zeA0F3-RURaYxlg-s@f5@{8_=)S9-nI6#WW6e)_DMI6=WZec#=$H(vkL$Xzo1b}US(G$pd5Hfjc=L##jy>z%tgnYz3J z2NpRo>s)V?YEWLZ;`OdahfT62*MFLx$MT>h>?*^SmarLDUNro<%d|b2ovV_m`W=Iw z&IFw|535(4XDH;idAP#gDsbDS1DjVr&YASISyzs~qmGYv#aiP6A-f5Vm1zd$pR10X znSbc4ac6UkDRfqa6 z=_HXVv(wc_)&`|aseii93Ax|&iGyn5Pmw#V> d{ZBA~f%lnJ$_HM<-@veE@O1TaS?83{1ONl5HsSyP diff --git a/source/tasksLegacy/Promote/PromoteV4/icon.svg b/source/tasksLegacy/Promote/PromoteV4/icon.svg deleted file mode 100644 index 94905963..00000000 --- a/source/tasksLegacy/Promote/PromoteV4/icon.svg +++ /dev/null @@ -1 +0,0 @@ -octopus \ No newline at end of file diff --git a/source/tasksLegacy/Promote/PromoteV4/index.ts b/source/tasksLegacy/Promote/PromoteV4/index.ts deleted file mode 100644 index 672fc0bd..00000000 --- a/source/tasksLegacy/Promote/PromoteV4/index.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; -import { argumentEnquote, argumentIfSet, assertOctoVersionAcceptsIds, connectionArguments, flag, getOrInstallOctoCommandRunner, includeAdditionalArgumentsAndProxyConfig, multiArgument } from "../../Utils/tool"; -import { getOptionalCsvInput, getRequiredCsvInput } from "../../Utils/inputs"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - const project = tasks.getInput("Project", true); - const from = tasks.getInput("From", true); - const to = getRequiredCsvInput("To"); - const deployForTenants = getOptionalCsvInput("DeployForTenants"); - const deployForTenantTags = getOptionalCsvInput("DeployForTenantTags"); - const showProgress = tasks.getBoolInput("ShowProgress"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - - await assertOctoVersionAcceptsIds(); - const octo = await getOrInstallOctoCommandRunner("promote-release"); - - const configure = [ - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - // @ts-expect-error - argumentEnquote("project", project), - connectionArguments(connection), - // @ts-expect-error - argumentEnquote("from", from), - multiArgument(argumentEnquote, "to", to), - multiArgument(argumentEnquote, "tenant", deployForTenants), - multiArgument(argumentEnquote, "tenanttag", deployForTenantTags), - flag("progress", showProgress), - // @ts-expect-error - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(release;promote;v4)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded promoting release with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to promote release. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Promote/PromoteV4/task.json b/source/tasksLegacy/Promote/PromoteV4/task.json deleted file mode 100644 index d29b100f..00000000 --- a/source/tasksLegacy/Promote/PromoteV4/task.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "id": "1627fcfe-f292-4904-adac-26cfb14bdb07", - "name": "OctopusPromote", - "friendlyName": "Promote Octopus Release", - "description": "There is a later version of this task, we recommend using the latest version. Promote an Octopus release from one environment to another", - "helpMarkDown": "set-by-pack.ps1", - "category": "Deploy", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "tenant", - "displayName": "Tenants", - "isExpanded": false - }, - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "pickList", - "label": "Space", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The space within Octopus." - }, - { - "name": "ProjectGroup", - "type": "pickList", - "label": "Project Group", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project group within Octopus (this populates the next Project dropdown)." - }, - { - "name": "Project", - "type": "pickList", - "label": "Project", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The project within Octopus." - }, - { - "name": "From", - "type": "pickList", - "label": "Promote From", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The environment the release is currently deployed to. e.g. 'Staging'" - }, - { - "name": "To", - "type": "pickList", - "label": "Promote To", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Comma separated list of environments to deploy to" - }, - { - "name": "ShowProgress", - "type": "boolean", - "label": "Show Deployment Progress", - "defaultValue": "False", - "required": false, - "helpMarkDown": "If checked, the build process will only succeed if the deployment is successful." - }, - { - "name": "DeployForTenants", - "type": "pickList", - "label": "Tenant(s)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "Promote the release for this comma delimited list of tenants. Wildcard '*' will deploy to all tenants currently able to deploy to the above provided environment.", - "groupName": "tenant" - }, - { - "name": "DeployForTenantTags", - "type": "string", - "label": "Tenant Tag(s)", - "defaultValue": "", - "required": false, - "helpMarkDown": "Promote the release for tenants who match these tags and are ready to deploy to the provided environment.", - "groupName": "tenant" - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExePromoteRelease) for available parameters.", - "groupName": "advanced" - } - ], - "dataSourceBindings": [ - { - "target": "Space", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllSpaces", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "ProjectGroup", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllProjectGroupsInSpace", - "parameters": { - "SpaceId": "$(Space)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "Project", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusListProjectsInProjectGroupInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectGroupId": "$(ProjectGroup)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "From", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectEnvironmentsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectId": "$(Project)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "To", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectEnvironmentsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectId": "$(Project)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - }, - { - "target": "DeployForTenants", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusProjectTenantsInSpace", - "parameters": { - "SpaceId": "$(Space)", - "ProjectName": "$(Project)" - }, - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Promote Project in Octopus", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Push/PushV3/icon.png b/source/tasksLegacy/Push/PushV3/icon.png deleted file mode 100644 index 236566a308c71c4b35ce91fa54e6914d05fb8d7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 481 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X5(0ceT=geE`2YXEw4QzPx)(OH9^H8T^V5&NwR_$iJAMB2 zlkd|{z7JdeY{`X>D>rQ4clWDC?vm|$4|^_rGX3O-f~~JMUjO{`<8KR(@UBDe9zA_7 zW8(Sr({J6jGn&@kn#Jq<8&?5MzN-Gj8RWW>AirQB7aw4ViIIK_RQuY~#WAGf)|JUO zg_;dGToq^cx@BK|*Zu$hbk@acQL?{p++$Bya%U26DRcg?yrHafN@ijhgZ4r1rD>cV z3NIEYFVJzex!AERaEc521I41Md6xGQ)F%rjx;bztnH<-Cb9A{1o6Eh}1U819ca*nG zm+fZUxZM1v#PO~^%`NJJE-iDIgrXGHTDTmJtv%Q9TK0{={z`MZhK=0Z+>-MIj5Y|y z9A0xm?Mgz*b=ND;xTpNT7s&dg{Nhgm$)%1_;l&3Qg-X3%IeF*&R+q&G0y|G#y{PkN zL&dCBCvNy}vz?b_|L$w;kE+Gn%0G$!U$dQonSt+$*N$DY75)Id&EVoctopus \ No newline at end of file diff --git a/source/tasksLegacy/Push/PushV3/index.ts b/source/tasksLegacy/Push/PushV3/index.ts deleted file mode 100644 index e002e3a0..00000000 --- a/source/tasksLegacy/Push/PushV3/index.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; - -import { multiArgument, connectionArguments, includeAdditionalArgumentsAndProxyConfig, flag, argumentEnquote, argumentIfSet, getOrInstallOctoCommandRunner } from "../../Utils/tool"; -import { getLineSeparatedItems, resolveGlobs } from "../../Utils/inputs"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - // @ts-expect-error - const packages = getLineSeparatedItems(tasks.getInput("Package", true)); - const replace = tasks.getBoolInput("Replace"); - const additionalArguments = tasks.getInput("AdditionalArguments"); - - const octo = await getOrInstallOctoCommandRunner("push"); - const matchedPackages = await resolveGlobs(packages); - - const configure = [ - connectionArguments(connection), - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - multiArgument(argumentEnquote, "package", matchedPackages), - flag("replace-existing", replace), - // @ts-expect-error - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(package;push;v3)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to push package. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Push/PushV3/task.json b/source/tasksLegacy/Push/PushV3/task.json deleted file mode 100644 index 5d6384ad..00000000 --- a/source/tasksLegacy/Push/PushV3/task.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "id": "d05ad9a2-5d9e-4a1c-a887-14034334d6f2", - "name": "OctopusPush", - "friendlyName": "Push Package(s) to Octopus", - "description": "There is a later version of this task, we recommend using the latest version. Push your NuGet or Zip package to your Octopus Deploy Server", - "helpMarkDown": "set-by-pack.ps1", - "category": "Package", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 3, - "Minor": 1, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "string", - "label": "Space (Legacy - Use version 4 of this task)", - "defaultValue": "", - "required": false, - "properties": { - "EditableOptions": "False" - }, - "helpMarkDown": "Version 3 of this task has limited support for spaces. We recommend using version 4 of this task for a better experience." - }, - { - "name": "Package", - "type": "multiLine", - "label": "Package", - "defaultValue": "", - "required": true, - "helpMarkDown": "Package file to push. To push multiple packages, enter on multiple lines." - }, - { - "name": "Replace", - "type": "boolean", - "label": "Replace Existing", - "defaultValue": "False", - "required": true, - "helpMarkDown": "If the package already exists in the repository, the default behavior is to reject the new package being pushed. Set this flag to 'True' to overwrite the existing package." - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExePush) for available parameters.", - "groupName": "advanced" - } - ], - "instanceNameFormat": "Push Packages to Octopus", - "execution": { - "Node10": { - "target": "index.js" - } - } -} diff --git a/source/tasksLegacy/Push/PushV4/icon.png b/source/tasksLegacy/Push/PushV4/icon.png deleted file mode 100644 index 236566a308c71c4b35ce91fa54e6914d05fb8d7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 481 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X5(0ceT=geE`2YXEw4QzPx)(OH9^H8T^V5&NwR_$iJAMB2 zlkd|{z7JdeY{`X>D>rQ4clWDC?vm|$4|^_rGX3O-f~~JMUjO{`<8KR(@UBDe9zA_7 zW8(Sr({J6jGn&@kn#Jq<8&?5MzN-Gj8RWW>AirQB7aw4ViIIK_RQuY~#WAGf)|JUO zg_;dGToq^cx@BK|*Zu$hbk@acQL?{p++$Bya%U26DRcg?yrHafN@ijhgZ4r1rD>cV z3NIEYFVJzex!AERaEc521I41Md6xGQ)F%rjx;bztnH<-Cb9A{1o6Eh}1U819ca*nG zm+fZUxZM1v#PO~^%`NJJE-iDIgrXGHTDTmJtv%Q9TK0{={z`MZhK=0Z+>-MIj5Y|y z9A0xm?Mgz*b=ND;xTpNT7s&dg{Nhgm$)%1_;l&3Qg-X3%IeF*&R+q&G0y|G#y{PkN zL&dCBCvNy}vz?b_|L$w;kE+Gn%0G$!U$dQonSt+$*N$DY75)Id&EVoctopus \ No newline at end of file diff --git a/source/tasksLegacy/Push/PushV4/index.ts b/source/tasksLegacy/Push/PushV4/index.ts deleted file mode 100644 index bd8d0671..00000000 --- a/source/tasksLegacy/Push/PushV4/index.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as tasks from "azure-pipelines-task-lib/task"; - -import { getLineSeparatedItems, getOverwriteModeFromReplaceInput, resolveGlobs } from "../../Utils/inputs"; -import { argument, argumentEnquote, argumentIfSet, assertOctoVersionAcceptsIds, connectionArguments, getOrInstallOctoCommandRunner, includeAdditionalArgumentsAndProxyConfig, multiArgument } from "../../Utils/tool"; -import { getDefaultOctopusConnectionDetailsOrThrow } from "../../Utils/connection"; -import os from "os"; - -async function run() { - try { - tasks.warning("There is a later version of this task, we recommend using the latest version."); - const connection = getDefaultOctopusConnectionDetailsOrThrow(); - - const space = tasks.getInput("Space"); - // @ts-expect-error - const packages = getLineSeparatedItems(tasks.getInput("Package", true)); - // @ts-expect-error - const overwriteMode = getOverwriteModeFromReplaceInput(tasks.getInput("Replace", true)); - const additionalArguments = tasks.getInput("AdditionalArguments"); - - await assertOctoVersionAcceptsIds(); - const octo = await getOrInstallOctoCommandRunner("push"); - const matchedPackages = await resolveGlobs(packages); - - const configure = [ - connectionArguments(connection), - // @ts-expect-error - argumentIfSet(argumentEnquote, "space", space), - multiArgument(argumentEnquote, "package", matchedPackages), - argument("overwrite-mode", overwriteMode), - // @ts-expect-error - includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), - ]; - - const code: number = await octo - .map((x) => x.launchOcto(configure, "(package;push;v4)")) - .getOrElseL((x) => { - throw new Error(x); - }); - - tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded with code " + code); - } catch (error: unknown) { - if (error instanceof Error) { - tasks.setResult(tasks.TaskResult.Failed, `"Failed to push package. ${error.message}${os.EOL}${error.stack}`, true); - } - } -} - -run(); diff --git a/source/tasksLegacy/Push/PushV4/task.json b/source/tasksLegacy/Push/PushV4/task.json deleted file mode 100644 index f9aceb43..00000000 --- a/source/tasksLegacy/Push/PushV4/task.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "id": "d05ad9a2-5d9e-4a1c-a887-14034334d6f2", - "name": "OctopusPush", - "friendlyName": "Push Package(s) to Octopus", - "description": "There is a later version of this task, we recommend using the latest version. Push your NuGet or Zip package to your Octopus Deploy Server", - "helpMarkDown": "set-by-pack.ps1", - "category": "Package", - "visibility": ["Build", "Release"], - "author": "Octopus Deploy", - "version": { - "Major": 4, - "Minor": 3, - "Patch": 0 - }, - "demands": [], - "minimumAgentVersion": "2.144.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced Options", - "isExpanded": false - } - ], - "inputs": [ - { - "name": "OctoConnectedServiceName", - "type": "connectedService:OctopusEndpoint", - "label": "Octopus Deploy Server", - "defaultValue": "", - "required": true, - "helpMarkDown": "Octopus Deploy server connection" - }, - { - "name": "Space", - "type": "pickList", - "label": "Space", - "defaultValue": "", - "required": true, - "properties": { - "EditableOptions": "True" - }, - "helpMarkDown": "The space within Octopus." - }, - { - "name": "Package", - "type": "multiLine", - "label": "Package", - "defaultValue": "", - "required": true, - "helpMarkDown": "Package file to push. To push multiple packages, enter on multiple lines." - }, - { - "name": "Replace", - "type": "pickList", - "label": "Overwrite Mode", - "defaultValue": "false", - "required": true, - "helpMarkDown": "Normally, if the same package already exists on the server, the server will reject the package push. This is a good practice as it ensures a package isn't accidentally overwritten or ignored. Use this setting to override this behavior.", - "options": { - "false": "Fail if exists", - "true": "Overwrite existing", - "IgnoreIfExists": "Ignore if exists" - } - }, - { - "name": "AdditionalArguments", - "type": "string", - "label": "Additional Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to be supplied to the Octopus CLI. See the [Octopus CLI documentation](https://g.octopushq.com/OctoExePush) for available parameters.", - "groupName": "advanced" - } - ], - "dataSourceBindings": [ - { - "target": "Space", - "endpointId": "$(OctoConnectedServiceName)", - "dataSourceName": "OctopusAllSpaces", - "resultTemplate": "{\"Value\":\"{{{Id}}}\",\"DisplayValue\":\"{{{Name}}}\"}" - } - ], - "instanceNameFormat": "Push Packages to Octopus", - "execution": { - "Node10": { - "target": "index.js" - } - } -} From 4646e031ee37206fdc014fb9cf1ee58b9d64311c Mon Sep 17 00:00:00 2001 From: Shane Date: Fri, 12 Jan 2024 08:37:22 +1000 Subject: [PATCH 15/16] Don't embed --- .github/workflows/build.yml | 4 -- embed-octo.cmd | 4 -- embed-octo.ps1 | 88 ------------------------------------- 3 files changed, 96 deletions(-) delete mode 100644 embed-octo.cmd delete mode 100644 embed-octo.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e16e7fbf..043c9519 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -104,10 +104,6 @@ jobs: with: go-version: "^1.19.5" - - name: Embed octo portable - run: | - pwsh ./embed-octo.ps1 - - name: Replace versions in tasks and create vsix run: | ./pack.ps1 -environment Production -version ${{ needs.build.outputs.package_version }} -setupTaskDependencies diff --git a/embed-octo.cmd b/embed-octo.cmd deleted file mode 100644 index 071b9174..00000000 --- a/embed-octo.cmd +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -setlocal -cd "%~dp0" -powershell -NoProfile -ExecutionPolicy Unrestricted .\embed-octo.ps1 %* \ No newline at end of file diff --git a/embed-octo.ps1 b/embed-octo.ps1 deleted file mode 100644 index 5158c89e..00000000 --- a/embed-octo.ps1 +++ /dev/null @@ -1,88 +0,0 @@ -param ( - [string] - $version = "latest", - $platform="portable", - [string] - $extension=".zip", - [string] - $latestOctoUrl = "https://g.octopushq.com/LatestTools", - [string] - $basePath = $PSScriptRoot -) - -$ErrorActionPreference = "Stop" - -$buildDirectoryPath = "$basePath/dist" - -function Copy-Object($object){ - $result = New-Object PsObject - $object.psobject.properties | ForEach-Object { - $result | Add-Member -MemberType $_.MemberType -Name $_.Name -Value $_.Value - } - return $result; -} - -function Expand-Template($template, $option){ - $result = $template; - $option.psobject.Properties | ForEach-Object { $result = $result -replace "{\s*$($_.Name)\s*}", $_.Value } - return $result; -} - -function Update-Option($option, [HashTable]$overrides){ - $result = Copy-Object $option - $overrides.Keys | ForEach-Object { $result.$_ = $overrides[$_] } - return $result; -} -function Resolve-Version($version, $option) { - if($version -ieq "latest"){ - return $option - }else{ - $result = Update-Option $option @{ version = $version } - - $result.location = Expand-Template $result.template $result - return $result - } -} - -function Resolve-InstallerTask($path){ - $taskManifestFiles = Get-ChildItem $path -Include "task.json" -Recurse - foreach ($taskManifestFile in $taskManifestFiles) { - if((Split-Path (Split-Path $taskManifestFile -Parent) -Leaf) -ieq "OctoInstallerV4") - { - return Split-Path $taskManifestFile -Parent - } - } -} - -function Expand-EmbeddedOctoZip($zipPath, $extractPath) { - Write-Host "Extracting $zipPath to $extractPath" - Add-Type -assembly "System.IO.Compression.Filesystem" - [IO.Compression.Zipfile]::ExtractToDirectory($zipPath, $extractPath) -} - - -$manifest = Invoke-RestMethod -Uri $latestOctoUrl -$option = $manifest.downloads | Where-Object { $_.platform -ieq $platform -and $_.extension -ieq $extension } -$option = Resolve-Version $version $option -$name = (Split-Path $option.location -Leaf) -$destinationFolder = Join-Path (Resolve-InstallerTask $buildDirectoryPath) "embedded" -$destinationBinFolder = Join-Path $destinationFolder "bin" - -if(!(Test-Path $destinationFolder)){ - New-Item -ItemType Directory -Path $destinationFolder | Out-Null -} - -$downloadFolder = Join-Path ([System.IO.Path]::GetTempPath()) "octo" -$downloadDestination = Join-Path $downloadFolder $name -Write-Host "Downloading Octo $($option.version) from $($option.location) and saving to $($downloadDestination)" - -if(!(Test-Path $downloadFolder)) { - New-Item -ItemType Directory -Path $downloadFolder | Out-Null -} - -(New-Object System.Net.WebClient).DownloadFile($option.location, $downloadDestination) -Expand-EmbeddedOctoZip $downloadDestination $destinationBinFolder -Remove-Item $downloadFolder -Force -Recurse - -$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False -[System.IO.File]::WriteAllLines( (Join-Path $destinationFolder "version.json"), (ConvertTo-Json $option -Compress -Depth 100), $Utf8NoBomEncoding) From 7a32a22c639b6faf8a4c5c02a243f96a4c69a719 Mon Sep 17 00:00:00 2001 From: Shane Date: Mon, 15 Jan 2024 09:48:10 +1000 Subject: [PATCH 16/16] Remove legacy task from manifest --- source/extension-manifest.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/source/extension-manifest.json b/source/extension-manifest.json index 433b5bce..adcd6ba7 100644 --- a/source/extension-manifest.json +++ b/source/extension-manifest.json @@ -168,16 +168,6 @@ "name": "tasks/RunRunbook" } }, - { - "id": "octopus-pack", - "type": "ms.vss-distributed-task.task", - "targets": [ - "ms.vss-distributed-task.tasks" - ], - "properties": { - "name": "tasks/Pack" - } - }, { "id": "octopus-pack-zip", "type": "ms.vss-distributed-task.task",