From abdad7f1cff3fef7be6c1edbf6fa3c1e15254b39 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Tue, 20 Nov 2018 20:58:51 +0000 Subject: [PATCH] (GH-11) Refactor into single task - As suggested by Oren - Based on what is done for the NuGet Task --- Tasks/apikey/apikey.ps1 | 54 -- Tasks/apikey/task.json | 80 -- Tasks/chocolatey/chocolatey.ps1 | 462 +++++++++++ Tasks/{apikey => chocolatey}/icon.png | Bin .../ps_modules/VstsTaskSdk/FindFunctions.ps1 | 0 .../ps_modules/VstsTaskSdk/InputFunctions.ps1 | 0 .../VstsTaskSdk/LegacyFindFunctions.ps1 | 0 .../VstsTaskSdk/LocalizationFunctions.ps1 | 0 .../VstsTaskSdk/LoggingCommandFunctions.ps1 | 0 .../VstsTaskSdk/LongPathFunctions.ps1 | 0 .../ps_modules/VstsTaskSdk/Minimatch.dll | Bin .../ps_modules/VstsTaskSdk/OutFunctions.ps1 | 0 .../VstsTaskSdk/PSGetModuleInfo.xml | 0 .../VstsTaskSdk/ServerOMFunctions.ps1 | 0 .../resources.resjson/de-de/resources.resjson | 0 .../resources.resjson/en-US/resources.resjson | 0 .../resources.resjson/es-es/resources.resjson | 0 .../resources.resjson/fr-fr/resources.resjson | 0 .../resources.resjson/it-IT/resources.resjson | 0 .../resources.resjson/ja-jp/resources.resjson | 0 .../resources.resjson/ko-KR/resources.resjson | 0 .../resources.resjson/ru-RU/resources.resjson | 0 .../resources.resjson/zh-CN/resources.resjson | 0 .../resources.resjson/zh-TW/resources.resjson | 0 .../ps_modules/VstsTaskSdk/ToolFunctions.ps1 | 0 .../ps_modules/VstsTaskSdk/TraceFunctions.ps1 | 0 .../ps_modules/VstsTaskSdk/VstsTaskSdk.dll | Bin .../ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 | Bin .../ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 | 0 .../ps_modules/VstsTaskSdk/lib.json | 0 Tasks/chocolatey/task.json | 700 +++++++++++++++++ Tasks/config/config.ps1 | 56 -- Tasks/config/icon.png | Bin 2656 -> 0 bytes .../ps_modules/VstsTaskSdk/FindFunctions.ps1 | 728 ------------------ .../ps_modules/VstsTaskSdk/InputFunctions.ps1 | 493 ------------ .../VstsTaskSdk/LegacyFindFunctions.ps1 | 320 -------- .../VstsTaskSdk/LocalizationFunctions.ps1 | 150 ---- .../VstsTaskSdk/LoggingCommandFunctions.ps1 | 601 --------------- .../VstsTaskSdk/LongPathFunctions.ps1 | 205 ----- .../ps_modules/VstsTaskSdk/Minimatch.dll | Bin 18432 -> 0 bytes .../ps_modules/VstsTaskSdk/OutFunctions.ps1 | 79 -- .../VstsTaskSdk/PSGetModuleInfo.xml | 213 ----- .../VstsTaskSdk/ServerOMFunctions.ps1 | 659 ---------------- .../resources.resjson/de-de/resources.resjson | 18 - .../resources.resjson/en-US/resources.resjson | 18 - .../resources.resjson/es-es/resources.resjson | 18 - .../resources.resjson/fr-fr/resources.resjson | 18 - .../resources.resjson/it-IT/resources.resjson | 18 - .../resources.resjson/ja-jp/resources.resjson | 18 - .../resources.resjson/ko-KR/resources.resjson | 18 - .../resources.resjson/ru-RU/resources.resjson | 18 - .../resources.resjson/zh-CN/resources.resjson | 18 - .../resources.resjson/zh-TW/resources.resjson | 18 - .../ps_modules/VstsTaskSdk/ToolFunctions.ps1 | 123 --- .../ps_modules/VstsTaskSdk/TraceFunctions.ps1 | 139 ---- .../ps_modules/VstsTaskSdk/VstsTaskSdk.dll | Bin 25408 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 | Bin 1738 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 | 168 ---- Tasks/config/ps_modules/VstsTaskSdk/lib.json | 20 - Tasks/config/task.json | 104 --- Tasks/custom/custom.ps1 | 56 -- Tasks/custom/icon.png | Bin 2656 -> 0 bytes .../ps_modules/VstsTaskSdk/FindFunctions.ps1 | 728 ------------------ .../ps_modules/VstsTaskSdk/InputFunctions.ps1 | 493 ------------ .../VstsTaskSdk/LegacyFindFunctions.ps1 | 320 -------- .../VstsTaskSdk/LocalizationFunctions.ps1 | 150 ---- .../VstsTaskSdk/LoggingCommandFunctions.ps1 | 601 --------------- .../VstsTaskSdk/LongPathFunctions.ps1 | 205 ----- .../ps_modules/VstsTaskSdk/Minimatch.dll | Bin 18432 -> 0 bytes .../ps_modules/VstsTaskSdk/OutFunctions.ps1 | 79 -- .../VstsTaskSdk/PSGetModuleInfo.xml | 213 ----- .../VstsTaskSdk/ServerOMFunctions.ps1 | 659 ---------------- .../resources.resjson/de-de/resources.resjson | 18 - .../resources.resjson/en-US/resources.resjson | 18 - .../resources.resjson/es-es/resources.resjson | 18 - .../resources.resjson/fr-fr/resources.resjson | 18 - .../resources.resjson/it-IT/resources.resjson | 18 - .../resources.resjson/ja-jp/resources.resjson | 18 - .../resources.resjson/ko-KR/resources.resjson | 18 - .../resources.resjson/ru-RU/resources.resjson | 18 - .../resources.resjson/zh-CN/resources.resjson | 18 - .../resources.resjson/zh-TW/resources.resjson | 18 - .../ps_modules/VstsTaskSdk/ToolFunctions.ps1 | 123 --- .../ps_modules/VstsTaskSdk/TraceFunctions.ps1 | 139 ---- .../ps_modules/VstsTaskSdk/VstsTaskSdk.dll | Bin 25408 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 | Bin 1738 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 | 168 ---- Tasks/custom/ps_modules/VstsTaskSdk/lib.json | 20 - Tasks/custom/task.json | 80 -- Tasks/feature/feature.ps1 | 51 -- Tasks/feature/icon.png | Bin 2656 -> 0 bytes .../ps_modules/VstsTaskSdk/FindFunctions.ps1 | 728 ------------------ .../ps_modules/VstsTaskSdk/InputFunctions.ps1 | 493 ------------ .../VstsTaskSdk/LegacyFindFunctions.ps1 | 320 -------- .../VstsTaskSdk/LocalizationFunctions.ps1 | 150 ---- .../VstsTaskSdk/LoggingCommandFunctions.ps1 | 601 --------------- .../VstsTaskSdk/LongPathFunctions.ps1 | 205 ----- .../ps_modules/VstsTaskSdk/Minimatch.dll | Bin 18432 -> 0 bytes .../ps_modules/VstsTaskSdk/OutFunctions.ps1 | 79 -- .../VstsTaskSdk/PSGetModuleInfo.xml | 213 ----- .../VstsTaskSdk/ServerOMFunctions.ps1 | 659 ---------------- .../resources.resjson/de-de/resources.resjson | 18 - .../resources.resjson/en-US/resources.resjson | 18 - .../resources.resjson/es-es/resources.resjson | 18 - .../resources.resjson/fr-fr/resources.resjson | 18 - .../resources.resjson/it-IT/resources.resjson | 18 - .../resources.resjson/ja-jp/resources.resjson | 18 - .../resources.resjson/ko-KR/resources.resjson | 18 - .../resources.resjson/ru-RU/resources.resjson | 18 - .../resources.resjson/zh-CN/resources.resjson | 18 - .../resources.resjson/zh-TW/resources.resjson | 18 - .../ps_modules/VstsTaskSdk/ToolFunctions.ps1 | 123 --- .../ps_modules/VstsTaskSdk/TraceFunctions.ps1 | 139 ---- .../ps_modules/VstsTaskSdk/VstsTaskSdk.dll | Bin 25408 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 | Bin 1738 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 | 168 ---- Tasks/feature/ps_modules/VstsTaskSdk/lib.json | 20 - Tasks/feature/task.json | 108 --- Tasks/install/icon.png | Bin 2656 -> 0 bytes Tasks/install/install.ps1 | 113 --- .../ps_modules/VstsTaskSdk/FindFunctions.ps1 | 728 ------------------ .../ps_modules/VstsTaskSdk/InputFunctions.ps1 | 493 ------------ .../VstsTaskSdk/LegacyFindFunctions.ps1 | 320 -------- .../VstsTaskSdk/LocalizationFunctions.ps1 | 150 ---- .../VstsTaskSdk/LoggingCommandFunctions.ps1 | 601 --------------- .../VstsTaskSdk/LongPathFunctions.ps1 | 205 ----- .../ps_modules/VstsTaskSdk/Minimatch.dll | Bin 18432 -> 0 bytes .../ps_modules/VstsTaskSdk/OutFunctions.ps1 | 79 -- .../VstsTaskSdk/PSGetModuleInfo.xml | 213 ----- .../VstsTaskSdk/ServerOMFunctions.ps1 | 659 ---------------- .../resources.resjson/de-de/resources.resjson | 18 - .../resources.resjson/en-US/resources.resjson | 18 - .../resources.resjson/es-es/resources.resjson | 18 - .../resources.resjson/fr-fr/resources.resjson | 18 - .../resources.resjson/it-IT/resources.resjson | 18 - .../resources.resjson/ja-jp/resources.resjson | 18 - .../resources.resjson/ko-KR/resources.resjson | 18 - .../resources.resjson/ru-RU/resources.resjson | 18 - .../resources.resjson/zh-CN/resources.resjson | 18 - .../resources.resjson/zh-TW/resources.resjson | 18 - .../ps_modules/VstsTaskSdk/ToolFunctions.ps1 | 123 --- .../ps_modules/VstsTaskSdk/TraceFunctions.ps1 | 139 ---- .../ps_modules/VstsTaskSdk/VstsTaskSdk.dll | Bin 25408 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 | Bin 1738 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 | 168 ---- Tasks/install/ps_modules/VstsTaskSdk/lib.json | 20 - Tasks/install/task.json | 150 ---- Tasks/pack/icon.png | Bin 2656 -> 0 bytes Tasks/pack/pack.ps1 | 124 --- .../ps_modules/VstsTaskSdk/FindFunctions.ps1 | 728 ------------------ .../ps_modules/VstsTaskSdk/InputFunctions.ps1 | 493 ------------ .../VstsTaskSdk/LegacyFindFunctions.ps1 | 320 -------- .../VstsTaskSdk/LocalizationFunctions.ps1 | 150 ---- .../VstsTaskSdk/LoggingCommandFunctions.ps1 | 601 --------------- .../VstsTaskSdk/LongPathFunctions.ps1 | 205 ----- .../pack/ps_modules/VstsTaskSdk/Minimatch.dll | Bin 18432 -> 0 bytes .../ps_modules/VstsTaskSdk/OutFunctions.ps1 | 79 -- .../VstsTaskSdk/PSGetModuleInfo.xml | 213 ----- .../VstsTaskSdk/ServerOMFunctions.ps1 | 659 ---------------- .../resources.resjson/de-de/resources.resjson | 18 - .../resources.resjson/en-US/resources.resjson | 18 - .../resources.resjson/es-es/resources.resjson | 18 - .../resources.resjson/fr-fr/resources.resjson | 18 - .../resources.resjson/it-IT/resources.resjson | 18 - .../resources.resjson/ja-jp/resources.resjson | 18 - .../resources.resjson/ko-KR/resources.resjson | 18 - .../resources.resjson/ru-RU/resources.resjson | 18 - .../resources.resjson/zh-CN/resources.resjson | 18 - .../resources.resjson/zh-TW/resources.resjson | 18 - .../ps_modules/VstsTaskSdk/ToolFunctions.ps1 | 123 --- .../ps_modules/VstsTaskSdk/TraceFunctions.ps1 | 139 ---- .../ps_modules/VstsTaskSdk/VstsTaskSdk.dll | Bin 25408 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 | Bin 1738 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 | 168 ---- Tasks/pack/ps_modules/VstsTaskSdk/lib.json | 20 - Tasks/pack/task.json | 162 ---- Tasks/push/icon.png | Bin 2656 -> 0 bytes .../ps_modules/VstsTaskSdk/FindFunctions.ps1 | 728 ------------------ .../ps_modules/VstsTaskSdk/InputFunctions.ps1 | 493 ------------ .../VstsTaskSdk/LegacyFindFunctions.ps1 | 320 -------- .../VstsTaskSdk/LocalizationFunctions.ps1 | 150 ---- .../VstsTaskSdk/LoggingCommandFunctions.ps1 | 601 --------------- .../VstsTaskSdk/LongPathFunctions.ps1 | 205 ----- .../push/ps_modules/VstsTaskSdk/Minimatch.dll | Bin 18432 -> 0 bytes .../ps_modules/VstsTaskSdk/OutFunctions.ps1 | 79 -- .../VstsTaskSdk/PSGetModuleInfo.xml | 213 ----- .../VstsTaskSdk/ServerOMFunctions.ps1 | 659 ---------------- .../resources.resjson/de-de/resources.resjson | 18 - .../resources.resjson/en-US/resources.resjson | 18 - .../resources.resjson/es-es/resources.resjson | 18 - .../resources.resjson/fr-fr/resources.resjson | 18 - .../resources.resjson/it-IT/resources.resjson | 18 - .../resources.resjson/ja-jp/resources.resjson | 18 - .../resources.resjson/ko-KR/resources.resjson | 18 - .../resources.resjson/ru-RU/resources.resjson | 18 - .../resources.resjson/zh-CN/resources.resjson | 18 - .../resources.resjson/zh-TW/resources.resjson | 18 - .../ps_modules/VstsTaskSdk/ToolFunctions.ps1 | 123 --- .../ps_modules/VstsTaskSdk/TraceFunctions.ps1 | 139 ---- .../ps_modules/VstsTaskSdk/VstsTaskSdk.dll | Bin 25408 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 | Bin 1738 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 | 168 ---- Tasks/push/ps_modules/VstsTaskSdk/lib.json | 20 - Tasks/push/push.ps1 | 91 --- Tasks/push/task.json | 127 --- Tasks/source/icon.png | Bin 2656 -> 0 bytes .../ps_modules/VstsTaskSdk/FindFunctions.ps1 | 728 ------------------ .../ps_modules/VstsTaskSdk/InputFunctions.ps1 | 493 ------------ .../VstsTaskSdk/LegacyFindFunctions.ps1 | 320 -------- .../VstsTaskSdk/LocalizationFunctions.ps1 | 150 ---- .../VstsTaskSdk/LoggingCommandFunctions.ps1 | 601 --------------- .../VstsTaskSdk/LongPathFunctions.ps1 | 205 ----- .../ps_modules/VstsTaskSdk/Minimatch.dll | Bin 18432 -> 0 bytes .../ps_modules/VstsTaskSdk/OutFunctions.ps1 | 79 -- .../VstsTaskSdk/PSGetModuleInfo.xml | 213 ----- .../VstsTaskSdk/ServerOMFunctions.ps1 | 659 ---------------- .../resources.resjson/de-de/resources.resjson | 18 - .../resources.resjson/en-US/resources.resjson | 18 - .../resources.resjson/es-es/resources.resjson | 18 - .../resources.resjson/fr-fr/resources.resjson | 18 - .../resources.resjson/it-IT/resources.resjson | 18 - .../resources.resjson/ja-jp/resources.resjson | 18 - .../resources.resjson/ko-KR/resources.resjson | 18 - .../resources.resjson/ru-RU/resources.resjson | 18 - .../resources.resjson/zh-CN/resources.resjson | 18 - .../resources.resjson/zh-TW/resources.resjson | 18 - .../ps_modules/VstsTaskSdk/ToolFunctions.ps1 | 123 --- .../ps_modules/VstsTaskSdk/TraceFunctions.ps1 | 139 ---- .../ps_modules/VstsTaskSdk/VstsTaskSdk.dll | Bin 25408 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 | Bin 1738 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 | 168 ---- Tasks/source/ps_modules/VstsTaskSdk/lib.json | 20 - Tasks/source/source.ps1 | 108 --- Tasks/source/task.json | 153 ---- Tasks/upgrade/icon.png | Bin 2656 -> 0 bytes .../ps_modules/VstsTaskSdk/FindFunctions.ps1 | 728 ------------------ .../ps_modules/VstsTaskSdk/InputFunctions.ps1 | 493 ------------ .../VstsTaskSdk/LegacyFindFunctions.ps1 | 320 -------- .../VstsTaskSdk/LocalizationFunctions.ps1 | 150 ---- .../VstsTaskSdk/LoggingCommandFunctions.ps1 | 601 --------------- .../VstsTaskSdk/LongPathFunctions.ps1 | 205 ----- .../ps_modules/VstsTaskSdk/Minimatch.dll | Bin 18432 -> 0 bytes .../ps_modules/VstsTaskSdk/OutFunctions.ps1 | 79 -- .../VstsTaskSdk/PSGetModuleInfo.xml | 213 ----- .../VstsTaskSdk/ServerOMFunctions.ps1 | 659 ---------------- .../resources.resjson/de-de/resources.resjson | 18 - .../resources.resjson/en-US/resources.resjson | 18 - .../resources.resjson/es-es/resources.resjson | 18 - .../resources.resjson/fr-fr/resources.resjson | 18 - .../resources.resjson/it-IT/resources.resjson | 18 - .../resources.resjson/ja-jp/resources.resjson | 18 - .../resources.resjson/ko-KR/resources.resjson | 18 - .../resources.resjson/ru-RU/resources.resjson | 18 - .../resources.resjson/zh-CN/resources.resjson | 18 - .../resources.resjson/zh-TW/resources.resjson | 18 - .../ps_modules/VstsTaskSdk/ToolFunctions.ps1 | 123 --- .../ps_modules/VstsTaskSdk/TraceFunctions.ps1 | 139 ---- .../ps_modules/VstsTaskSdk/VstsTaskSdk.dll | Bin 25408 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 | Bin 1738 -> 0 bytes .../ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 | 168 ---- Tasks/upgrade/ps_modules/VstsTaskSdk/lib.json | 20 - Tasks/upgrade/task.json | 159 ---- Tasks/upgrade/upgrade.ps1 | 119 --- build.cake | 2 +- vss-extension.json | 112 +-- 265 files changed, 1167 insertions(+), 34628 deletions(-) delete mode 100644 Tasks/apikey/apikey.ps1 delete mode 100644 Tasks/apikey/task.json create mode 100644 Tasks/chocolatey/chocolatey.ps1 rename Tasks/{apikey => chocolatey}/icon.png (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/FindFunctions.ps1 (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/InputFunctions.ps1 (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/Minimatch.dll (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/OutFunctions.ps1 (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/ToolFunctions.ps1 (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/TraceFunctions.ps1 (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/VstsTaskSdk.dll (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 (100%) rename Tasks/{apikey => chocolatey}/ps_modules/VstsTaskSdk/lib.json (100%) create mode 100644 Tasks/chocolatey/task.json delete mode 100644 Tasks/config/config.ps1 delete mode 100755 Tasks/config/icon.png delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/FindFunctions.ps1 delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/InputFunctions.ps1 delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/Minimatch.dll delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/OutFunctions.ps1 delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/ToolFunctions.ps1 delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/TraceFunctions.ps1 delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/VstsTaskSdk.dll delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 delete mode 100644 Tasks/config/ps_modules/VstsTaskSdk/lib.json delete mode 100644 Tasks/config/task.json delete mode 100644 Tasks/custom/custom.ps1 delete mode 100755 Tasks/custom/icon.png delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/FindFunctions.ps1 delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/InputFunctions.ps1 delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/Minimatch.dll delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/OutFunctions.ps1 delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/ToolFunctions.ps1 delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/TraceFunctions.ps1 delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/VstsTaskSdk.dll delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 delete mode 100644 Tasks/custom/ps_modules/VstsTaskSdk/lib.json delete mode 100644 Tasks/custom/task.json delete mode 100644 Tasks/feature/feature.ps1 delete mode 100755 Tasks/feature/icon.png delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/FindFunctions.ps1 delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/InputFunctions.ps1 delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/Minimatch.dll delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/OutFunctions.ps1 delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/ToolFunctions.ps1 delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/TraceFunctions.ps1 delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/VstsTaskSdk.dll delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 delete mode 100644 Tasks/feature/ps_modules/VstsTaskSdk/lib.json delete mode 100644 Tasks/feature/task.json delete mode 100755 Tasks/install/icon.png delete mode 100644 Tasks/install/install.ps1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/FindFunctions.ps1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/InputFunctions.ps1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/Minimatch.dll delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/OutFunctions.ps1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/ToolFunctions.ps1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/TraceFunctions.ps1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/VstsTaskSdk.dll delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 delete mode 100644 Tasks/install/ps_modules/VstsTaskSdk/lib.json delete mode 100644 Tasks/install/task.json delete mode 100755 Tasks/pack/icon.png delete mode 100644 Tasks/pack/pack.ps1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/FindFunctions.ps1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/InputFunctions.ps1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/Minimatch.dll delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/OutFunctions.ps1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/ToolFunctions.ps1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/TraceFunctions.ps1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/VstsTaskSdk.dll delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 delete mode 100644 Tasks/pack/ps_modules/VstsTaskSdk/lib.json delete mode 100644 Tasks/pack/task.json delete mode 100755 Tasks/push/icon.png delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/FindFunctions.ps1 delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/InputFunctions.ps1 delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/Minimatch.dll delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/OutFunctions.ps1 delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/ToolFunctions.ps1 delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/TraceFunctions.ps1 delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/VstsTaskSdk.dll delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 delete mode 100644 Tasks/push/ps_modules/VstsTaskSdk/lib.json delete mode 100644 Tasks/push/push.ps1 delete mode 100644 Tasks/push/task.json delete mode 100755 Tasks/source/icon.png delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/FindFunctions.ps1 delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/InputFunctions.ps1 delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/Minimatch.dll delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/OutFunctions.ps1 delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/ToolFunctions.ps1 delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/TraceFunctions.ps1 delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/VstsTaskSdk.dll delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 delete mode 100644 Tasks/source/ps_modules/VstsTaskSdk/lib.json delete mode 100644 Tasks/source/source.ps1 delete mode 100644 Tasks/source/task.json delete mode 100755 Tasks/upgrade/icon.png delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/FindFunctions.ps1 delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/InputFunctions.ps1 delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/Minimatch.dll delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/OutFunctions.ps1 delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/ToolFunctions.ps1 delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/TraceFunctions.ps1 delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/VstsTaskSdk.dll delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 delete mode 100644 Tasks/upgrade/ps_modules/VstsTaskSdk/lib.json delete mode 100644 Tasks/upgrade/task.json delete mode 100644 Tasks/upgrade/upgrade.ps1 diff --git a/Tasks/apikey/apikey.ps1 b/Tasks/apikey/apikey.ps1 deleted file mode 100644 index 3d9c3e5..0000000 --- a/Tasks/apikey/apikey.ps1 +++ /dev/null @@ -1,54 +0,0 @@ -[CmdletBinding()] -param() - -Trace-VstsEnteringInvocation $MyInvocation - -try { - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "Machine") - if(-not (Test-Path $chocoInstallLocation)) { - Write-Output "Environment variable 'ChocolateyInstall' was not found in the system variables. Attempting to find it in the user variables..." - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "User") - } - - $chocoExe = "$chocoInstallLocation\choco.exe" - - if (-not (Test-Path $chocoExe)) { - throw "Chocolatey was not found." - } - - [string]$source = Get-VstsInput -Name 'source' -Require - [string]$apikey = Get-VstsInput -Name 'apikey' -Require - [bool]$debug = Get-VstsInput -Name 'debug' -AsBool -Default $false - [bool]$verbose = Get-VstsInput -Name 'verbose' -AsBool -Default $false - [bool]$trace = Get-VstsInput -Name 'trace' -AsBool -Default $false - - $chocolateyVersion = & $chocoExe --version - Write-Output "Running Chocolatey Version: $chocolateyVersion" - - $chocolateyArguments = @() - - $chocolateyArguments += @("--source", $source) - $chocolateyArguments += @("--api-key", $apikey) - - if($debug) { - Write-Output "Adding --debug to arguments" - $chocolateyArguments += @("--debug", "") - } - - if($verbose) { - Write-Output "Adding --verbose to arguments" - $chocolateyArguments += @("--verbose", "") - } - - if($trace) { - Write-Output "Adding --trace to arguments" - $chocolateyArguments += @("--trace", "") - } - - & $chocoExe apikey $($chocolateyArguments) -} catch { - Write-VstsTaskError $_.Exception.Message - throw -} finally { - Trace-VstsLeavingInvocation $MyInvocation -} diff --git a/Tasks/apikey/task.json b/Tasks/apikey/task.json deleted file mode 100644 index 00e3dc9..0000000 --- a/Tasks/apikey/task.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "id": "7c5f5405-6950-441b-86f0-8720d732ca94", - "name": "choco-apikey", - "friendlyName": "Chocolatey - ApiKey", - "description": "Runs Chocolatey ApiKey with specified parameters", - "author": "gep13", - "helpMarkDown": "", - "category": "Build", - "visibility": [ - "Build", - "Release" - ], - "demands": [], - "version": { - "Major": "0", - "Minor": "1", - "Patch": "0" - }, - "minimumAgentVersion": "1.83.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced options", - "isExpanded": false - } - ], - "instanceNameFormat": "Chocolatey ApiKey", - "inputs": [ - { - "name": "source", - "type": "string", - "label": "Source", - "defaultValue": "", - "required": true, - "helpMarkDown": "The source that is associated with the ApiKey." - }, - { - "name": "apikey", - "type": "string", - "label": "ApiKey", - "defaultValue": "", - "required": true, - "helpMarkDown": "The ApiKey that should be used when pushing to the source." - }, - { - "name": "debug", - "type": "boolean", - "label": "Show debug messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "", - "groupname": "advanced" - }, - { - "name": "verbose", - "type": "boolean", - "label": "Show verbose messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very verbose messaging, avoid using under normal circumstances.", - "groupname": "advanced" - }, - { - "name": "trace", - "type": "boolean", - "label": "Show trace messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very, very verbose trace messaging. Avoid except when needing super low-level .NET Framework debugging.", - "groupname": "advanced" - } - ], - "execution": { - "PowerShell3": { - "target": "$(currentDirectory)\\apikey.ps1", - "argumentFormat": "", - "workingDirectory": "$(currentDirectory)" - } - } -} diff --git a/Tasks/chocolatey/chocolatey.ps1 b/Tasks/chocolatey/chocolatey.ps1 new file mode 100644 index 0000000..8f67993 --- /dev/null +++ b/Tasks/chocolatey/chocolatey.ps1 @@ -0,0 +1,462 @@ +[CmdletBinding()] +param() + +Trace-VstsEnteringInvocation $MyInvocation + +try { + $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "Machine") + if(-not (Test-Path $chocoInstallLocation)) { + Write-Output "Environment variable 'ChocolateyInstall' was not found in the system variables. Attempting to find it in the user variables..." + $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "User") + } + + $chocoExe = "$chocoInstallLocation\choco.exe" + + if (-not (Test-Path $chocoExe)) { + throw "Chocolatey was not found." + } + + $chocolateyVersion = & $chocoExe --version + Write-Output "Running Chocolatey Version: $chocolateyVersion" + + $chocolateyArguments = New-Object System.Collections.ArrayList + + [bool]$debug = Get-VstsInput -Name 'debug' -AsBool -Default $false + [bool]$verbose = Get-VstsInput -Name 'verbose' -AsBool -Default $false + [bool]$trace = Get-VstsInput -Name 'trace' -AsBool -Default $false + [string]$extraArguments = Get-VstsInput -Name 'extraArguments' + [string]$commandName = "" + + if($debug) { + Write-Output "Adding --debug to arguments" + $chocolateyArguments.Add("--debug") > $null + } + + if($verbose) { + Write-Output "Adding --verbose to arguments" + $chocolateyArguments.Add("--verbose") > $null + } + + if($trace) { + Write-Output "Adding --trace to arguments" + $chocolateyArguments.Add("--trace") > $null + } + + [string]$command = Get-VstsInput -Name 'command' -Require + + switch ( $command ) + { + "apikey" + { + [string]$apiKeysource = Get-VstsInput -Name 'apikeySource' -Require + [string]$apikeyApikey = Get-VstsInput -Name 'apikeyApikey' -Require + $commandName = "apikey" + + $chocolateyArguments.Add("--source") > $null + $chocolateyArguments.Add($apikeySource) > $null + $chocolateyArguments.Add("--api-key") > $null + $chocolateyArguments.Add($apikeyApikey) > $null + } + "config" + { + [string]$configOperation = Get-VstsInput -Name 'configOperation' -Require + [string]$configName = Get-VstsInput -Name 'configName' -Require + + $chocolateyArguments.Add("--name") > $null + $chocolateyArguments.Add($configName) > $null + + $commandName = "config" + + if($configOperation -eq "set") { + [string]$configValue = Get-VstsInput -Name 'configValue' -Require + + $chocolateyArguments.Add("--value") > $null + $chocolateyArguments.Add($configValue) > $null + $chocolateyArguments.Insert(0, "set") > $null + } else { + $chocolateyArguments.Insert(0, "unset") > $null + } + } + "custom" + { + [string]$customCommand = Get-VstsInput -Name 'customCommand' -Require + [string]$customArguments = Get-VstsInput -Name 'customArguments' + + if($customArguments) { + Write-Output "Adding custom arguments" + $chocolateyArguments.Add($customArguments) > $null + } + + $commandName = $customCommand + } + "feature" + { + [string]$featureOperation = Get-VstsInput -Name 'featureOperation' -Require + [string]$featureName = Get-VstsInput -Name 'featureName' -Require + + $commandName = "feature" + $chocolateyArguments.Add("--name") > $null + $chocolateyArguments.Add($featureName) > $null + $chocolateyArguments.Insert(0, $featureOperation) > $null + + } + "install" + { + [string]$installPackageId = Get-VstsInput -Name 'installPackageId' -Require + [string]$installPackageVersion = Get-VstsInput -Name 'installPackageVersion' + [bool]$installPre = Get-VstsInput -Name 'installPre' -AsBool -Default $false + [string]$installSource = Get-VstsInput -Name 'installSource' + [bool]$installForce = Get-VstsInput -Name 'installForce' -AsBool -Default $false + [bool]$installX86 = Get-VstsInput -Name 'installX86' -AsBool -Default $false + [string]$installInstallArgs = Get-VstsInput -Name 'installInstallargs' + [bool]$installOverride = Get-VstsInput -Name 'installOverride' -AsBool -Default $false + [string]$installParams = Get-VstsInput -Name 'installParams' + + if([System.Version]::Parse($chocolateyVersion) -ge [System.Version]::Parse("0.9.8.33")) { + Write-Output "Adding -y to arguments" + $chocolateyArguments.Add("-y") > $null + } + + if([System.Version]::Parse($chocolateyVersion) -ge [System.Version]::Parse("0.10.4")) { + Write-Output "Adding --no-progress to arguments" + $chocolateyArguments.Add("--no-progress") > $null + } + + if($installPackageVersion) { + Write-Output "Adding --version to arguments" + $chocolateyArguments.Add("--version") > $null + $chocolateyArguments.Add($installPackageVersion) > $null + } + + if($installPre) { + Write-Output "Adding --pre to arguments" + $chocolateyArguments.Add("--pre") > $null + } + + if($installSource) { + Write-Output "Adding --source to arguments" + $chocolateyArguments.Add("--version") > $null + $chocolateyArguments.Add($installSource) > $null + } + + if($installForce) { + Write-Output "Adding --force to arguments" + $chocolateyArguments.Add("--force") > $null + } + + if($installX86) { + Write-Output "Adding --x86 to arguments" + $chocolateyArguments.Add("--x86") > $null + } + + if($installInstallArgs) { + Write-Output "Adding --install-arguments to arguments" + $chocolateyArguments.Add("--install-arguments") > $null + $chocolateyArguments.Add($installInstallArgs) > $null + } + + if($installOverride) { + Write-Output "Adding --override-arguments to arguments" + $chocolateyArguments.Add("--override-arguments") > $null + } + + if($installParams) { + Write-Output "Adding --package-parameters to arguments" + $chocolateyArguments.Add("--package-parameters") > $null + $chocolateyArguments.Add($installParams) > $null + } + + $chocolateyArguments.Insert(0, $installPackageId) > $null + $commandName = "install" + } + "pack" + { + [string]$packOperation = Get-VstsInput -Name 'packOperation' -Require + [string]$packWorkingDirectory = Get-VstsInput -Name 'packWorkingDirectory' -Require + [string]$packVersion = Get-VstsInput -Name 'packVersion' + [string]$packOutputDirectory = Get-VstsInput -Name 'packOutputDirectory' + [bool]$pushPackages = Get-VstsInput -Name 'pushPackages' -AsBool + + if($packVersion) { + Write-Output "Adding --version to arguments" + $chocolateyArguments.Add("--version") > $null + $chocolateyArguments.Add($packVersion) > $null + } + + if($packOutputDirectory) { + Write-Output "Adding --output-directory to arguments" + $chocolateyArguments.Add("--output-directory") > $null + $chocolateyArguments.Add($packOutputDirectory) > $null + } + + if($pushPackages) { + [string]$packSource = Get-VstsInput -Name 'packSource' -Default 'https://push.chocolatey.org/' + [string]$packApikey = Get-VstsInput -Name 'packApikey' + [bool]$packForce = Get-VstsInput -Name 'packForce' -AsBool -Default $false + [string]$packTimeout = Get-VstsInput -Name 'packTimeout' + + if($packSource) { + Write-Output "Adding --source to arguments" + $chocolateyArguments.Add("--source") > $null + $chocolateyArguments.Add($packSource) > $null + } + + if($packApikey) { + Write-Output "Adding --apikey to arguments" + $chocolateyArguments.Add("--apikey") > $null + $chocolateyArguments.Add($packApikey) > $null + } + + if($packForce) { + Write-Output "Adding --force to arguments" + $chocolateyArguments.Add("--force") > $null + } + + if($packTimeout) { + Write-Output "Adding -t to arguments" + $chocolateyArguments.Add("-t") > $null + $chocolateyArguments.Add($packTimeout) > $null + } + + $commandName = "pack" + } + } + "push" + { + [string]$pushOperation = Get-VstsInput -Name 'pushOperation' -Require + [string]$pushWorkingDirectory = Get-VstsInput -Name 'pushWorkingDirectory' -Require + [string]$pushSource = Get-VstsInput -Name 'pushSource' -Default 'https://push.chocolatey.org/' + [string]$pushApikey = Get-VstsInput -Name 'pushApikey' + [bool]$pushForce = Get-VstsInput -Name 'pushForce' -AsBool -Default $false + [string]$pushTimeout = Get-VstsInput -Name 'pushTimeout' + + if($pushSource) { + Write-Output "Adding --source to arguments" + $chocolateyArguments.Add("--source") > $null + $chocolateyArguments.Add($pushSource) > $null + } + + if($pushApikey) { + Write-Output "Adding --apikey to arguments" + $chocolateyArguments.Add("--apikey") > $null + $chocolateyArguments.Add($pushApikey) > $null + } + + if($pushForce) { + Write-Output "Adding --force to arguments" + $chocolateyArguments.Add("--force") > $null + } + + if($pushTimeout) { + Write-Output "Adding -t to arguments" + $chocolateyArguments.Add("-t") > $null + $chocolateyArguments.Add($pushTimeout) > $null + } + + $commandName = "push" + } + "source" + { + [string]$sourceOperation = Get-VstsInput -Name 'sourceOperation' -Require + [string]$sourceSourceName = Get-VstsInput -Name 'sourceSourceName' -Require + [string]$sourcePriority = Get-VstsInput -Name 'sourcePriority' + [string]$user = Get-VstsInput -Name 'user' + [string]$password = Get-VstsInput -Name 'password' + [string]$cert = Get-VstsInput -Name 'cert' + [string]$certPassword = Get-VstsInput -Name 'certPassword' + [bool]$byPassProxy = Get-VstsInput -Name 'byPassProxy' -AsBool -Default $false + + $chocolateyArguments.Add("--name") > $null + $chocolateyArguments.Add($sourceSourceName) > $null + + if($sourcePriority) { + Write-Output "Adding --priority to arguments" + $chocolateyArguments.Add("--priority") > $null + $chocolateyArguments.Add($sourcePriority) > $null + } + + if($user) { + Write-Output "Adding --user to arguments" + $chocolateyArguments.Add("--user") > $null + $chocolateyArguments.Add($user) > $null + } + + if($password) { + Write-Output "Adding --password to arguments" + $chocolateyArguments.Add("--password") > $null + $chocolateyArguments.Add($password) > $null + } + + if($cert) { + Write-Output "Adding --cert to arguments" + $chocolateyArguments.Add("--cert") > $null + $chocolateyArguments.Add($cert) > $null + } + + if($certPassword) { + Write-Output "Adding --certpassword to arguments" + $chocolateyArguments.Add("--certpassword") > $null + $chocolateyArguments.Add($certPassword) > $null + } + + if($byPassProxy) { + Write-Output "Adding --bypass-proxy to arguments" + $chocolateyArguments.Add("--bypass-proxy") > $null + } + + $commandName = "source" + + switch ( $sourceOperation ) + { + "add" + { + [string]$sourceSource = Get-VstsInput -Name 'sourceSource' -Require + $chocolateyArguments.Add("--source") > $null + $chocolateyArguments.Add($sourceSource) > $null + + $chocolateyArguments.Insert(0, "add") > $null + } + "remove" + { + $chocolateyArguments.Insert(0, "remove") > $null + } + "enable" + { + $chocolateyArguments.Insert(0, "enable") > $null + } + "disable" + { + $chocolateyArguments.Insert(0, "disable") > $null + } + } + } + "upgrade" + { + [string]$upgradePackageId = Get-VstsInput -Name 'upgradePackageId' -Require + [string]$upgradePackageVersion = Get-VstsInput -Name 'upgradePackageVersion' + [bool]$upgradePre = Get-VstsInput -Name 'upgradePre' -AsBool -Default $false + [string]$upgradeSource = Get-VstsInput -Name 'upgradeSource' + [string]$except = Get-VstsInput -Name 'except' + [bool]$upgradeForce = Get-VstsInput -Name 'upgradeForce' -AsBool -Default $false + [bool]$upgradeX86 = Get-VstsInput -Name 'upgradeX86' -AsBool -Default $false + [string]$upgradeInstallArgs = Get-VstsInput -Name 'upgradeInstallArgs' + [bool]$upgradeOverride = Get-VstsInput -Name 'upgradeOverride' -AsBool -Default $false + [string]$upgradeParams = Get-VstsInput -Name 'upgradeParams' + + if([System.Version]::Parse($chocolateyVersion) -ge [System.Version]::Parse("0.9.8.33")) { + Write-Output "Adding -y to arguments" + $chocolateyArguments.Add("-y") > $null + } + + if([System.Version]::Parse($chocolateyVersion) -ge [System.Version]::Parse("0.10.4")) { + Write-Output "Adding --no-progress to arguments" + $chocolateyArguments.Add("--no-progress") > $null + } + + if($upgradePackageVersion) { + Write-Output "Adding --version to arguments" + $chocolateyArguments.Add("--version") > $null + $chocolateyArguments.Add($upgradePackageVersion) > $null + } + + if($upgradePre) { + Write-Output "Adding --pre to arguments" + $chocolateyArguments.Add("--pre") > $null + } + + if($upgradeSource) { + Write-Output "Adding --source to arguments" + $chocolateyArguments.Add("--version") > $null + $chocolateyArguments.Add($upgradeSource) > $null + } + + if($except) { + Write-Output "Adding --except to arguments" + $chocolateyArguments.Add("--except") > $null + $chocolateyArguments.Add($except) > $null + } + + if($upgradeForce) { + Write-Output "Adding --force to arguments" + $chocolateyArguments.Add("--force") > $null + } + + if($upgradeX86) { + Write-Output "Adding --x86 to arguments" + $chocolateyArguments.Add("--x86") > $null + } + + if($upgradeInstallArgs) { + Write-Output "Adding --install-arguments to arguments" + $chocolateyArguments.Add("--install-arguments") > $null + $chocolateyArguments.Add($upgradeInstallArgs) > $null + } + + if($upgradeOverride) { + Write-Output "Adding --override-arguments to arguments" + $chocolateyArguments.Add("--override-arguments") > $null + } + + if($upgradeParams) { + Write-Output "Adding --package-parameters to arguments" + $chocolateyArguments.Add("--package-parameters") > $null + $chocolateyArguments.Add($upgradeParams) > $null + } + + $chocolateyArguments.Insert(0, $upgradePackageId) > $null + $commandName = "upgrade" + } + } + + if($extraArguments) { + Write-Output "Adding extra arguments" + $chocolateyArguments.Add($extraArguments) + } + + # Execute Chocolatey + if($commandName -eq 'pack') { + Set-Location $packWorkingDirectory + + Remove-Item "\*.nupkg" + + if($packOperation -eq "single") { + [string]$packNuspecFileName = Get-VstsInput -Name 'packNuspecFileName' -Require + & $chocoExe $commandName $packNuspecFileName $($chocolateyArguments) + } else { + $nuspecFiles = Get-ChildItem "*.nuspec" + foreach($nuspecFile in $nuspecFiles) { + & $chocoExe $commandName $nuspecFile $($chocolateyArguments) + } + } + + if($pushPackages) { + if($outputDirectory){ + Set-Location $outputDirectory + } + + $nupkgFiles = Get-ChildItem "*.nupkg" + foreach($nupkgFile in $nupkgFiles) { + & $chocoExe push $nupkgFile $($chocolateyArguments) + } + } + } elseif($commandName -eq 'push') { + Set-Location $pushWorkingDirectory + + if($pushOperation -eq "single") { + [string]$pushNupkgFileName = Get-VstsInput -Name 'pushNupkgFileName' -Require + & $chocoExe $commandName $pushNupkgFileName $($chocolateyArguments) + } else { + $nupkgFiles = Get-ChildItem "*.nupkg" + foreach($nupkgFile in $nupkgFiles) { + & $chocoExe $commandName $nupkgFile $($chocolateyArguments) + } + } + } else { + & $chocoExe $commandName $($chocolateyArguments) + } +} catch { + Write-VstsTaskError $_.Exception.Message + throw +} finally { + Trace-VstsLeavingInvocation $MyInvocation +} diff --git a/Tasks/apikey/icon.png b/Tasks/chocolatey/icon.png similarity index 100% rename from Tasks/apikey/icon.png rename to Tasks/chocolatey/icon.png diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/FindFunctions.ps1 b/Tasks/chocolatey/ps_modules/VstsTaskSdk/FindFunctions.ps1 similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/FindFunctions.ps1 rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/FindFunctions.ps1 diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/InputFunctions.ps1 b/Tasks/chocolatey/ps_modules/VstsTaskSdk/InputFunctions.ps1 similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/InputFunctions.ps1 rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/InputFunctions.ps1 diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 b/Tasks/chocolatey/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 b/Tasks/chocolatey/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 b/Tasks/chocolatey/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 b/Tasks/chocolatey/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/Minimatch.dll b/Tasks/chocolatey/ps_modules/VstsTaskSdk/Minimatch.dll similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/Minimatch.dll rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/Minimatch.dll diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/OutFunctions.ps1 b/Tasks/chocolatey/ps_modules/VstsTaskSdk/OutFunctions.ps1 similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/OutFunctions.ps1 rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/OutFunctions.ps1 diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml b/Tasks/chocolatey/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 b/Tasks/chocolatey/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson b/Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson b/Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson b/Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson b/Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson b/Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson b/Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson b/Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson b/Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson b/Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson b/Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/ToolFunctions.ps1 b/Tasks/chocolatey/ps_modules/VstsTaskSdk/ToolFunctions.ps1 similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/ToolFunctions.ps1 rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/ToolFunctions.ps1 diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/TraceFunctions.ps1 b/Tasks/chocolatey/ps_modules/VstsTaskSdk/TraceFunctions.ps1 similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/TraceFunctions.ps1 rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/TraceFunctions.ps1 diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/VstsTaskSdk.dll b/Tasks/chocolatey/ps_modules/VstsTaskSdk/VstsTaskSdk.dll similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/VstsTaskSdk.dll rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/VstsTaskSdk.dll diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 b/Tasks/chocolatey/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/VstsTaskSdk.psd1 diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 b/Tasks/chocolatey/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 diff --git a/Tasks/apikey/ps_modules/VstsTaskSdk/lib.json b/Tasks/chocolatey/ps_modules/VstsTaskSdk/lib.json similarity index 100% rename from Tasks/apikey/ps_modules/VstsTaskSdk/lib.json rename to Tasks/chocolatey/ps_modules/VstsTaskSdk/lib.json diff --git a/Tasks/chocolatey/task.json b/Tasks/chocolatey/task.json new file mode 100644 index 0000000..09a0fb0 --- /dev/null +++ b/Tasks/chocolatey/task.json @@ -0,0 +1,700 @@ +{ + "id": "7360ca82-d88f-4188-be8f-88d60ca03f4f", + "name": "ChocolateyCommand", + "friendlyName": "Chocolatey", + "description": "Run various Chocolatey commands, including pack, push, install, upgrade, etc.", + "author": "gep13", + "helpMarkDown": "[More Information](https://gep13.co.uk/chocolatey-azuredevops", + "category": "Build", + "visibility": [ + "Build", + "Release" + ], + "demands": [], + "version": { + "Major": "0", + "Minor": "1", + "Patch": "0" + }, + "minimumAgentVersion": "1.83.0", + "groups": [ + { + "name": "apikeyOptions", + "displayName": "Options for API Key Command", + "isExpanded": true, + "visibleRule": "command = apikey" + }, + { + "name": "configOptions", + "displayName": "Options for Config Command", + "isExpanded": true, + "visibleRule": "command = config" + }, + { + "name": "customOptions", + "displayName": "Options for Custom Command", + "isExpanded": true, + "visibleRule": "command = custom" + }, + { + "name": "featureOptions", + "displayName": "Options for Feature Command", + "isExpanded": true, + "visibleRule": "command = feature" + }, + { + "name": "installOptions", + "displayName": "Options for Install Command", + "isExpanded": true, + "visibleRule": "command = install" + }, + { + "name": "packOptions", + "displayName": "Options for Pack Command", + "isExpanded": true, + "visibleRule": "command = pack" + }, + { + "name": "pushOptions", + "displayName": "Options for Push Command", + "isExpanded": true, + "visibleRule": "command = push" + }, + { + "name": "sourceOptions", + "displayName": "Options for Source Command", + "isExpanded": true, + "visibleRule": "command = source" + }, + { + "name": "upgradeOptions", + "displayName": "Options for Upgrade Command", + "isExpanded": true, + "visibleRule": "command = upgrade" + }, + { + "name": "advancedOptions", + "displayName": "Advanced Options", + "isExpanded": false + } + ], + "instanceNameFormat": "Chocolatey $(command)", + "inputs": [ + { + "name": "command", + "type": "pickList", + "label": "Command", + "defaultValue": "pack", + "helpMarkDown": "The Chocolatey command to run. Select 'Custom' to use a different command.", + "required": "true", + "properties": { + "EditableOptions": "False" + }, + "options": { + "apikey": "apikey", + "config": "config", + "custom": "custom", + "feature": "feature", + "install": "install", + "pack": "pack", + "push": "push", + "source": "source", + "upgrade": "upgrade" + } + }, + { + "name": "extraArguments", + "type": "string", + "label": "Extra Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Additional Chocolatey Arguments that are not catered for above.", + "groupName": "advancedOptions" + }, + { + "name": "debug", + "type": "boolean", + "label": "Show debug messaging.", + "defaultValue": "false", + "required": false, + "helpMarkDown": "", + "groupName": "advancedOptions" + }, + { + "name": "verbose", + "type": "boolean", + "label": "Show verbose messaging.", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Very verbose messaging, avoid using under normal circumstances.", + "groupName": "advancedOptions" + }, + { + "name": "trace", + "type": "boolean", + "label": "Show trace messaging.", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Very, very verbose trace messaging. Avoid except when needing super low-level .NET Framework debugging.", + "groupName": "advancedOptions" + }, + { + "name": "apikeySource", + "type": "string", + "label": "Source", + "defaultValue": "", + "required": true, + "helpMarkDown": "The source that is associated with the ApiKey.", + "groupName": "apikeyOptions" + }, + { + "name": "apikeyApikey", + "type": "string", + "label": "ApiKey", + "defaultValue": "", + "required": true, + "helpMarkDown": "The ApiKey that should be used when pushing to the source.", + "groupName": "apikeyOptions" + }, + { + "name": "configOperation", + "type": "radio", + "label": "Config Operation", + "required": true, + "defaultValue": "set", + "helpMarkDown": "Choose whether to set or unset a config value.", + "options": { + "set": "Set Value", + "unset": "Unset Value" + }, + "groupName": "configOptions" + }, + { + "name": "configName", + "type": "pickList", + "label": "Config Name", + "defaultValue": "", + "options": { + "cacheLocation": "Cache Location", + "containsLegacyPackageInstalls": "Contains Legacy Package Installs", + "commandExecutionTimeoutSeconds": "Command Execution Timeout", + "proxy": "Proxy", + "proxyUser": "Proxy User", + "proxyPassword": "Proxy Password", + "webRequestTimeoutSeconds": "Web Request Timeout", + "proxyBypassList": "Proxy Bypass List", + "proxyBypassOnLocal": "Proxy Bypass On Local" + }, + "required": true, + "helpMarkDown": "The config name which is going to set or unset.", + "groupName": "configOptions" + }, + { + "name": "configValue", + "type": "string", + "label": "Config Value", + "defaultValue": "", + "required": true, + "helpMarkDown": "Parameters to pass to the package.", + "visibleRule": "configOperation=set", + "groupName": "configOptions" + }, + { + "name": "customCommand", + "type": "string", + "label": "Command", + "defaultValue": "", + "required": true, + "helpMarkDown": "The Chocolatey Command that you would like to execute.", + "groupName": "customOptions" + }, + { + "name": "customArguments", + "type": "string", + "label": "Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Chocolatey Arguments that should be passed to the command.", + "groupName": "customOptions" + }, + { + "name": "featureOperation", + "type": "radio", + "label": "Feature Operation", + "required": true, + "defaultValue": "enable", + "helpMarkDown": "Choose whether to enable or disable a feature.", + "options": { + "enable": "Enable Feature", + "disable": "Disable Feature" + }, + "groupName": "featureOptions" + }, + { + "name": "featureName", + "type": "pickList", + "label": "Feature Name", + "defaultValue": "", + "options": { + "checkSumFiles": "Checksum Files", + "autoUninstaller": "Auto Uninstaller", + "allowGlobalConfirmation": "Allow Global Confirmation", + "failOnAutoUninstaller": "Fail On Auto Uninstaller", + "failOnStandardError": "Fail On Standard Error", + "allowEmptyChecksums": "Allow Empty Checksums", + "allowEmptyChecksumsSecure": "Allow Empty Checksums Secure", + "powershellHost": "PowerShell Host", + "logEnvironmentValues": "Log Environment Values", + "virusCheck": "Virus Check", + "failOnInvalidOrMissingLicense": "Fail On Invalid or Missing License", + "ignoreInvalidOptionsSwitches": "Ignore Invalid Options and Switches", + "usePackageExitCodes": "Use Package Exit Codes", + "useFipsCompliantChecksums": "Use FIPS Compliant Checksums", + "showNonElevatedWarnings": "Show Non Elevated Warnings", + "showDownloadProgress": "Show Download Progress", + "stopOnFirstPackageFailure": "Stop On First Package Failure", + "useRememberedArgumentsForUpgrades": "Use Remembered Arguments", + "ignoreUnfoundPackagesOnUpgradeOutdated": "Ignore Unfound Packages", + "removePackageInformationOnUninstall": "Remove Package Information On Uninstall", + "logWithoutColor": "Log Without Color", + "scriptsCheckLastExitCode": "Script Check Last Exit Code" + }, + "required": true, + "helpMarkDown": "The feature name which is going to be enabled or disabled.", + "groupName": "featureOptions" + }, + { + "name": "installPackageId", + "type": "string", + "label": "The id of the package(s) that are to be installed.", + "defaultValue": "", + "required": true, + "helpMarkDown": "For example, windirstat.", + "groupName": "installOptions" + }, + { + "name": "installPackageVersion", + "type": "string", + "label": "The version of the package that is to be installed.", + "defaultValue": "", + "required": false, + "helpMarkDown": "For example, 1.2.3.", + "groupName": "installOptions" + }, + { + "name": "installPre", + "type": "boolean", + "label": "Prerelease.", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Include Prereleases?", + "groupName": "installOptions" + }, + { + "name": "installSource", + "type": "string", + "label": "The source to find the package(s) to install.", + "defaultValue": "", + "required": false, + "helpMarkDown": "Special sources include: ruby, webpi, cygwin, windowsfeatures, and python. To specify more than one source, pass it with a semi-colon separating the values (e.g. \"'source1;source2'\"). Defaults to default feeds.", + "groupName": "installOptions" + }, + { + "name": "installInstallArgs", + "type": "string", + "label": "Install Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Install Arguments to pass to the native installer in the package.", + "groupName": "installOptions" + }, + { + "name": "installParams", + "type": "string", + "label": "Package Parameters", + "defaultValue": "", + "required": false, + "helpMarkDown": "Parameters to pass to the package.", + "groupName": "installOptions" + }, + { + "name": "installForce", + "type": "boolean", + "label": "Force the behavior.", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Do not use force during normal operation - it subverts some of the smart behavior for commands.", + "groupName": "installOptions" + }, + { + "name": "installX86", + "type": "boolean", + "label": "Force X86.", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Force x86 (32bit) installation on 64 bit systems.", + "groupName": "installOptions" + }, + { + "name": "installOverride", + "type": "boolean", + "label": "Override Arguments", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Should install arguments be used exclusively without appending to current package passed arguments?", + "groupName": "installOptions" + }, + { + "name": "packOperation", + "type": "radio", + "label": "How many nuspec files?", + "required": true, + "defaultValue": "single", + "helpMarkDown": "Choose whether to pack a single nuspec file, or multiple.", + "options": { + "single": "One nuspec file", + "multiple": "Multiple nuspec files" + }, + "groupName": "packOptions" + }, + { + "name": "packWorkingDirectory", + "type": "string", + "label": "Working Directory", + "defaultValue": "", + "required": true, + "helpMarkDown": "The location of the nuspec file(s).", + "groupName": "packOptions" + }, + { + "name": "packNuspecFileName", + "type": "string", + "label": "NuSpec File Name.", + "defaultValue": "", + "required": true, + "helpMarkDown": "The file name of the NuSpec File that should be packed.", + "visibleRule": "packOperation=single", + "groupName": "packOptions" + }, + { + "name": "packVersion", + "type": "string", + "label": "Version", + "defaultValue": "", + "required": false, + "helpMarkDown": "The version you would like to insert into the package.", + "groupName": "packOptions" + }, + { + "name": "packOutputDirectory", + "type": "string", + "label": "Output Directory", + "defaultValue": "", + "required": false, + "helpMarkDown": "The location where the generated nupkg(s) should be placed.", + "groupName": "packOptions" + }, + { + "name": "pushPackages", + "type": "boolean", + "label": "Push generated nupkg(s).", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Should the generated nupkg(s) also be pushed to the specified source?", + "groupName": "packOptions" + }, + { + "name": "packSource", + "type": "string", + "label": "Source", + "defaultValue": "https://push.chocolatey.org/", + "required": false, + "helpMarkDown": "The source to push the generated nupkg(s) to.", + "visibleRule": "pushPackages=true", + "groupName": "packOptions" + }, + { + "name": "packApikey", + "type": "string", + "label": "API Key", + "defaultValue": "", + "required": false, + "helpMarkDown": "The API Key that should be used to push the nupkg(s) to specified source.", + "visibleRule": "pushPackages=true", + "groupName": "packOptions" + }, + { + "name": "packForce", + "type": "boolean", + "label": "Force.", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Force the operation to continue.", + "visibleRule": "pushPackages=true", + "groupName": "packOptions" + }, + { + "name": "packTimeout", + "type": "string", + "label": "Timeout", + "defaultValue": "", + "required": false, + "helpMarkDown": "The time, in seconds, to allow a package push to occur before timing out.", + "visibleRule": "pushPackages=true", + "groupName": "packOptions" + }, + { + "name": "pushOperation", + "type": "radio", + "label": "How many nupkg files?", + "required": true, + "defaultValue": "single", + "helpMarkDown": "Choose whether to pus a single nupkg file, or multiple.", + "options": { + "single": "One nupkg file", + "multiple": "Multiple nupkg files" + }, + "groupName": "pushOptions" + }, + { + "name": "pushWorkingDirectory", + "type": "string", + "label": "Working Directory", + "defaultValue": "", + "required": true, + "helpMarkDown": "The location of the nupkg file(s).", + "groupName": "pushOptions" + }, + { + "name": "pushNupkgFileName", + "type": "string", + "label": "Nupkg File Name.", + "defaultValue": "", + "required": true, + "helpMarkDown": "The file name of the Nupkg File that should be pushed.", + "visibleRule": "pushOperation=single", + "groupName": "pushOptions" + }, + { + "name": "pushSource", + "type": "string", + "label": "Source", + "defaultValue": "https://push.chocolatey.org/", + "required": false, + "helpMarkDown": "The source to push the nupkg(s) to.", + "groupName": "pushOptions" + }, + { + "name": "pushApikey", + "type": "string", + "label": "API Key", + "defaultValue": "", + "required": false, + "helpMarkDown": "The API Key that should be used to push the nupkg(s) to specified source.", + "groupName": "pushOptions" + }, + { + "name": "pushForce", + "type": "boolean", + "label": "Force.", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Force the operation to continue.", + "groupName": "pushOptions" + }, + { + "name": "pushTimeout", + "type": "string", + "label": "Timeout", + "defaultValue": "", + "required": false, + "helpMarkDown": "The time, in seconds, to allow a package push to occur before timing out.", + "groupName": "pushOptions" + }, + { + "name": "sourceOperation", + "type": "radio", + "label": "Source Operation", + "required": true, + "defaultValue": "add", + "helpMarkDown": "Choose whether to add, remove, enable or disable a source.", + "options": { + "add": "Add a source", + "remove": "Remove a source", + "enable": "Enable a source", + "disable": "Disable a source" + }, + "groupName": "sourceOptions" + }, + { + "name": "sourceSourceName", + "type": "string", + "label": "Name", + "defaultValue": "", + "required": true, + "helpMarkDown": "The name to give the Source.", + "groupName": "sourceOptions" + }, + { + "name": "sourceSource", + "type": "string", + "label": "Source", + "defaultValue": "", + "required": true, + "helpMarkDown": "The name to give the Source.", + "visibleRule": "sourceOperation=add", + "groupName": "sourceOptions" + }, + { + "name": "sourcePriority", + "type": "string", + "label": "Priority", + "defaultValue": "", + "required": false, + "helpMarkDown": "The priority order of this source as compared to other sources, lower is better. Defaults to 0 (no priority). All priorities above 0 will be evaluated first, then zero-based values will be evaluated in config file order.", + "groupName": "sourceOptions" + }, + { + "name": "user", + "type": "string", + "label": "User", + "defaultValue": "", + "required": false, + "helpMarkDown": "Used with authenticated feeds.", + "groupName": "sourceOptions" + }, + { + "name": "password", + "type": "string", + "label": "Password", + "defaultValue": "", + "required": false, + "helpMarkDown": "The user's password to the source. Encrypted in chocolatey.config file.", + "groupName": "sourceOptions" + }, + { + "name": "cert", + "type": "string", + "label": "Client Certificate", + "defaultValue": "", + "required": false, + "helpMarkDown": "PFX pathname for an x509 authenticated feeds.", + "groupName": "sourceOptions" + }, + { + "name": "certPassword", + "type": "string", + "label": "Certificate Password", + "defaultValue": "", + "required": false, + "helpMarkDown": "the client certificate's password to the source.", + "groupName": "sourceOptions" + }, + { + "name": "byPassProxy", + "type": "boolean", + "label": "Bypass Proxy.", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Should this source explicitly bypass any explicitly or system configured proxies?", + "groupName": "sourceOptions" + }, + { + "name": "upgradePackageId", + "type": "string", + "label": "The id of the package(s) that are to be installed.", + "defaultValue": "", + "required": true, + "helpMarkDown": "For example, windirstat.", + "groupName": "upgradeOptions" + }, + { + "name": "upgradePackageVersion", + "type": "string", + "label": "The version of the package that is to be installed.", + "defaultValue": "", + "required": false, + "helpMarkDown": "For example, 1.2.3.", + "groupName": "upgradeOptions" + }, + { + "name": "upgradePre", + "type": "boolean", + "label": "PreRelease.", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Include PreReleases?", + "groupName": "upgradeOptions" + }, + { + "name": "upgradeSource", + "type": "string", + "label": "The source to find the package(s) to install.", + "defaultValue": "", + "required": false, + "helpMarkDown": "Special sources include: ruby, webpi, cygwin, windowsfeatures, and python. To specify more than one source, pass it with a semi-colon separating the values (e.g. \"'source1;source2'\"). Defaults to default feeds.", + "groupName": "upgradeOptions" + }, + { + "name": "except", + "type": "string", + "label": "Except.", + "defaultValue": "", + "required": false, + "helpMarkDown": "A comma-separated list of package names that should not be upgraded when upgrading 'all'.", + "groupName": "upgradeOptions" + }, + { + "name": "upgradeInstallArgs", + "type": "string", + "label": "Install Arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Install Arguments to pass to the native installer in the package.", + "groupName": "upgradeOptions" + }, + { + "name": "upgradeParams", + "type": "string", + "label": "Package Parameters", + "defaultValue": "", + "required": false, + "helpMarkDown": "Parameters to pass to the package.", + "groupName": "upgradeOptions" + }, + { + "name": "upgradeForce", + "type": "boolean", + "label": "Force the behavior.", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Do not use force during normal operation - it subverts some of the smart behavior for commands.", + "groupName": "upgradeOptions" + }, + { + "name": "upgradeX86", + "type": "boolean", + "label": "Force X86.", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Force x86 (32bit) installation on 64 bit systems.", + "groupName": "upgradeOptions" + }, + { + "name": "upgradeOverride", + "type": "boolean", + "label": "Override Arguments", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Should install arguments be used exclusively without appending to current package passed arguments?", + "groupName": "upgradeOptions" + } + ], + "execution": { + "PowerShell3": { + "target": "$(currentDirectory)\\chocolatey.ps1", + "argumentFormat": "", + "workingDirectory": "$(currentDirectory)" + } + } +} \ No newline at end of file diff --git a/Tasks/config/config.ps1 b/Tasks/config/config.ps1 deleted file mode 100644 index c9b68b5..0000000 --- a/Tasks/config/config.ps1 +++ /dev/null @@ -1,56 +0,0 @@ -[CmdletBinding()] -param() - -Trace-VstsEnteringInvocation $MyInvocation - -try { - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "Machine") - if(-not (Test-Path $chocoInstallLocation)) { - Write-Output "Environment variable 'ChocolateyInstall' was not found in the system variables. Attempting to find it in the user variables..." - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "User") - } - - $chocoExe = "$chocoInstallLocation\choco.exe" - - if (-not (Test-Path $chocoExe)) { - throw "Chocolatey was not found." - } - - [string]$operation = Get-VstsInput -Name 'operation' -Require - [string]$configName = Get-VstsInput -Name 'configName' -Require - [bool]$debug = Get-VstsInput -Name 'debug' -AsBool -Default $false - [bool]$verbose = Get-VstsInput -Name 'verbose' -AsBool -Default $false - [bool]$trace = Get-VstsInput -Name 'trace' -AsBool -Default $false - - $chocolateyVersion = & $chocoExe --version - Write-Output "Running Chocolatey Version: $chocolateyVersion" - - $chocolateyArguments = @() - - if($debug) { - Write-Output "Adding --debug to arguments" - $chocolateyArguments += @("--debug", "") - } - - if($verbose) { - Write-Output "Adding --verbose to arguments" - $chocolateyArguments += @("--verbose", "") - } - - if($trace) { - Write-Output "Adding --trace to arguments" - $chocolateyArguments += @("--trace", "") - } - - if($operation -eq "set") { - [string]$configValue = Get-VstsInput -Name 'configValue' -Require - & $chocoExe config set --name $configName --value $configValue $($chocolateyArguments) - } else { - & $chocoExe config unset --name $configName $($chocolateyArguments) - } -} catch { - Write-VstsTaskError $_.Exception.Message - throw -} finally { - Trace-VstsLeavingInvocation $MyInvocation -} diff --git a/Tasks/config/icon.png b/Tasks/config/icon.png deleted file mode 100755 index ab05af71592b547960e4fcf1f5d527bece1fd5c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2656 zcmY*bc|6o>7yp&5nTW_XQyF7lXG|nABl{9z2o*AxVaQ;NEtRov*Bv(hrKxhFDVoxG4buln4OW*xUDC0l*�JDw&pneYk z1ijO)x9RU=K|Y38`~cu6-+>(hvL6Tmz@aMyD_gRysfoI?x0fQ$#oNhMG04kj9}NH+ zLF)UVmn#_u3-Y=_^ivN)!+#;v_v3>!0uK8HA$y|Xwx;GV9dD8=Ohr*y5edhDVKA5m z$px>D)z$x}egA}pyOYU2>Ig(&V4z~)8AWfB8$wAcFl({#nSu%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oHlzD?aNb91=<9e4Ey;q;%(Y6g~nm{l+;F0(40p<{nF z>wcIBih?#=Uo-gDpTTn~l^|iFdOhERaair#%8cl}Wqppp9%8C)!L_msmh-7sSJ$au zwooOK-<{W5&PJZDhd-M}zxlK4y_LbHeTxE9(XO^rg{Qtw%ODc@`L)mpPD$at^AwMx zZM1Pfjq1Y{)dZcP`G)BvddP=(!1NTPx25UgVTtC6X@<8!WJT!5i=j|k-|wdS%Bc*v zi^*^zqSeu8c#$-AG#d+?&9_GeiqMdbK5QqW%C-P_Z -function Find-Match { - [CmdletBinding()] - param( - [Parameter()] - [string]$DefaultRoot, - [Parameter()] - [string[]]$Pattern, - $FindOptions, - $MatchOptions) - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Apply defaults for parameters and trace. - if (!$DefaultRoot) { - $DefaultRoot = Get-TaskVariable -Name 'System.DefaultWorkingDirectory' -Default (Get-Location).Path - } - - Write-Verbose "DefaultRoot: '$DefaultRoot'" - if (!$FindOptions) { - $FindOptions = New-FindOptions -FollowSpecifiedSymbolicLink -FollowSymbolicLinks - } - - Trace-FindOptions -Options $FindOptions - if (!$MatchOptions) { - $MatchOptions = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $MatchOptions - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Normalize slashes for root dir. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - $results = @{ } - $originalMatchOptions = $MatchOptions - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $MatchOptions = Copy-MatchOptions -Options $originalMatchOptions - - # Skip comments. - if (!$MatchOptions.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $MatchOptions.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$MatchOptions.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$MatchOptions.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $MatchOptions.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $MatchOptions.NoNegate = $true - $MatchOptions.FlipNegate = $false - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Expand braces - required to accurately interpret findPath. - $expanded = $null - $preExpanded = $pat - if ($MatchOptions.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - } - - # Set NoBrace. - $MatchOptions.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - if ($isIncludePattern) { - # Determine the findPath. - $findInfo = Get-FindInfoFromPattern -DefaultRoot $DefaultRoot -Pattern $pat -MatchOptions $MatchOptions - $findPath = $findInfo.FindPath - Write-Verbose "FindPath: '$findPath'" - - if (!$findPath) { - Write-Verbose "Skipping empty path." - continue - } - - # Perform the find. - Write-Verbose "StatOnly: '$($findInfo.StatOnly)'" - [string[]]$findResults = @( ) - if ($findInfo.StatOnly) { - # Simply stat the path - all path segments were used to build the path. - if ((Test-Path -LiteralPath $findPath)) { - $findResults += $findPath - } - } else { - $findResults = Get-FindResult -Path $findPath -Options $FindOptions - } - - Write-Verbose "Found $($findResults.Count) paths." - - # Apply the pattern. - Write-Verbose "Applying include pattern." - if ($findInfo.AdjustedPattern -ne $pat) { - Write-Verbose "AdjustedPattern: '$($findInfo.AdjustedPattern)'" - $pat = $findInfo.AdjustedPattern - } - - $matchResults = [Minimatch.Minimatcher]::Filter( - $findResults, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results[$matchResult.ToUpperInvariant()] = $matchResult - } - - Write-Verbose "$matchCount matches" - } else { - # Check if basename only and MatchBase=true. - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $pat) -and - ($pat -replace '\\', '/').IndexOf('/') -lt 0) { - - # Do not root the pattern. - Write-Verbose "MatchBase and basename only." - } else { - # Root the exclude pattern. - $pat = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - # Apply the pattern. - Write-Verbose 'Applying exclude pattern.' - $matchResults = [Minimatch.Minimatcher]::Filter( - [string[]]$results.Values, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results.Remove($matchResult.ToUpperInvariant()) - } - - Write-Verbose "$matchCount matches" - } - } - } - - $finalResult = @( $results.Values | Sort-Object ) - Write-Verbose "$($finalResult.Count) final results" - return $finalResult - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Creates FindOptions for use with Find-VstsMatch. - -.DESCRIPTION -Creates FindOptions for use with Find-VstsMatch. Contains switches to control whether to follow symlinks. - -.PARAMETER FollowSpecifiedSymbolicLink -Indicates whether to traverse descendants if the specified path is a symbolic link directory. Does not cause nested symbolic link directories to be traversed. - -.PARAMETER FollowSymbolicLinks -Indicates whether to traverse descendants of symbolic link directories. -#> -function New-FindOptions { - [CmdletBinding()] - param( - [switch]$FollowSpecifiedSymbolicLink, - [switch]$FollowSymbolicLinks) - - return New-Object psobject -Property @{ - FollowSpecifiedSymbolicLink = $FollowSpecifiedSymbolicLink.IsPresent - FollowSymbolicLinks = $FollowSymbolicLinks.IsPresent - } -} - -<# -.SYNOPSIS -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. - -.DESCRIPTION -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. Contains switches to control which pattern matching options are applied. -#> -function New-MatchOptions { - [CmdletBinding()] - param( - [switch]$Dot, - [switch]$FlipNegate, - [switch]$MatchBase, - [switch]$NoBrace, - [switch]$NoCase, - [switch]$NoComment, - [switch]$NoExt, - [switch]$NoGlobStar, - [switch]$NoNegate, - [switch]$NoNull) - - return New-Object psobject -Property @{ - Dot = $Dot.IsPresent - FlipNegate = $FlipNegate.IsPresent - MatchBase = $MatchBase.IsPresent - NoBrace = $NoBrace.IsPresent - NoCase = $NoCase.IsPresent - NoComment = $NoComment.IsPresent - NoExt = $NoExt.IsPresent - NoGlobStar = $NoGlobStar.IsPresent - NoNegate = $NoNegate.IsPresent - NoNull = $NoNull.IsPresent - } -} - -<# -.SYNOPSIS -Applies match patterns against a list of files. - -.DESCRIPTION -Applies match patterns to a list of paths. Supports interleaved exclude patterns. - -.PARAMETER ItemPath -Array of paths. - -.PARAMETER Pattern -Patterns to apply. Supports interleaved exclude patterns. - -.PARAMETER PatternRoot -Default root to apply to unrooted patterns. Not applied to basename-only patterns when Options.MatchBase is true. - -.PARAMETER Options -When the Options parameter is not specified, defaults to (New-VstsMatchOptions -Dot -NoBrace -NoCase). -#> -function Select-Match { - [CmdletBinding()] - param( - [Parameter()] - [string[]]$ItemPath, - [Parameter()] - [string[]]$Pattern, - [Parameter()] - [string]$PatternRoot, - $Options) - - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - if (!$Options) { - $Options = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $Options - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Hashtable to keep track of matches. - $map = @{ } - - $originalOptions = $Options - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $Options = Copy-MatchOptions -Options $originalOptions - - # Skip comments. - if (!$Options.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $Options.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$Options.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$Options.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $Options.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $Options.NoNegate = $true - $Options.FlipNegate = $false - - # Expand braces - required to accurately root patterns. - $expanded = $null - $preExpanded = $pat - if ($Options.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $Options)) - } - - # Set NoBrace. - $Options.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - # Root the pattern when all of the following conditions are true: - if ($PatternRoot -and # PatternRoot is supplied - !(Test-Rooted -Path $pat) -and # AND pattern is not rooted - # # AND MatchBase=false or not basename only - (!$Options.MatchBase -or ($pat -replace '\\', '/').IndexOf('/') -ge 0)) { - - # Root the include pattern. - $pat = Get-RootedPattern -DefaultRoot $PatternRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - if ($isIncludePattern) { - # Apply the pattern. - Write-Verbose 'Applying include pattern against original list.' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map[$matchResult] = $true - } - - Write-Verbose "$matchCount matches" - } else { - # Apply the pattern. - Write-Verbose 'Applying exclude pattern against original list' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map.Remove($matchResult) - } - - Write-Verbose "$matchCount matches" - } - } - } - - # return a filtered version of the original list (preserves order and prevents duplication) - $result = $ItemPath | Where-Object { $map[$_] } - Write-Verbose "$($result.Count) final results" - $result - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -################################################################################ -# Private functions. -################################################################################ - -function Copy-MatchOptions { - [CmdletBinding()] - param($Options) - - return New-Object psobject -Property @{ - Dot = $Options.Dot -eq $true - FlipNegate = $Options.FlipNegate -eq $true - MatchBase = $Options.MatchBase -eq $true - NoBrace = $Options.NoBrace -eq $true - NoCase = $Options.NoCase -eq $true - NoComment = $Options.NoComment -eq $true - NoExt = $Options.NoExt -eq $true - NoGlobStar = $Options.NoGlobStar -eq $true - NoNegate = $Options.NoNegate -eq $true - NoNull = $Options.NoNull -eq $true - } -} - -function ConvertTo-MinimatchOptions { - [CmdletBinding()] - param($Options) - - $opt = New-Object Minimatch.Options - $opt.AllowWindowsPaths = $true - $opt.Dot = $Options.Dot -eq $true - $opt.FlipNegate = $Options.FlipNegate -eq $true - $opt.MatchBase = $Options.MatchBase -eq $true - $opt.NoBrace = $Options.NoBrace -eq $true - $opt.NoCase = $Options.NoCase -eq $true - $opt.NoComment = $Options.NoComment -eq $true - $opt.NoExt = $Options.NoExt -eq $true - $opt.NoGlobStar = $Options.NoGlobStar -eq $true - $opt.NoNegate = $Options.NoNegate -eq $true - $opt.NoNull = $Options.NoNull -eq $true - return $opt -} - -function ConvertTo-NormalizedSeparators { - [CmdletBinding()] - param([string]$Path) - - # Convert slashes. - $Path = "$Path".Replace('/', '\') - - # Remove redundant slashes. - $isUnc = $Path -match '^\\\\+[^\\]' - $Path = $Path -replace '\\\\+', '\' - if ($isUnc) { - $Path = '\' + $Path - } - - return $Path -} - -function Get-FindInfoFromPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern, - [Parameter(Mandatory = $true)] - $MatchOptions) - - if (!$MatchOptions.NoBrace) { - throw "Get-FindInfoFromPattern expected MatchOptions.NoBrace to be true." - } - - # For the sake of determining the find path, pretend NoCase=false. - $MatchOptions = Copy-MatchOptions -Options $MatchOptions - $MatchOptions.NoCase = $false - - # Check if basename only and MatchBase=true - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $Pattern) -and - ($Pattern -replace '\\', '/').IndexOf('/') -lt 0) { - - return New-Object psobject -Property @{ - AdjustedPattern = $Pattern - FindPath = $DefaultRoot - StatOnly = $false - } - } - - # The technique applied by this function is to use the information on the Minimatch object determine - # the findPath. Minimatch breaks the pattern into path segments, and exposes information about which - # segments are literal vs patterns. - # - # Note, the technique currently imposes a limitation for drive-relative paths with a glob in the - # first segment, e.g. C:hello*/world. It's feasible to overcome this limitation, but is left unsolved - # for now. - $minimatchObj = New-Object Minimatch.Minimatcher($Pattern, (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # The "set" field is a two-dimensional enumerable of parsed path segment info. The outer enumerable should only - # contain one item, otherwise something went wrong. Brace expansion can result in multiple items in the outer - # enumerable, but that should be turned off by the time this function is reached. - # - # Note, "set" is a private field in the .NET implementation but is documented as a feature in the nodejs - # implementation. The .NET implementation is a port and is by a different author. - $setFieldInfo = $minimatchObj.GetType().GetField('set', 'Instance,NonPublic') - [object[]]$set = $setFieldInfo.GetValue($minimatchObj) - if ($set.Count -ne 1) { - throw "Get-FindInfoFromPattern expected Minimatch.Minimatcher(...).set.Count to be 1. Actual: '$($set.Count)'" - } - - [string[]]$literalSegments = @( ) - [object[]]$parsedSegments = $set[0] - foreach ($parsedSegment in $parsedSegments) { - if ($parsedSegment.GetType().Name -eq 'LiteralItem') { - # The item is a LiteralItem when the original input for the path segment does not contain any - # unescaped glob characters. - $literalSegments += $parsedSegment.Source; - continue - } - - break; - } - - # Join the literal segments back together. Minimatch converts '\' to '/' on Windows, then squashes - # consequetive slashes, and finally splits on slash. This means that UNC format is lost, but can - # be detected from the original pattern. - $joinedSegments = [string]::Join('/', $literalSegments) - if ($joinedSegments -and ($Pattern -replace '\\', '/').StartsWith('//')) { - $joinedSegments = '/' + $joinedSegments # restore UNC format - } - - # Determine the find path. - $findPath = '' - if ((Test-Rooted -Path $Pattern)) { # The pattern is rooted. - $findPath = $joinedSegments - } elseif ($joinedSegments) { # The pattern is not rooted, and literal segements were found. - $findPath = [System.IO.Path]::Combine($DefaultRoot, $joinedSegments) - } else { # The pattern is not rooted, and no literal segements were found. - $findPath = $DefaultRoot - } - - # Clean up the path. - if ($findPath) { - $findPath = [System.IO.Path]::GetDirectoryName(([System.IO.Path]::Combine($findPath, '_'))) # Hack to remove unnecessary trailing slash. - $findPath = ConvertTo-NormalizedSeparators -Path $findPath - } - - return New-Object psobject -Property @{ - AdjustedPattern = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $Pattern - FindPath = $findPath - StatOnly = $literalSegments.Count -eq $parsedSegments.Count - } -} - -function Get-FindResult { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - $Options) - - if (!(Test-Path -LiteralPath $Path)) { - Write-Verbose 'Path not found.' - return - } - - $Path = ConvertTo-NormalizedSeparators -Path $Path - - # Push the first item. - [System.Collections.Stack]$stack = New-Object System.Collections.Stack - $stack.Push((Get-Item -LiteralPath $Path)) - - $count = 0 - while ($stack.Count) { - # Pop the next item and yield the result. - $item = $stack.Pop() - $count++ - $item.FullName - - # Traverse. - if (($item.Attributes -band 0x00000010) -eq 0x00000010) { # Directory - if (($item.Attributes -band 0x00000400) -ne 0x00000400 -or # ReparsePoint - $Options.FollowSymbolicLinks -or - ($count -eq 1 -and $Options.FollowSpecifiedSymbolicLink)) { - - $childItems = @( Get-DirectoryChildItem -Path $Item.FullName -Force ) - [System.Array]::Reverse($childItems) - foreach ($childItem in $childItems) { - $stack.Push($childItem) - } - } - } - } -} - -function Get-RootedPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern) - - if ((Test-Rooted -Path $Pattern)) { - return $Pattern - } - - # Normalize root. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - # Escape special glob characters. - $DefaultRoot = $DefaultRoot -replace '(\[)(?=[^\/]+\])', '[[]' # Escape '[' when ']' follows within the path segment - $DefaultRoot = $DefaultRoot.Replace('?', '[?]') # Escape '?' - $DefaultRoot = $DefaultRoot.Replace('*', '[*]') # Escape '*' - $DefaultRoot = $DefaultRoot -replace '\+\(', '[+](' # Escape '+(' - $DefaultRoot = $DefaultRoot -replace '@\(', '[@](' # Escape '@(' - $DefaultRoot = $DefaultRoot -replace '!\(', '[!](' # Escape '!(' - - if ($DefaultRoot -like '[A-Z]:') { # e.g. C: - return "$DefaultRoot$Pattern" - } - - # Ensure root ends with a separator. - if (!$DefaultRoot.EndsWith('\')) { - $DefaultRoot = "$DefaultRoot\" - } - - return "$DefaultRoot$Pattern" -} - -function Test-Rooted { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - $Path = ConvertTo-NormalizedSeparators -Path $Path - return $Path.StartsWith('\') -or # e.g. \ or \hello or \\hello - $Path -like '[A-Z]:*' # e.g. C: or C:\hello -} - -function Trace-MatchOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "MatchOptions.Dot: '$($Options.Dot)'" - Write-Verbose "MatchOptions.FlipNegate: '$($Options.FlipNegate)'" - Write-Verbose "MatchOptions.MatchBase: '$($Options.MatchBase)'" - Write-Verbose "MatchOptions.NoBrace: '$($Options.NoBrace)'" - Write-Verbose "MatchOptions.NoCase: '$($Options.NoCase)'" - Write-Verbose "MatchOptions.NoComment: '$($Options.NoComment)'" - Write-Verbose "MatchOptions.NoExt: '$($Options.NoExt)'" - Write-Verbose "MatchOptions.NoGlobStar: '$($Options.NoGlobStar)'" - Write-Verbose "MatchOptions.NoNegate: '$($Options.NoNegate)'" - Write-Verbose "MatchOptions.NoNull: '$($Options.NoNull)'" -} - -function Trace-FindOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "FindOptions.FollowSpecifiedSymbolicLink: '$($FindOptions.FollowSpecifiedSymbolicLink)'" - Write-Verbose "FindOptions.FollowSymbolicLinks: '$($FindOptions.FollowSymbolicLinks)'" -} diff --git a/Tasks/config/ps_modules/VstsTaskSdk/InputFunctions.ps1 b/Tasks/config/ps_modules/VstsTaskSdk/InputFunctions.ps1 deleted file mode 100644 index 846492d..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/InputFunctions.ps1 +++ /dev/null @@ -1,493 +0,0 @@ -# Hash table of known variable info. The formatted env var name is the lookup key. -# -# The purpose of this hash table is to keep track of known variables. The hash table -# needs to be maintained for multiple reasons: -# 1) to distinguish between env vars and job vars -# 2) to distinguish between secret vars and public -# 3) to know the real variable name and not just the formatted env var name. -$script:knownVariables = @{ } -$script:vault = @{ } - -<# -.SYNOPSIS -Gets an endpoint. - -.DESCRIPTION -Gets an endpoint object for the specified endpoint name. The endpoint is returned as an object with three properties: Auth, Data, and Url. - -The Data property requires a 1.97 agent or higher. - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-Endpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the URL. - $description = Get-LocString -Key PSLIB_EndpointUrl0 -ArgumentList $Name - $key = "ENDPOINT_URL_$Name" - $url = Get-VaultValue -Description $description -Key $key -Require:$Require - - # Get the auth object. - $description = Get-LocString -Key PSLIB_EndpointAuth0 -ArgumentList $Name - $key = "ENDPOINT_AUTH_$Name" - if ($auth = (Get-VaultValue -Description $description -Key $key -Require:$Require)) { - $auth = ConvertFrom-Json -InputObject $auth - } - - # Get the data. - $description = "'$Name' service endpoint data" - $key = "ENDPOINT_DATA_$Name" - if ($data = (Get-VaultValue -Description $description -Key $key)) { - $data = ConvertFrom-Json -InputObject $data - } - - # Return the endpoint. - if ($url -or $auth -or $data) { - New-Object -TypeName psobject -Property @{ - Url = $url - Auth = $auth - Data = $data - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file ticket. - -.DESCRIPTION -Gets the secure file ticket that can be used to download the secure file contents. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileTicket { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_TICKET_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file name. - -.DESCRIPTION -Gets the name for a secure file. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_NAME_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets an input. - -.DESCRIPTION -Gets the value for the specified input name. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-Input { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - # Get the input from the vault. Splat the bound parameters hashtable. Splatting is required - # in order to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Name - $key = "INPUT_$($Name.Replace(' ', '_').ToUpperInvariant())" - Get-VaultValue @PSBoundParameters -Description $description -Key $key -} - -<# -.SYNOPSIS -Gets a task variable. - -.DESCRIPTION -Gets the value for the specified task variable. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-TaskVariable { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - $description = Get-LocString -Key PSLIB_TaskVariable0 -ArgumentList $Name - $variableKey = Get-VariableKey -Name $Name - if ($script:knownVariables.$variableKey.Secret) { - # Get secret variable. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $vaultKey = "SECRET_$variableKey" - Get-VaultValue @PSBoundParameters -Description $description -Key $vaultKey - } else { - # Get public variable. - $item = $null - $path = "Env:$variableKey" - if ((Test-Path -LiteralPath $path) -and ($item = Get-Item -LiteralPath $path).Value) { - # Intentionally empty. Value was successfully retrieved. - } elseif (!$script:nonInteractive) { - # The value wasn't found and the module is running in interactive dev mode. - # Prompt for the value. - Set-Item -LiteralPath $path -Value (Read-Host -Prompt $description) - if (Test-Path -LiteralPath $path) { - $item = Get-Item -LiteralPath $path - } - } - - # Get the converted value. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - Get-Value @PSBoundParameters -Description $description -Key $variableKey -Value $item.Value - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets all job variables available to the task. Requires 2.104.1 agent or higher. - -.DESCRIPTION -Gets a snapshot of the current state of all job variables available to the task. -Requires a 2.104.1 agent or higher for full functionality. - -Returns an array of objects with the following properties: - [string]Name - [string]Value - [bool]Secret - -Limitations on an agent prior to 2.104.1: - 1) The return value does not include all public variables. Only public variables - that have been added using setVariable are returned. - 2) The name returned for each secret variable is the formatted environment variable - name, not the actual variable name (unless it was set explicitly at runtime using - setVariable). -#> -function Get-TaskVariableInfo { - [CmdletBinding()] - param() - - foreach ($info in $script:knownVariables.Values) { - New-Object -TypeName psobject -Property @{ - Name = $info.Name - Value = Get-TaskVariable -Name $info.Name - Secret = $info.Secret - } - } -} - -<# -.SYNOPSIS -Sets a task variable. - -.DESCRIPTION -Sets a task variable in the current task context as well as in the current job context. This allows the task variable to retrieved by subsequent tasks within the same job. -#> -function Set-TaskVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret) - - # Once a secret always a secret. - $variableKey = Get-VariableKey -Name $Name - [bool]$Secret = $Secret -or $script:knownVariables.$variableKey.Secret - if ($Secret) { - $vaultKey = "SECRET_$variableKey" - if (!$Value) { - # Clear the secret. - Write-Verbose "Set $Name = ''" - $script:vault.Remove($vaultKey) - } else { - # Store the secret in the vault. - Write-Verbose "Set $Name = '********'" - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Set-Item -LiteralPath "Env:$variableKey" -Value '' - } else { - # Set the environment variable. - Write-Verbose "Set $Name = '$Value'" - Set-Item -LiteralPath "Env:$variableKey" -Value $Value - } - - # Store the metadata. - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $Secret - } - - # Persist the variable in the task context. - Write-SetVariable -Name $Name -Value $Value -Secret:$Secret -} - -######################################## -# Private functions. -######################################## -function Get-VaultValue { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - # Attempt to get the vault value. - $value = $null - if ($psCredential = $script:vault[$Key]) { - $value = $psCredential.GetNetworkCredential().Password - } elseif (!$script:nonInteractive) { - # The value wasn't found. Prompt for the value if running in interactive dev mode. - $value = Read-Host -Prompt $Description - if ($value) { - $script:vault[$Key] = New-Object System.Management.Automation.PSCredential( - $Key, - (ConvertTo-SecureString -String $value -AsPlainText -Force)) - } - } - - Get-Value -Value $value @PSBoundParameters -} - -function Get-Value { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [string]$Value, - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - $result = $Value - if ($result) { - if ($Key -like 'ENDPOINT_AUTH_*') { - Write-Verbose "$($Key): '********'" - } else { - Write-Verbose "$($Key): '$result'" - } - } else { - Write-Verbose "$Key (empty)" - - # Write error if required. - if ($Require) { - Write-Error "$(Get-LocString -Key PSLIB_Required0 $Description)" - return - } - - # Fallback to the default if provided. - if ($PSCmdlet.ParameterSetName -eq 'Default') { - $result = $Default - $OFS = ' ' - Write-Verbose " Defaulted to: '$result'" - } else { - $result = '' - } - } - - # Convert to bool if specified. - if ($AsBool) { - if ($result -isnot [bool]) { - $result = "$result" -in '1', 'true' - Write-Verbose " Converted to bool: $result" - } - - return $result - } - - # Convert to int if specified. - if ($AsInt) { - if ($result -isnot [int]) { - try { - $result = [int]"$result" - } catch { - $result = 0 - } - - Write-Verbose " Converted to int: $result" - } - - return $result - } - - return $result -} - -function Initialize-Inputs { - # Store endpoints, inputs, and secret variables in the vault. - foreach ($variable in (Get-ChildItem -Path Env:ENDPOINT_?*, Env:INPUT_?*, Env:SECRET_?*, Env:SECUREFILE_?*)) { - # Record the secret variable metadata. This is required by Get-TaskVariable to - # retrieve the value. In a 2.104.1 agent or higher, this metadata will be overwritten - # when $env:VSTS_SECRET_VARIABLES is processed. - if ($variable.Name -like 'SECRET_?*') { - $variableKey = $variable.Name.Substring('SECRET_'.Length) - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - # This is technically not the variable name (has underscores instead of dots), - # but it's good enough to make Get-TaskVariable work in a pre-2.104.1 agent - # where $env:VSTS_SECRET_VARIABLES is not defined. - Name = $variableKey - Secret = $true - } - } - - # Store the value in the vault. - $vaultKey = $variable.Name - if ($variable.Value) { - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $variable.Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Remove-Item -LiteralPath "Env:$($variable.Name)" - } - - # Record the public variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_PUBLIC_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_PUBLIC_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $false - } - } - - $env:VSTS_PUBLIC_VARIABLES = '' - } - - # Record the secret variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_SECRET_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_SECRET_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $true - } - } - - $env:VSTS_SECRET_VARIABLES = '' - } -} - -function Get-VariableKey { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name) - - if ($Name -ne 'agent.jobstatus') { - $Name = $Name.Replace('.', '_') - } - - $Name.ToUpperInvariant() -} diff --git a/Tasks/config/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 b/Tasks/config/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 deleted file mode 100644 index b4080ae..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 +++ /dev/null @@ -1,320 +0,0 @@ -<# -.SYNOPSIS -Finds files or directories. - -.DESCRIPTION -Finds files or directories using advanced pattern matching. - -.PARAMETER LiteralDirectory -Directory to search. - -.PARAMETER LegacyPattern -Proprietary pattern format. The LiteralDirectory parameter is used to root any unrooted patterns. - -Separate multiple patterns using ";". Escape actual ";" in the path by using ";;". -"?" indicates a wildcard that represents any single character within a path segment. -"*" indicates a wildcard that represents zero or more characters within a path segment. -"**" as the entire path segment indicates a recursive search. -"**" within a path segment indicates a recursive intersegment wildcard. -"+:" (can be omitted) indicates an include pattern. -"-:" indicates an exclude pattern. - -The result is from the command is a union of all the matches from the include patterns, minus the matches from the exclude patterns. - -.PARAMETER IncludeFiles -Indicates whether to include files in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER IncludeDirectories -Indicates whether to include directories in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER Force -Indicates whether to include hidden items. - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is?Match.txt" - -Given: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt -C:\Directory\IsNotMatch.txt - -Returns: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is*Match.txt" - -Given: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt -C:\Directory\NonMatch.txt - -Returns: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**\Match.txt" - -Given: -C:\Directory\Match.txt -C:\Directory\NotAMatch.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -Returns: -C:\Directory\Match.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**" - -Given: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -Returns: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Sub**Match.txt" - -Given: -C:\Directory\IsNotAMatch.txt -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\IsNot.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsNot.txt - -Returns: -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -#> -function Find-Files { - [CmdletBinding()] - param( - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$LiteralDirectory, - [Parameter(Mandatory = $true)] - [string]$LegacyPattern, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - # Note, due to subtle implementation details of Get-PathPrefix/Get-PathIterator, - # this function does not appear to be able to search the root of a drive and other - # cases where Path.GetDirectoryName() returns empty. More details in Get-PathPrefix. - - Trace-EnteringInvocation $MyInvocation - if (!$IncludeFiles -and !$IncludeDirectories) { - $IncludeFiles = $true - } - - $includePatterns = New-Object System.Collections.Generic.List[string] - $excludePatterns = New-Object System.Collections.Generic.List[System.Text.RegularExpressions.Regex] - $LegacyPattern = $LegacyPattern.Replace(';;', "`0") - foreach ($pattern in $LegacyPattern.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries)) { - $pattern = $pattern.Replace("`0", ';') - $isIncludePattern = Test-IsIncludePattern -Pattern ([ref]$pattern) - if ($LiteralDirectory -and !([System.IO.Path]::IsPathRooted($pattern))) { - # Use the root directory provided to make the pattern a rooted path. - $pattern = [System.IO.Path]::Combine($LiteralDirectory, $pattern) - } - - # Validate pattern does not end with a \. - if ($pattern[$pattern.Length - 1] -eq [System.IO.Path]::DirectorySeparatorChar) { - throw (Get-LocString -Key PSLIB_InvalidPattern0 -ArgumentList $pattern) - } - - if ($isIncludePattern) { - $includePatterns.Add($pattern) - } else { - $excludePatterns.Add((Convert-PatternToRegex -Pattern $pattern)) - } - } - - $count = 0 - foreach ($path in (Get-MatchingItems -IncludePatterns $includePatterns -ExcludePatterns $excludePatterns -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force)) { - $count++ - $path - } - - Write-Verbose "Total found: $count" - Trace-LeavingInvocation $MyInvocation -} - -######################################## -# Private functions. -######################################## -function Convert-PatternToRegex { - [CmdletBinding()] - param([string]$Pattern) - - $Pattern = [regex]::Escape($Pattern.Replace('\', '/')). # Normalize separators and regex escape. - Replace('/\*\*/', '((/.+/)|(/))'). # Replace directory globstar. - Replace('\*\*', '.*'). # Replace remaining globstars with a wildcard that can span directory separators. - Replace('\*', '[^/]*'). # Replace asterisks with a wildcard that cannot span directory separators. - # bug: should be '[^/]' instead of '.' - Replace('\?', '.') # Replace single character wildcards. - New-Object regex -ArgumentList "^$Pattern`$", ([System.Text.RegularExpressions.RegexOptions]::IgnoreCase) -} - -function Get-FileNameFilter { - [CmdletBinding()] - param([string]$Pattern) - - $index = $Pattern.LastIndexOf('\') - if ($index -eq -1 -or # Pattern does not contain a backslash. - !($Pattern = $Pattern.Substring($index + 1)) -or # Pattern ends in a backslash. - $Pattern.Contains('**')) # Last segment contains an inter-segment wildcard. - { - return '*' - } - - # bug? is this supposed to do substring? - return $Pattern -} - -function Get-MatchingItems { - [CmdletBinding()] - param( - [System.Collections.Generic.List[string]]$IncludePatterns, - [System.Collections.Generic.List[regex]]$ExcludePatterns, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - Trace-EnteringInvocation $MyInvocation - $allFiles = New-Object System.Collections.Generic.HashSet[string] - foreach ($pattern in $IncludePatterns) { - $pathPrefix = Get-PathPrefix -Pattern $pattern - $fileNameFilter = Get-FileNameFilter -Pattern $pattern - $patternRegex = Convert-PatternToRegex -Pattern $pattern - # Iterate over the directories and files under the pathPrefix. - Get-PathIterator -Path $pathPrefix -Filter $fileNameFilter -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force | - ForEach-Object { - # Normalize separators. - $normalizedPath = $_.Replace('\', '/') - # **/times/** will not match C:/fun/times because there isn't a trailing slash. - # So try both if including directories. - $alternatePath = "$normalizedPath/" # potential bug: it looks like this will result in a false - # positive if the item is a regular file and not a directory - - $isMatch = $false - if ($patternRegex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $patternRegex.IsMatch($alternatePath))) { - $isMatch = $true - - # Test whether the path should be excluded. - foreach ($regex in $ExcludePatterns) { - if ($regex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $regex.IsMatch($alternatePath))) { - $isMatch = $false - break - } - } - } - - if ($isMatch) { - $null = $allFiles.Add($_) - } - } - } - - Trace-Path -Path $allFiles -PassThru - Trace-LeavingInvocation $MyInvocation -} - -function Get-PathIterator { - [CmdletBinding()] - param( - [string]$Path, - [string]$Filter, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - if (!$Path) { - return - } - - # bug: this returns the dir without verifying whether exists - if ($IncludeDirectories) { - $Path - } - - Get-DirectoryChildItem -Path $Path -Filter $Filter -Force:$Force -Recurse | - ForEach-Object { - if ($_.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - if ($IncludeDirectories) { - $_.FullName - } - } elseif ($IncludeFiles) { - $_.FullName - } - } -} - -function Get-PathPrefix { - [CmdletBinding()] - param([string]$Pattern) - - # Note, unable to search root directories is a limitation due to subtleties of this function - # and downstream code in Get-PathIterator that short-circuits when the path prefix is empty. - # This function uses Path.GetDirectoryName() to determine the path prefix, which will yield - # empty in some cases. See the following examples of Path.GetDirectoryName() input => output: - # C:/ => - # C:/hello => C:\ - # C:/hello/ => C:\hello - # C:/hello/world => C:\hello - # C:/hello/world/ => C:\hello\world - # C: => - # C:hello => C: - # C:hello/ => C:hello - # / => - # /hello => \ - # /hello/ => \hello - # //hello => - # //hello/ => - # //hello/world => - # //hello/world/ => \\hello\world - - $index = $Pattern.IndexOfAny([char[]]@('*'[0], '?'[0])) - if ($index -eq -1) { - # If no wildcards are found, return the directory name portion of the path. - # If there is no directory name (file name only in pattern), this will return empty string. - return [System.IO.Path]::GetDirectoryName($Pattern) - } - - [System.IO.Path]::GetDirectoryName($Pattern.Substring(0, $index)) -} - -function Test-IsIncludePattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [ref]$Pattern) - - # Include patterns start with +: or anything except -: - # Exclude patterns start with -: - if ($Pattern.value.StartsWith("+:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $true - } elseif ($Pattern.value.StartsWith("-:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $false - } else { - # No prefix, so leave the string alone. - $true; - } -} diff --git a/Tasks/config/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 b/Tasks/config/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 deleted file mode 100644 index c31790c..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 +++ /dev/null @@ -1,150 +0,0 @@ -$script:resourceStrings = @{ } - -<# -.SYNOPSIS -Gets a localized resource string. - -.DESCRIPTION -Gets a localized resource string and optionally formats the string with arguments. - -If the format fails (due to a bad format string or incorrect expected arguments in the format string), then the format string is returned followed by each of the arguments (delimited by a space). - -If the lookup key is not found, then the lookup key is returned followed by each of the arguments (delimited by a space). - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-LocString { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true, Position = 1)] - [string]$Key, - [Parameter(Position = 2)] - [object[]]$ArgumentList = @( )) - - # Due to the dynamically typed nature of PowerShell, a single null argument passed - # to an array parameter is interpreted as a null array. - if ([object]::ReferenceEquals($null, $ArgumentList)) { - $ArgumentList = @( $null ) - } - - # Lookup the format string. - $format = '' - if (!($format = $script:resourceStrings[$Key])) { - # Warn the key was not found. Prevent recursion if the lookup key is the - # "string resource key not found" lookup key. - $resourceNotFoundKey = 'PSLIB_StringResourceKeyNotFound0' - if ($key -ne $resourceNotFoundKey) { - Write-Warning (Get-LocString -Key $resourceNotFoundKey -ArgumentList $Key) - } - - # Fallback to just the key itself if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $key } - - # Otherwise fallback to the key followed by the arguments. - $OFS = " " - return "$key $ArgumentList" - } - - # Return the string if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $format } - - try { - [string]::Format($format, $ArgumentList) - } catch { - Write-Warning (Get-LocString -Key 'PSLIB_StringFormatFailed') - $OFS = " " - "$format $ArgumentList" - } -} - -<# -.SYNOPSIS -Imports resource strings for use with Get-VstsLocString. - -.DESCRIPTION -Imports resource strings for use with Get-VstsLocString. The imported strings are stored in an internal resource string dictionary. Optionally, if a separate resource file for the current culture exists, then the localized strings from that file then imported (overlaid) into the same internal resource string dictionary. - -Resource strings from the SDK are prefixed with "PSLIB_". This prefix should be avoided for custom resource strings. - -.Parameter LiteralPath -JSON file containing resource strings. - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Imports strings from messages section in the JSON file. If a messages section is not defined, then no strings are imported. Example messages section: -{ - "messages": { - "Hello": "Hello you!", - "Hello0": "Hello {0}!" - } -} - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Overlays strings from an optional separate resource file for the current culture. - -Given the task variable System.Culture is set to 'de-DE'. This variable is set by the agent based on the current culture for the job. -Given the file Task.json contains: -{ - "messages": { - "GoodDay": "Good day!", - } -} -Given the file resources.resjson\de-DE\resources.resjson: -{ - "loc.messages.GoodDay": "Guten Tag!" -} - -The net result from the import command would be one new key-value pair added to the internal dictionary: Key = 'GoodDay', Value = 'Guten Tag!' -#> -function Import-LocStrings { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - # Validate the file exists. - if (!(Test-Path -LiteralPath $LiteralPath -PathType Leaf)) { - Write-Warning (Get-LocString -Key PSLIB_FileNotFound0 -ArgumentList $LiteralPath) - return - } - - # Load the json. - Write-Verbose "Loading resource strings from: $LiteralPath" - $count = 0 - if ($messages = (Get-Content -LiteralPath $LiteralPath -Encoding UTF8 | Out-String | ConvertFrom-Json).messages) { - # Add each resource string to the hashtable. - foreach ($member in (Get-Member -InputObject $messages -MemberType NoteProperty)) { - [string]$key = $member.Name - $script:resourceStrings[$key] = $messages."$key" - $count++ - } - } - - Write-Verbose "Loaded $count strings." - - # Get the culture. - $culture = Get-TaskVariable -Name "System.Culture" -Default "en-US" - - # Load the resjson. - $resjsonPath = "$([System.IO.Path]::GetDirectoryName($LiteralPath))\Strings\resources.resjson\$culture\resources.resjson" - if (Test-Path -LiteralPath $resjsonPath) { - Write-Verbose "Loading resource strings from: $resjsonPath" - $count = 0 - $resjson = Get-Content -LiteralPath $resjsonPath -Encoding UTF8 | Out-String | ConvertFrom-Json - foreach ($member in (Get-Member -Name loc.messages.* -InputObject $resjson -MemberType NoteProperty)) { - if (!($value = $resjson."$($member.Name)")) { - continue - } - - [string]$key = $member.Name.Substring('loc.messages.'.Length) - $script:resourceStrings[$key] = $value - $count++ - } - - Write-Verbose "Loaded $count strings." - } -} diff --git a/Tasks/config/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 b/Tasks/config/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 deleted file mode 100644 index 595a7d8..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 +++ /dev/null @@ -1,601 +0,0 @@ -$script:loggingCommandPrefix = '##vso[' -$script:loggingCommandEscapeMappings = @( # TODO: WHAT ABOUT "="? WHAT ABOUT "%"? - New-Object psobject -Property @{ Token = ';' ; Replacement = '%3B' } - New-Object psobject -Property @{ Token = "`r" ; Replacement = '%0D' } - New-Object psobject -Property @{ Token = "`n" ; Replacement = '%0A' } - New-Object psobject -Property @{ Token = "]" ; Replacement = '%5D' } -) -# TODO: BUG: Escape % ??? -# TODO: Add test to verify don't need to escape "=". - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddAttachment { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Type, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'addattachment' -Data $Path -Properties @{ - 'type' = $Type - 'name' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadSummary { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadsummary' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetEndpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [Parameter(Mandatory = $true)] - [string]$Field, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setendpoint' -Data $Value -Properties @{ - 'id' = $Id - 'field' = $Field - 'key' = $Key - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddBuildTag { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'addbuildtag' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AssociateArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - [string]$Type, - [hashtable]$Properties, - [switch]$AsOutput) - - $p = @{ } - if ($Properties) { - foreach ($key in $Properties.Keys) { - $p[$key] = $Properties[$key] - } - } - - $p['artifactname'] = $Name - $p['artifacttype'] = $Type - Write-LoggingCommand -Area 'artifact' -Event 'associate' -Data $Path -Properties $p -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-LogDetail { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [guid]$Id, - $ParentId, - [string]$Type, - [string]$Name, - $Order, - $StartTime, - $FinishTime, - $Progress, - [ValidateSet('Unknown', 'Initialized', 'InProgress', 'Completed')] - [Parameter()] - $State, - [ValidateSet('Succeeded', 'SucceededWithIssues', 'Failed', 'Cancelled', 'Skipped')] - [Parameter()] - $Result, - [string]$Message, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'logdetail' -Data $Message -Properties @{ - 'id' = $Id - 'parentid' = $ParentId - 'type' = $Type - 'name' = $Name - 'order' = $Order - 'starttime' = $StartTime - 'finishtime' = $FinishTime - 'progress' = $Progress - 'state' = $State - 'result' = $Result - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetProgress { - [CmdletBinding()] - param( - [ValidateRange(0, 100)] - [Parameter(Mandatory = $true)] - [int]$Percent, - [string]$CurrentOperation, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setprogress' -Data $CurrentOperation -Properties @{ - 'value' = $Percent - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetResult { - [CmdletBinding(DefaultParameterSetName = 'AsOutput')] - param( - [ValidateSet("Succeeded", "SucceededWithIssues", "Failed", "Cancelled", "Skipped")] - [Parameter(Mandatory = $true)] - [string]$Result, - [string]$Message, - [Parameter(ParameterSetName = 'AsOutput')] - [switch]$AsOutput, - [Parameter(ParameterSetName = 'DoNotThrow')] - [switch]$DoNotThrow) - - Write-LoggingCommand -Area 'task' -Event 'complete' -Data $Message -Properties @{ - 'result' = $Result - } -AsOutput:$AsOutput - if ($Result -eq 'Failed' -and !$AsOutput -and !$DoNotThrow) { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - throw (New-Object VstsTaskSdk.TerminationException($Message)) - } -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetSecret { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setsecret' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ - 'variable' = $Name - 'issecret' = $Secret - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskDebug { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskError { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type error @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskVerbose { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -AsVerbose -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskWarning { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type warning @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadFile { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadfile' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-PrependPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateBuildNumber { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'updatebuildnumber' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$ContainerFolder, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'artifact' -Event 'upload' -Data $Path -Properties @{ - 'containerfolder' = $ContainerFolder - 'artifactname' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadBuildLog { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'uploadlog' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateReleaseName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'release' -Event 'updatereleasename' -Data $Name -AsOutput:$AsOutput -} - -######################################## -# Private functions. -######################################## -function Format-LoggingCommandData { - [CmdletBinding()] - param([string]$Value, [switch]$Reverse) - - if (!$Value) { - return '' - } - - if (!$Reverse) { - foreach ($mapping in $script:loggingCommandEscapeMappings) { - $Value = $Value.Replace($mapping.Token, $mapping.Replacement) - } - } else { - for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { - $mapping = $script:loggingCommandEscapeMappings[$i] - $Value = $Value.Replace($mapping.Replacement, $mapping.Token) - } - } - - return $Value -} - -function Format-LoggingCommand { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Area, - [Parameter(Mandatory = $true)] - [string]$Event, - [string]$Data, - [hashtable]$Properties) - - # Append the preamble. - [System.Text.StringBuilder]$sb = New-Object -TypeName System.Text.StringBuilder - $null = $sb.Append($script:loggingCommandPrefix).Append($Area).Append('.').Append($Event) - - # Append the properties. - if ($Properties) { - $first = $true - foreach ($key in $Properties.Keys) { - [string]$value = Format-LoggingCommandData $Properties[$key] - if ($value) { - if ($first) { - $null = $sb.Append(' ') - $first = $false - } else { - $null = $sb.Append(';') - } - - $null = $sb.Append("$key=$value") - } - } - } - - # Append the tail and output the value. - $Data = Format-LoggingCommandData $Data - $sb.Append(']').Append($Data).ToString() -} - -function Write-LoggingCommand { - [CmdletBinding(DefaultParameterSetName = 'Parameters')] - param( - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Area, - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Event, - [Parameter(ParameterSetName = 'Parameters')] - [string]$Data, - [Parameter(ParameterSetName = 'Parameters')] - [hashtable]$Properties, - [Parameter(Mandatory = $true, ParameterSetName = 'Object')] - $Command, - [switch]$AsOutput) - - if ($PSCmdlet.ParameterSetName -eq 'Object') { - Write-LoggingCommand -Area $Command.Area -Event $Command.Event -Data $Command.Data -Properties $Command.Properties -AsOutput:$AsOutput - return - } - - $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties - if ($AsOutput) { - $command - } else { - Write-Host $command - } -} - -function Write-LogIssue { - [CmdletBinding()] - param( - [ValidateSet('warning', 'error')] - [Parameter(Mandatory = $true)] - [string]$Type, - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ - 'type' = $Type - 'code' = $ErrCode - 'sourcepath' = $SourcePath - 'linenumber' = $LineNumber - 'columnnumber' = $ColumnNumber - } - if ($AsOutput) { - return $command - } - - if ($Type -eq 'error') { - $foregroundColor = $host.PrivateData.ErrorForegroundColor - $backgroundColor = $host.PrivateData.ErrorBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Red - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.WarningForegroundColor - $backgroundColor = $host.PrivateData.WarningBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Yellow - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} - -function Write-TaskDebug_Internal { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsVerbose, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'debug' -Data $Message - if ($AsOutput) { - return $command - } - - if ($AsVerbose) { - $foregroundColor = $host.PrivateData.VerboseForegroundColor - $backgroundColor = $host.PrivateData.VerboseBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Cyan - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.DebugForegroundColor - $backgroundColor = $host.PrivateData.DebugBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::DarkGray - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host -Object $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} diff --git a/Tasks/config/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 b/Tasks/config/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 deleted file mode 100644 index d536111..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 +++ /dev/null @@ -1,205 +0,0 @@ -######################################## -# Private functions. -######################################## -function ConvertFrom-LongFormPath { - [CmdletBinding()] - param([string]$Path) - - if ($Path) { - if ($Path.StartsWith('\\?\UNC')) { - # E.g. \\?\UNC\server\share -> \\server\share - return $Path.Substring(1, '\?\UNC'.Length) - } elseif ($Path.StartsWith('\\?\')) { - # E.g. \\?\C:\directory -> C:\directory - return $Path.Substring('\\?\'.Length) - } - } - - return $Path -} -function ConvertTo-LongFormPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$longFormPath = Get-FullNormalizedPath -Path $Path - if ($longFormPath -and !$longFormPath.StartsWith('\\?')) { - if ($longFormPath.StartsWith('\\')) { - # E.g. \\server\share -> \\?\UNC\server\share - return "\\?\UNC$($longFormPath.Substring(1))" - } else { - # E.g. C:\directory -> \\?\C:\directory - return "\\?\$longFormPath" - } - } - - return $longFormPath -} - -# TODO: ADD A SWITCH TO EXCLUDE FILES, A SWITCH TO EXCLUDE DIRECTORIES, AND A SWITCH NOT TO FOLLOW REPARSE POINTS. -function Get-DirectoryChildItem { - [CmdletBinding()] - param( - [string]$Path, - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$Filter = "*", - [switch]$Force, - [VstsTaskSdk.FS.FindFlags]$Flags = [VstsTaskSdk.FS.FindFlags]::LargeFetch, - [VstsTaskSdk.FS.FindInfoLevel]$InfoLevel = [VstsTaskSdk.FS.FindInfoLevel]::Basic, - [switch]$Recurse) - - $stackOfDirectoryQueues = New-Object System.Collections.Stack - while ($true) { - $directoryQueue = New-Object System.Collections.Queue - $fileQueue = New-Object System.Collections.Queue - $findData = New-Object VstsTaskSdk.FS.FindData - $longFormPath = (ConvertTo-LongFormPath $Path) - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, $Filter), - $InfoLevel, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - # Output directories immediately. - if ($item.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - $item - # Append to the directory queue if recursive and default filter. - if ($Recurse -and $Filter -eq '*') { - $directoryQueue.Enqueue($item) - } - } else { - # Hold the files until all directories have been output. - $fileQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - - # If recursive and non-default filter, queue child directories. - if ($Recurse -and $Filter -ne '*') { - $findData = New-Object VstsTaskSdk.FS.FindData - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, '*'), - [VstsTaskSdk.FS.FindInfoLevel]::Basic, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Collect directories only. - if ($attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - $directoryQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - } - - # Output the files. - $fileQueue - - # Push the directory queue onto the stack if any directories were found. - if ($directoryQueue.Count) { $stackOfDirectoryQueues.Push($directoryQueue) } - - # Break out of the loop if no more directory queues to process. - if (!$stackOfDirectoryQueues.Count) { break } - - # Get the next path. - $directoryQueue = $stackOfDirectoryQueues.Peek() - $Path = $directoryQueue.Dequeue().FullName - - # Pop the directory queue if it's empty. - if (!$directoryQueue.Count) { $null = $stackOfDirectoryQueues.Pop() } - } -} - -function Get-FullNormalizedPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$outPath = $Path - [uint32]$bufferSize = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, 0, $null, $null) - [int]$lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($bufferSize -gt 0) { - $absolutePath = New-Object System.Text.StringBuilder([int]$bufferSize) - [uint32]$length = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, $bufferSize, $absolutePath, $null) - $lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($length -gt 0) { - $outPath = $absolutePath.ToString() - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - - if ($outPath.EndsWith('\') -and !$outPath.EndsWith(':\')) { - $outPath = $outPath.TrimEnd('\') - } - - $outPath -} \ No newline at end of file diff --git a/Tasks/config/ps_modules/VstsTaskSdk/Minimatch.dll b/Tasks/config/ps_modules/VstsTaskSdk/Minimatch.dll deleted file mode 100644 index 700ddc426e56b08270c9dcbb1ade8ded248f98d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18432 zcmeHvd3amZweLFTNJpa;OY%U-U;wdJ(iE<^0Dr1eX+yVU^ZP<}CerFP{^D;NRAvpy{Upu7qdr-p#QQK0A=EE z*j@RF!K$=fum`{t+x7$Dj;_a3@mYu3X*)Y&L6B{wNj$7;1D=Y{x>+@ezQumUhi%iz zO@BY1=+-!qPq<}p%U-3n%sDf*P#@P|Wa1p%m=FXEn4%bhfB`=%h9F>|Q;H!781527 z5HJu1N4U|d+S*S|6A90AA zkcdZ#{0VeB+M>~Zr~5WKIT}ZR`3qry$+MxwZUC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Sx z`{tfwk3Rjs-`(@)7u#+*@b2&fb<3*0nqD`t;EumPyk`7E?55KHhkzXnS5bT)o=#3d z-F+{9yXNOFH5^~}{vRh_efj-=znQJ>TG@X|0T&zneSN+C-Px<~SNNlRlIX`lH6K&= zS^XHJY=2iHztz#b0<#WW(T^L9EUuHv-1O++0s1PME`6S3JXWHnze|6@uekfVEW3MT zWD8De>Y6p1mBYT2o^FDY>gm-hDgI`N@NExGR&rJ1CG65?^I2{ao?ZKiy45!v%mU6o z{-pd7xp#x)`K^9S*368ckzJK@|eeCHK|wh@#b0Crf~9w6M#pe4dt zz?`bfXOcXA%di!1*2AAZ>IHR3^sUCXQ`(eW-H<5Yn`5?jbXtG5NDp!qZSh!nE9zb< ztrseM(26}cKP~cbpO68?i={JC27M@7HoJ{94MJiBHg6Jt^rDR+*ghhj8AZR?(joL5 zXRI^uV)Ov~6T{i41(qQF;Jm}5U)G~Wa1eUgi?-tx2;$Q%_HJ|9;1T4OOVPlT^5`4c zy-fVO9Xc%ZWemP8R`eKu26_g+E)%~_uQSuTGkx13bviM61?kHHSb7va|F7z)p8hw( X?dtd6e<)43|K{fYzxw~TJn(-2*CUr_ diff --git a/Tasks/config/ps_modules/VstsTaskSdk/OutFunctions.ps1 b/Tasks/config/ps_modules/VstsTaskSdk/OutFunctions.ps1 deleted file mode 100644 index fd898d6..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/OutFunctions.ps1 +++ /dev/null @@ -1,79 +0,0 @@ -# TODO: It would be better if the Out-Default function resolved the underlying Out-Default -# command in the begin block. This would allow for supporting other modules that override -# Out-Default. -$script:outDefaultCmdlet = $ExecutionContext.InvokeCommand.GetCmdlet("Microsoft.PowerShell.Core\Out-Default") - -######################################## -# Public functions. -######################################## -function Out-Default { - [CmdletBinding(ConfirmImpact = "Medium")] - param( - [Parameter(ValueFromPipeline = $true)] - [System.Management.Automation.PSObject]$InputObject) - - begin { - #Write-Host '[Entering Begin Out-Default]' - $__sp = { & $script:outDefaultCmdlet @PSBoundParameters }.GetSteppablePipeline() - $__sp.Begin($pscmdlet) - #Write-Host '[Leaving Begin Out-Default]' - } - - process { - #Write-Host '[Entering Process Out-Default]' - if ($_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose -Message 'Error record:' 4>&1 | Out-Default - Write-Verbose -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) 4>&1 | Out-Default - Write-Verbose -Message 'Script stack trace:' 4>&1 | Out-Default - Write-Verbose -Message "$($_.ScriptStackTrace)" 4>&1 | Out-Default - Write-Verbose -Message 'Exception:' 4>&1 | Out-Default - Write-Verbose -Message $_.Exception.ToString() 4>&1 | Out-Default - Write-TaskError -Message $_.Exception.Message - } elseif ($_ -is [System.Management.Automation.WarningRecord]) { - Write-TaskWarning -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) - } elseif ($_ -is [System.Management.Automation.VerboseRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskVerbose -Message $private:str - } - } elseif ($_ -is [System.Management.Automation.DebugRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskDebug -Message $private:str - } - } else { -# TODO: Consider using out-string here to control the width. As a security precaution it would actually be best to set it to max so wrapping doesn't interfere with secret masking. - $__sp.Process($_) - } - - #Write-Host '[Leaving Process Out-Default]' - } - - end { - #Write-Host '[Entering End Out-Default]' - $__sp.End() - #Write-Host '[Leaving End Out-Default]' - } -} - -######################################## -# Private functions. -######################################## -function Format-DebugMessage { - [CmdletBinding()] - param([psobject]$Object) - - $private:str = Out-String -InputObject $Object -Width 2147483647 - $private:str = Remove-TrailingNewLine $private:str - "$private:str".Replace("`r`n", "`n").Replace("`r", "`n").Split("`n"[0]) -} - -function Remove-TrailingNewLine { - [CmdletBinding()] - param($Str) - if ([object]::ReferenceEquals($Str, $null)) { - return $Str - } elseif ($Str.EndsWith("`r`n")) { - return $Str.Substring(0, $Str.Length - 2) - } else { - return $Str - } -} diff --git a/Tasks/config/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml b/Tasks/config/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml deleted file mode 100644 index 8c20388..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - Microsoft.PowerShell.Commands.PSRepositoryItemInfo - System.Management.Automation.PSCustomObject - System.Object - - - VstsTaskSdk - 0.11.0 - Module - VSTS Task SDK - Microsoft - VSTS - (c) 2016 Microsoft. All rights reserved. -
2018-05-21T03:27:56+01:00
- - - - https://github.com/Microsoft/vsts-task-lib - - - - System.Object[] - System.Array - System.Object - - - PSModule - - - - - System.Collections.Hashtable - System.Object - - - - DscResource - - - - - - - RoleCapability - - - - Cmdlet - - - - Workflow - - - - Command - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - Function - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - - - - - - - - https://www.powershellgallery.com/api/v2 - PSGallery - NuGet - - - System.Management.Automation.PSCustomObject - System.Object - - - (c) 2016 Microsoft. All rights reserved. - VSTS Task SDK - False - True - True - 12749 - 136204 - 71074 - 21/05/2018 03:27:56 +01:00 - 21/05/2018 03:27:56 +01:00 - 09/11/2018 22:20:20 +00:00 - PSModule PSFunction_Find-Match PSCommand_Find-Match PSFunction_New-FindOptions PSCommand_New-FindOptions PSFunction_New-MatchOptions PSCommand_New-MatchOptions PSFunction_Select-Match PSCommand_Select-Match PSFunction_Get-Endpoint PSCommand_Get-Endpoint PSFunction_Get-SecureFileTicket PSCommand_Get-SecureFileTicket PSFunction_Get-SecureFileName PSCommand_Get-SecureFileName PSFunction_Get-Input PSCommand_Get-Input PSFunction_Get-TaskVariable PSCommand_Get-TaskVariable PSFunction_Get-TaskVariableInfo PSCommand_Get-TaskVariableInfo PSFunction_Set-TaskVariable PSCommand_Set-TaskVariable PSFunction_Find-Files PSCommand_Find-Files PSFunction_Get-LocString PSCommand_Get-LocString PSFunction_Import-LocStrings PSCommand_Import-LocStrings PSFunction_Write-AddAttachment PSCommand_Write-AddAttachment PSFunction_Write-AddBuildTag PSCommand_Write-AddBuildTag PSFunction_Write-AssociateArtifact PSCommand_Write-AssociateArtifact PSFunction_Write-LogDetail PSCommand_Write-LogDetail PSFunction_Write-PrependPath PSCommand_Write-PrependPath PSFunction_Write-SetEndpoint PSCommand_Write-SetEndpoint PSFunction_Write-SetProgress PSCommand_Write-SetProgress PSFunction_Write-SetResult PSCommand_Write-SetResult PSFunction_Write-SetSecret PSCommand_Write-SetSecret PSFunction_Write-SetVariable PSCommand_Write-SetVariable PSFunction_Write-TaskDebug PSCommand_Write-TaskDebug PSFunction_Write-TaskError PSCommand_Write-TaskError PSFunction_Write-TaskVerbose PSCommand_Write-TaskVerbose PSFunction_Write-TaskWarning PSCommand_Write-TaskWarning PSFunction_Write-UpdateBuildNumber PSCommand_Write-UpdateBuildNumber PSFunction_Write-UpdateReleaseName PSCommand_Write-UpdateReleaseName PSFunction_Write-UploadArtifact PSCommand_Write-UploadArtifact PSFunction_Write-UploadBuildLog PSCommand_Write-UploadBuildLog PSFunction_Write-UploadFile PSCommand_Write-UploadFile PSFunction_Write-UploadSummary PSCommand_Write-UploadSummary PSFunction_Out-Default PSCommand_Out-Default PSFunction_Get-AssemblyReference PSCommand_Get-AssemblyReference PSFunction_Get-TfsClientCredentials PSCommand_Get-TfsClientCredentials PSFunction_Get-TfsService PSCommand_Get-TfsService PSFunction_Get-VssCredentials PSCommand_Get-VssCredentials PSFunction_Get-VssHttpClient PSCommand_Get-VssHttpClient PSFunction_Assert-Agent PSCommand_Assert-Agent PSFunction_Assert-Path PSCommand_Assert-Path PSFunction_Invoke-Tool PSCommand_Invoke-Tool PSFunction_Trace-EnteringInvocation PSCommand_Trace-EnteringInvocation PSFunction_Trace-LeavingInvocation PSCommand_Trace-LeavingInvocation PSFunction_Trace-Path PSCommand_Trace-Path PSFunction_Get-WebProxy PSCommand_Get-WebProxy PSFunction_Get-ClientCertificate PSCommand_Get-ClientCertificate PSIncludes_Function - False - 2018-11-09T22:20:20Z - 0.11.0 - Microsoft - false - Module - VstsTaskSdk.nuspec|FindFunctions.ps1|InputFunctions.ps1|LegacyFindFunctions.ps1|lib.json|LocalizationFunctions.ps1|LoggingCommandFunctions.ps1|LongPathFunctions.ps1|Minimatch.dll|OutFunctions.ps1|ServerOMFunctions.ps1|ToolFunctions.ps1|TraceFunctions.ps1|VstsTaskSdk.dll|VstsTaskSdk.psd1|VstsTaskSdk.psm1|Strings\resources.resjson\de-de\resources.resjson|Strings\resources.resjson\en-US\resources.resjson|Strings\resources.resjson\es-es\resources.resjson|Strings\resources.resjson\fr-fr\resources.resjson|Strings\resources.resjson\it-IT\resources.resjson|Strings\resources.resjson\ja-jp\resources.resjson|Strings\resources.resjson\ko-KR\resources.resjson|Strings\resources.resjson\ru-RU\resources.resjson|Strings\resources.resjson\zh-CN\resources.resjson|Strings\resources.resjson\zh-TW\resources.resjson - bbed04e2-4e8e-4089-90a2-58b858fed8d8 - 3.0 - Microsoft - - - /Users/gep13/github/gep13/chocolatey-azuredevops/Tasks/install/VstsTaskSdk/0.11.0 -
-
-
diff --git a/Tasks/config/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 b/Tasks/config/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 deleted file mode 100644 index 177820b..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 +++ /dev/null @@ -1,659 +0,0 @@ -<# -.SYNOPSIS -Gets assembly reference information. - -.DESCRIPTION -Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK. - -Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario. - -Walks an assembly's references to determine all of it's dependencies. Also walks the references of the dependencies, and so on until all nested dependencies have been traversed. Dependencies are searched for in the directory of the specified assembly. NET Framework assemblies are omitted. - -See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER LiteralPath -Assembly to walk. - -.EXAMPLE -Get-VstsAssemblyReference -LiteralPath C:\nuget\microsoft.teamfoundationserver.client.14.102.0\lib\net45\Microsoft.TeamFoundation.Build2.WebApi.dll -#> -function Get-AssemblyReference { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - $ErrorActionPreference = 'Stop' - Write-Warning "Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK." - Write-Output '' - Write-Warning "Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario." - $directory = [System.IO.Path]::GetDirectoryName($LiteralPath) - $hashtable = @{ } - $queue = @( [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($LiteralPath).GetName() ) - while ($queue.Count) { - # Add a blank line between assemblies. - Write-Output '' - - # Pop. - $assemblyName = $queue[0] - $queue = @( $queue | Select-Object -Skip 1 ) - - # Attempt to find the assembly in the same directory. - $assembly = $null - $path = "$directory\$($assemblyName.Name).dll" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } else { - $path = "$directory\$($assemblyName.Name).exe" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } - } - - # Make sure the assembly full name matches, not just the file name. - if ($assembly -and $assembly.GetName().FullName -ne $assemblyName.FullName) { - $assembly = $null - } - - # Print the assembly. - if ($assembly) { - Write-Output $assemblyName.FullName - } else { - if ($assemblyName.FullName -eq 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed') { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) *** This is an expected condition when using the HTTP clients from the 15.x VSTS REST SDK. Use Get-VstsVssHttpClient to load the HTTP clients (which applies a binding redirect assembly resolver for Newtonsoft.Json). Otherwise you will need to manage the binding redirect yourself." - } else { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) ***" - } - - continue - } - - # Walk the references. - $refAssemblyNames = @( $assembly.GetReferencedAssemblies() ) - for ($i = 0 ; $i -lt $refAssemblyNames.Count ; $i++) { - $refAssemblyName = $refAssemblyNames[$i] - - # Skip framework assemblies. - $fxPaths = @( - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\$($refAssemblyName.Name).dll" - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\WPF\$($refAssemblyName.Name).dll" - ) - $fxPath = $fxPaths | - Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } | - Where-Object { [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($_).GetName().FullName -eq $refAssemblyName.FullName } - if ($fxPath) { - continue - } - - # Print the reference. - Write-Output " $($refAssemblyName.FullName)" - - # Add new references to the queue. - if (!$hashtable[$refAssemblyName.FullName]) { - $queue += $refAssemblyName - $hashtable[$refAssemblyName.FullName] = $true - } - } - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the TFS extended client SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -Refer to Get-VstsTfsService for a more simple to get a TFS service object. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -$credentials = Get-VstsTfsClientCredentials -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.VersionControl.Client.dll" -$tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection( - (Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require), - $credentials) -$versionControlServer = $tfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer]) -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsClientCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Validate the type can be found. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsClientCredentials' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Construct the credentials. - $credentials = New-Object Microsoft.TeamFoundation.Client.TfsClientCredentials($false) # Do not use default credentials. - $credentials.AllowInteractive = $false - $credentials.Federated = New-Object Microsoft.TeamFoundation.Client.OAuthTokenCredential([string]$endpoint.auth.parameters.AccessToken) - return $credentials - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a TFS extended client service. - -.DESCRIPTION -Gets an instance of an ITfsTeamProjectCollectionObject. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the service to get. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER Uri -URI to use when initializing the service. If not specified, defaults to System.TeamFoundationCollectionUri. - -.PARAMETER TfsClientCredentials -Credentials to use when initializing the service. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -.EXAMPLE -$versionControlServer = Get-VstsTfsService -TypeName Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsService { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $TfsClientCredentials) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Default the credentials. - if (!$TfsClientCredentials) { - $TfsClientCredentials = Get-TfsClientCredentials -OMDirectory $OMDirectory - } - - # Validate the project collection type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsTeamProjectCollection' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Load the project collection object. - $tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection($Uri, $TfsClientCredentials) - - # Validate the requested type can be loaded. - $type = Get-OMType -TypeName $TypeName -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Return the service object. - return $tfsTeamProjectCollection.GetService($type) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the VSTS REST SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project service build/release identity). - -Refer to Get-VstsVssHttpClient for a more simple to get a VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -# This example works using the 14.x .NET SDK. A Newtonsoft.Json 6.0 to 8.0 binding -# redirect may be required when working with the 15.x SDK. Or use Get-VstsVssHttpClient -# to avoid managing the binding redirect. -# -$vssCredentials = Get-VstsVssCredentials -$collectionUrl = New-Object System.Uri((Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require)) -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.Core.WebApi.dll" -$projectHttpClient = New-Object Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient($collectionUrl, $vssCredentials) -$projectHttpClient.GetProjects().Result -#> -function Get-VssCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Check if the VssOAuthAccessTokenCredential type is available. - if ((Get-OMType -TypeName 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory)) { - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential($endpoint.auth.parameters.AccessToken) - } else { - # Validate the fallback type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.Client.VssOAuthCredential($endpoint.auth.parameters.AccessToken) - } - - # Return the credentials. - return New-Object Microsoft.VisualStudio.Services.Common.VssCredentials( - (New-Object Microsoft.VisualStudio.Services.Common.WindowsCredential($false)), # Do not use default credentials. - $federatedCredential, - [Microsoft.VisualStudio.Services.Common.CredentialPromptType]::DoNotPrompt) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VSS HTTP client. - -.DESCRIPTION -Gets an instance of an VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the HTTP client to get. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -# .PARAMETER Uri -# URI to use when initializing the HTTP client. If not specified, defaults to System.TeamFoundationCollectionUri. - -# .PARAMETER VssCredentials -# Credentials to use when initializing the HTTP client. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -# .PARAMETER WebProxy -# WebProxy to use when initializing the HTTP client. If not specified, the default uses the proxy configuration agent current has. - -# .PARAMETER ClientCert -# ClientCert to use when initializing the HTTP client. If not specified, the default uses the client certificate agent current has. - -# .PARAMETER IgnoreSslError -# Skip SSL server certificate validation on all requests made by this HTTP client. If not specified, the default is to validate SSL server certificate. - -.EXAMPLE -$projectHttpClient = Get-VstsVssHttpClient -TypeName Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient -$projectHttpClient.GetProjects().Result -#> -function Get-VssHttpClient { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $VssCredentials, - - $WebProxy = (Get-WebProxy), - - $ClientCert = (Get-ClientCertificate), - - [switch]$IgnoreSslError) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Cast the URI. - [uri]$Uri = New-Object System.Uri($Uri) - - # Default the credentials. - if (!$VssCredentials) { - $VssCredentials = Get-VssCredentials -OMDirectory $OMDirectory - } - - # Validate the type can be loaded. - $null = Get-OMType -TypeName $TypeName -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Update proxy setting for vss http client - [Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler]::DefaultWebProxy = $WebProxy - - # Update client certificate setting for vss http client - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - [Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings]$Settings = [Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings]::Default.Clone() - - if ($ClientCert) { - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance.ClientCertificates.Add($ClientCert) - - $Settings.ClientCertificateManager = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance - } - - # Skip SSL server certificate validation - [bool]$SkipCertValidation = (Get-TaskVariable -Name Agent.SkipCertValidation -AsBool) -or $IgnoreSslError - if ($SkipCertValidation) { - if ($Settings.GetType().GetProperty('ServerCertificateValidationCallback')) { - Write-Verbose "Ignore any SSL server certificate validation errors."; - $Settings.ServerCertificateValidationCallback = [VstsTaskSdk.VstsHttpHandlerSettings]::UnsafeSkipServerCertificateValidation - } - else { - # OMDirectory has older version of Microsoft.VisualStudio.Services.Common.dll - Write-Verbose "The version of 'Microsoft.VisualStudio.Services.Common.dll' does not support skip SSL server certificate validation." - } - } - - # Try to construct the HTTP client. - Write-Verbose "Constructing HTTP client." - try { - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } catch { - # Rethrow if the exception is not due to Newtonsoft.Json DLL not found. - if ($_.Exception.InnerException -isnot [System.IO.FileNotFoundException] -or - $_.Exception.InnerException.FileName -notlike 'Newtonsoft.Json, *') { - - throw - } - - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Test if the Newtonsoft.Json DLL exists in the OM directory. - $newtonsoftDll = [System.IO.Path]::Combine($OMDirectory, "Newtonsoft.Json.dll") - Write-Verbose "Testing file path: '$newtonsoftDll'" - if (!(Test-Path -LiteralPath $newtonsoftDll -PathType Leaf)) { - Write-Verbose 'Not found. Rethrowing exception.' - throw - } - - # Add a binding redirect and try again. Parts of the Dev15 preview SDK have a - # dependency on the 6.0.0.0 Newtonsoft.Json DLL, while other parts reference - # the 8.0.0.0 Newtonsoft.Json DLL. - Write-Verbose "Adding assembly resolver." - $onAssemblyResolve = [System.ResolveEventHandler] { - param($sender, $e) - - if ($e.Name -like 'Newtonsoft.Json, *') { - Write-Verbose "Resolving '$($e.Name)'" - return [System.Reflection.Assembly]::LoadFrom($newtonsoftDll) - } - - Write-Verbose "Unable to resolve assembly name '$($e.Name)'" - return $null - } - [System.AppDomain]::CurrentDomain.add_AssemblyResolve($onAssemblyResolve) - try { - # Try again to construct the HTTP client. - Write-Verbose "Trying again to construct the HTTP client." - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } finally { - # Unregister the assembly resolver. - Write-Verbose "Removing assemlby resolver." - [System.AppDomain]::CurrentDomain.remove_AssemblyResolve($onAssemblyResolve) - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VstsTaskSdk.VstsWebProxy - -.DESCRIPTION -Gets an instance of a VstsTaskSdk.VstsWebProxy that has same proxy configuration as Build/Release agent. - -VstsTaskSdk.VstsWebProxy implement System.Net.IWebProxy interface. - -.EXAMPLE -$webProxy = Get-VstsWebProxy -$webProxy.GetProxy(New-Object System.Uri("https://github.com/Microsoft/vsts-task-lib")) -#> -function Get-WebProxy { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports proxy - Assert-Agent -Minimum '2.105.7' - - $proxyUrl = Get-TaskVariable -Name Agent.ProxyUrl - $proxyUserName = Get-TaskVariable -Name Agent.ProxyUserName - $proxyPassword = Get-TaskVariable -Name Agent.ProxyPassword - $proxyBypassListJson = Get-TaskVariable -Name Agent.ProxyBypassList - [string[]]$ProxyBypassList = ConvertFrom-Json -InputObject $ProxyBypassListJson - - return New-Object -TypeName VstsTaskSdk.VstsWebProxy -ArgumentList @($proxyUrl, $proxyUserName, $proxyPassword, $proxyBypassList) - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a client certificate for current connected TFS instance - -.DESCRIPTION -Gets an instance of a X509Certificate2 that is the client certificate Build/Release agent used. - -.EXAMPLE -$x509cert = Get-ClientCertificate -WebRequestHandler.ClientCertificates.Add(x509cert) -#> -function Get-ClientCertificate { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports client certificate - Assert-Agent -Minimum '2.122.0' - - [string]$clientCert = Get-TaskVariable -Name Agent.ClientCertArchive - [string]$clientCertPassword = Get-TaskVariable -Name Agent.ClientCertPassword - - if ($clientCert -and (Test-Path -LiteralPath $clientCert -PathType Leaf)) { - return New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($clientCert, $clientCertPassword) - } - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -######################################## -# Private functions. -######################################## -function Get-OMType { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [ValidateSet('ExtendedClient', 'WebApi')] - [Parameter(Mandatory = $true)] - [string]$OMKind, - - [string]$OMDirectory, - - [switch]$Require) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Try to load the type. - $errorRecord = $null - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - # Store the error record. - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - - # Build a list of candidate DLL file paths from the namespace. - $dllPaths = @( ) - $namespace = $TypeName - while ($namespace.LastIndexOf('.') -gt 0) { - # Trim the next segment from the namespace. - $namespace = $namespace.SubString(0, $namespace.LastIndexOf('.')) - - # Derive potential DLL file paths based on the namespace and OM kind (i.e. extended client vs web API). - if ($OMKind -eq 'ExtendedClient') { - if ($namespace -like 'Microsoft.TeamFoundation.*') { - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } else { - if ($namespace -like 'Microsoft.TeamFoundation.*' -or - $namespace -like 'Microsoft.VisualStudio.Services' -or - $namespace -like 'Microsoft.VisualStudio.Services.*') { - - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.WebApi.dll") - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } - } - - foreach ($dllPath in $dllPaths) { - # Check whether the DLL exists. - Write-Verbose "Testing leaf path: '$dllPath'" - if (!(Test-Path -PathType Leaf -LiteralPath "$dllPath")) { - Write-Verbose "Not found." - continue - } - - # Load the DLL. - Write-Verbose "Loading assembly: $dllPath" - try { - Add-Type -LiteralPath $dllPath - } catch { - # Write the information to the verbose stream and proceed to attempt to load the requested type. - # - # The requested type may successfully load now. For example, the type used with the 14.0 Web API for the - # federated credential (VssOAuthCredential) resides in Microsoft.VisualStudio.Services.Client.dll. Even - # though loading the DLL results in a ReflectionTypeLoadException when Microsoft.ServiceBus.dll (approx 3.75mb) - # is not present, enough types are loaded to use the VssOAuthCredential federated credential with the Web API - # HTTP clients. - Write-Verbose "$($_.Exception.GetType().FullName): $($_.Exception.Message)" - if ($_.Exception -is [System.Reflection.ReflectionTypeLoadException]) { - for ($i = 0 ; $i -lt $_.Exception.LoaderExceptions.Length ; $i++) { - $loaderException = $_.Exception.LoaderExceptions[$i] - Write-Verbose "LoaderExceptions[$i]: $($loaderException.GetType().FullName): $($loaderException.Message)" - } - } - } - - # Try to load the type. - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - } - - # Check whether to propagate the error. - if ($Require) { - Write-Error $errorRecord - } - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} diff --git a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson b/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson deleted file mode 100644 index 7871c36..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agentversion {0} oder höher ist erforderlich.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Der Containerpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "\"{0}\"-Dienstendpunkt-Anmeldeinformationen", - "loc.messages.PSLIB_EndpointUrl0": "\"{0}\"-Dienstendpunkt-URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Fehler beim Aufzählen von Unterverzeichnissen für den folgenden Pfad: \"{0}\"", - "loc.messages.PSLIB_FileNotFound0": "Die Datei wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Input0": "\"{0}\"-Eingabe", - "loc.messages.PSLIB_InvalidPattern0": "Ungültiges Muster: \"{0}\"", - "loc.messages.PSLIB_LeafPathNotFound0": "Der Blattpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Fehler bei der Normalisierung bzw. Erweiterung des Pfads. Die Pfadlänge wurde vom Kernel32-Subsystem nicht zurückgegeben für: \"{0}\"", - "loc.messages.PSLIB_PathNotFound0": "Der Pfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Der Prozess \"{0}\" wurde mit dem Code \"{1}\" beendet.", - "loc.messages.PSLIB_Required0": "Erforderlich: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Fehler beim Zeichenfolgenformat.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Der Zeichenfolgen-Ressourcenschlüssel wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "\"{0}\"-Taskvariable" -} \ No newline at end of file diff --git a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson b/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson deleted file mode 100644 index 66c17bc..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "File not found: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' input", - "loc.messages.PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Path not found: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "loc.messages.PSLIB_Required0": "Required: {0}", - "loc.messages.PSLIB_StringFormatFailed": "String format failed.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' task variable" -} \ No newline at end of file diff --git a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson b/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson deleted file mode 100644 index f5c9c23..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Se require la versión {0} o posterior del agente.", - "loc.messages.PSLIB_ContainerPathNotFound0": "No se encuentra la ruta de acceso del contenedor: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenciales del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "No se pudieron enumerar los subdirectorios de la ruta de acceso: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Archivo no encontrado: '{0}'", - "loc.messages.PSLIB_Input0": "Entrada '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Patrón no válido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "No se encuentra la ruta de acceso de la hoja: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "No se pudo normalizar o expandir la ruta de acceso. El subsistema Kernel32 no devolvió la longitud de la ruta de acceso para: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "No se encuentra la ruta de acceso: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "El proceso '{0}' finalizó con el código '{1}'.", - "loc.messages.PSLIB_Required0": "Se requiere: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Error de formato de cadena.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "No se encuentra la clave de recurso de la cadena: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tarea '{0}'" -} \ No newline at end of file diff --git a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson b/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson deleted file mode 100644 index 652870c..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "L'agent version {0} (ou une version ultérieure) est obligatoire.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Le chemin du conteneur est introuvable : '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Informations d'identification du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Échec de l'énumération des sous-répertoires pour le chemin : '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Fichier introuvable : {0}.", - "loc.messages.PSLIB_Input0": "Entrée '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Modèle non valide : '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Le chemin feuille est introuvable : '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Échec de la normalisation/l'expansion du chemin. La longueur du chemin n'a pas été retournée par le sous-système Kernel32 pour : '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Chemin introuvable : '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Le processus '{0}' s'est arrêté avec le code '{1}'.", - "loc.messages.PSLIB_Required0": "Obligatoire : {0}", - "loc.messages.PSLIB_StringFormatFailed": "Échec du format de la chaîne.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Clé de la ressource de type chaîne introuvable : '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tâche '{0}'" -} \ No newline at end of file diff --git a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson b/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson deleted file mode 100644 index 6aeb1df..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "È richiesta la versione dell'agente {0} o superiore.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Percorso del contenitore non trovato: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenziali dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "L'enumerazione delle sottodirectory per il percorso '{0}' non è riuscita", - "loc.messages.PSLIB_FileNotFound0": "File non trovato: '{0}'", - "loc.messages.PSLIB_Input0": "Input di '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Criterio non valido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Percorso foglia non trovato: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "La normalizzazione o l'espansione del percorso non è riuscita. Il sottosistema Kernel32 non ha restituito la lunghezza del percorso per '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Percorso non trovato: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Il processo '{0}' è stato terminato ed è stato restituito il codice '{1}'.", - "loc.messages.PSLIB_Required0": "Obbligatorio: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Errore nel formato della stringa.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "La chiave della risorsa stringa non è stata trovata: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variabile dell'attività '{0}'" -} \ No newline at end of file diff --git a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson b/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson deleted file mode 100644 index 6b07ab6..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "バージョン {0} 以降のエージェントが必要です。", - "loc.messages.PSLIB_ContainerPathNotFound0": "コンテナーのパスが見つかりません: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' サービス エンドポイントの資格情報", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' サービス エンドポイントの URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "パス '{0}' のサブディレクトリを列挙できませんでした", - "loc.messages.PSLIB_FileNotFound0": "ファイルが見つかりません: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 入力", - "loc.messages.PSLIB_InvalidPattern0": "使用できないパターンです: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "リーフ パスが見つかりません: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "パスの正規化/展開に失敗しました。Kernel32 サブシステムからパス '{0}' の長さが返されませんでした", - "loc.messages.PSLIB_PathNotFound0": "パスが見つかりません: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "プロセス '{0}' がコード '{1}' で終了しました。", - "loc.messages.PSLIB_Required0": "必要: {0}", - "loc.messages.PSLIB_StringFormatFailed": "文字列のフォーマットに失敗しました。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "文字列のリソース キーが見つかりません: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' タスク変数" -} \ No newline at end of file diff --git a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson b/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson deleted file mode 100644 index e58cbdc..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "에이전트 버전 {0} 이상이 필요합니다.", - "loc.messages.PSLIB_ContainerPathNotFound0": "컨테이너 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 서비스 끝점 자격 증명", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 서비스 끝점 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "경로에 대해 하위 디렉터리를 열거하지 못함: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "{0} 파일을 찾을 수 없습니다.", - "loc.messages.PSLIB_Input0": "'{0}' 입력", - "loc.messages.PSLIB_InvalidPattern0": "잘못된 패턴: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "경로 정규화/확장에 실패했습니다. 다음에 대해 Kernel32 subsystem에서 경로 길이를 반환하지 않음: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "'{1}' 코드로 '{0}' 프로세스가 종료되었습니다.", - "loc.messages.PSLIB_Required0": "필수: {0}", - "loc.messages.PSLIB_StringFormatFailed": "문자열을 포맷하지 못했습니다.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "문자열 리소스 키를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 작업 변수" -} \ No newline at end of file diff --git a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson b/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson deleted file mode 100644 index 38dd69d..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Требуется версия агента {0} или более поздняя.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Путь к контейнеру не найден: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "Учетные данные конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EndpointUrl0": "URL-адрес конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Сбой перечисления подкаталогов для пути: \"{0}\".", - "loc.messages.PSLIB_FileNotFound0": "Файл не найден: \"{0}\".", - "loc.messages.PSLIB_Input0": "Входные данные \"{0}\".", - "loc.messages.PSLIB_InvalidPattern0": "Недопустимый шаблон: \"{0}\".", - "loc.messages.PSLIB_LeafPathNotFound0": "Путь к конечному объекту не найден: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Сбой нормализации и расширения пути. Длина пути не была возвращена подсистемой Kernel32 для: \"{0}\".", - "loc.messages.PSLIB_PathNotFound0": "Путь не найден: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Процесс \"{0}\" завершил работу с кодом \"{1}\".", - "loc.messages.PSLIB_Required0": "Требуется: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Сбой формата строки.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Ключ ресурса строки не найден: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "Переменная задачи \"{0}\"" -} \ No newline at end of file diff --git a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson b/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson deleted file mode 100644 index 1d333de..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理版本 {0} 或更高版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路径:“{0}”", - "loc.messages.PSLIB_EndpointAuth0": "“{0}”服务终结点凭据", - "loc.messages.PSLIB_EndpointUrl0": "“{0}”服务终结点 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "枚举路径的子目录失败:“{0}”", - "loc.messages.PSLIB_FileNotFound0": "找不到文件: {0}。", - "loc.messages.PSLIB_Input0": "“{0}”输入", - "loc.messages.PSLIB_InvalidPattern0": "无效的模式:“{0}”", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到叶路径:“{0}”", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路径规范化/扩展失败。路径长度不是由“{0}”的 Kernel32 子系统返回的", - "loc.messages.PSLIB_PathNotFound0": "找不到路径:“{0}”", - "loc.messages.PSLIB_Process0ExitedWithCode1": "过程“{0}”已退出,代码为“{1}”。", - "loc.messages.PSLIB_Required0": "必需: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字符串格式无效。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字符串资源关键字:“{0}”", - "loc.messages.PSLIB_TaskVariable0": "“{0}”任务变量" -} \ No newline at end of file diff --git a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson b/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson deleted file mode 100644 index 512509b..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理程式版本 {0} 或更新的版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路徑: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 服務端點認證", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 服務端點 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "為路徑列舉子目錄失敗: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "找不到檔案: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 輸入", - "loc.messages.PSLIB_InvalidPattern0": "模式無效: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到分葉路徑: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路徑正規化/展開失敗。Kernel32 子系統未傳回 '{0}' 的路徑長度", - "loc.messages.PSLIB_PathNotFound0": "找不到路徑: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "處理序 '{0}' 以返回碼 '{1}' 結束。", - "loc.messages.PSLIB_Required0": "必要項: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字串格式失敗。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字串資源索引鍵: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 工作變數" -} \ No newline at end of file diff --git a/Tasks/config/ps_modules/VstsTaskSdk/ToolFunctions.ps1 b/Tasks/config/ps_modules/VstsTaskSdk/ToolFunctions.ps1 deleted file mode 100644 index 0e82595..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/ToolFunctions.ps1 +++ /dev/null @@ -1,123 +0,0 @@ -<# -.SYNOPSIS -Asserts the agent version is at least the specified minimum. - -.PARAMETER Minimum -Minimum version - must be 2.104.1 or higher. -#> -function Assert-Agent { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [version]$Minimum) - - if (([version]'2.104.1').CompareTo($Minimum) -ge 1) { - Write-Error "Assert-Agent requires the parameter to be 2.104.1 or higher." - return - } - - $agent = Get-TaskVariable -Name 'agent.version' - if (!$agent -or $Minimum.CompareTo([version]$agent) -ge 1) { - Write-Error (Get-LocString -Key 'PSLIB_AgentVersion0Required' -ArgumentList $Minimum) - } -} - -<# -.SYNOPSIS -Asserts that a path exists. Throws if the path does not exist. - -.PARAMETER PassThru -True to return the path. -#> -function Assert-Path { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath, - [Microsoft.PowerShell.Commands.TestPathType]$PathType = [Microsoft.PowerShell.Commands.TestPathType]::Any, - [switch]$PassThru) - - if ($PathType -eq [Microsoft.PowerShell.Commands.TestPathType]::Any) { - Write-Verbose "Asserting path exists: '$LiteralPath'" - } else { - Write-Verbose "Asserting $("$PathType".ToLowerInvariant()) path exists: '$LiteralPath'" - } - - if (Test-Path -LiteralPath $LiteralPath -PathType $PathType) { - if ($PassThru) { - return $LiteralPath - } - - return - } - - $resourceKey = switch ($PathType) { - ([Microsoft.PowerShell.Commands.TestPathType]::Container) { "PSLIB_ContainerPathNotFound0" ; break } - ([Microsoft.PowerShell.Commands.TestPathType]::Leaf) { "PSLIB_LeafPathNotFound0" ; break } - default { "PSLIB_PathNotFound0" } - } - - throw (Get-LocString -Key $resourceKey -ArgumentList $LiteralPath) -} - -<# -.SYNOPSIS -Executes an external program. - -.DESCRIPTION -Executes an external program and waits for the process to exit. - -After calling this command, the exit code of the process can be retrieved from the variable $LASTEXITCODE. - -.PARAMETER Encoding -This parameter not required for most scenarios. Indicates how to interpret the encoding from the external program. An example use case would be if an external program outputs UTF-16 XML and the output needs to be parsed. - -.PARAMETER RequireExitCodeZero -Indicates whether to write an error to the error pipeline if the exit code is not zero. -#> -function Invoke-Tool { # TODO: RENAME TO INVOKE-PROCESS? - [CmdletBinding()] - param( - [ValidatePattern('^[^\r\n]*$')] - [Parameter(Mandatory = $true)] - [string]$FileName, - [ValidatePattern('^[^\r\n]*$')] - [Parameter()] - [string]$Arguments, - [string]$WorkingDirectory, - [System.Text.Encoding]$Encoding, - [switch]$RequireExitCodeZero) - - Trace-EnteringInvocation $MyInvocation - $isPushed = $false - $originalEncoding = $null - try { - if ($Encoding) { - $originalEncoding = [System.Console]::OutputEncoding - [System.Console]::OutputEncoding = $Encoding - } - - if ($WorkingDirectory) { - Push-Location -LiteralPath $WorkingDirectory -ErrorAction Stop - $isPushed = $true - } - - $FileName = $FileName.Replace('"', '').Replace("'", "''") - Write-Host "##[command]""$FileName"" $Arguments" - Invoke-Expression "& '$FileName' --% $Arguments" - Write-Verbose "Exit code: $LASTEXITCODE" - if ($RequireExitCodeZero -and $LASTEXITCODE -ne 0) { - Write-Error (Get-LocString -Key PSLIB_Process0ExitedWithCode1 -ArgumentList ([System.IO.Path]::GetFileName($FileName)), $LASTEXITCODE) - } - } finally { - if ($originalEncoding) { - [System.Console]::OutputEncoding = $originalEncoding - } - - if ($isPushed) { - Pop-Location - } - - Trace-LeavingInvocation $MyInvocation - } -} diff --git a/Tasks/config/ps_modules/VstsTaskSdk/TraceFunctions.ps1 b/Tasks/config/ps_modules/VstsTaskSdk/TraceFunctions.ps1 deleted file mode 100644 index b8e084b..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/TraceFunctions.ps1 +++ /dev/null @@ -1,139 +0,0 @@ -<# -.SYNOPSIS -Writes verbose information about the invocation being entered. - -.DESCRIPTION -Used to trace verbose information when entering a function/script. Writes an entering message followed by a short description of the invocation. Additionally each bound parameter and unbound argument is also traced. - -.PARAMETER Parameter -Wildcard pattern to control which bound parameters are traced. -#> -function Trace-EnteringInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo, - [string[]]$Parameter = '*') - - Write-Verbose "Entering $(Get-InvocationDescription $InvocationInfo)." - $OFS = ", " - if ($InvocationInfo.BoundParameters.Count -and $Parameter.Count) { - if ($Parameter.Count -eq 1 -and $Parameter[0] -eq '*') { - # Trace all parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - } - } else { - # Trace matching parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - foreach ($p in $Parameter) { - if ($key -like $p) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - break - } - } - } - } - } - - # Trace all unbound arguments. - if (@($InvocationInfo.UnboundArguments).Count) { - for ($i = 0 ; $i -lt $InvocationInfo.UnboundArguments.Count ; $i++) { - Write-Verbose " args[$i]: '$($InvocationInfo.UnboundArguments[$i])'" - } - } -} - -<# -.SYNOPSIS -Writes verbose information about the invocation being left. - -.DESCRIPTION -Used to trace verbose information when leaving a function/script. Writes a leaving message followed by a short description of the invocation. -#> -function Trace-LeavingInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo) - - Write-Verbose "Leaving $(Get-InvocationDescription $InvocationInfo)." -} - -<# -.SYNOPSIS -Writes verbose information about paths. - -.DESCRIPTION -Writes verbose information about the paths. The paths are sorted and a the common root is written only once, followed by each relative path. - -.PARAMETER PassThru -Indicates whether to return the sorted paths. -#> -function Trace-Path { - [CmdletBinding()] - param( - [string[]]$Path, - [switch]$PassThru) - - if ($Path.Count -eq 0) { - Write-Verbose "No paths." - if ($PassThru) { - $Path - } - } elseif ($Path.Count -eq 1) { - Write-Verbose "Path: $($Path[0])" - if ($PassThru) { - $Path - } - } else { - # Find the greatest common root. - $sorted = $Path | Sort-Object - $firstPath = $sorted[0].ToCharArray() - $lastPath = $sorted[-1].ToCharArray() - $commonEndIndex = 0 - $j = if ($firstPath.Length -lt $lastPath.Length) { $firstPath.Length } else { $lastPath.Length } - for ($i = 0 ; $i -lt $j ; $i++) { - if ($firstPath[$i] -eq $lastPath[$i]) { - if ($firstPath[$i] -eq '\') { - $commonEndIndex = $i - } - } else { - break - } - } - - if ($commonEndIndex -eq 0) { - # No common root. - Write-Verbose "Paths:" - foreach ($p in $sorted) { - Write-Verbose " $p" - } - } else { - Write-Verbose "Paths: $($Path[0].Substring(0, $commonEndIndex + 1))" - foreach ($p in $sorted) { - Write-Verbose " $($p.Substring($commonEndIndex + 1))" - } - } - - if ($PassThru) { - $sorted - } - } -} - -######################################## -# Private functions. -######################################## -function Get-InvocationDescription { - [CmdletBinding()] - param([System.Management.Automation.InvocationInfo]$InvocationInfo) - - if ($InvocationInfo.MyCommand.Path) { - $InvocationInfo.MyCommand.Path - } elseif ($InvocationInfo.MyCommand.Name) { - $InvocationInfo.MyCommand.Name - } else { - $InvocationInfo.MyCommand.CommandType - } -} diff --git a/Tasks/config/ps_modules/VstsTaskSdk/VstsTaskSdk.dll b/Tasks/config/ps_modules/VstsTaskSdk/VstsTaskSdk.dll deleted file mode 100644 index 54938ab05180ddaf77cf067f2501a1f97ee7e5cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25408 zcmeIa2Urx#@+jULfkmqhP%&pQASxi36%_+2 zidj)qRLqKkIbqJC|C%A{Ip^NgryDMlC=Tgb)?ppFa_* zgD?KL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config/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 deleted file mode 100644 index a1bf2c6..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 +++ /dev/null @@ -1,168 +0,0 @@ -[CmdletBinding()] -param( - [ValidateNotNull()] - [Parameter()] - [hashtable]$ModuleParameters = @{ }) - -if ($host.Name -ne 'ConsoleHost') { - Write-Warning "VstsTaskSdk is designed for use with powershell.exe (ConsoleHost). Output may be different when used with other hosts." -} - -# Private module variables. -[bool]$script:nonInteractive = "$($ModuleParameters['NonInteractive'])" -eq 'true' -Write-Verbose "NonInteractive: $script:nonInteractive" - -# VstsTaskSdk.dll contains the TerminationException and NativeMethods for handle long path -# We used to do inline C# in this powershell module -# However when csc compile the inline C#, it will hit process env block size limit since it's not use unicode to encode env -# To solve the env block size problem, we choose to put all inline C# into an assembly VstsTaskSdk.dll, signing it, package with the PS modules. -Write-Verbose "Loading compiled helper $PSScriptRoot\VstsTaskSdk.dll." -Add-Type -LiteralPath $PSScriptRoot\VstsTaskSdk.dll - -# Import/export functions. -. "$PSScriptRoot\FindFunctions.ps1" -. "$PSScriptRoot\InputFunctions.ps1" -. "$PSScriptRoot\LegacyFindFunctions.ps1" -. "$PSScriptRoot\LocalizationFunctions.ps1" -. "$PSScriptRoot\LoggingCommandFunctions.ps1" -. "$PSScriptRoot\LongPathFunctions.ps1" -. "$PSScriptRoot\ServerOMFunctions.ps1" -. "$PSScriptRoot\ToolFunctions.ps1" -. "$PSScriptRoot\TraceFunctions.ps1" -. "$PSScriptRoot\OutFunctions.ps1" # Load the out functions after all of the other functions are loaded. -Export-ModuleMember -Function @( - # Find functions. - 'Find-Match' - 'New-FindOptions' - 'New-MatchOptions' - 'Select-Match' - # Input functions. - 'Get-Endpoint' - 'Get-SecureFileTicket' - 'Get-SecureFileName' - 'Get-Input' - 'Get-TaskVariable' - 'Get-TaskVariableInfo' - 'Set-TaskVariable' - # Legacy find functions. - 'Find-Files' - # Localization functions. - 'Get-LocString' - 'Import-LocStrings' - # Logging command functions. - 'Write-AddAttachment' - 'Write-AddBuildTag' - 'Write-AssociateArtifact' - 'Write-LogDetail' - 'Write-PrependPath' - 'Write-SetEndpoint' - 'Write-SetProgress' - 'Write-SetResult' - 'Write-SetSecret' - 'Write-SetVariable' - 'Write-TaskDebug' - 'Write-TaskError' - 'Write-TaskVerbose' - 'Write-TaskWarning' - 'Write-UpdateBuildNumber' - 'Write-UpdateReleaseName' - 'Write-UploadArtifact' - 'Write-UploadBuildLog' - 'Write-UploadFile' - 'Write-UploadSummary' - # Out functions. - 'Out-Default' - # Server OM functions. - 'Get-AssemblyReference' - 'Get-TfsClientCredentials' - 'Get-TfsService' - 'Get-VssCredentials' - 'Get-VssHttpClient' - # Tool functions. - 'Assert-Agent' - 'Assert-Path' - 'Invoke-Tool' - # Trace functions. - 'Trace-EnteringInvocation' - 'Trace-LeavingInvocation' - 'Trace-Path' - # Proxy functions - 'Get-WebProxy' - # Client cert functions - 'Get-ClientCertificate' - ) - -# Override Out-Default globally. -$null = New-Item -Force -Path "function:\global:Out-Default" -Value (Get-Command -CommandType Function -Name Out-Default -ListImported) -New-Alias -Name Out-Default -Value "global:Out-Default" -Scope global - -# Perform some initialization in a script block to enable merging the pipelines. -$scriptText = @" -# Load the SDK resource strings. -Import-LocStrings "$PSScriptRoot\lib.json" - -# Load the module that contains ConvertTo-SecureString. -if (!(Get-Module -Name Microsoft.PowerShell.Security)) { - Write-Verbose "Importing the module 'Microsoft.PowerShell.Security'." - Import-Module -Name Microsoft.PowerShell.Security 2>&1 | - ForEach-Object { - if (`$_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose `$_.Exception.Message - } else { - ,`$_ - } - } -} -"@ -. ([scriptblock]::Create($scriptText)) 2>&1 3>&1 4>&1 5>&1 | Out-Default - -# Create Invoke-VstsTaskScript in a special way so it is not bound to the module. -# Otherwise calling the task script block would run within the module context. -# -# An alternative way to solve the problem is to close the script block (i.e. closure). -# However, that introduces a different problem. Closed script blocks are created within -# a dynamic module. Each module gets it's own session state separate from the global -# session state. When running in a regular script context, Import-Module calls import -# the target module into the global session state. When running in a module context, -# Import-Module calls import the target module into the caller module's session state. -# -# The goal of a task may include executing ad-hoc scripts. Therefore, task scripts -# should run in regular script context. The end user specifying an ad-hoc script expects -# the module import rules to be consistent with the default behavior (i.e. imported -# into the global session state). -$null = New-Item -Force -Path "function:\global:Invoke-VstsTaskScript" -Value ([scriptblock]::Create(@' - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [scriptblock]$ScriptBlock) - - try { - $global:ErrorActionPreference = 'Stop' - - # Initialize the environment. - $vstsModule = Get-Module -Name VstsTaskSdk - Write-Verbose "$($vstsModule.Name) $($vstsModule.Version) commit $($vstsModule.PrivateData.PSData.CommitHash)" 4>&1 | Out-Default - & $vstsModule Initialize-Inputs 4>&1 | Out-Default - - # Remove the local variable before calling the user's script. - Remove-Variable -Name vstsModule - - # Call the user's script. - $ScriptBlock | - ForEach-Object { - # Remove the scriptblock variable before calling it. - Remove-Variable -Name ScriptBlock - & $_ 2>&1 3>&1 4>&1 5>&1 | Out-Default - } - } catch [VstsTaskSdk.TerminationException] { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Task script terminated." 4>&1 | Out-Default - } catch { - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Caught exception from task script." 4>&1 | Out-Default - $_ | Out-Default - Write-Host "##vso[task.complete result=Failed]" - } -'@)) diff --git a/Tasks/config/ps_modules/VstsTaskSdk/lib.json b/Tasks/config/ps_modules/VstsTaskSdk/lib.json deleted file mode 100644 index ecdc9d0..0000000 --- a/Tasks/config/ps_modules/VstsTaskSdk/lib.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "messages": { - "PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "PSLIB_FileNotFound0": "File not found: '{0}'", - "PSLIB_Input0": "'{0}' input", - "PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "PSLIB_PathNotFound0": "Path not found: '{0}'", - "PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "PSLIB_Required0": "Required: {0}", - "PSLIB_StringFormatFailed": "String format failed.", - "PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "PSLIB_TaskVariable0": "'{0}' task variable" - } -} diff --git a/Tasks/config/task.json b/Tasks/config/task.json deleted file mode 100644 index 4fc68b7..0000000 --- a/Tasks/config/task.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "id": "f3b522f8-3419-4065-b2f2-2f744fecd2ec", - "name": "choco-config", - "friendlyName": "Chocolatey - Config", - "description": "Runs Chocolatey Config with specified parameters", - "author": "gep13", - "helpMarkDown": "", - "category": "Build", - "visibility": [ - "Build", - "Release" - ], - "demands": [], - "version": { - "Major": "0", - "Minor": "1", - "Patch": "0" - }, - "minimumAgentVersion": "1.83.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced options", - "isExpanded": false - } - ], - "instanceNameFormat": "Chocolatey Config", - "inputs": [ - { - "name": "operation", - "type": "radio", - "label": "Config Operation", - "required": true, - "defaultValue": "set", - "helpMarkDown": "Choose whether to set or unset a config value.", - "options": { - "set": "Set Value", - "unset": "Unset Value" - } - }, - { - "name": "configName", - "type": "pickList", - "label": "Config Name", - "defaultValue": "", - "options": { - "cacheLocation": "Cache Location", - "containsLegacyPackageInstalls": "Contains Legacy Package Installs", - "commandExecutionTimeoutSeconds": "Command Execution Timeout", - "proxy": "Proxy", - "proxyUser": "Proxy User", - "proxyPassword": "Proxy Password", - "webRequestTimeoutSeconds": "Web Request Timeout", - "proxyBypassList": "Proxy Bypass List", - "proxyBypassOnLocal": "Proxy Bypass On Local" - }, - "required": true, - "helpMarkDown": "The config name which is going to set or unset." - }, - { - "name": "configValue", - "type": "string", - "label": "Config Value", - "defaultValue": "", - "required": true, - "helpMarkDown": "Parameters to pass to the package.", - "visibleRule": "operation=set" - }, - { - "name": "debug", - "type": "boolean", - "label": "Show debug messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "", - "groupname": "advanced" - }, - { - "name": "verbose", - "type": "boolean", - "label": "Show verbose messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very verbose messaging, avoid using under normal circumstances.", - "groupname": "advanced" - }, - { - "name": "trace", - "type": "boolean", - "label": "Show trace messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very, very verbose trace messaging. Avoid except when needing super low-level .NET Framework debugging.", - "groupname": "advanced" - } - ], - "execution": { - "PowerShell3": { - "target": "$(currentDirectory)\\config.ps1", - "argumentFormat": "", - "workingDirectory": "$(currentDirectory)" - } - } -} diff --git a/Tasks/custom/custom.ps1 b/Tasks/custom/custom.ps1 deleted file mode 100644 index e686d17..0000000 --- a/Tasks/custom/custom.ps1 +++ /dev/null @@ -1,56 +0,0 @@ -[CmdletBinding()] -param() - -Trace-VstsEnteringInvocation $MyInvocation - -try { - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "Machine") - if(-not (Test-Path $chocoInstallLocation)) { - Write-Output "Environment variable 'ChocolateyInstall' was not found in the system variables. Attempting to find it in the user variables..." - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "User") - } - - $chocoExe = "$chocoInstallLocation\choco.exe" - - if (-not (Test-Path $chocoExe)) { - throw "Chocolatey was not found." - } - - [string]$command = Get-VstsInput -Name 'command' -Require - [string]$arguments = Get-VstsInput -Name 'arguments' - [bool]$debug = Get-VstsInput -Name 'debug' -AsBool -Default $false - [bool]$verbose = Get-VstsInput -Name 'verbose' -AsBool -Default $false - [bool]$trace = Get-VstsInput -Name 'trace' -AsBool -Default $false - - $chocolateyVersion = & $chocoExe --version - Write-Output "Running Chocolatey Version: $chocolateyVersion" - - $chocolateyArguments = @() - - if($arguments) { - Write-Output "Adding arguments" - $chocolateyArguments += @($arguments, "") - } - - if($debug) { - Write-Output "Adding --debug to arguments" - $chocolateyArguments += @("--debug", "") - } - - if($verbose) { - Write-Output "Adding --verbose to arguments" - $chocolateyArguments += @("--verbose", "") - } - - if($trace) { - Write-Output "Adding --trace to arguments" - $chocolateyArguments += @("--trace", "") - } - - & $chocoExe $command $($chocolateyArguments) -} catch { - Write-VstsTaskError $_.Exception.Message - throw -} finally { - Trace-VstsLeavingInvocation $MyInvocation -} diff --git a/Tasks/custom/icon.png b/Tasks/custom/icon.png deleted file mode 100755 index ab05af71592b547960e4fcf1f5d527bece1fd5c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2656 zcmY*bc|6o>7yp&5nTW_XQyF7lXG|nABl{9z2o*AxVaQ;NEtRov*Bv(hrKxhFDVoxG4buln4OW*xUDC0l*�JDw&pneYk z1ijO)x9RU=K|Y38`~cu6-+>(hvL6Tmz@aMyD_gRysfoI?x0fQ$#oNhMG04kj9}NH+ zLF)UVmn#_u3-Y=_^ivN)!+#;v_v3>!0uK8HA$y|Xwx;GV9dD8=Ohr*y5edhDVKA5m z$px>D)z$x}egA}pyOYU2>Ig(&V4z~)8AWfB8$wAcFl({#nSu%ZdvvL%wT5M?USLS_lI1E z!e!!CZ!DnQx^^6xYv``$x*8e0n?0JCAsf>Qp7;U$7p&xazpS*`uL}azE7*a)DF3yb z^|}*gs<}`RziUQipLJfTsO8;iDp#orfd#)y-ea2Hp74-%+fWJ}o#Y5f)-&-fEfDP$ zjBd_<`3RY7KHG0m<=clw-ExluH{nEEj`KgR&3A`(MjQ#fCoR-GydGP}JEI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tC6X@<8!WJT!5i=j|k-|wdS%Bc*v zi^*^zqSeu8c#$-AG#d+?&9_GeiqMdbK5QqW%C-P_Z -function Find-Match { - [CmdletBinding()] - param( - [Parameter()] - [string]$DefaultRoot, - [Parameter()] - [string[]]$Pattern, - $FindOptions, - $MatchOptions) - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Apply defaults for parameters and trace. - if (!$DefaultRoot) { - $DefaultRoot = Get-TaskVariable -Name 'System.DefaultWorkingDirectory' -Default (Get-Location).Path - } - - Write-Verbose "DefaultRoot: '$DefaultRoot'" - if (!$FindOptions) { - $FindOptions = New-FindOptions -FollowSpecifiedSymbolicLink -FollowSymbolicLinks - } - - Trace-FindOptions -Options $FindOptions - if (!$MatchOptions) { - $MatchOptions = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $MatchOptions - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Normalize slashes for root dir. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - $results = @{ } - $originalMatchOptions = $MatchOptions - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $MatchOptions = Copy-MatchOptions -Options $originalMatchOptions - - # Skip comments. - if (!$MatchOptions.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $MatchOptions.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$MatchOptions.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$MatchOptions.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $MatchOptions.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $MatchOptions.NoNegate = $true - $MatchOptions.FlipNegate = $false - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Expand braces - required to accurately interpret findPath. - $expanded = $null - $preExpanded = $pat - if ($MatchOptions.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - } - - # Set NoBrace. - $MatchOptions.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - if ($isIncludePattern) { - # Determine the findPath. - $findInfo = Get-FindInfoFromPattern -DefaultRoot $DefaultRoot -Pattern $pat -MatchOptions $MatchOptions - $findPath = $findInfo.FindPath - Write-Verbose "FindPath: '$findPath'" - - if (!$findPath) { - Write-Verbose "Skipping empty path." - continue - } - - # Perform the find. - Write-Verbose "StatOnly: '$($findInfo.StatOnly)'" - [string[]]$findResults = @( ) - if ($findInfo.StatOnly) { - # Simply stat the path - all path segments were used to build the path. - if ((Test-Path -LiteralPath $findPath)) { - $findResults += $findPath - } - } else { - $findResults = Get-FindResult -Path $findPath -Options $FindOptions - } - - Write-Verbose "Found $($findResults.Count) paths." - - # Apply the pattern. - Write-Verbose "Applying include pattern." - if ($findInfo.AdjustedPattern -ne $pat) { - Write-Verbose "AdjustedPattern: '$($findInfo.AdjustedPattern)'" - $pat = $findInfo.AdjustedPattern - } - - $matchResults = [Minimatch.Minimatcher]::Filter( - $findResults, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results[$matchResult.ToUpperInvariant()] = $matchResult - } - - Write-Verbose "$matchCount matches" - } else { - # Check if basename only and MatchBase=true. - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $pat) -and - ($pat -replace '\\', '/').IndexOf('/') -lt 0) { - - # Do not root the pattern. - Write-Verbose "MatchBase and basename only." - } else { - # Root the exclude pattern. - $pat = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - # Apply the pattern. - Write-Verbose 'Applying exclude pattern.' - $matchResults = [Minimatch.Minimatcher]::Filter( - [string[]]$results.Values, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results.Remove($matchResult.ToUpperInvariant()) - } - - Write-Verbose "$matchCount matches" - } - } - } - - $finalResult = @( $results.Values | Sort-Object ) - Write-Verbose "$($finalResult.Count) final results" - return $finalResult - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Creates FindOptions for use with Find-VstsMatch. - -.DESCRIPTION -Creates FindOptions for use with Find-VstsMatch. Contains switches to control whether to follow symlinks. - -.PARAMETER FollowSpecifiedSymbolicLink -Indicates whether to traverse descendants if the specified path is a symbolic link directory. Does not cause nested symbolic link directories to be traversed. - -.PARAMETER FollowSymbolicLinks -Indicates whether to traverse descendants of symbolic link directories. -#> -function New-FindOptions { - [CmdletBinding()] - param( - [switch]$FollowSpecifiedSymbolicLink, - [switch]$FollowSymbolicLinks) - - return New-Object psobject -Property @{ - FollowSpecifiedSymbolicLink = $FollowSpecifiedSymbolicLink.IsPresent - FollowSymbolicLinks = $FollowSymbolicLinks.IsPresent - } -} - -<# -.SYNOPSIS -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. - -.DESCRIPTION -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. Contains switches to control which pattern matching options are applied. -#> -function New-MatchOptions { - [CmdletBinding()] - param( - [switch]$Dot, - [switch]$FlipNegate, - [switch]$MatchBase, - [switch]$NoBrace, - [switch]$NoCase, - [switch]$NoComment, - [switch]$NoExt, - [switch]$NoGlobStar, - [switch]$NoNegate, - [switch]$NoNull) - - return New-Object psobject -Property @{ - Dot = $Dot.IsPresent - FlipNegate = $FlipNegate.IsPresent - MatchBase = $MatchBase.IsPresent - NoBrace = $NoBrace.IsPresent - NoCase = $NoCase.IsPresent - NoComment = $NoComment.IsPresent - NoExt = $NoExt.IsPresent - NoGlobStar = $NoGlobStar.IsPresent - NoNegate = $NoNegate.IsPresent - NoNull = $NoNull.IsPresent - } -} - -<# -.SYNOPSIS -Applies match patterns against a list of files. - -.DESCRIPTION -Applies match patterns to a list of paths. Supports interleaved exclude patterns. - -.PARAMETER ItemPath -Array of paths. - -.PARAMETER Pattern -Patterns to apply. Supports interleaved exclude patterns. - -.PARAMETER PatternRoot -Default root to apply to unrooted patterns. Not applied to basename-only patterns when Options.MatchBase is true. - -.PARAMETER Options -When the Options parameter is not specified, defaults to (New-VstsMatchOptions -Dot -NoBrace -NoCase). -#> -function Select-Match { - [CmdletBinding()] - param( - [Parameter()] - [string[]]$ItemPath, - [Parameter()] - [string[]]$Pattern, - [Parameter()] - [string]$PatternRoot, - $Options) - - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - if (!$Options) { - $Options = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $Options - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Hashtable to keep track of matches. - $map = @{ } - - $originalOptions = $Options - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $Options = Copy-MatchOptions -Options $originalOptions - - # Skip comments. - if (!$Options.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $Options.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$Options.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$Options.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $Options.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $Options.NoNegate = $true - $Options.FlipNegate = $false - - # Expand braces - required to accurately root patterns. - $expanded = $null - $preExpanded = $pat - if ($Options.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $Options)) - } - - # Set NoBrace. - $Options.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - # Root the pattern when all of the following conditions are true: - if ($PatternRoot -and # PatternRoot is supplied - !(Test-Rooted -Path $pat) -and # AND pattern is not rooted - # # AND MatchBase=false or not basename only - (!$Options.MatchBase -or ($pat -replace '\\', '/').IndexOf('/') -ge 0)) { - - # Root the include pattern. - $pat = Get-RootedPattern -DefaultRoot $PatternRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - if ($isIncludePattern) { - # Apply the pattern. - Write-Verbose 'Applying include pattern against original list.' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map[$matchResult] = $true - } - - Write-Verbose "$matchCount matches" - } else { - # Apply the pattern. - Write-Verbose 'Applying exclude pattern against original list' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map.Remove($matchResult) - } - - Write-Verbose "$matchCount matches" - } - } - } - - # return a filtered version of the original list (preserves order and prevents duplication) - $result = $ItemPath | Where-Object { $map[$_] } - Write-Verbose "$($result.Count) final results" - $result - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -################################################################################ -# Private functions. -################################################################################ - -function Copy-MatchOptions { - [CmdletBinding()] - param($Options) - - return New-Object psobject -Property @{ - Dot = $Options.Dot -eq $true - FlipNegate = $Options.FlipNegate -eq $true - MatchBase = $Options.MatchBase -eq $true - NoBrace = $Options.NoBrace -eq $true - NoCase = $Options.NoCase -eq $true - NoComment = $Options.NoComment -eq $true - NoExt = $Options.NoExt -eq $true - NoGlobStar = $Options.NoGlobStar -eq $true - NoNegate = $Options.NoNegate -eq $true - NoNull = $Options.NoNull -eq $true - } -} - -function ConvertTo-MinimatchOptions { - [CmdletBinding()] - param($Options) - - $opt = New-Object Minimatch.Options - $opt.AllowWindowsPaths = $true - $opt.Dot = $Options.Dot -eq $true - $opt.FlipNegate = $Options.FlipNegate -eq $true - $opt.MatchBase = $Options.MatchBase -eq $true - $opt.NoBrace = $Options.NoBrace -eq $true - $opt.NoCase = $Options.NoCase -eq $true - $opt.NoComment = $Options.NoComment -eq $true - $opt.NoExt = $Options.NoExt -eq $true - $opt.NoGlobStar = $Options.NoGlobStar -eq $true - $opt.NoNegate = $Options.NoNegate -eq $true - $opt.NoNull = $Options.NoNull -eq $true - return $opt -} - -function ConvertTo-NormalizedSeparators { - [CmdletBinding()] - param([string]$Path) - - # Convert slashes. - $Path = "$Path".Replace('/', '\') - - # Remove redundant slashes. - $isUnc = $Path -match '^\\\\+[^\\]' - $Path = $Path -replace '\\\\+', '\' - if ($isUnc) { - $Path = '\' + $Path - } - - return $Path -} - -function Get-FindInfoFromPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern, - [Parameter(Mandatory = $true)] - $MatchOptions) - - if (!$MatchOptions.NoBrace) { - throw "Get-FindInfoFromPattern expected MatchOptions.NoBrace to be true." - } - - # For the sake of determining the find path, pretend NoCase=false. - $MatchOptions = Copy-MatchOptions -Options $MatchOptions - $MatchOptions.NoCase = $false - - # Check if basename only and MatchBase=true - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $Pattern) -and - ($Pattern -replace '\\', '/').IndexOf('/') -lt 0) { - - return New-Object psobject -Property @{ - AdjustedPattern = $Pattern - FindPath = $DefaultRoot - StatOnly = $false - } - } - - # The technique applied by this function is to use the information on the Minimatch object determine - # the findPath. Minimatch breaks the pattern into path segments, and exposes information about which - # segments are literal vs patterns. - # - # Note, the technique currently imposes a limitation for drive-relative paths with a glob in the - # first segment, e.g. C:hello*/world. It's feasible to overcome this limitation, but is left unsolved - # for now. - $minimatchObj = New-Object Minimatch.Minimatcher($Pattern, (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # The "set" field is a two-dimensional enumerable of parsed path segment info. The outer enumerable should only - # contain one item, otherwise something went wrong. Brace expansion can result in multiple items in the outer - # enumerable, but that should be turned off by the time this function is reached. - # - # Note, "set" is a private field in the .NET implementation but is documented as a feature in the nodejs - # implementation. The .NET implementation is a port and is by a different author. - $setFieldInfo = $minimatchObj.GetType().GetField('set', 'Instance,NonPublic') - [object[]]$set = $setFieldInfo.GetValue($minimatchObj) - if ($set.Count -ne 1) { - throw "Get-FindInfoFromPattern expected Minimatch.Minimatcher(...).set.Count to be 1. Actual: '$($set.Count)'" - } - - [string[]]$literalSegments = @( ) - [object[]]$parsedSegments = $set[0] - foreach ($parsedSegment in $parsedSegments) { - if ($parsedSegment.GetType().Name -eq 'LiteralItem') { - # The item is a LiteralItem when the original input for the path segment does not contain any - # unescaped glob characters. - $literalSegments += $parsedSegment.Source; - continue - } - - break; - } - - # Join the literal segments back together. Minimatch converts '\' to '/' on Windows, then squashes - # consequetive slashes, and finally splits on slash. This means that UNC format is lost, but can - # be detected from the original pattern. - $joinedSegments = [string]::Join('/', $literalSegments) - if ($joinedSegments -and ($Pattern -replace '\\', '/').StartsWith('//')) { - $joinedSegments = '/' + $joinedSegments # restore UNC format - } - - # Determine the find path. - $findPath = '' - if ((Test-Rooted -Path $Pattern)) { # The pattern is rooted. - $findPath = $joinedSegments - } elseif ($joinedSegments) { # The pattern is not rooted, and literal segements were found. - $findPath = [System.IO.Path]::Combine($DefaultRoot, $joinedSegments) - } else { # The pattern is not rooted, and no literal segements were found. - $findPath = $DefaultRoot - } - - # Clean up the path. - if ($findPath) { - $findPath = [System.IO.Path]::GetDirectoryName(([System.IO.Path]::Combine($findPath, '_'))) # Hack to remove unnecessary trailing slash. - $findPath = ConvertTo-NormalizedSeparators -Path $findPath - } - - return New-Object psobject -Property @{ - AdjustedPattern = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $Pattern - FindPath = $findPath - StatOnly = $literalSegments.Count -eq $parsedSegments.Count - } -} - -function Get-FindResult { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - $Options) - - if (!(Test-Path -LiteralPath $Path)) { - Write-Verbose 'Path not found.' - return - } - - $Path = ConvertTo-NormalizedSeparators -Path $Path - - # Push the first item. - [System.Collections.Stack]$stack = New-Object System.Collections.Stack - $stack.Push((Get-Item -LiteralPath $Path)) - - $count = 0 - while ($stack.Count) { - # Pop the next item and yield the result. - $item = $stack.Pop() - $count++ - $item.FullName - - # Traverse. - if (($item.Attributes -band 0x00000010) -eq 0x00000010) { # Directory - if (($item.Attributes -band 0x00000400) -ne 0x00000400 -or # ReparsePoint - $Options.FollowSymbolicLinks -or - ($count -eq 1 -and $Options.FollowSpecifiedSymbolicLink)) { - - $childItems = @( Get-DirectoryChildItem -Path $Item.FullName -Force ) - [System.Array]::Reverse($childItems) - foreach ($childItem in $childItems) { - $stack.Push($childItem) - } - } - } - } -} - -function Get-RootedPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern) - - if ((Test-Rooted -Path $Pattern)) { - return $Pattern - } - - # Normalize root. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - # Escape special glob characters. - $DefaultRoot = $DefaultRoot -replace '(\[)(?=[^\/]+\])', '[[]' # Escape '[' when ']' follows within the path segment - $DefaultRoot = $DefaultRoot.Replace('?', '[?]') # Escape '?' - $DefaultRoot = $DefaultRoot.Replace('*', '[*]') # Escape '*' - $DefaultRoot = $DefaultRoot -replace '\+\(', '[+](' # Escape '+(' - $DefaultRoot = $DefaultRoot -replace '@\(', '[@](' # Escape '@(' - $DefaultRoot = $DefaultRoot -replace '!\(', '[!](' # Escape '!(' - - if ($DefaultRoot -like '[A-Z]:') { # e.g. C: - return "$DefaultRoot$Pattern" - } - - # Ensure root ends with a separator. - if (!$DefaultRoot.EndsWith('\')) { - $DefaultRoot = "$DefaultRoot\" - } - - return "$DefaultRoot$Pattern" -} - -function Test-Rooted { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - $Path = ConvertTo-NormalizedSeparators -Path $Path - return $Path.StartsWith('\') -or # e.g. \ or \hello or \\hello - $Path -like '[A-Z]:*' # e.g. C: or C:\hello -} - -function Trace-MatchOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "MatchOptions.Dot: '$($Options.Dot)'" - Write-Verbose "MatchOptions.FlipNegate: '$($Options.FlipNegate)'" - Write-Verbose "MatchOptions.MatchBase: '$($Options.MatchBase)'" - Write-Verbose "MatchOptions.NoBrace: '$($Options.NoBrace)'" - Write-Verbose "MatchOptions.NoCase: '$($Options.NoCase)'" - Write-Verbose "MatchOptions.NoComment: '$($Options.NoComment)'" - Write-Verbose "MatchOptions.NoExt: '$($Options.NoExt)'" - Write-Verbose "MatchOptions.NoGlobStar: '$($Options.NoGlobStar)'" - Write-Verbose "MatchOptions.NoNegate: '$($Options.NoNegate)'" - Write-Verbose "MatchOptions.NoNull: '$($Options.NoNull)'" -} - -function Trace-FindOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "FindOptions.FollowSpecifiedSymbolicLink: '$($FindOptions.FollowSpecifiedSymbolicLink)'" - Write-Verbose "FindOptions.FollowSymbolicLinks: '$($FindOptions.FollowSymbolicLinks)'" -} diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/InputFunctions.ps1 b/Tasks/custom/ps_modules/VstsTaskSdk/InputFunctions.ps1 deleted file mode 100644 index 846492d..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/InputFunctions.ps1 +++ /dev/null @@ -1,493 +0,0 @@ -# Hash table of known variable info. The formatted env var name is the lookup key. -# -# The purpose of this hash table is to keep track of known variables. The hash table -# needs to be maintained for multiple reasons: -# 1) to distinguish between env vars and job vars -# 2) to distinguish between secret vars and public -# 3) to know the real variable name and not just the formatted env var name. -$script:knownVariables = @{ } -$script:vault = @{ } - -<# -.SYNOPSIS -Gets an endpoint. - -.DESCRIPTION -Gets an endpoint object for the specified endpoint name. The endpoint is returned as an object with three properties: Auth, Data, and Url. - -The Data property requires a 1.97 agent or higher. - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-Endpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the URL. - $description = Get-LocString -Key PSLIB_EndpointUrl0 -ArgumentList $Name - $key = "ENDPOINT_URL_$Name" - $url = Get-VaultValue -Description $description -Key $key -Require:$Require - - # Get the auth object. - $description = Get-LocString -Key PSLIB_EndpointAuth0 -ArgumentList $Name - $key = "ENDPOINT_AUTH_$Name" - if ($auth = (Get-VaultValue -Description $description -Key $key -Require:$Require)) { - $auth = ConvertFrom-Json -InputObject $auth - } - - # Get the data. - $description = "'$Name' service endpoint data" - $key = "ENDPOINT_DATA_$Name" - if ($data = (Get-VaultValue -Description $description -Key $key)) { - $data = ConvertFrom-Json -InputObject $data - } - - # Return the endpoint. - if ($url -or $auth -or $data) { - New-Object -TypeName psobject -Property @{ - Url = $url - Auth = $auth - Data = $data - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file ticket. - -.DESCRIPTION -Gets the secure file ticket that can be used to download the secure file contents. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileTicket { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_TICKET_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file name. - -.DESCRIPTION -Gets the name for a secure file. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_NAME_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets an input. - -.DESCRIPTION -Gets the value for the specified input name. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-Input { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - # Get the input from the vault. Splat the bound parameters hashtable. Splatting is required - # in order to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Name - $key = "INPUT_$($Name.Replace(' ', '_').ToUpperInvariant())" - Get-VaultValue @PSBoundParameters -Description $description -Key $key -} - -<# -.SYNOPSIS -Gets a task variable. - -.DESCRIPTION -Gets the value for the specified task variable. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-TaskVariable { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - $description = Get-LocString -Key PSLIB_TaskVariable0 -ArgumentList $Name - $variableKey = Get-VariableKey -Name $Name - if ($script:knownVariables.$variableKey.Secret) { - # Get secret variable. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $vaultKey = "SECRET_$variableKey" - Get-VaultValue @PSBoundParameters -Description $description -Key $vaultKey - } else { - # Get public variable. - $item = $null - $path = "Env:$variableKey" - if ((Test-Path -LiteralPath $path) -and ($item = Get-Item -LiteralPath $path).Value) { - # Intentionally empty. Value was successfully retrieved. - } elseif (!$script:nonInteractive) { - # The value wasn't found and the module is running in interactive dev mode. - # Prompt for the value. - Set-Item -LiteralPath $path -Value (Read-Host -Prompt $description) - if (Test-Path -LiteralPath $path) { - $item = Get-Item -LiteralPath $path - } - } - - # Get the converted value. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - Get-Value @PSBoundParameters -Description $description -Key $variableKey -Value $item.Value - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets all job variables available to the task. Requires 2.104.1 agent or higher. - -.DESCRIPTION -Gets a snapshot of the current state of all job variables available to the task. -Requires a 2.104.1 agent or higher for full functionality. - -Returns an array of objects with the following properties: - [string]Name - [string]Value - [bool]Secret - -Limitations on an agent prior to 2.104.1: - 1) The return value does not include all public variables. Only public variables - that have been added using setVariable are returned. - 2) The name returned for each secret variable is the formatted environment variable - name, not the actual variable name (unless it was set explicitly at runtime using - setVariable). -#> -function Get-TaskVariableInfo { - [CmdletBinding()] - param() - - foreach ($info in $script:knownVariables.Values) { - New-Object -TypeName psobject -Property @{ - Name = $info.Name - Value = Get-TaskVariable -Name $info.Name - Secret = $info.Secret - } - } -} - -<# -.SYNOPSIS -Sets a task variable. - -.DESCRIPTION -Sets a task variable in the current task context as well as in the current job context. This allows the task variable to retrieved by subsequent tasks within the same job. -#> -function Set-TaskVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret) - - # Once a secret always a secret. - $variableKey = Get-VariableKey -Name $Name - [bool]$Secret = $Secret -or $script:knownVariables.$variableKey.Secret - if ($Secret) { - $vaultKey = "SECRET_$variableKey" - if (!$Value) { - # Clear the secret. - Write-Verbose "Set $Name = ''" - $script:vault.Remove($vaultKey) - } else { - # Store the secret in the vault. - Write-Verbose "Set $Name = '********'" - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Set-Item -LiteralPath "Env:$variableKey" -Value '' - } else { - # Set the environment variable. - Write-Verbose "Set $Name = '$Value'" - Set-Item -LiteralPath "Env:$variableKey" -Value $Value - } - - # Store the metadata. - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $Secret - } - - # Persist the variable in the task context. - Write-SetVariable -Name $Name -Value $Value -Secret:$Secret -} - -######################################## -# Private functions. -######################################## -function Get-VaultValue { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - # Attempt to get the vault value. - $value = $null - if ($psCredential = $script:vault[$Key]) { - $value = $psCredential.GetNetworkCredential().Password - } elseif (!$script:nonInteractive) { - # The value wasn't found. Prompt for the value if running in interactive dev mode. - $value = Read-Host -Prompt $Description - if ($value) { - $script:vault[$Key] = New-Object System.Management.Automation.PSCredential( - $Key, - (ConvertTo-SecureString -String $value -AsPlainText -Force)) - } - } - - Get-Value -Value $value @PSBoundParameters -} - -function Get-Value { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [string]$Value, - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - $result = $Value - if ($result) { - if ($Key -like 'ENDPOINT_AUTH_*') { - Write-Verbose "$($Key): '********'" - } else { - Write-Verbose "$($Key): '$result'" - } - } else { - Write-Verbose "$Key (empty)" - - # Write error if required. - if ($Require) { - Write-Error "$(Get-LocString -Key PSLIB_Required0 $Description)" - return - } - - # Fallback to the default if provided. - if ($PSCmdlet.ParameterSetName -eq 'Default') { - $result = $Default - $OFS = ' ' - Write-Verbose " Defaulted to: '$result'" - } else { - $result = '' - } - } - - # Convert to bool if specified. - if ($AsBool) { - if ($result -isnot [bool]) { - $result = "$result" -in '1', 'true' - Write-Verbose " Converted to bool: $result" - } - - return $result - } - - # Convert to int if specified. - if ($AsInt) { - if ($result -isnot [int]) { - try { - $result = [int]"$result" - } catch { - $result = 0 - } - - Write-Verbose " Converted to int: $result" - } - - return $result - } - - return $result -} - -function Initialize-Inputs { - # Store endpoints, inputs, and secret variables in the vault. - foreach ($variable in (Get-ChildItem -Path Env:ENDPOINT_?*, Env:INPUT_?*, Env:SECRET_?*, Env:SECUREFILE_?*)) { - # Record the secret variable metadata. This is required by Get-TaskVariable to - # retrieve the value. In a 2.104.1 agent or higher, this metadata will be overwritten - # when $env:VSTS_SECRET_VARIABLES is processed. - if ($variable.Name -like 'SECRET_?*') { - $variableKey = $variable.Name.Substring('SECRET_'.Length) - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - # This is technically not the variable name (has underscores instead of dots), - # but it's good enough to make Get-TaskVariable work in a pre-2.104.1 agent - # where $env:VSTS_SECRET_VARIABLES is not defined. - Name = $variableKey - Secret = $true - } - } - - # Store the value in the vault. - $vaultKey = $variable.Name - if ($variable.Value) { - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $variable.Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Remove-Item -LiteralPath "Env:$($variable.Name)" - } - - # Record the public variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_PUBLIC_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_PUBLIC_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $false - } - } - - $env:VSTS_PUBLIC_VARIABLES = '' - } - - # Record the secret variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_SECRET_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_SECRET_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $true - } - } - - $env:VSTS_SECRET_VARIABLES = '' - } -} - -function Get-VariableKey { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name) - - if ($Name -ne 'agent.jobstatus') { - $Name = $Name.Replace('.', '_') - } - - $Name.ToUpperInvariant() -} diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 b/Tasks/custom/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 deleted file mode 100644 index b4080ae..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 +++ /dev/null @@ -1,320 +0,0 @@ -<# -.SYNOPSIS -Finds files or directories. - -.DESCRIPTION -Finds files or directories using advanced pattern matching. - -.PARAMETER LiteralDirectory -Directory to search. - -.PARAMETER LegacyPattern -Proprietary pattern format. The LiteralDirectory parameter is used to root any unrooted patterns. - -Separate multiple patterns using ";". Escape actual ";" in the path by using ";;". -"?" indicates a wildcard that represents any single character within a path segment. -"*" indicates a wildcard that represents zero or more characters within a path segment. -"**" as the entire path segment indicates a recursive search. -"**" within a path segment indicates a recursive intersegment wildcard. -"+:" (can be omitted) indicates an include pattern. -"-:" indicates an exclude pattern. - -The result is from the command is a union of all the matches from the include patterns, minus the matches from the exclude patterns. - -.PARAMETER IncludeFiles -Indicates whether to include files in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER IncludeDirectories -Indicates whether to include directories in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER Force -Indicates whether to include hidden items. - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is?Match.txt" - -Given: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt -C:\Directory\IsNotMatch.txt - -Returns: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is*Match.txt" - -Given: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt -C:\Directory\NonMatch.txt - -Returns: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**\Match.txt" - -Given: -C:\Directory\Match.txt -C:\Directory\NotAMatch.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -Returns: -C:\Directory\Match.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**" - -Given: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -Returns: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Sub**Match.txt" - -Given: -C:\Directory\IsNotAMatch.txt -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\IsNot.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsNot.txt - -Returns: -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -#> -function Find-Files { - [CmdletBinding()] - param( - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$LiteralDirectory, - [Parameter(Mandatory = $true)] - [string]$LegacyPattern, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - # Note, due to subtle implementation details of Get-PathPrefix/Get-PathIterator, - # this function does not appear to be able to search the root of a drive and other - # cases where Path.GetDirectoryName() returns empty. More details in Get-PathPrefix. - - Trace-EnteringInvocation $MyInvocation - if (!$IncludeFiles -and !$IncludeDirectories) { - $IncludeFiles = $true - } - - $includePatterns = New-Object System.Collections.Generic.List[string] - $excludePatterns = New-Object System.Collections.Generic.List[System.Text.RegularExpressions.Regex] - $LegacyPattern = $LegacyPattern.Replace(';;', "`0") - foreach ($pattern in $LegacyPattern.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries)) { - $pattern = $pattern.Replace("`0", ';') - $isIncludePattern = Test-IsIncludePattern -Pattern ([ref]$pattern) - if ($LiteralDirectory -and !([System.IO.Path]::IsPathRooted($pattern))) { - # Use the root directory provided to make the pattern a rooted path. - $pattern = [System.IO.Path]::Combine($LiteralDirectory, $pattern) - } - - # Validate pattern does not end with a \. - if ($pattern[$pattern.Length - 1] -eq [System.IO.Path]::DirectorySeparatorChar) { - throw (Get-LocString -Key PSLIB_InvalidPattern0 -ArgumentList $pattern) - } - - if ($isIncludePattern) { - $includePatterns.Add($pattern) - } else { - $excludePatterns.Add((Convert-PatternToRegex -Pattern $pattern)) - } - } - - $count = 0 - foreach ($path in (Get-MatchingItems -IncludePatterns $includePatterns -ExcludePatterns $excludePatterns -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force)) { - $count++ - $path - } - - Write-Verbose "Total found: $count" - Trace-LeavingInvocation $MyInvocation -} - -######################################## -# Private functions. -######################################## -function Convert-PatternToRegex { - [CmdletBinding()] - param([string]$Pattern) - - $Pattern = [regex]::Escape($Pattern.Replace('\', '/')). # Normalize separators and regex escape. - Replace('/\*\*/', '((/.+/)|(/))'). # Replace directory globstar. - Replace('\*\*', '.*'). # Replace remaining globstars with a wildcard that can span directory separators. - Replace('\*', '[^/]*'). # Replace asterisks with a wildcard that cannot span directory separators. - # bug: should be '[^/]' instead of '.' - Replace('\?', '.') # Replace single character wildcards. - New-Object regex -ArgumentList "^$Pattern`$", ([System.Text.RegularExpressions.RegexOptions]::IgnoreCase) -} - -function Get-FileNameFilter { - [CmdletBinding()] - param([string]$Pattern) - - $index = $Pattern.LastIndexOf('\') - if ($index -eq -1 -or # Pattern does not contain a backslash. - !($Pattern = $Pattern.Substring($index + 1)) -or # Pattern ends in a backslash. - $Pattern.Contains('**')) # Last segment contains an inter-segment wildcard. - { - return '*' - } - - # bug? is this supposed to do substring? - return $Pattern -} - -function Get-MatchingItems { - [CmdletBinding()] - param( - [System.Collections.Generic.List[string]]$IncludePatterns, - [System.Collections.Generic.List[regex]]$ExcludePatterns, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - Trace-EnteringInvocation $MyInvocation - $allFiles = New-Object System.Collections.Generic.HashSet[string] - foreach ($pattern in $IncludePatterns) { - $pathPrefix = Get-PathPrefix -Pattern $pattern - $fileNameFilter = Get-FileNameFilter -Pattern $pattern - $patternRegex = Convert-PatternToRegex -Pattern $pattern - # Iterate over the directories and files under the pathPrefix. - Get-PathIterator -Path $pathPrefix -Filter $fileNameFilter -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force | - ForEach-Object { - # Normalize separators. - $normalizedPath = $_.Replace('\', '/') - # **/times/** will not match C:/fun/times because there isn't a trailing slash. - # So try both if including directories. - $alternatePath = "$normalizedPath/" # potential bug: it looks like this will result in a false - # positive if the item is a regular file and not a directory - - $isMatch = $false - if ($patternRegex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $patternRegex.IsMatch($alternatePath))) { - $isMatch = $true - - # Test whether the path should be excluded. - foreach ($regex in $ExcludePatterns) { - if ($regex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $regex.IsMatch($alternatePath))) { - $isMatch = $false - break - } - } - } - - if ($isMatch) { - $null = $allFiles.Add($_) - } - } - } - - Trace-Path -Path $allFiles -PassThru - Trace-LeavingInvocation $MyInvocation -} - -function Get-PathIterator { - [CmdletBinding()] - param( - [string]$Path, - [string]$Filter, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - if (!$Path) { - return - } - - # bug: this returns the dir without verifying whether exists - if ($IncludeDirectories) { - $Path - } - - Get-DirectoryChildItem -Path $Path -Filter $Filter -Force:$Force -Recurse | - ForEach-Object { - if ($_.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - if ($IncludeDirectories) { - $_.FullName - } - } elseif ($IncludeFiles) { - $_.FullName - } - } -} - -function Get-PathPrefix { - [CmdletBinding()] - param([string]$Pattern) - - # Note, unable to search root directories is a limitation due to subtleties of this function - # and downstream code in Get-PathIterator that short-circuits when the path prefix is empty. - # This function uses Path.GetDirectoryName() to determine the path prefix, which will yield - # empty in some cases. See the following examples of Path.GetDirectoryName() input => output: - # C:/ => - # C:/hello => C:\ - # C:/hello/ => C:\hello - # C:/hello/world => C:\hello - # C:/hello/world/ => C:\hello\world - # C: => - # C:hello => C: - # C:hello/ => C:hello - # / => - # /hello => \ - # /hello/ => \hello - # //hello => - # //hello/ => - # //hello/world => - # //hello/world/ => \\hello\world - - $index = $Pattern.IndexOfAny([char[]]@('*'[0], '?'[0])) - if ($index -eq -1) { - # If no wildcards are found, return the directory name portion of the path. - # If there is no directory name (file name only in pattern), this will return empty string. - return [System.IO.Path]::GetDirectoryName($Pattern) - } - - [System.IO.Path]::GetDirectoryName($Pattern.Substring(0, $index)) -} - -function Test-IsIncludePattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [ref]$Pattern) - - # Include patterns start with +: or anything except -: - # Exclude patterns start with -: - if ($Pattern.value.StartsWith("+:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $true - } elseif ($Pattern.value.StartsWith("-:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $false - } else { - # No prefix, so leave the string alone. - $true; - } -} diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 b/Tasks/custom/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 deleted file mode 100644 index c31790c..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 +++ /dev/null @@ -1,150 +0,0 @@ -$script:resourceStrings = @{ } - -<# -.SYNOPSIS -Gets a localized resource string. - -.DESCRIPTION -Gets a localized resource string and optionally formats the string with arguments. - -If the format fails (due to a bad format string or incorrect expected arguments in the format string), then the format string is returned followed by each of the arguments (delimited by a space). - -If the lookup key is not found, then the lookup key is returned followed by each of the arguments (delimited by a space). - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-LocString { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true, Position = 1)] - [string]$Key, - [Parameter(Position = 2)] - [object[]]$ArgumentList = @( )) - - # Due to the dynamically typed nature of PowerShell, a single null argument passed - # to an array parameter is interpreted as a null array. - if ([object]::ReferenceEquals($null, $ArgumentList)) { - $ArgumentList = @( $null ) - } - - # Lookup the format string. - $format = '' - if (!($format = $script:resourceStrings[$Key])) { - # Warn the key was not found. Prevent recursion if the lookup key is the - # "string resource key not found" lookup key. - $resourceNotFoundKey = 'PSLIB_StringResourceKeyNotFound0' - if ($key -ne $resourceNotFoundKey) { - Write-Warning (Get-LocString -Key $resourceNotFoundKey -ArgumentList $Key) - } - - # Fallback to just the key itself if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $key } - - # Otherwise fallback to the key followed by the arguments. - $OFS = " " - return "$key $ArgumentList" - } - - # Return the string if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $format } - - try { - [string]::Format($format, $ArgumentList) - } catch { - Write-Warning (Get-LocString -Key 'PSLIB_StringFormatFailed') - $OFS = " " - "$format $ArgumentList" - } -} - -<# -.SYNOPSIS -Imports resource strings for use with Get-VstsLocString. - -.DESCRIPTION -Imports resource strings for use with Get-VstsLocString. The imported strings are stored in an internal resource string dictionary. Optionally, if a separate resource file for the current culture exists, then the localized strings from that file then imported (overlaid) into the same internal resource string dictionary. - -Resource strings from the SDK are prefixed with "PSLIB_". This prefix should be avoided for custom resource strings. - -.Parameter LiteralPath -JSON file containing resource strings. - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Imports strings from messages section in the JSON file. If a messages section is not defined, then no strings are imported. Example messages section: -{ - "messages": { - "Hello": "Hello you!", - "Hello0": "Hello {0}!" - } -} - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Overlays strings from an optional separate resource file for the current culture. - -Given the task variable System.Culture is set to 'de-DE'. This variable is set by the agent based on the current culture for the job. -Given the file Task.json contains: -{ - "messages": { - "GoodDay": "Good day!", - } -} -Given the file resources.resjson\de-DE\resources.resjson: -{ - "loc.messages.GoodDay": "Guten Tag!" -} - -The net result from the import command would be one new key-value pair added to the internal dictionary: Key = 'GoodDay', Value = 'Guten Tag!' -#> -function Import-LocStrings { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - # Validate the file exists. - if (!(Test-Path -LiteralPath $LiteralPath -PathType Leaf)) { - Write-Warning (Get-LocString -Key PSLIB_FileNotFound0 -ArgumentList $LiteralPath) - return - } - - # Load the json. - Write-Verbose "Loading resource strings from: $LiteralPath" - $count = 0 - if ($messages = (Get-Content -LiteralPath $LiteralPath -Encoding UTF8 | Out-String | ConvertFrom-Json).messages) { - # Add each resource string to the hashtable. - foreach ($member in (Get-Member -InputObject $messages -MemberType NoteProperty)) { - [string]$key = $member.Name - $script:resourceStrings[$key] = $messages."$key" - $count++ - } - } - - Write-Verbose "Loaded $count strings." - - # Get the culture. - $culture = Get-TaskVariable -Name "System.Culture" -Default "en-US" - - # Load the resjson. - $resjsonPath = "$([System.IO.Path]::GetDirectoryName($LiteralPath))\Strings\resources.resjson\$culture\resources.resjson" - if (Test-Path -LiteralPath $resjsonPath) { - Write-Verbose "Loading resource strings from: $resjsonPath" - $count = 0 - $resjson = Get-Content -LiteralPath $resjsonPath -Encoding UTF8 | Out-String | ConvertFrom-Json - foreach ($member in (Get-Member -Name loc.messages.* -InputObject $resjson -MemberType NoteProperty)) { - if (!($value = $resjson."$($member.Name)")) { - continue - } - - [string]$key = $member.Name.Substring('loc.messages.'.Length) - $script:resourceStrings[$key] = $value - $count++ - } - - Write-Verbose "Loaded $count strings." - } -} diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 b/Tasks/custom/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 deleted file mode 100644 index 595a7d8..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 +++ /dev/null @@ -1,601 +0,0 @@ -$script:loggingCommandPrefix = '##vso[' -$script:loggingCommandEscapeMappings = @( # TODO: WHAT ABOUT "="? WHAT ABOUT "%"? - New-Object psobject -Property @{ Token = ';' ; Replacement = '%3B' } - New-Object psobject -Property @{ Token = "`r" ; Replacement = '%0D' } - New-Object psobject -Property @{ Token = "`n" ; Replacement = '%0A' } - New-Object psobject -Property @{ Token = "]" ; Replacement = '%5D' } -) -# TODO: BUG: Escape % ??? -# TODO: Add test to verify don't need to escape "=". - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddAttachment { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Type, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'addattachment' -Data $Path -Properties @{ - 'type' = $Type - 'name' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadSummary { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadsummary' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetEndpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [Parameter(Mandatory = $true)] - [string]$Field, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setendpoint' -Data $Value -Properties @{ - 'id' = $Id - 'field' = $Field - 'key' = $Key - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddBuildTag { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'addbuildtag' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AssociateArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - [string]$Type, - [hashtable]$Properties, - [switch]$AsOutput) - - $p = @{ } - if ($Properties) { - foreach ($key in $Properties.Keys) { - $p[$key] = $Properties[$key] - } - } - - $p['artifactname'] = $Name - $p['artifacttype'] = $Type - Write-LoggingCommand -Area 'artifact' -Event 'associate' -Data $Path -Properties $p -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-LogDetail { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [guid]$Id, - $ParentId, - [string]$Type, - [string]$Name, - $Order, - $StartTime, - $FinishTime, - $Progress, - [ValidateSet('Unknown', 'Initialized', 'InProgress', 'Completed')] - [Parameter()] - $State, - [ValidateSet('Succeeded', 'SucceededWithIssues', 'Failed', 'Cancelled', 'Skipped')] - [Parameter()] - $Result, - [string]$Message, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'logdetail' -Data $Message -Properties @{ - 'id' = $Id - 'parentid' = $ParentId - 'type' = $Type - 'name' = $Name - 'order' = $Order - 'starttime' = $StartTime - 'finishtime' = $FinishTime - 'progress' = $Progress - 'state' = $State - 'result' = $Result - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetProgress { - [CmdletBinding()] - param( - [ValidateRange(0, 100)] - [Parameter(Mandatory = $true)] - [int]$Percent, - [string]$CurrentOperation, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setprogress' -Data $CurrentOperation -Properties @{ - 'value' = $Percent - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetResult { - [CmdletBinding(DefaultParameterSetName = 'AsOutput')] - param( - [ValidateSet("Succeeded", "SucceededWithIssues", "Failed", "Cancelled", "Skipped")] - [Parameter(Mandatory = $true)] - [string]$Result, - [string]$Message, - [Parameter(ParameterSetName = 'AsOutput')] - [switch]$AsOutput, - [Parameter(ParameterSetName = 'DoNotThrow')] - [switch]$DoNotThrow) - - Write-LoggingCommand -Area 'task' -Event 'complete' -Data $Message -Properties @{ - 'result' = $Result - } -AsOutput:$AsOutput - if ($Result -eq 'Failed' -and !$AsOutput -and !$DoNotThrow) { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - throw (New-Object VstsTaskSdk.TerminationException($Message)) - } -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetSecret { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setsecret' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ - 'variable' = $Name - 'issecret' = $Secret - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskDebug { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskError { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type error @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskVerbose { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -AsVerbose -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskWarning { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type warning @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadFile { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadfile' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-PrependPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateBuildNumber { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'updatebuildnumber' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$ContainerFolder, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'artifact' -Event 'upload' -Data $Path -Properties @{ - 'containerfolder' = $ContainerFolder - 'artifactname' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadBuildLog { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'uploadlog' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateReleaseName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'release' -Event 'updatereleasename' -Data $Name -AsOutput:$AsOutput -} - -######################################## -# Private functions. -######################################## -function Format-LoggingCommandData { - [CmdletBinding()] - param([string]$Value, [switch]$Reverse) - - if (!$Value) { - return '' - } - - if (!$Reverse) { - foreach ($mapping in $script:loggingCommandEscapeMappings) { - $Value = $Value.Replace($mapping.Token, $mapping.Replacement) - } - } else { - for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { - $mapping = $script:loggingCommandEscapeMappings[$i] - $Value = $Value.Replace($mapping.Replacement, $mapping.Token) - } - } - - return $Value -} - -function Format-LoggingCommand { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Area, - [Parameter(Mandatory = $true)] - [string]$Event, - [string]$Data, - [hashtable]$Properties) - - # Append the preamble. - [System.Text.StringBuilder]$sb = New-Object -TypeName System.Text.StringBuilder - $null = $sb.Append($script:loggingCommandPrefix).Append($Area).Append('.').Append($Event) - - # Append the properties. - if ($Properties) { - $first = $true - foreach ($key in $Properties.Keys) { - [string]$value = Format-LoggingCommandData $Properties[$key] - if ($value) { - if ($first) { - $null = $sb.Append(' ') - $first = $false - } else { - $null = $sb.Append(';') - } - - $null = $sb.Append("$key=$value") - } - } - } - - # Append the tail and output the value. - $Data = Format-LoggingCommandData $Data - $sb.Append(']').Append($Data).ToString() -} - -function Write-LoggingCommand { - [CmdletBinding(DefaultParameterSetName = 'Parameters')] - param( - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Area, - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Event, - [Parameter(ParameterSetName = 'Parameters')] - [string]$Data, - [Parameter(ParameterSetName = 'Parameters')] - [hashtable]$Properties, - [Parameter(Mandatory = $true, ParameterSetName = 'Object')] - $Command, - [switch]$AsOutput) - - if ($PSCmdlet.ParameterSetName -eq 'Object') { - Write-LoggingCommand -Area $Command.Area -Event $Command.Event -Data $Command.Data -Properties $Command.Properties -AsOutput:$AsOutput - return - } - - $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties - if ($AsOutput) { - $command - } else { - Write-Host $command - } -} - -function Write-LogIssue { - [CmdletBinding()] - param( - [ValidateSet('warning', 'error')] - [Parameter(Mandatory = $true)] - [string]$Type, - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ - 'type' = $Type - 'code' = $ErrCode - 'sourcepath' = $SourcePath - 'linenumber' = $LineNumber - 'columnnumber' = $ColumnNumber - } - if ($AsOutput) { - return $command - } - - if ($Type -eq 'error') { - $foregroundColor = $host.PrivateData.ErrorForegroundColor - $backgroundColor = $host.PrivateData.ErrorBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Red - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.WarningForegroundColor - $backgroundColor = $host.PrivateData.WarningBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Yellow - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} - -function Write-TaskDebug_Internal { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsVerbose, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'debug' -Data $Message - if ($AsOutput) { - return $command - } - - if ($AsVerbose) { - $foregroundColor = $host.PrivateData.VerboseForegroundColor - $backgroundColor = $host.PrivateData.VerboseBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Cyan - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.DebugForegroundColor - $backgroundColor = $host.PrivateData.DebugBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::DarkGray - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host -Object $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 b/Tasks/custom/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 deleted file mode 100644 index d536111..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 +++ /dev/null @@ -1,205 +0,0 @@ -######################################## -# Private functions. -######################################## -function ConvertFrom-LongFormPath { - [CmdletBinding()] - param([string]$Path) - - if ($Path) { - if ($Path.StartsWith('\\?\UNC')) { - # E.g. \\?\UNC\server\share -> \\server\share - return $Path.Substring(1, '\?\UNC'.Length) - } elseif ($Path.StartsWith('\\?\')) { - # E.g. \\?\C:\directory -> C:\directory - return $Path.Substring('\\?\'.Length) - } - } - - return $Path -} -function ConvertTo-LongFormPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$longFormPath = Get-FullNormalizedPath -Path $Path - if ($longFormPath -and !$longFormPath.StartsWith('\\?')) { - if ($longFormPath.StartsWith('\\')) { - # E.g. \\server\share -> \\?\UNC\server\share - return "\\?\UNC$($longFormPath.Substring(1))" - } else { - # E.g. C:\directory -> \\?\C:\directory - return "\\?\$longFormPath" - } - } - - return $longFormPath -} - -# TODO: ADD A SWITCH TO EXCLUDE FILES, A SWITCH TO EXCLUDE DIRECTORIES, AND A SWITCH NOT TO FOLLOW REPARSE POINTS. -function Get-DirectoryChildItem { - [CmdletBinding()] - param( - [string]$Path, - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$Filter = "*", - [switch]$Force, - [VstsTaskSdk.FS.FindFlags]$Flags = [VstsTaskSdk.FS.FindFlags]::LargeFetch, - [VstsTaskSdk.FS.FindInfoLevel]$InfoLevel = [VstsTaskSdk.FS.FindInfoLevel]::Basic, - [switch]$Recurse) - - $stackOfDirectoryQueues = New-Object System.Collections.Stack - while ($true) { - $directoryQueue = New-Object System.Collections.Queue - $fileQueue = New-Object System.Collections.Queue - $findData = New-Object VstsTaskSdk.FS.FindData - $longFormPath = (ConvertTo-LongFormPath $Path) - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, $Filter), - $InfoLevel, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - # Output directories immediately. - if ($item.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - $item - # Append to the directory queue if recursive and default filter. - if ($Recurse -and $Filter -eq '*') { - $directoryQueue.Enqueue($item) - } - } else { - # Hold the files until all directories have been output. - $fileQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - - # If recursive and non-default filter, queue child directories. - if ($Recurse -and $Filter -ne '*') { - $findData = New-Object VstsTaskSdk.FS.FindData - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, '*'), - [VstsTaskSdk.FS.FindInfoLevel]::Basic, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Collect directories only. - if ($attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - $directoryQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - } - - # Output the files. - $fileQueue - - # Push the directory queue onto the stack if any directories were found. - if ($directoryQueue.Count) { $stackOfDirectoryQueues.Push($directoryQueue) } - - # Break out of the loop if no more directory queues to process. - if (!$stackOfDirectoryQueues.Count) { break } - - # Get the next path. - $directoryQueue = $stackOfDirectoryQueues.Peek() - $Path = $directoryQueue.Dequeue().FullName - - # Pop the directory queue if it's empty. - if (!$directoryQueue.Count) { $null = $stackOfDirectoryQueues.Pop() } - } -} - -function Get-FullNormalizedPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$outPath = $Path - [uint32]$bufferSize = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, 0, $null, $null) - [int]$lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($bufferSize -gt 0) { - $absolutePath = New-Object System.Text.StringBuilder([int]$bufferSize) - [uint32]$length = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, $bufferSize, $absolutePath, $null) - $lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($length -gt 0) { - $outPath = $absolutePath.ToString() - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - - if ($outPath.EndsWith('\') -and !$outPath.EndsWith(':\')) { - $outPath = $outPath.TrimEnd('\') - } - - $outPath -} \ No newline at end of file diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/Minimatch.dll b/Tasks/custom/ps_modules/VstsTaskSdk/Minimatch.dll deleted file mode 100644 index 700ddc426e56b08270c9dcbb1ade8ded248f98d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18432 zcmeHvd3amZweLFTNJpa;OY%U-U;wdJ(iE<^0Dr1eX+yVU^ZP<}CerFP{^D;NRAvpy{Upu7qdr-p#QQK0A=EE z*j@RF!K$=fum`{t+x7$Dj;_a3@mYu3X*)Y&L6B{wNj$7;1D=Y{x>+@ezQumUhi%iz zO@BY1=+-!qPq<}p%U-3n%sDf*P#@P|Wa1p%m=FXEn4%bhfB`=%h9F>|Q;H!781527 z5HJu1N4U|d+S*S|6A90AA zkcdZ#{0VeB+M>~Zr~5WKIT}ZR`3qry$+MxwZUCkMpp6A zlnP^-LRYHRWuXsdbCpqNodtCbjqPxWp&AP6_LosJK9}1uT+)sn=XT(TXp2E@Xam*5 zPMKe?G$W3ZWHq@`VV5-rby7Zf6F~r;o>=af9Y2q?MO$37yJW9;db*vutEt&Mw*dE= z6Nqt_Zdh=pf1--OAk^fxTE;9o}~-pGxds~dH31h<)Z!q6++rR>xk zJz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MT zWD8De>Y6p1mBYT2o^FDY>gm-hDgI`N@NExGR&rJ1CG65?^I2{ao?ZKiy45!v%mU6o z{-pd7xp#x)`K^9S*368ckzJK@|eeCHK|wh@#b0Crf~9w6M#pe4dt zz?`bfXOcXA%di!1*2AAZ>IHR3^sUCXQ`(eW-H<5Yn`5?jbXtG5NDp!qZSh!nE9zb< ztrseM(26}cKP~cbpO68?i={JC27M@7HoJ{94MJiBHg6Jt^rDR+*ghhj8AZR?(joL5 zXRI^uV)Ov~6T{i41(qQF;Jm}5U)G~Wa1eUgi?-tx2;$Q%_HJ|9;1T4OOVPlT^5`4c zy-fVO9Xc%ZWemP8R`eKu26_g+E)%~_uQSuTGkx13bviM61?kHHSb7va|F7z)p8hw( X?dtd6e<)43|K{fYzxw~TJn(-2*CUr_ diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/OutFunctions.ps1 b/Tasks/custom/ps_modules/VstsTaskSdk/OutFunctions.ps1 deleted file mode 100644 index fd898d6..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/OutFunctions.ps1 +++ /dev/null @@ -1,79 +0,0 @@ -# TODO: It would be better if the Out-Default function resolved the underlying Out-Default -# command in the begin block. This would allow for supporting other modules that override -# Out-Default. -$script:outDefaultCmdlet = $ExecutionContext.InvokeCommand.GetCmdlet("Microsoft.PowerShell.Core\Out-Default") - -######################################## -# Public functions. -######################################## -function Out-Default { - [CmdletBinding(ConfirmImpact = "Medium")] - param( - [Parameter(ValueFromPipeline = $true)] - [System.Management.Automation.PSObject]$InputObject) - - begin { - #Write-Host '[Entering Begin Out-Default]' - $__sp = { & $script:outDefaultCmdlet @PSBoundParameters }.GetSteppablePipeline() - $__sp.Begin($pscmdlet) - #Write-Host '[Leaving Begin Out-Default]' - } - - process { - #Write-Host '[Entering Process Out-Default]' - if ($_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose -Message 'Error record:' 4>&1 | Out-Default - Write-Verbose -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) 4>&1 | Out-Default - Write-Verbose -Message 'Script stack trace:' 4>&1 | Out-Default - Write-Verbose -Message "$($_.ScriptStackTrace)" 4>&1 | Out-Default - Write-Verbose -Message 'Exception:' 4>&1 | Out-Default - Write-Verbose -Message $_.Exception.ToString() 4>&1 | Out-Default - Write-TaskError -Message $_.Exception.Message - } elseif ($_ -is [System.Management.Automation.WarningRecord]) { - Write-TaskWarning -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) - } elseif ($_ -is [System.Management.Automation.VerboseRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskVerbose -Message $private:str - } - } elseif ($_ -is [System.Management.Automation.DebugRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskDebug -Message $private:str - } - } else { -# TODO: Consider using out-string here to control the width. As a security precaution it would actually be best to set it to max so wrapping doesn't interfere with secret masking. - $__sp.Process($_) - } - - #Write-Host '[Leaving Process Out-Default]' - } - - end { - #Write-Host '[Entering End Out-Default]' - $__sp.End() - #Write-Host '[Leaving End Out-Default]' - } -} - -######################################## -# Private functions. -######################################## -function Format-DebugMessage { - [CmdletBinding()] - param([psobject]$Object) - - $private:str = Out-String -InputObject $Object -Width 2147483647 - $private:str = Remove-TrailingNewLine $private:str - "$private:str".Replace("`r`n", "`n").Replace("`r", "`n").Split("`n"[0]) -} - -function Remove-TrailingNewLine { - [CmdletBinding()] - param($Str) - if ([object]::ReferenceEquals($Str, $null)) { - return $Str - } elseif ($Str.EndsWith("`r`n")) { - return $Str.Substring(0, $Str.Length - 2) - } else { - return $Str - } -} diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml b/Tasks/custom/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml deleted file mode 100644 index 8c20388..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - Microsoft.PowerShell.Commands.PSRepositoryItemInfo - System.Management.Automation.PSCustomObject - System.Object - - - VstsTaskSdk - 0.11.0 - Module - VSTS Task SDK - Microsoft - VSTS - (c) 2016 Microsoft. All rights reserved. -

2018-05-21T03:27:56+01:00
- - - - https://github.com/Microsoft/vsts-task-lib - - - - System.Object[] - System.Array - System.Object - - - PSModule - - - - - System.Collections.Hashtable - System.Object - - - - DscResource - - - - - - - RoleCapability - - - - Cmdlet - - - - Workflow - - - - Command - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - Function - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - - - - - - - - https://www.powershellgallery.com/api/v2 - PSGallery - NuGet - - - System.Management.Automation.PSCustomObject - System.Object - - - (c) 2016 Microsoft. All rights reserved. - VSTS Task SDK - False - True - True - 12749 - 136204 - 71074 - 21/05/2018 03:27:56 +01:00 - 21/05/2018 03:27:56 +01:00 - 09/11/2018 22:20:20 +00:00 - PSModule PSFunction_Find-Match PSCommand_Find-Match PSFunction_New-FindOptions PSCommand_New-FindOptions PSFunction_New-MatchOptions PSCommand_New-MatchOptions PSFunction_Select-Match PSCommand_Select-Match PSFunction_Get-Endpoint PSCommand_Get-Endpoint PSFunction_Get-SecureFileTicket PSCommand_Get-SecureFileTicket PSFunction_Get-SecureFileName PSCommand_Get-SecureFileName PSFunction_Get-Input PSCommand_Get-Input PSFunction_Get-TaskVariable PSCommand_Get-TaskVariable PSFunction_Get-TaskVariableInfo PSCommand_Get-TaskVariableInfo PSFunction_Set-TaskVariable PSCommand_Set-TaskVariable PSFunction_Find-Files PSCommand_Find-Files PSFunction_Get-LocString PSCommand_Get-LocString PSFunction_Import-LocStrings PSCommand_Import-LocStrings PSFunction_Write-AddAttachment PSCommand_Write-AddAttachment PSFunction_Write-AddBuildTag PSCommand_Write-AddBuildTag PSFunction_Write-AssociateArtifact PSCommand_Write-AssociateArtifact PSFunction_Write-LogDetail PSCommand_Write-LogDetail PSFunction_Write-PrependPath PSCommand_Write-PrependPath PSFunction_Write-SetEndpoint PSCommand_Write-SetEndpoint PSFunction_Write-SetProgress PSCommand_Write-SetProgress PSFunction_Write-SetResult PSCommand_Write-SetResult PSFunction_Write-SetSecret PSCommand_Write-SetSecret PSFunction_Write-SetVariable PSCommand_Write-SetVariable PSFunction_Write-TaskDebug PSCommand_Write-TaskDebug PSFunction_Write-TaskError PSCommand_Write-TaskError PSFunction_Write-TaskVerbose PSCommand_Write-TaskVerbose PSFunction_Write-TaskWarning PSCommand_Write-TaskWarning PSFunction_Write-UpdateBuildNumber PSCommand_Write-UpdateBuildNumber PSFunction_Write-UpdateReleaseName PSCommand_Write-UpdateReleaseName PSFunction_Write-UploadArtifact PSCommand_Write-UploadArtifact PSFunction_Write-UploadBuildLog PSCommand_Write-UploadBuildLog PSFunction_Write-UploadFile PSCommand_Write-UploadFile PSFunction_Write-UploadSummary PSCommand_Write-UploadSummary PSFunction_Out-Default PSCommand_Out-Default PSFunction_Get-AssemblyReference PSCommand_Get-AssemblyReference PSFunction_Get-TfsClientCredentials PSCommand_Get-TfsClientCredentials PSFunction_Get-TfsService PSCommand_Get-TfsService PSFunction_Get-VssCredentials PSCommand_Get-VssCredentials PSFunction_Get-VssHttpClient PSCommand_Get-VssHttpClient PSFunction_Assert-Agent PSCommand_Assert-Agent PSFunction_Assert-Path PSCommand_Assert-Path PSFunction_Invoke-Tool PSCommand_Invoke-Tool PSFunction_Trace-EnteringInvocation PSCommand_Trace-EnteringInvocation PSFunction_Trace-LeavingInvocation PSCommand_Trace-LeavingInvocation PSFunction_Trace-Path PSCommand_Trace-Path PSFunction_Get-WebProxy PSCommand_Get-WebProxy PSFunction_Get-ClientCertificate PSCommand_Get-ClientCertificate PSIncludes_Function - False - 2018-11-09T22:20:20Z - 0.11.0 - Microsoft - false - Module - VstsTaskSdk.nuspec|FindFunctions.ps1|InputFunctions.ps1|LegacyFindFunctions.ps1|lib.json|LocalizationFunctions.ps1|LoggingCommandFunctions.ps1|LongPathFunctions.ps1|Minimatch.dll|OutFunctions.ps1|ServerOMFunctions.ps1|ToolFunctions.ps1|TraceFunctions.ps1|VstsTaskSdk.dll|VstsTaskSdk.psd1|VstsTaskSdk.psm1|Strings\resources.resjson\de-de\resources.resjson|Strings\resources.resjson\en-US\resources.resjson|Strings\resources.resjson\es-es\resources.resjson|Strings\resources.resjson\fr-fr\resources.resjson|Strings\resources.resjson\it-IT\resources.resjson|Strings\resources.resjson\ja-jp\resources.resjson|Strings\resources.resjson\ko-KR\resources.resjson|Strings\resources.resjson\ru-RU\resources.resjson|Strings\resources.resjson\zh-CN\resources.resjson|Strings\resources.resjson\zh-TW\resources.resjson - bbed04e2-4e8e-4089-90a2-58b858fed8d8 - 3.0 - Microsoft - - - /Users/gep13/github/gep13/chocolatey-azuredevops/Tasks/install/VstsTaskSdk/0.11.0 - - - diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 b/Tasks/custom/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 deleted file mode 100644 index 177820b..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 +++ /dev/null @@ -1,659 +0,0 @@ -<# -.SYNOPSIS -Gets assembly reference information. - -.DESCRIPTION -Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK. - -Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario. - -Walks an assembly's references to determine all of it's dependencies. Also walks the references of the dependencies, and so on until all nested dependencies have been traversed. Dependencies are searched for in the directory of the specified assembly. NET Framework assemblies are omitted. - -See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER LiteralPath -Assembly to walk. - -.EXAMPLE -Get-VstsAssemblyReference -LiteralPath C:\nuget\microsoft.teamfoundationserver.client.14.102.0\lib\net45\Microsoft.TeamFoundation.Build2.WebApi.dll -#> -function Get-AssemblyReference { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - $ErrorActionPreference = 'Stop' - Write-Warning "Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK." - Write-Output '' - Write-Warning "Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario." - $directory = [System.IO.Path]::GetDirectoryName($LiteralPath) - $hashtable = @{ } - $queue = @( [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($LiteralPath).GetName() ) - while ($queue.Count) { - # Add a blank line between assemblies. - Write-Output '' - - # Pop. - $assemblyName = $queue[0] - $queue = @( $queue | Select-Object -Skip 1 ) - - # Attempt to find the assembly in the same directory. - $assembly = $null - $path = "$directory\$($assemblyName.Name).dll" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } else { - $path = "$directory\$($assemblyName.Name).exe" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } - } - - # Make sure the assembly full name matches, not just the file name. - if ($assembly -and $assembly.GetName().FullName -ne $assemblyName.FullName) { - $assembly = $null - } - - # Print the assembly. - if ($assembly) { - Write-Output $assemblyName.FullName - } else { - if ($assemblyName.FullName -eq 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed') { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) *** This is an expected condition when using the HTTP clients from the 15.x VSTS REST SDK. Use Get-VstsVssHttpClient to load the HTTP clients (which applies a binding redirect assembly resolver for Newtonsoft.Json). Otherwise you will need to manage the binding redirect yourself." - } else { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) ***" - } - - continue - } - - # Walk the references. - $refAssemblyNames = @( $assembly.GetReferencedAssemblies() ) - for ($i = 0 ; $i -lt $refAssemblyNames.Count ; $i++) { - $refAssemblyName = $refAssemblyNames[$i] - - # Skip framework assemblies. - $fxPaths = @( - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\$($refAssemblyName.Name).dll" - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\WPF\$($refAssemblyName.Name).dll" - ) - $fxPath = $fxPaths | - Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } | - Where-Object { [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($_).GetName().FullName -eq $refAssemblyName.FullName } - if ($fxPath) { - continue - } - - # Print the reference. - Write-Output " $($refAssemblyName.FullName)" - - # Add new references to the queue. - if (!$hashtable[$refAssemblyName.FullName]) { - $queue += $refAssemblyName - $hashtable[$refAssemblyName.FullName] = $true - } - } - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the TFS extended client SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -Refer to Get-VstsTfsService for a more simple to get a TFS service object. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -$credentials = Get-VstsTfsClientCredentials -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.VersionControl.Client.dll" -$tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection( - (Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require), - $credentials) -$versionControlServer = $tfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer]) -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsClientCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Validate the type can be found. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsClientCredentials' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Construct the credentials. - $credentials = New-Object Microsoft.TeamFoundation.Client.TfsClientCredentials($false) # Do not use default credentials. - $credentials.AllowInteractive = $false - $credentials.Federated = New-Object Microsoft.TeamFoundation.Client.OAuthTokenCredential([string]$endpoint.auth.parameters.AccessToken) - return $credentials - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a TFS extended client service. - -.DESCRIPTION -Gets an instance of an ITfsTeamProjectCollectionObject. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the service to get. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER Uri -URI to use when initializing the service. If not specified, defaults to System.TeamFoundationCollectionUri. - -.PARAMETER TfsClientCredentials -Credentials to use when initializing the service. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -.EXAMPLE -$versionControlServer = Get-VstsTfsService -TypeName Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsService { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $TfsClientCredentials) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Default the credentials. - if (!$TfsClientCredentials) { - $TfsClientCredentials = Get-TfsClientCredentials -OMDirectory $OMDirectory - } - - # Validate the project collection type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsTeamProjectCollection' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Load the project collection object. - $tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection($Uri, $TfsClientCredentials) - - # Validate the requested type can be loaded. - $type = Get-OMType -TypeName $TypeName -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Return the service object. - return $tfsTeamProjectCollection.GetService($type) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the VSTS REST SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project service build/release identity). - -Refer to Get-VstsVssHttpClient for a more simple to get a VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -# This example works using the 14.x .NET SDK. A Newtonsoft.Json 6.0 to 8.0 binding -# redirect may be required when working with the 15.x SDK. Or use Get-VstsVssHttpClient -# to avoid managing the binding redirect. -# -$vssCredentials = Get-VstsVssCredentials -$collectionUrl = New-Object System.Uri((Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require)) -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.Core.WebApi.dll" -$projectHttpClient = New-Object Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient($collectionUrl, $vssCredentials) -$projectHttpClient.GetProjects().Result -#> -function Get-VssCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Check if the VssOAuthAccessTokenCredential type is available. - if ((Get-OMType -TypeName 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory)) { - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential($endpoint.auth.parameters.AccessToken) - } else { - # Validate the fallback type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.Client.VssOAuthCredential($endpoint.auth.parameters.AccessToken) - } - - # Return the credentials. - return New-Object Microsoft.VisualStudio.Services.Common.VssCredentials( - (New-Object Microsoft.VisualStudio.Services.Common.WindowsCredential($false)), # Do not use default credentials. - $federatedCredential, - [Microsoft.VisualStudio.Services.Common.CredentialPromptType]::DoNotPrompt) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VSS HTTP client. - -.DESCRIPTION -Gets an instance of an VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the HTTP client to get. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -# .PARAMETER Uri -# URI to use when initializing the HTTP client. If not specified, defaults to System.TeamFoundationCollectionUri. - -# .PARAMETER VssCredentials -# Credentials to use when initializing the HTTP client. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -# .PARAMETER WebProxy -# WebProxy to use when initializing the HTTP client. If not specified, the default uses the proxy configuration agent current has. - -# .PARAMETER ClientCert -# ClientCert to use when initializing the HTTP client. If not specified, the default uses the client certificate agent current has. - -# .PARAMETER IgnoreSslError -# Skip SSL server certificate validation on all requests made by this HTTP client. If not specified, the default is to validate SSL server certificate. - -.EXAMPLE -$projectHttpClient = Get-VstsVssHttpClient -TypeName Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient -$projectHttpClient.GetProjects().Result -#> -function Get-VssHttpClient { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $VssCredentials, - - $WebProxy = (Get-WebProxy), - - $ClientCert = (Get-ClientCertificate), - - [switch]$IgnoreSslError) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Cast the URI. - [uri]$Uri = New-Object System.Uri($Uri) - - # Default the credentials. - if (!$VssCredentials) { - $VssCredentials = Get-VssCredentials -OMDirectory $OMDirectory - } - - # Validate the type can be loaded. - $null = Get-OMType -TypeName $TypeName -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Update proxy setting for vss http client - [Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler]::DefaultWebProxy = $WebProxy - - # Update client certificate setting for vss http client - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - [Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings]$Settings = [Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings]::Default.Clone() - - if ($ClientCert) { - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance.ClientCertificates.Add($ClientCert) - - $Settings.ClientCertificateManager = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance - } - - # Skip SSL server certificate validation - [bool]$SkipCertValidation = (Get-TaskVariable -Name Agent.SkipCertValidation -AsBool) -or $IgnoreSslError - if ($SkipCertValidation) { - if ($Settings.GetType().GetProperty('ServerCertificateValidationCallback')) { - Write-Verbose "Ignore any SSL server certificate validation errors."; - $Settings.ServerCertificateValidationCallback = [VstsTaskSdk.VstsHttpHandlerSettings]::UnsafeSkipServerCertificateValidation - } - else { - # OMDirectory has older version of Microsoft.VisualStudio.Services.Common.dll - Write-Verbose "The version of 'Microsoft.VisualStudio.Services.Common.dll' does not support skip SSL server certificate validation." - } - } - - # Try to construct the HTTP client. - Write-Verbose "Constructing HTTP client." - try { - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } catch { - # Rethrow if the exception is not due to Newtonsoft.Json DLL not found. - if ($_.Exception.InnerException -isnot [System.IO.FileNotFoundException] -or - $_.Exception.InnerException.FileName -notlike 'Newtonsoft.Json, *') { - - throw - } - - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Test if the Newtonsoft.Json DLL exists in the OM directory. - $newtonsoftDll = [System.IO.Path]::Combine($OMDirectory, "Newtonsoft.Json.dll") - Write-Verbose "Testing file path: '$newtonsoftDll'" - if (!(Test-Path -LiteralPath $newtonsoftDll -PathType Leaf)) { - Write-Verbose 'Not found. Rethrowing exception.' - throw - } - - # Add a binding redirect and try again. Parts of the Dev15 preview SDK have a - # dependency on the 6.0.0.0 Newtonsoft.Json DLL, while other parts reference - # the 8.0.0.0 Newtonsoft.Json DLL. - Write-Verbose "Adding assembly resolver." - $onAssemblyResolve = [System.ResolveEventHandler] { - param($sender, $e) - - if ($e.Name -like 'Newtonsoft.Json, *') { - Write-Verbose "Resolving '$($e.Name)'" - return [System.Reflection.Assembly]::LoadFrom($newtonsoftDll) - } - - Write-Verbose "Unable to resolve assembly name '$($e.Name)'" - return $null - } - [System.AppDomain]::CurrentDomain.add_AssemblyResolve($onAssemblyResolve) - try { - # Try again to construct the HTTP client. - Write-Verbose "Trying again to construct the HTTP client." - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } finally { - # Unregister the assembly resolver. - Write-Verbose "Removing assemlby resolver." - [System.AppDomain]::CurrentDomain.remove_AssemblyResolve($onAssemblyResolve) - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VstsTaskSdk.VstsWebProxy - -.DESCRIPTION -Gets an instance of a VstsTaskSdk.VstsWebProxy that has same proxy configuration as Build/Release agent. - -VstsTaskSdk.VstsWebProxy implement System.Net.IWebProxy interface. - -.EXAMPLE -$webProxy = Get-VstsWebProxy -$webProxy.GetProxy(New-Object System.Uri("https://github.com/Microsoft/vsts-task-lib")) -#> -function Get-WebProxy { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports proxy - Assert-Agent -Minimum '2.105.7' - - $proxyUrl = Get-TaskVariable -Name Agent.ProxyUrl - $proxyUserName = Get-TaskVariable -Name Agent.ProxyUserName - $proxyPassword = Get-TaskVariable -Name Agent.ProxyPassword - $proxyBypassListJson = Get-TaskVariable -Name Agent.ProxyBypassList - [string[]]$ProxyBypassList = ConvertFrom-Json -InputObject $ProxyBypassListJson - - return New-Object -TypeName VstsTaskSdk.VstsWebProxy -ArgumentList @($proxyUrl, $proxyUserName, $proxyPassword, $proxyBypassList) - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a client certificate for current connected TFS instance - -.DESCRIPTION -Gets an instance of a X509Certificate2 that is the client certificate Build/Release agent used. - -.EXAMPLE -$x509cert = Get-ClientCertificate -WebRequestHandler.ClientCertificates.Add(x509cert) -#> -function Get-ClientCertificate { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports client certificate - Assert-Agent -Minimum '2.122.0' - - [string]$clientCert = Get-TaskVariable -Name Agent.ClientCertArchive - [string]$clientCertPassword = Get-TaskVariable -Name Agent.ClientCertPassword - - if ($clientCert -and (Test-Path -LiteralPath $clientCert -PathType Leaf)) { - return New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($clientCert, $clientCertPassword) - } - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -######################################## -# Private functions. -######################################## -function Get-OMType { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [ValidateSet('ExtendedClient', 'WebApi')] - [Parameter(Mandatory = $true)] - [string]$OMKind, - - [string]$OMDirectory, - - [switch]$Require) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Try to load the type. - $errorRecord = $null - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - # Store the error record. - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - - # Build a list of candidate DLL file paths from the namespace. - $dllPaths = @( ) - $namespace = $TypeName - while ($namespace.LastIndexOf('.') -gt 0) { - # Trim the next segment from the namespace. - $namespace = $namespace.SubString(0, $namespace.LastIndexOf('.')) - - # Derive potential DLL file paths based on the namespace and OM kind (i.e. extended client vs web API). - if ($OMKind -eq 'ExtendedClient') { - if ($namespace -like 'Microsoft.TeamFoundation.*') { - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } else { - if ($namespace -like 'Microsoft.TeamFoundation.*' -or - $namespace -like 'Microsoft.VisualStudio.Services' -or - $namespace -like 'Microsoft.VisualStudio.Services.*') { - - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.WebApi.dll") - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } - } - - foreach ($dllPath in $dllPaths) { - # Check whether the DLL exists. - Write-Verbose "Testing leaf path: '$dllPath'" - if (!(Test-Path -PathType Leaf -LiteralPath "$dllPath")) { - Write-Verbose "Not found." - continue - } - - # Load the DLL. - Write-Verbose "Loading assembly: $dllPath" - try { - Add-Type -LiteralPath $dllPath - } catch { - # Write the information to the verbose stream and proceed to attempt to load the requested type. - # - # The requested type may successfully load now. For example, the type used with the 14.0 Web API for the - # federated credential (VssOAuthCredential) resides in Microsoft.VisualStudio.Services.Client.dll. Even - # though loading the DLL results in a ReflectionTypeLoadException when Microsoft.ServiceBus.dll (approx 3.75mb) - # is not present, enough types are loaded to use the VssOAuthCredential federated credential with the Web API - # HTTP clients. - Write-Verbose "$($_.Exception.GetType().FullName): $($_.Exception.Message)" - if ($_.Exception -is [System.Reflection.ReflectionTypeLoadException]) { - for ($i = 0 ; $i -lt $_.Exception.LoaderExceptions.Length ; $i++) { - $loaderException = $_.Exception.LoaderExceptions[$i] - Write-Verbose "LoaderExceptions[$i]: $($loaderException.GetType().FullName): $($loaderException.Message)" - } - } - } - - # Try to load the type. - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - } - - # Check whether to propagate the error. - if ($Require) { - Write-Error $errorRecord - } - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson b/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson deleted file mode 100644 index 7871c36..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agentversion {0} oder höher ist erforderlich.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Der Containerpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "\"{0}\"-Dienstendpunkt-Anmeldeinformationen", - "loc.messages.PSLIB_EndpointUrl0": "\"{0}\"-Dienstendpunkt-URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Fehler beim Aufzählen von Unterverzeichnissen für den folgenden Pfad: \"{0}\"", - "loc.messages.PSLIB_FileNotFound0": "Die Datei wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Input0": "\"{0}\"-Eingabe", - "loc.messages.PSLIB_InvalidPattern0": "Ungültiges Muster: \"{0}\"", - "loc.messages.PSLIB_LeafPathNotFound0": "Der Blattpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Fehler bei der Normalisierung bzw. Erweiterung des Pfads. Die Pfadlänge wurde vom Kernel32-Subsystem nicht zurückgegeben für: \"{0}\"", - "loc.messages.PSLIB_PathNotFound0": "Der Pfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Der Prozess \"{0}\" wurde mit dem Code \"{1}\" beendet.", - "loc.messages.PSLIB_Required0": "Erforderlich: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Fehler beim Zeichenfolgenformat.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Der Zeichenfolgen-Ressourcenschlüssel wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "\"{0}\"-Taskvariable" -} \ No newline at end of file diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson b/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson deleted file mode 100644 index 66c17bc..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "File not found: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' input", - "loc.messages.PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Path not found: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "loc.messages.PSLIB_Required0": "Required: {0}", - "loc.messages.PSLIB_StringFormatFailed": "String format failed.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' task variable" -} \ No newline at end of file diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson b/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson deleted file mode 100644 index f5c9c23..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Se require la versión {0} o posterior del agente.", - "loc.messages.PSLIB_ContainerPathNotFound0": "No se encuentra la ruta de acceso del contenedor: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenciales del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "No se pudieron enumerar los subdirectorios de la ruta de acceso: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Archivo no encontrado: '{0}'", - "loc.messages.PSLIB_Input0": "Entrada '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Patrón no válido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "No se encuentra la ruta de acceso de la hoja: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "No se pudo normalizar o expandir la ruta de acceso. El subsistema Kernel32 no devolvió la longitud de la ruta de acceso para: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "No se encuentra la ruta de acceso: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "El proceso '{0}' finalizó con el código '{1}'.", - "loc.messages.PSLIB_Required0": "Se requiere: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Error de formato de cadena.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "No se encuentra la clave de recurso de la cadena: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tarea '{0}'" -} \ No newline at end of file diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson b/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson deleted file mode 100644 index 652870c..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "L'agent version {0} (ou une version ultérieure) est obligatoire.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Le chemin du conteneur est introuvable : '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Informations d'identification du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Échec de l'énumération des sous-répertoires pour le chemin : '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Fichier introuvable : {0}.", - "loc.messages.PSLIB_Input0": "Entrée '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Modèle non valide : '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Le chemin feuille est introuvable : '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Échec de la normalisation/l'expansion du chemin. La longueur du chemin n'a pas été retournée par le sous-système Kernel32 pour : '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Chemin introuvable : '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Le processus '{0}' s'est arrêté avec le code '{1}'.", - "loc.messages.PSLIB_Required0": "Obligatoire : {0}", - "loc.messages.PSLIB_StringFormatFailed": "Échec du format de la chaîne.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Clé de la ressource de type chaîne introuvable : '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tâche '{0}'" -} \ No newline at end of file diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson b/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson deleted file mode 100644 index 6aeb1df..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "È richiesta la versione dell'agente {0} o superiore.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Percorso del contenitore non trovato: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenziali dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "L'enumerazione delle sottodirectory per il percorso '{0}' non è riuscita", - "loc.messages.PSLIB_FileNotFound0": "File non trovato: '{0}'", - "loc.messages.PSLIB_Input0": "Input di '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Criterio non valido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Percorso foglia non trovato: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "La normalizzazione o l'espansione del percorso non è riuscita. Il sottosistema Kernel32 non ha restituito la lunghezza del percorso per '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Percorso non trovato: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Il processo '{0}' è stato terminato ed è stato restituito il codice '{1}'.", - "loc.messages.PSLIB_Required0": "Obbligatorio: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Errore nel formato della stringa.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "La chiave della risorsa stringa non è stata trovata: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variabile dell'attività '{0}'" -} \ No newline at end of file diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson b/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson deleted file mode 100644 index 6b07ab6..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "バージョン {0} 以降のエージェントが必要です。", - "loc.messages.PSLIB_ContainerPathNotFound0": "コンテナーのパスが見つかりません: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' サービス エンドポイントの資格情報", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' サービス エンドポイントの URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "パス '{0}' のサブディレクトリを列挙できませんでした", - "loc.messages.PSLIB_FileNotFound0": "ファイルが見つかりません: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 入力", - "loc.messages.PSLIB_InvalidPattern0": "使用できないパターンです: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "リーフ パスが見つかりません: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "パスの正規化/展開に失敗しました。Kernel32 サブシステムからパス '{0}' の長さが返されませんでした", - "loc.messages.PSLIB_PathNotFound0": "パスが見つかりません: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "プロセス '{0}' がコード '{1}' で終了しました。", - "loc.messages.PSLIB_Required0": "必要: {0}", - "loc.messages.PSLIB_StringFormatFailed": "文字列のフォーマットに失敗しました。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "文字列のリソース キーが見つかりません: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' タスク変数" -} \ No newline at end of file diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson b/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson deleted file mode 100644 index e58cbdc..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "에이전트 버전 {0} 이상이 필요합니다.", - "loc.messages.PSLIB_ContainerPathNotFound0": "컨테이너 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 서비스 끝점 자격 증명", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 서비스 끝점 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "경로에 대해 하위 디렉터리를 열거하지 못함: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "{0} 파일을 찾을 수 없습니다.", - "loc.messages.PSLIB_Input0": "'{0}' 입력", - "loc.messages.PSLIB_InvalidPattern0": "잘못된 패턴: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "경로 정규화/확장에 실패했습니다. 다음에 대해 Kernel32 subsystem에서 경로 길이를 반환하지 않음: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "'{1}' 코드로 '{0}' 프로세스가 종료되었습니다.", - "loc.messages.PSLIB_Required0": "필수: {0}", - "loc.messages.PSLIB_StringFormatFailed": "문자열을 포맷하지 못했습니다.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "문자열 리소스 키를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 작업 변수" -} \ No newline at end of file diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson b/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson deleted file mode 100644 index 38dd69d..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Требуется версия агента {0} или более поздняя.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Путь к контейнеру не найден: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "Учетные данные конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EndpointUrl0": "URL-адрес конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Сбой перечисления подкаталогов для пути: \"{0}\".", - "loc.messages.PSLIB_FileNotFound0": "Файл не найден: \"{0}\".", - "loc.messages.PSLIB_Input0": "Входные данные \"{0}\".", - "loc.messages.PSLIB_InvalidPattern0": "Недопустимый шаблон: \"{0}\".", - "loc.messages.PSLIB_LeafPathNotFound0": "Путь к конечному объекту не найден: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Сбой нормализации и расширения пути. Длина пути не была возвращена подсистемой Kernel32 для: \"{0}\".", - "loc.messages.PSLIB_PathNotFound0": "Путь не найден: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Процесс \"{0}\" завершил работу с кодом \"{1}\".", - "loc.messages.PSLIB_Required0": "Требуется: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Сбой формата строки.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Ключ ресурса строки не найден: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "Переменная задачи \"{0}\"" -} \ No newline at end of file diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson b/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson deleted file mode 100644 index 1d333de..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理版本 {0} 或更高版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路径:“{0}”", - "loc.messages.PSLIB_EndpointAuth0": "“{0}”服务终结点凭据", - "loc.messages.PSLIB_EndpointUrl0": "“{0}”服务终结点 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "枚举路径的子目录失败:“{0}”", - "loc.messages.PSLIB_FileNotFound0": "找不到文件: {0}。", - "loc.messages.PSLIB_Input0": "“{0}”输入", - "loc.messages.PSLIB_InvalidPattern0": "无效的模式:“{0}”", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到叶路径:“{0}”", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路径规范化/扩展失败。路径长度不是由“{0}”的 Kernel32 子系统返回的", - "loc.messages.PSLIB_PathNotFound0": "找不到路径:“{0}”", - "loc.messages.PSLIB_Process0ExitedWithCode1": "过程“{0}”已退出,代码为“{1}”。", - "loc.messages.PSLIB_Required0": "必需: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字符串格式无效。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字符串资源关键字:“{0}”", - "loc.messages.PSLIB_TaskVariable0": "“{0}”任务变量" -} \ No newline at end of file diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson b/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson deleted file mode 100644 index 512509b..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理程式版本 {0} 或更新的版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路徑: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 服務端點認證", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 服務端點 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "為路徑列舉子目錄失敗: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "找不到檔案: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 輸入", - "loc.messages.PSLIB_InvalidPattern0": "模式無效: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到分葉路徑: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路徑正規化/展開失敗。Kernel32 子系統未傳回 '{0}' 的路徑長度", - "loc.messages.PSLIB_PathNotFound0": "找不到路徑: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "處理序 '{0}' 以返回碼 '{1}' 結束。", - "loc.messages.PSLIB_Required0": "必要項: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字串格式失敗。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字串資源索引鍵: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 工作變數" -} \ No newline at end of file diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/ToolFunctions.ps1 b/Tasks/custom/ps_modules/VstsTaskSdk/ToolFunctions.ps1 deleted file mode 100644 index 0e82595..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/ToolFunctions.ps1 +++ /dev/null @@ -1,123 +0,0 @@ -<# -.SYNOPSIS -Asserts the agent version is at least the specified minimum. - -.PARAMETER Minimum -Minimum version - must be 2.104.1 or higher. -#> -function Assert-Agent { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [version]$Minimum) - - if (([version]'2.104.1').CompareTo($Minimum) -ge 1) { - Write-Error "Assert-Agent requires the parameter to be 2.104.1 or higher." - return - } - - $agent = Get-TaskVariable -Name 'agent.version' - if (!$agent -or $Minimum.CompareTo([version]$agent) -ge 1) { - Write-Error (Get-LocString -Key 'PSLIB_AgentVersion0Required' -ArgumentList $Minimum) - } -} - -<# -.SYNOPSIS -Asserts that a path exists. Throws if the path does not exist. - -.PARAMETER PassThru -True to return the path. -#> -function Assert-Path { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath, - [Microsoft.PowerShell.Commands.TestPathType]$PathType = [Microsoft.PowerShell.Commands.TestPathType]::Any, - [switch]$PassThru) - - if ($PathType -eq [Microsoft.PowerShell.Commands.TestPathType]::Any) { - Write-Verbose "Asserting path exists: '$LiteralPath'" - } else { - Write-Verbose "Asserting $("$PathType".ToLowerInvariant()) path exists: '$LiteralPath'" - } - - if (Test-Path -LiteralPath $LiteralPath -PathType $PathType) { - if ($PassThru) { - return $LiteralPath - } - - return - } - - $resourceKey = switch ($PathType) { - ([Microsoft.PowerShell.Commands.TestPathType]::Container) { "PSLIB_ContainerPathNotFound0" ; break } - ([Microsoft.PowerShell.Commands.TestPathType]::Leaf) { "PSLIB_LeafPathNotFound0" ; break } - default { "PSLIB_PathNotFound0" } - } - - throw (Get-LocString -Key $resourceKey -ArgumentList $LiteralPath) -} - -<# -.SYNOPSIS -Executes an external program. - -.DESCRIPTION -Executes an external program and waits for the process to exit. - -After calling this command, the exit code of the process can be retrieved from the variable $LASTEXITCODE. - -.PARAMETER Encoding -This parameter not required for most scenarios. Indicates how to interpret the encoding from the external program. An example use case would be if an external program outputs UTF-16 XML and the output needs to be parsed. - -.PARAMETER RequireExitCodeZero -Indicates whether to write an error to the error pipeline if the exit code is not zero. -#> -function Invoke-Tool { # TODO: RENAME TO INVOKE-PROCESS? - [CmdletBinding()] - param( - [ValidatePattern('^[^\r\n]*$')] - [Parameter(Mandatory = $true)] - [string]$FileName, - [ValidatePattern('^[^\r\n]*$')] - [Parameter()] - [string]$Arguments, - [string]$WorkingDirectory, - [System.Text.Encoding]$Encoding, - [switch]$RequireExitCodeZero) - - Trace-EnteringInvocation $MyInvocation - $isPushed = $false - $originalEncoding = $null - try { - if ($Encoding) { - $originalEncoding = [System.Console]::OutputEncoding - [System.Console]::OutputEncoding = $Encoding - } - - if ($WorkingDirectory) { - Push-Location -LiteralPath $WorkingDirectory -ErrorAction Stop - $isPushed = $true - } - - $FileName = $FileName.Replace('"', '').Replace("'", "''") - Write-Host "##[command]""$FileName"" $Arguments" - Invoke-Expression "& '$FileName' --% $Arguments" - Write-Verbose "Exit code: $LASTEXITCODE" - if ($RequireExitCodeZero -and $LASTEXITCODE -ne 0) { - Write-Error (Get-LocString -Key PSLIB_Process0ExitedWithCode1 -ArgumentList ([System.IO.Path]::GetFileName($FileName)), $LASTEXITCODE) - } - } finally { - if ($originalEncoding) { - [System.Console]::OutputEncoding = $originalEncoding - } - - if ($isPushed) { - Pop-Location - } - - Trace-LeavingInvocation $MyInvocation - } -} diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/TraceFunctions.ps1 b/Tasks/custom/ps_modules/VstsTaskSdk/TraceFunctions.ps1 deleted file mode 100644 index b8e084b..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/TraceFunctions.ps1 +++ /dev/null @@ -1,139 +0,0 @@ -<# -.SYNOPSIS -Writes verbose information about the invocation being entered. - -.DESCRIPTION -Used to trace verbose information when entering a function/script. Writes an entering message followed by a short description of the invocation. Additionally each bound parameter and unbound argument is also traced. - -.PARAMETER Parameter -Wildcard pattern to control which bound parameters are traced. -#> -function Trace-EnteringInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo, - [string[]]$Parameter = '*') - - Write-Verbose "Entering $(Get-InvocationDescription $InvocationInfo)." - $OFS = ", " - if ($InvocationInfo.BoundParameters.Count -and $Parameter.Count) { - if ($Parameter.Count -eq 1 -and $Parameter[0] -eq '*') { - # Trace all parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - } - } else { - # Trace matching parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - foreach ($p in $Parameter) { - if ($key -like $p) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - break - } - } - } - } - } - - # Trace all unbound arguments. - if (@($InvocationInfo.UnboundArguments).Count) { - for ($i = 0 ; $i -lt $InvocationInfo.UnboundArguments.Count ; $i++) { - Write-Verbose " args[$i]: '$($InvocationInfo.UnboundArguments[$i])'" - } - } -} - -<# -.SYNOPSIS -Writes verbose information about the invocation being left. - -.DESCRIPTION -Used to trace verbose information when leaving a function/script. Writes a leaving message followed by a short description of the invocation. -#> -function Trace-LeavingInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo) - - Write-Verbose "Leaving $(Get-InvocationDescription $InvocationInfo)." -} - -<# -.SYNOPSIS -Writes verbose information about paths. - -.DESCRIPTION -Writes verbose information about the paths. The paths are sorted and a the common root is written only once, followed by each relative path. - -.PARAMETER PassThru -Indicates whether to return the sorted paths. -#> -function Trace-Path { - [CmdletBinding()] - param( - [string[]]$Path, - [switch]$PassThru) - - if ($Path.Count -eq 0) { - Write-Verbose "No paths." - if ($PassThru) { - $Path - } - } elseif ($Path.Count -eq 1) { - Write-Verbose "Path: $($Path[0])" - if ($PassThru) { - $Path - } - } else { - # Find the greatest common root. - $sorted = $Path | Sort-Object - $firstPath = $sorted[0].ToCharArray() - $lastPath = $sorted[-1].ToCharArray() - $commonEndIndex = 0 - $j = if ($firstPath.Length -lt $lastPath.Length) { $firstPath.Length } else { $lastPath.Length } - for ($i = 0 ; $i -lt $j ; $i++) { - if ($firstPath[$i] -eq $lastPath[$i]) { - if ($firstPath[$i] -eq '\') { - $commonEndIndex = $i - } - } else { - break - } - } - - if ($commonEndIndex -eq 0) { - # No common root. - Write-Verbose "Paths:" - foreach ($p in $sorted) { - Write-Verbose " $p" - } - } else { - Write-Verbose "Paths: $($Path[0].Substring(0, $commonEndIndex + 1))" - foreach ($p in $sorted) { - Write-Verbose " $($p.Substring($commonEndIndex + 1))" - } - } - - if ($PassThru) { - $sorted - } - } -} - -######################################## -# Private functions. -######################################## -function Get-InvocationDescription { - [CmdletBinding()] - param([System.Management.Automation.InvocationInfo]$InvocationInfo) - - if ($InvocationInfo.MyCommand.Path) { - $InvocationInfo.MyCommand.Path - } elseif ($InvocationInfo.MyCommand.Name) { - $InvocationInfo.MyCommand.Name - } else { - $InvocationInfo.MyCommand.CommandType - } -} diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/VstsTaskSdk.dll b/Tasks/custom/ps_modules/VstsTaskSdk/VstsTaskSdk.dll deleted file mode 100644 index 54938ab05180ddaf77cf067f2501a1f97ee7e5cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25408 zcmeIa2Urx#@+jULfkmqhP%&pQASxi36%_+2 zidj)qRLqKkIbqJC|C%A{Ip^NgryDMlC=Tgb)?ppFa_* zgD?KL5%6Dw0*IE?-Y<)GNuATFBL$w*iA?2*n3+OBijbYbF+H{2L%K|95{8flQ0QIM^F!gwgx3vTgye}Z zxvSkc0dGI?6aWPJm*)uj%Ro(CG}HVlviga*LJ z%c-k5J<6tW2zm5FiQsmeukhe)BO@9rfIMER2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YPg&f zaAuI>jn3V3Xt^=l;%HyeiyFg8QdckPyCeg8Z=(>)u$VSSVt;j6wbe_ zw6|WRHhZ|_nuYUYyjeTqB4-qOB%91~SKi&KH{s{*;caH?8)~j|wf1CA91}&4Q(dOr ze1vf_*<|*suxPoIQ~R85&NbT^@0+1{t#L-gHs8oMm$4M=6ml*T-g7xa zV=ker`C3Q|ja^T>9>#dtpq1fu`P*NFZHp(A2-`rOF$QP^=qQE&uZkj*RKB7W5c!g? z0_h7Fa_}j-8E?fE5Mv6OoV^RAgq4Z;iP6kh*Od}!VRko2B_4I{(pGl8rg&SSx!qlx z-#KrM7|InfHJ`AO_eUAYF?sl^#S$BqNIJ}W(y+OYtWqR>*+<$(n%M4ZR$_+Esaf{H z-LF;mfQ%IN3Y0$53He+YYQ>eZU+u`D<)c|Fspn^AR|nVK$5^ki+Yn_&WbKc$d_mNg zeC?4#OS(vZ`qJ(l(1DzJ>%sS|AkPgw)t-el)B{!v%PXU|+Pz&4jbY(AL%HEt8Spib zPc<(?tZppIne|$c+|SB32$YYzT>e0{mtgSG^$e`!z1)IGJFu@RSev0mQr?$X4Q!rJP3>&`Zt!=+&?>AJf79Gr=vlfV zg4S?kF+F>fNu}K(Z=}gHBL`*nHQ9&g>ltj`!>A^FaraRJeb@VjRUoeQz@zZ9I|mDk zb7Yo!2RJVGI5#Ow?y=qmZv={jr^{*&IYR2*oz^L5G-brBv_Yz;wu5eD9@@M+Ao<_- zTJ<*aIe)M4x%zcPo;e*jhT|#q9?2=PugJgekDl<9dh6e&6yF`ar4mto>Tbqa^N9R^ J$g$t$@(XnB12_Nx diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 b/Tasks/custom/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 deleted file mode 100644 index a1bf2c6..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 +++ /dev/null @@ -1,168 +0,0 @@ -[CmdletBinding()] -param( - [ValidateNotNull()] - [Parameter()] - [hashtable]$ModuleParameters = @{ }) - -if ($host.Name -ne 'ConsoleHost') { - Write-Warning "VstsTaskSdk is designed for use with powershell.exe (ConsoleHost). Output may be different when used with other hosts." -} - -# Private module variables. -[bool]$script:nonInteractive = "$($ModuleParameters['NonInteractive'])" -eq 'true' -Write-Verbose "NonInteractive: $script:nonInteractive" - -# VstsTaskSdk.dll contains the TerminationException and NativeMethods for handle long path -# We used to do inline C# in this powershell module -# However when csc compile the inline C#, it will hit process env block size limit since it's not use unicode to encode env -# To solve the env block size problem, we choose to put all inline C# into an assembly VstsTaskSdk.dll, signing it, package with the PS modules. -Write-Verbose "Loading compiled helper $PSScriptRoot\VstsTaskSdk.dll." -Add-Type -LiteralPath $PSScriptRoot\VstsTaskSdk.dll - -# Import/export functions. -. "$PSScriptRoot\FindFunctions.ps1" -. "$PSScriptRoot\InputFunctions.ps1" -. "$PSScriptRoot\LegacyFindFunctions.ps1" -. "$PSScriptRoot\LocalizationFunctions.ps1" -. "$PSScriptRoot\LoggingCommandFunctions.ps1" -. "$PSScriptRoot\LongPathFunctions.ps1" -. "$PSScriptRoot\ServerOMFunctions.ps1" -. "$PSScriptRoot\ToolFunctions.ps1" -. "$PSScriptRoot\TraceFunctions.ps1" -. "$PSScriptRoot\OutFunctions.ps1" # Load the out functions after all of the other functions are loaded. -Export-ModuleMember -Function @( - # Find functions. - 'Find-Match' - 'New-FindOptions' - 'New-MatchOptions' - 'Select-Match' - # Input functions. - 'Get-Endpoint' - 'Get-SecureFileTicket' - 'Get-SecureFileName' - 'Get-Input' - 'Get-TaskVariable' - 'Get-TaskVariableInfo' - 'Set-TaskVariable' - # Legacy find functions. - 'Find-Files' - # Localization functions. - 'Get-LocString' - 'Import-LocStrings' - # Logging command functions. - 'Write-AddAttachment' - 'Write-AddBuildTag' - 'Write-AssociateArtifact' - 'Write-LogDetail' - 'Write-PrependPath' - 'Write-SetEndpoint' - 'Write-SetProgress' - 'Write-SetResult' - 'Write-SetSecret' - 'Write-SetVariable' - 'Write-TaskDebug' - 'Write-TaskError' - 'Write-TaskVerbose' - 'Write-TaskWarning' - 'Write-UpdateBuildNumber' - 'Write-UpdateReleaseName' - 'Write-UploadArtifact' - 'Write-UploadBuildLog' - 'Write-UploadFile' - 'Write-UploadSummary' - # Out functions. - 'Out-Default' - # Server OM functions. - 'Get-AssemblyReference' - 'Get-TfsClientCredentials' - 'Get-TfsService' - 'Get-VssCredentials' - 'Get-VssHttpClient' - # Tool functions. - 'Assert-Agent' - 'Assert-Path' - 'Invoke-Tool' - # Trace functions. - 'Trace-EnteringInvocation' - 'Trace-LeavingInvocation' - 'Trace-Path' - # Proxy functions - 'Get-WebProxy' - # Client cert functions - 'Get-ClientCertificate' - ) - -# Override Out-Default globally. -$null = New-Item -Force -Path "function:\global:Out-Default" -Value (Get-Command -CommandType Function -Name Out-Default -ListImported) -New-Alias -Name Out-Default -Value "global:Out-Default" -Scope global - -# Perform some initialization in a script block to enable merging the pipelines. -$scriptText = @" -# Load the SDK resource strings. -Import-LocStrings "$PSScriptRoot\lib.json" - -# Load the module that contains ConvertTo-SecureString. -if (!(Get-Module -Name Microsoft.PowerShell.Security)) { - Write-Verbose "Importing the module 'Microsoft.PowerShell.Security'." - Import-Module -Name Microsoft.PowerShell.Security 2>&1 | - ForEach-Object { - if (`$_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose `$_.Exception.Message - } else { - ,`$_ - } - } -} -"@ -. ([scriptblock]::Create($scriptText)) 2>&1 3>&1 4>&1 5>&1 | Out-Default - -# Create Invoke-VstsTaskScript in a special way so it is not bound to the module. -# Otherwise calling the task script block would run within the module context. -# -# An alternative way to solve the problem is to close the script block (i.e. closure). -# However, that introduces a different problem. Closed script blocks are created within -# a dynamic module. Each module gets it's own session state separate from the global -# session state. When running in a regular script context, Import-Module calls import -# the target module into the global session state. When running in a module context, -# Import-Module calls import the target module into the caller module's session state. -# -# The goal of a task may include executing ad-hoc scripts. Therefore, task scripts -# should run in regular script context. The end user specifying an ad-hoc script expects -# the module import rules to be consistent with the default behavior (i.e. imported -# into the global session state). -$null = New-Item -Force -Path "function:\global:Invoke-VstsTaskScript" -Value ([scriptblock]::Create(@' - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [scriptblock]$ScriptBlock) - - try { - $global:ErrorActionPreference = 'Stop' - - # Initialize the environment. - $vstsModule = Get-Module -Name VstsTaskSdk - Write-Verbose "$($vstsModule.Name) $($vstsModule.Version) commit $($vstsModule.PrivateData.PSData.CommitHash)" 4>&1 | Out-Default - & $vstsModule Initialize-Inputs 4>&1 | Out-Default - - # Remove the local variable before calling the user's script. - Remove-Variable -Name vstsModule - - # Call the user's script. - $ScriptBlock | - ForEach-Object { - # Remove the scriptblock variable before calling it. - Remove-Variable -Name ScriptBlock - & $_ 2>&1 3>&1 4>&1 5>&1 | Out-Default - } - } catch [VstsTaskSdk.TerminationException] { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Task script terminated." 4>&1 | Out-Default - } catch { - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Caught exception from task script." 4>&1 | Out-Default - $_ | Out-Default - Write-Host "##vso[task.complete result=Failed]" - } -'@)) diff --git a/Tasks/custom/ps_modules/VstsTaskSdk/lib.json b/Tasks/custom/ps_modules/VstsTaskSdk/lib.json deleted file mode 100644 index ecdc9d0..0000000 --- a/Tasks/custom/ps_modules/VstsTaskSdk/lib.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "messages": { - "PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "PSLIB_FileNotFound0": "File not found: '{0}'", - "PSLIB_Input0": "'{0}' input", - "PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "PSLIB_PathNotFound0": "Path not found: '{0}'", - "PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "PSLIB_Required0": "Required: {0}", - "PSLIB_StringFormatFailed": "String format failed.", - "PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "PSLIB_TaskVariable0": "'{0}' task variable" - } -} diff --git a/Tasks/custom/task.json b/Tasks/custom/task.json deleted file mode 100644 index 0e2d2ee..0000000 --- a/Tasks/custom/task.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "id": "f2baf658-e4a4-4bf3-b42e-41d6afeb079e", - "name": "choco-custom", - "friendlyName": "Chocolatey - Custom", - "description": "Runs Custom Chocolatey with specified parameters", - "author": "gep13", - "helpMarkDown": "", - "category": "Build", - "visibility": [ - "Build", - "Release" - ], - "demands": [], - "version": { - "Major": "0", - "Minor": "1", - "Patch": "0" - }, - "minimumAgentVersion": "1.83.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced options", - "isExpanded": false - } - ], - "instanceNameFormat": "Chocolatey Custom", - "inputs": [ - { - "name": "command", - "type": "string", - "label": "Command", - "defaultValue": "", - "required": true, - "helpMarkDown": "The Chocolatey Command that you would like to execute." - }, - { - "name": "arguments", - "type": "string", - "label": "Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Chocolatey Arguments that should be passed to the command." - }, - { - "name": "debug", - "type": "boolean", - "label": "Show debug messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "", - "groupname": "advanced" - }, - { - "name": "verbose", - "type": "boolean", - "label": "Show verbose messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very verbose messaging, avoid using under normal circumstances.", - "groupname": "advanced" - }, - { - "name": "trace", - "type": "boolean", - "label": "Show trace messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very, very verbose trace messaging. Avoid except when needing super low-level .NET Framework debugging.", - "groupname": "advanced" - } - ], - "execution": { - "PowerShell3": { - "target": "$(currentDirectory)\\custom.ps1", - "argumentFormat": "", - "workingDirectory": "$(currentDirectory)" - } - } -} diff --git a/Tasks/feature/feature.ps1 b/Tasks/feature/feature.ps1 deleted file mode 100644 index 2d6460b..0000000 --- a/Tasks/feature/feature.ps1 +++ /dev/null @@ -1,51 +0,0 @@ -[CmdletBinding()] -param() - -Trace-VstsEnteringInvocation $MyInvocation - -try { - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "Machine") - if(-not (Test-Path $chocoInstallLocation)) { - Write-Output "Environment variable 'ChocolateyInstall' was not found in the system variables. Attempting to find it in the user variables..." - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "User") - } - - $chocoExe = "$chocoInstallLocation\choco.exe" - - if (-not (Test-Path $chocoExe)) { - throw "Chocolatey was not found." - } - - [string]$operation = Get-VstsInput -Name 'operation' -Require - [string]$featureName = Get-VstsInput -Name 'featureName' -Require - [bool]$debug = Get-VstsInput -Name 'debug' -AsBool -Default $false - [bool]$verbose = Get-VstsInput -Name 'verbose' -AsBool -Default $false - [bool]$trace = Get-VstsInput -Name 'trace' -AsBool -Default $false - - $chocolateyVersion = & $chocoExe --version - Write-Output "Running Chocolatey Version: $chocolateyVersion" - - $chocolateyArguments = @() - - if($debug) { - Write-Output "Adding --debug to arguments" - $chocolateyArguments += @("--debug", "") - } - - if($verbose) { - Write-Output "Adding --verbose to arguments" - $chocolateyArguments += @("--verbose", "") - } - - if($trace) { - Write-Output "Adding --trace to arguments" - $chocolateyArguments += @("--trace", "") - } - - & $chocoExe feature $operation --name=$featureName $($chocolateyArguments) -} catch { - Write-VstsTaskError $_.Exception.Message - throw -} finally { - Trace-VstsLeavingInvocation $MyInvocation -} diff --git a/Tasks/feature/icon.png b/Tasks/feature/icon.png deleted file mode 100755 index ab05af71592b547960e4fcf1f5d527bece1fd5c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2656 zcmY*bc|6o>7yp&5nTW_XQyF7lXG|nABl{9z2o*AxVaQ;NEtRov*Bv(hrKxhFDVoxG4buln4OW*xUDC0l*�JDw&pneYk z1ijO)x9RU=K|Y38`~cu6-+>(hvL6Tmz@aMyD_gRysfoI?x0fQ$#oNhMG04kj9}NH+ zLF)UVmn#_u3-Y=_^ivN)!+#;v_v3>!0uK8HA$y|Xwx;GV9dD8=Ohr*y5edhDVKA5m z$px>D)z$x}egA}pyOYU2>Ig(&V4z~)8AWfB8$wAcFl({#nSu%ZdvvL%wT5M?USLS_lI1E z!e!!CZ!DnQx^^6xYv``$x*8e0n?0JCAsf>Qp7;U$7p&xazpS*`uL}azE7*a)DF3yb z^|}*gs<}`RziUQipLJfTsO8;iDp#orfd#)y-ea2Hp74-%+fWJ}o#Y5f)-&-fEfDP$ zjBd_<`3RY7KHG0m<=clw-ExluH{nEEj`KgR&3A`(MjQ#fCoR-GydGP}JEI?&QRFeO z@$E~f$S0P!i@NZFjLsv+iRk{V7^{oSiF~{KF7|{B$M2L3=HrV!lUwbWO%?3dOEayL z+$qxbu;cK^iJ($5z9$}DPp>d`QF^ZJ3IV|DZkcciX zew_MP0jJHyC}WQqlEe*-b{hvWVjHQw99iinXZdgmdINR#R=HIfSSbgI<#{vQh=Pik zF6T`JJsg|6J$P%GIvs>t$doa^89m@2tlsU&iKmW*2RhfF8`K1%B~())^hDT^pu21* zsi&mQha@=(zBeaqdQBBwm3ant;kM7u%)1>H*+Ha;bCk>4QaB}`E#poO)*5o3QUctF z!RbP@dh-WfYecr!px@L68vu3uW^TfF6BvcjedGtHYTDOK`Y?$vQQlVXPUU^hQHhcV zk31};rmeq!5ak(Z%#}^Z%ipeVnvxF*b0M&9edD1YcN?f>@3mt^Ve-8s=WPm}FcxHr~*67epRryKBr7m&(c;u*wp@#xTIEJ^BsApC)1! zrknNyjmpv3s5lYaCnAx$=IGOBpt}@pE&1l$^obZbtYL^rUl3_sUziCY>&)0hxdhFA-^v;UqjC~%l**cdnZbtWjz*|QGEG?J^TT)92CQLs`ymq0j7d4VJ zR0yfyTnh4)w?j`QKm|RbP(6#cA0cmjK`I=5)a|RJA8)C$v&&zZyd5iB^1Sh4(tfJ-OxONjdxdT(RDI9dXdvS0~U-I}u=u|Ogy3mq?uHkj4 zn?QSY{&XZn56{L3^9+wZhWg|~dqKRP&v2+c?#%qm>s(m%&{}DoYZThnAuekxmRP_v zo1<{TeakXFI}60nz4iiFC)9Tmqf9nC%IO$e-4TUI;0mLh-j zQLr41J|YehYI5OI`_@NoHlzD?aNb91=<9e4Ey;q;%(Y6g~nm{l+;F0(40p<{nF z>wcIBih?#=Uo-gDpTTn~l^|iFdOhERaair#%8cl}Wqppp9%8C)!L_msmh-7sSJ$au zwooOK-<{W5&PJZDhd-M}zxlK4y_LbHeTxE9(XO^rg{Qtw%ODc@`L)mpPD$at^AwMx zZM1Pfjq1Y{)dZcP`G)BvddP=(!1NTPx25UgVTtC6X@<8!WJT!5i=j|k-|wdS%Bc*v zi^*^zqSeu8c#$-AG#d+?&9_GeiqMdbK5QqW%C-P_Z -function Find-Match { - [CmdletBinding()] - param( - [Parameter()] - [string]$DefaultRoot, - [Parameter()] - [string[]]$Pattern, - $FindOptions, - $MatchOptions) - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Apply defaults for parameters and trace. - if (!$DefaultRoot) { - $DefaultRoot = Get-TaskVariable -Name 'System.DefaultWorkingDirectory' -Default (Get-Location).Path - } - - Write-Verbose "DefaultRoot: '$DefaultRoot'" - if (!$FindOptions) { - $FindOptions = New-FindOptions -FollowSpecifiedSymbolicLink -FollowSymbolicLinks - } - - Trace-FindOptions -Options $FindOptions - if (!$MatchOptions) { - $MatchOptions = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $MatchOptions - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Normalize slashes for root dir. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - $results = @{ } - $originalMatchOptions = $MatchOptions - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $MatchOptions = Copy-MatchOptions -Options $originalMatchOptions - - # Skip comments. - if (!$MatchOptions.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $MatchOptions.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$MatchOptions.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$MatchOptions.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $MatchOptions.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $MatchOptions.NoNegate = $true - $MatchOptions.FlipNegate = $false - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Expand braces - required to accurately interpret findPath. - $expanded = $null - $preExpanded = $pat - if ($MatchOptions.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - } - - # Set NoBrace. - $MatchOptions.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - if ($isIncludePattern) { - # Determine the findPath. - $findInfo = Get-FindInfoFromPattern -DefaultRoot $DefaultRoot -Pattern $pat -MatchOptions $MatchOptions - $findPath = $findInfo.FindPath - Write-Verbose "FindPath: '$findPath'" - - if (!$findPath) { - Write-Verbose "Skipping empty path." - continue - } - - # Perform the find. - Write-Verbose "StatOnly: '$($findInfo.StatOnly)'" - [string[]]$findResults = @( ) - if ($findInfo.StatOnly) { - # Simply stat the path - all path segments were used to build the path. - if ((Test-Path -LiteralPath $findPath)) { - $findResults += $findPath - } - } else { - $findResults = Get-FindResult -Path $findPath -Options $FindOptions - } - - Write-Verbose "Found $($findResults.Count) paths." - - # Apply the pattern. - Write-Verbose "Applying include pattern." - if ($findInfo.AdjustedPattern -ne $pat) { - Write-Verbose "AdjustedPattern: '$($findInfo.AdjustedPattern)'" - $pat = $findInfo.AdjustedPattern - } - - $matchResults = [Minimatch.Minimatcher]::Filter( - $findResults, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results[$matchResult.ToUpperInvariant()] = $matchResult - } - - Write-Verbose "$matchCount matches" - } else { - # Check if basename only and MatchBase=true. - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $pat) -and - ($pat -replace '\\', '/').IndexOf('/') -lt 0) { - - # Do not root the pattern. - Write-Verbose "MatchBase and basename only." - } else { - # Root the exclude pattern. - $pat = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - # Apply the pattern. - Write-Verbose 'Applying exclude pattern.' - $matchResults = [Minimatch.Minimatcher]::Filter( - [string[]]$results.Values, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results.Remove($matchResult.ToUpperInvariant()) - } - - Write-Verbose "$matchCount matches" - } - } - } - - $finalResult = @( $results.Values | Sort-Object ) - Write-Verbose "$($finalResult.Count) final results" - return $finalResult - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Creates FindOptions for use with Find-VstsMatch. - -.DESCRIPTION -Creates FindOptions for use with Find-VstsMatch. Contains switches to control whether to follow symlinks. - -.PARAMETER FollowSpecifiedSymbolicLink -Indicates whether to traverse descendants if the specified path is a symbolic link directory. Does not cause nested symbolic link directories to be traversed. - -.PARAMETER FollowSymbolicLinks -Indicates whether to traverse descendants of symbolic link directories. -#> -function New-FindOptions { - [CmdletBinding()] - param( - [switch]$FollowSpecifiedSymbolicLink, - [switch]$FollowSymbolicLinks) - - return New-Object psobject -Property @{ - FollowSpecifiedSymbolicLink = $FollowSpecifiedSymbolicLink.IsPresent - FollowSymbolicLinks = $FollowSymbolicLinks.IsPresent - } -} - -<# -.SYNOPSIS -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. - -.DESCRIPTION -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. Contains switches to control which pattern matching options are applied. -#> -function New-MatchOptions { - [CmdletBinding()] - param( - [switch]$Dot, - [switch]$FlipNegate, - [switch]$MatchBase, - [switch]$NoBrace, - [switch]$NoCase, - [switch]$NoComment, - [switch]$NoExt, - [switch]$NoGlobStar, - [switch]$NoNegate, - [switch]$NoNull) - - return New-Object psobject -Property @{ - Dot = $Dot.IsPresent - FlipNegate = $FlipNegate.IsPresent - MatchBase = $MatchBase.IsPresent - NoBrace = $NoBrace.IsPresent - NoCase = $NoCase.IsPresent - NoComment = $NoComment.IsPresent - NoExt = $NoExt.IsPresent - NoGlobStar = $NoGlobStar.IsPresent - NoNegate = $NoNegate.IsPresent - NoNull = $NoNull.IsPresent - } -} - -<# -.SYNOPSIS -Applies match patterns against a list of files. - -.DESCRIPTION -Applies match patterns to a list of paths. Supports interleaved exclude patterns. - -.PARAMETER ItemPath -Array of paths. - -.PARAMETER Pattern -Patterns to apply. Supports interleaved exclude patterns. - -.PARAMETER PatternRoot -Default root to apply to unrooted patterns. Not applied to basename-only patterns when Options.MatchBase is true. - -.PARAMETER Options -When the Options parameter is not specified, defaults to (New-VstsMatchOptions -Dot -NoBrace -NoCase). -#> -function Select-Match { - [CmdletBinding()] - param( - [Parameter()] - [string[]]$ItemPath, - [Parameter()] - [string[]]$Pattern, - [Parameter()] - [string]$PatternRoot, - $Options) - - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - if (!$Options) { - $Options = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $Options - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Hashtable to keep track of matches. - $map = @{ } - - $originalOptions = $Options - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $Options = Copy-MatchOptions -Options $originalOptions - - # Skip comments. - if (!$Options.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $Options.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$Options.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$Options.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $Options.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $Options.NoNegate = $true - $Options.FlipNegate = $false - - # Expand braces - required to accurately root patterns. - $expanded = $null - $preExpanded = $pat - if ($Options.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $Options)) - } - - # Set NoBrace. - $Options.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - # Root the pattern when all of the following conditions are true: - if ($PatternRoot -and # PatternRoot is supplied - !(Test-Rooted -Path $pat) -and # AND pattern is not rooted - # # AND MatchBase=false or not basename only - (!$Options.MatchBase -or ($pat -replace '\\', '/').IndexOf('/') -ge 0)) { - - # Root the include pattern. - $pat = Get-RootedPattern -DefaultRoot $PatternRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - if ($isIncludePattern) { - # Apply the pattern. - Write-Verbose 'Applying include pattern against original list.' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map[$matchResult] = $true - } - - Write-Verbose "$matchCount matches" - } else { - # Apply the pattern. - Write-Verbose 'Applying exclude pattern against original list' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map.Remove($matchResult) - } - - Write-Verbose "$matchCount matches" - } - } - } - - # return a filtered version of the original list (preserves order and prevents duplication) - $result = $ItemPath | Where-Object { $map[$_] } - Write-Verbose "$($result.Count) final results" - $result - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -################################################################################ -# Private functions. -################################################################################ - -function Copy-MatchOptions { - [CmdletBinding()] - param($Options) - - return New-Object psobject -Property @{ - Dot = $Options.Dot -eq $true - FlipNegate = $Options.FlipNegate -eq $true - MatchBase = $Options.MatchBase -eq $true - NoBrace = $Options.NoBrace -eq $true - NoCase = $Options.NoCase -eq $true - NoComment = $Options.NoComment -eq $true - NoExt = $Options.NoExt -eq $true - NoGlobStar = $Options.NoGlobStar -eq $true - NoNegate = $Options.NoNegate -eq $true - NoNull = $Options.NoNull -eq $true - } -} - -function ConvertTo-MinimatchOptions { - [CmdletBinding()] - param($Options) - - $opt = New-Object Minimatch.Options - $opt.AllowWindowsPaths = $true - $opt.Dot = $Options.Dot -eq $true - $opt.FlipNegate = $Options.FlipNegate -eq $true - $opt.MatchBase = $Options.MatchBase -eq $true - $opt.NoBrace = $Options.NoBrace -eq $true - $opt.NoCase = $Options.NoCase -eq $true - $opt.NoComment = $Options.NoComment -eq $true - $opt.NoExt = $Options.NoExt -eq $true - $opt.NoGlobStar = $Options.NoGlobStar -eq $true - $opt.NoNegate = $Options.NoNegate -eq $true - $opt.NoNull = $Options.NoNull -eq $true - return $opt -} - -function ConvertTo-NormalizedSeparators { - [CmdletBinding()] - param([string]$Path) - - # Convert slashes. - $Path = "$Path".Replace('/', '\') - - # Remove redundant slashes. - $isUnc = $Path -match '^\\\\+[^\\]' - $Path = $Path -replace '\\\\+', '\' - if ($isUnc) { - $Path = '\' + $Path - } - - return $Path -} - -function Get-FindInfoFromPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern, - [Parameter(Mandatory = $true)] - $MatchOptions) - - if (!$MatchOptions.NoBrace) { - throw "Get-FindInfoFromPattern expected MatchOptions.NoBrace to be true." - } - - # For the sake of determining the find path, pretend NoCase=false. - $MatchOptions = Copy-MatchOptions -Options $MatchOptions - $MatchOptions.NoCase = $false - - # Check if basename only and MatchBase=true - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $Pattern) -and - ($Pattern -replace '\\', '/').IndexOf('/') -lt 0) { - - return New-Object psobject -Property @{ - AdjustedPattern = $Pattern - FindPath = $DefaultRoot - StatOnly = $false - } - } - - # The technique applied by this function is to use the information on the Minimatch object determine - # the findPath. Minimatch breaks the pattern into path segments, and exposes information about which - # segments are literal vs patterns. - # - # Note, the technique currently imposes a limitation for drive-relative paths with a glob in the - # first segment, e.g. C:hello*/world. It's feasible to overcome this limitation, but is left unsolved - # for now. - $minimatchObj = New-Object Minimatch.Minimatcher($Pattern, (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # The "set" field is a two-dimensional enumerable of parsed path segment info. The outer enumerable should only - # contain one item, otherwise something went wrong. Brace expansion can result in multiple items in the outer - # enumerable, but that should be turned off by the time this function is reached. - # - # Note, "set" is a private field in the .NET implementation but is documented as a feature in the nodejs - # implementation. The .NET implementation is a port and is by a different author. - $setFieldInfo = $minimatchObj.GetType().GetField('set', 'Instance,NonPublic') - [object[]]$set = $setFieldInfo.GetValue($minimatchObj) - if ($set.Count -ne 1) { - throw "Get-FindInfoFromPattern expected Minimatch.Minimatcher(...).set.Count to be 1. Actual: '$($set.Count)'" - } - - [string[]]$literalSegments = @( ) - [object[]]$parsedSegments = $set[0] - foreach ($parsedSegment in $parsedSegments) { - if ($parsedSegment.GetType().Name -eq 'LiteralItem') { - # The item is a LiteralItem when the original input for the path segment does not contain any - # unescaped glob characters. - $literalSegments += $parsedSegment.Source; - continue - } - - break; - } - - # Join the literal segments back together. Minimatch converts '\' to '/' on Windows, then squashes - # consequetive slashes, and finally splits on slash. This means that UNC format is lost, but can - # be detected from the original pattern. - $joinedSegments = [string]::Join('/', $literalSegments) - if ($joinedSegments -and ($Pattern -replace '\\', '/').StartsWith('//')) { - $joinedSegments = '/' + $joinedSegments # restore UNC format - } - - # Determine the find path. - $findPath = '' - if ((Test-Rooted -Path $Pattern)) { # The pattern is rooted. - $findPath = $joinedSegments - } elseif ($joinedSegments) { # The pattern is not rooted, and literal segements were found. - $findPath = [System.IO.Path]::Combine($DefaultRoot, $joinedSegments) - } else { # The pattern is not rooted, and no literal segements were found. - $findPath = $DefaultRoot - } - - # Clean up the path. - if ($findPath) { - $findPath = [System.IO.Path]::GetDirectoryName(([System.IO.Path]::Combine($findPath, '_'))) # Hack to remove unnecessary trailing slash. - $findPath = ConvertTo-NormalizedSeparators -Path $findPath - } - - return New-Object psobject -Property @{ - AdjustedPattern = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $Pattern - FindPath = $findPath - StatOnly = $literalSegments.Count -eq $parsedSegments.Count - } -} - -function Get-FindResult { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - $Options) - - if (!(Test-Path -LiteralPath $Path)) { - Write-Verbose 'Path not found.' - return - } - - $Path = ConvertTo-NormalizedSeparators -Path $Path - - # Push the first item. - [System.Collections.Stack]$stack = New-Object System.Collections.Stack - $stack.Push((Get-Item -LiteralPath $Path)) - - $count = 0 - while ($stack.Count) { - # Pop the next item and yield the result. - $item = $stack.Pop() - $count++ - $item.FullName - - # Traverse. - if (($item.Attributes -band 0x00000010) -eq 0x00000010) { # Directory - if (($item.Attributes -band 0x00000400) -ne 0x00000400 -or # ReparsePoint - $Options.FollowSymbolicLinks -or - ($count -eq 1 -and $Options.FollowSpecifiedSymbolicLink)) { - - $childItems = @( Get-DirectoryChildItem -Path $Item.FullName -Force ) - [System.Array]::Reverse($childItems) - foreach ($childItem in $childItems) { - $stack.Push($childItem) - } - } - } - } -} - -function Get-RootedPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern) - - if ((Test-Rooted -Path $Pattern)) { - return $Pattern - } - - # Normalize root. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - # Escape special glob characters. - $DefaultRoot = $DefaultRoot -replace '(\[)(?=[^\/]+\])', '[[]' # Escape '[' when ']' follows within the path segment - $DefaultRoot = $DefaultRoot.Replace('?', '[?]') # Escape '?' - $DefaultRoot = $DefaultRoot.Replace('*', '[*]') # Escape '*' - $DefaultRoot = $DefaultRoot -replace '\+\(', '[+](' # Escape '+(' - $DefaultRoot = $DefaultRoot -replace '@\(', '[@](' # Escape '@(' - $DefaultRoot = $DefaultRoot -replace '!\(', '[!](' # Escape '!(' - - if ($DefaultRoot -like '[A-Z]:') { # e.g. C: - return "$DefaultRoot$Pattern" - } - - # Ensure root ends with a separator. - if (!$DefaultRoot.EndsWith('\')) { - $DefaultRoot = "$DefaultRoot\" - } - - return "$DefaultRoot$Pattern" -} - -function Test-Rooted { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - $Path = ConvertTo-NormalizedSeparators -Path $Path - return $Path.StartsWith('\') -or # e.g. \ or \hello or \\hello - $Path -like '[A-Z]:*' # e.g. C: or C:\hello -} - -function Trace-MatchOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "MatchOptions.Dot: '$($Options.Dot)'" - Write-Verbose "MatchOptions.FlipNegate: '$($Options.FlipNegate)'" - Write-Verbose "MatchOptions.MatchBase: '$($Options.MatchBase)'" - Write-Verbose "MatchOptions.NoBrace: '$($Options.NoBrace)'" - Write-Verbose "MatchOptions.NoCase: '$($Options.NoCase)'" - Write-Verbose "MatchOptions.NoComment: '$($Options.NoComment)'" - Write-Verbose "MatchOptions.NoExt: '$($Options.NoExt)'" - Write-Verbose "MatchOptions.NoGlobStar: '$($Options.NoGlobStar)'" - Write-Verbose "MatchOptions.NoNegate: '$($Options.NoNegate)'" - Write-Verbose "MatchOptions.NoNull: '$($Options.NoNull)'" -} - -function Trace-FindOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "FindOptions.FollowSpecifiedSymbolicLink: '$($FindOptions.FollowSpecifiedSymbolicLink)'" - Write-Verbose "FindOptions.FollowSymbolicLinks: '$($FindOptions.FollowSymbolicLinks)'" -} diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/InputFunctions.ps1 b/Tasks/feature/ps_modules/VstsTaskSdk/InputFunctions.ps1 deleted file mode 100644 index 846492d..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/InputFunctions.ps1 +++ /dev/null @@ -1,493 +0,0 @@ -# Hash table of known variable info. The formatted env var name is the lookup key. -# -# The purpose of this hash table is to keep track of known variables. The hash table -# needs to be maintained for multiple reasons: -# 1) to distinguish between env vars and job vars -# 2) to distinguish between secret vars and public -# 3) to know the real variable name and not just the formatted env var name. -$script:knownVariables = @{ } -$script:vault = @{ } - -<# -.SYNOPSIS -Gets an endpoint. - -.DESCRIPTION -Gets an endpoint object for the specified endpoint name. The endpoint is returned as an object with three properties: Auth, Data, and Url. - -The Data property requires a 1.97 agent or higher. - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-Endpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the URL. - $description = Get-LocString -Key PSLIB_EndpointUrl0 -ArgumentList $Name - $key = "ENDPOINT_URL_$Name" - $url = Get-VaultValue -Description $description -Key $key -Require:$Require - - # Get the auth object. - $description = Get-LocString -Key PSLIB_EndpointAuth0 -ArgumentList $Name - $key = "ENDPOINT_AUTH_$Name" - if ($auth = (Get-VaultValue -Description $description -Key $key -Require:$Require)) { - $auth = ConvertFrom-Json -InputObject $auth - } - - # Get the data. - $description = "'$Name' service endpoint data" - $key = "ENDPOINT_DATA_$Name" - if ($data = (Get-VaultValue -Description $description -Key $key)) { - $data = ConvertFrom-Json -InputObject $data - } - - # Return the endpoint. - if ($url -or $auth -or $data) { - New-Object -TypeName psobject -Property @{ - Url = $url - Auth = $auth - Data = $data - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file ticket. - -.DESCRIPTION -Gets the secure file ticket that can be used to download the secure file contents. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileTicket { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_TICKET_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file name. - -.DESCRIPTION -Gets the name for a secure file. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_NAME_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets an input. - -.DESCRIPTION -Gets the value for the specified input name. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-Input { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - # Get the input from the vault. Splat the bound parameters hashtable. Splatting is required - # in order to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Name - $key = "INPUT_$($Name.Replace(' ', '_').ToUpperInvariant())" - Get-VaultValue @PSBoundParameters -Description $description -Key $key -} - -<# -.SYNOPSIS -Gets a task variable. - -.DESCRIPTION -Gets the value for the specified task variable. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-TaskVariable { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - $description = Get-LocString -Key PSLIB_TaskVariable0 -ArgumentList $Name - $variableKey = Get-VariableKey -Name $Name - if ($script:knownVariables.$variableKey.Secret) { - # Get secret variable. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $vaultKey = "SECRET_$variableKey" - Get-VaultValue @PSBoundParameters -Description $description -Key $vaultKey - } else { - # Get public variable. - $item = $null - $path = "Env:$variableKey" - if ((Test-Path -LiteralPath $path) -and ($item = Get-Item -LiteralPath $path).Value) { - # Intentionally empty. Value was successfully retrieved. - } elseif (!$script:nonInteractive) { - # The value wasn't found and the module is running in interactive dev mode. - # Prompt for the value. - Set-Item -LiteralPath $path -Value (Read-Host -Prompt $description) - if (Test-Path -LiteralPath $path) { - $item = Get-Item -LiteralPath $path - } - } - - # Get the converted value. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - Get-Value @PSBoundParameters -Description $description -Key $variableKey -Value $item.Value - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets all job variables available to the task. Requires 2.104.1 agent or higher. - -.DESCRIPTION -Gets a snapshot of the current state of all job variables available to the task. -Requires a 2.104.1 agent or higher for full functionality. - -Returns an array of objects with the following properties: - [string]Name - [string]Value - [bool]Secret - -Limitations on an agent prior to 2.104.1: - 1) The return value does not include all public variables. Only public variables - that have been added using setVariable are returned. - 2) The name returned for each secret variable is the formatted environment variable - name, not the actual variable name (unless it was set explicitly at runtime using - setVariable). -#> -function Get-TaskVariableInfo { - [CmdletBinding()] - param() - - foreach ($info in $script:knownVariables.Values) { - New-Object -TypeName psobject -Property @{ - Name = $info.Name - Value = Get-TaskVariable -Name $info.Name - Secret = $info.Secret - } - } -} - -<# -.SYNOPSIS -Sets a task variable. - -.DESCRIPTION -Sets a task variable in the current task context as well as in the current job context. This allows the task variable to retrieved by subsequent tasks within the same job. -#> -function Set-TaskVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret) - - # Once a secret always a secret. - $variableKey = Get-VariableKey -Name $Name - [bool]$Secret = $Secret -or $script:knownVariables.$variableKey.Secret - if ($Secret) { - $vaultKey = "SECRET_$variableKey" - if (!$Value) { - # Clear the secret. - Write-Verbose "Set $Name = ''" - $script:vault.Remove($vaultKey) - } else { - # Store the secret in the vault. - Write-Verbose "Set $Name = '********'" - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Set-Item -LiteralPath "Env:$variableKey" -Value '' - } else { - # Set the environment variable. - Write-Verbose "Set $Name = '$Value'" - Set-Item -LiteralPath "Env:$variableKey" -Value $Value - } - - # Store the metadata. - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $Secret - } - - # Persist the variable in the task context. - Write-SetVariable -Name $Name -Value $Value -Secret:$Secret -} - -######################################## -# Private functions. -######################################## -function Get-VaultValue { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - # Attempt to get the vault value. - $value = $null - if ($psCredential = $script:vault[$Key]) { - $value = $psCredential.GetNetworkCredential().Password - } elseif (!$script:nonInteractive) { - # The value wasn't found. Prompt for the value if running in interactive dev mode. - $value = Read-Host -Prompt $Description - if ($value) { - $script:vault[$Key] = New-Object System.Management.Automation.PSCredential( - $Key, - (ConvertTo-SecureString -String $value -AsPlainText -Force)) - } - } - - Get-Value -Value $value @PSBoundParameters -} - -function Get-Value { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [string]$Value, - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - $result = $Value - if ($result) { - if ($Key -like 'ENDPOINT_AUTH_*') { - Write-Verbose "$($Key): '********'" - } else { - Write-Verbose "$($Key): '$result'" - } - } else { - Write-Verbose "$Key (empty)" - - # Write error if required. - if ($Require) { - Write-Error "$(Get-LocString -Key PSLIB_Required0 $Description)" - return - } - - # Fallback to the default if provided. - if ($PSCmdlet.ParameterSetName -eq 'Default') { - $result = $Default - $OFS = ' ' - Write-Verbose " Defaulted to: '$result'" - } else { - $result = '' - } - } - - # Convert to bool if specified. - if ($AsBool) { - if ($result -isnot [bool]) { - $result = "$result" -in '1', 'true' - Write-Verbose " Converted to bool: $result" - } - - return $result - } - - # Convert to int if specified. - if ($AsInt) { - if ($result -isnot [int]) { - try { - $result = [int]"$result" - } catch { - $result = 0 - } - - Write-Verbose " Converted to int: $result" - } - - return $result - } - - return $result -} - -function Initialize-Inputs { - # Store endpoints, inputs, and secret variables in the vault. - foreach ($variable in (Get-ChildItem -Path Env:ENDPOINT_?*, Env:INPUT_?*, Env:SECRET_?*, Env:SECUREFILE_?*)) { - # Record the secret variable metadata. This is required by Get-TaskVariable to - # retrieve the value. In a 2.104.1 agent or higher, this metadata will be overwritten - # when $env:VSTS_SECRET_VARIABLES is processed. - if ($variable.Name -like 'SECRET_?*') { - $variableKey = $variable.Name.Substring('SECRET_'.Length) - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - # This is technically not the variable name (has underscores instead of dots), - # but it's good enough to make Get-TaskVariable work in a pre-2.104.1 agent - # where $env:VSTS_SECRET_VARIABLES is not defined. - Name = $variableKey - Secret = $true - } - } - - # Store the value in the vault. - $vaultKey = $variable.Name - if ($variable.Value) { - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $variable.Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Remove-Item -LiteralPath "Env:$($variable.Name)" - } - - # Record the public variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_PUBLIC_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_PUBLIC_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $false - } - } - - $env:VSTS_PUBLIC_VARIABLES = '' - } - - # Record the secret variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_SECRET_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_SECRET_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $true - } - } - - $env:VSTS_SECRET_VARIABLES = '' - } -} - -function Get-VariableKey { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name) - - if ($Name -ne 'agent.jobstatus') { - $Name = $Name.Replace('.', '_') - } - - $Name.ToUpperInvariant() -} diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 b/Tasks/feature/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 deleted file mode 100644 index b4080ae..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 +++ /dev/null @@ -1,320 +0,0 @@ -<# -.SYNOPSIS -Finds files or directories. - -.DESCRIPTION -Finds files or directories using advanced pattern matching. - -.PARAMETER LiteralDirectory -Directory to search. - -.PARAMETER LegacyPattern -Proprietary pattern format. The LiteralDirectory parameter is used to root any unrooted patterns. - -Separate multiple patterns using ";". Escape actual ";" in the path by using ";;". -"?" indicates a wildcard that represents any single character within a path segment. -"*" indicates a wildcard that represents zero or more characters within a path segment. -"**" as the entire path segment indicates a recursive search. -"**" within a path segment indicates a recursive intersegment wildcard. -"+:" (can be omitted) indicates an include pattern. -"-:" indicates an exclude pattern. - -The result is from the command is a union of all the matches from the include patterns, minus the matches from the exclude patterns. - -.PARAMETER IncludeFiles -Indicates whether to include files in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER IncludeDirectories -Indicates whether to include directories in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER Force -Indicates whether to include hidden items. - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is?Match.txt" - -Given: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt -C:\Directory\IsNotMatch.txt - -Returns: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is*Match.txt" - -Given: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt -C:\Directory\NonMatch.txt - -Returns: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**\Match.txt" - -Given: -C:\Directory\Match.txt -C:\Directory\NotAMatch.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -Returns: -C:\Directory\Match.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**" - -Given: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -Returns: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Sub**Match.txt" - -Given: -C:\Directory\IsNotAMatch.txt -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\IsNot.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsNot.txt - -Returns: -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -#> -function Find-Files { - [CmdletBinding()] - param( - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$LiteralDirectory, - [Parameter(Mandatory = $true)] - [string]$LegacyPattern, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - # Note, due to subtle implementation details of Get-PathPrefix/Get-PathIterator, - # this function does not appear to be able to search the root of a drive and other - # cases where Path.GetDirectoryName() returns empty. More details in Get-PathPrefix. - - Trace-EnteringInvocation $MyInvocation - if (!$IncludeFiles -and !$IncludeDirectories) { - $IncludeFiles = $true - } - - $includePatterns = New-Object System.Collections.Generic.List[string] - $excludePatterns = New-Object System.Collections.Generic.List[System.Text.RegularExpressions.Regex] - $LegacyPattern = $LegacyPattern.Replace(';;', "`0") - foreach ($pattern in $LegacyPattern.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries)) { - $pattern = $pattern.Replace("`0", ';') - $isIncludePattern = Test-IsIncludePattern -Pattern ([ref]$pattern) - if ($LiteralDirectory -and !([System.IO.Path]::IsPathRooted($pattern))) { - # Use the root directory provided to make the pattern a rooted path. - $pattern = [System.IO.Path]::Combine($LiteralDirectory, $pattern) - } - - # Validate pattern does not end with a \. - if ($pattern[$pattern.Length - 1] -eq [System.IO.Path]::DirectorySeparatorChar) { - throw (Get-LocString -Key PSLIB_InvalidPattern0 -ArgumentList $pattern) - } - - if ($isIncludePattern) { - $includePatterns.Add($pattern) - } else { - $excludePatterns.Add((Convert-PatternToRegex -Pattern $pattern)) - } - } - - $count = 0 - foreach ($path in (Get-MatchingItems -IncludePatterns $includePatterns -ExcludePatterns $excludePatterns -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force)) { - $count++ - $path - } - - Write-Verbose "Total found: $count" - Trace-LeavingInvocation $MyInvocation -} - -######################################## -# Private functions. -######################################## -function Convert-PatternToRegex { - [CmdletBinding()] - param([string]$Pattern) - - $Pattern = [regex]::Escape($Pattern.Replace('\', '/')). # Normalize separators and regex escape. - Replace('/\*\*/', '((/.+/)|(/))'). # Replace directory globstar. - Replace('\*\*', '.*'). # Replace remaining globstars with a wildcard that can span directory separators. - Replace('\*', '[^/]*'). # Replace asterisks with a wildcard that cannot span directory separators. - # bug: should be '[^/]' instead of '.' - Replace('\?', '.') # Replace single character wildcards. - New-Object regex -ArgumentList "^$Pattern`$", ([System.Text.RegularExpressions.RegexOptions]::IgnoreCase) -} - -function Get-FileNameFilter { - [CmdletBinding()] - param([string]$Pattern) - - $index = $Pattern.LastIndexOf('\') - if ($index -eq -1 -or # Pattern does not contain a backslash. - !($Pattern = $Pattern.Substring($index + 1)) -or # Pattern ends in a backslash. - $Pattern.Contains('**')) # Last segment contains an inter-segment wildcard. - { - return '*' - } - - # bug? is this supposed to do substring? - return $Pattern -} - -function Get-MatchingItems { - [CmdletBinding()] - param( - [System.Collections.Generic.List[string]]$IncludePatterns, - [System.Collections.Generic.List[regex]]$ExcludePatterns, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - Trace-EnteringInvocation $MyInvocation - $allFiles = New-Object System.Collections.Generic.HashSet[string] - foreach ($pattern in $IncludePatterns) { - $pathPrefix = Get-PathPrefix -Pattern $pattern - $fileNameFilter = Get-FileNameFilter -Pattern $pattern - $patternRegex = Convert-PatternToRegex -Pattern $pattern - # Iterate over the directories and files under the pathPrefix. - Get-PathIterator -Path $pathPrefix -Filter $fileNameFilter -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force | - ForEach-Object { - # Normalize separators. - $normalizedPath = $_.Replace('\', '/') - # **/times/** will not match C:/fun/times because there isn't a trailing slash. - # So try both if including directories. - $alternatePath = "$normalizedPath/" # potential bug: it looks like this will result in a false - # positive if the item is a regular file and not a directory - - $isMatch = $false - if ($patternRegex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $patternRegex.IsMatch($alternatePath))) { - $isMatch = $true - - # Test whether the path should be excluded. - foreach ($regex in $ExcludePatterns) { - if ($regex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $regex.IsMatch($alternatePath))) { - $isMatch = $false - break - } - } - } - - if ($isMatch) { - $null = $allFiles.Add($_) - } - } - } - - Trace-Path -Path $allFiles -PassThru - Trace-LeavingInvocation $MyInvocation -} - -function Get-PathIterator { - [CmdletBinding()] - param( - [string]$Path, - [string]$Filter, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - if (!$Path) { - return - } - - # bug: this returns the dir without verifying whether exists - if ($IncludeDirectories) { - $Path - } - - Get-DirectoryChildItem -Path $Path -Filter $Filter -Force:$Force -Recurse | - ForEach-Object { - if ($_.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - if ($IncludeDirectories) { - $_.FullName - } - } elseif ($IncludeFiles) { - $_.FullName - } - } -} - -function Get-PathPrefix { - [CmdletBinding()] - param([string]$Pattern) - - # Note, unable to search root directories is a limitation due to subtleties of this function - # and downstream code in Get-PathIterator that short-circuits when the path prefix is empty. - # This function uses Path.GetDirectoryName() to determine the path prefix, which will yield - # empty in some cases. See the following examples of Path.GetDirectoryName() input => output: - # C:/ => - # C:/hello => C:\ - # C:/hello/ => C:\hello - # C:/hello/world => C:\hello - # C:/hello/world/ => C:\hello\world - # C: => - # C:hello => C: - # C:hello/ => C:hello - # / => - # /hello => \ - # /hello/ => \hello - # //hello => - # //hello/ => - # //hello/world => - # //hello/world/ => \\hello\world - - $index = $Pattern.IndexOfAny([char[]]@('*'[0], '?'[0])) - if ($index -eq -1) { - # If no wildcards are found, return the directory name portion of the path. - # If there is no directory name (file name only in pattern), this will return empty string. - return [System.IO.Path]::GetDirectoryName($Pattern) - } - - [System.IO.Path]::GetDirectoryName($Pattern.Substring(0, $index)) -} - -function Test-IsIncludePattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [ref]$Pattern) - - # Include patterns start with +: or anything except -: - # Exclude patterns start with -: - if ($Pattern.value.StartsWith("+:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $true - } elseif ($Pattern.value.StartsWith("-:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $false - } else { - # No prefix, so leave the string alone. - $true; - } -} diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 b/Tasks/feature/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 deleted file mode 100644 index c31790c..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 +++ /dev/null @@ -1,150 +0,0 @@ -$script:resourceStrings = @{ } - -<# -.SYNOPSIS -Gets a localized resource string. - -.DESCRIPTION -Gets a localized resource string and optionally formats the string with arguments. - -If the format fails (due to a bad format string or incorrect expected arguments in the format string), then the format string is returned followed by each of the arguments (delimited by a space). - -If the lookup key is not found, then the lookup key is returned followed by each of the arguments (delimited by a space). - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-LocString { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true, Position = 1)] - [string]$Key, - [Parameter(Position = 2)] - [object[]]$ArgumentList = @( )) - - # Due to the dynamically typed nature of PowerShell, a single null argument passed - # to an array parameter is interpreted as a null array. - if ([object]::ReferenceEquals($null, $ArgumentList)) { - $ArgumentList = @( $null ) - } - - # Lookup the format string. - $format = '' - if (!($format = $script:resourceStrings[$Key])) { - # Warn the key was not found. Prevent recursion if the lookup key is the - # "string resource key not found" lookup key. - $resourceNotFoundKey = 'PSLIB_StringResourceKeyNotFound0' - if ($key -ne $resourceNotFoundKey) { - Write-Warning (Get-LocString -Key $resourceNotFoundKey -ArgumentList $Key) - } - - # Fallback to just the key itself if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $key } - - # Otherwise fallback to the key followed by the arguments. - $OFS = " " - return "$key $ArgumentList" - } - - # Return the string if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $format } - - try { - [string]::Format($format, $ArgumentList) - } catch { - Write-Warning (Get-LocString -Key 'PSLIB_StringFormatFailed') - $OFS = " " - "$format $ArgumentList" - } -} - -<# -.SYNOPSIS -Imports resource strings for use with Get-VstsLocString. - -.DESCRIPTION -Imports resource strings for use with Get-VstsLocString. The imported strings are stored in an internal resource string dictionary. Optionally, if a separate resource file for the current culture exists, then the localized strings from that file then imported (overlaid) into the same internal resource string dictionary. - -Resource strings from the SDK are prefixed with "PSLIB_". This prefix should be avoided for custom resource strings. - -.Parameter LiteralPath -JSON file containing resource strings. - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Imports strings from messages section in the JSON file. If a messages section is not defined, then no strings are imported. Example messages section: -{ - "messages": { - "Hello": "Hello you!", - "Hello0": "Hello {0}!" - } -} - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Overlays strings from an optional separate resource file for the current culture. - -Given the task variable System.Culture is set to 'de-DE'. This variable is set by the agent based on the current culture for the job. -Given the file Task.json contains: -{ - "messages": { - "GoodDay": "Good day!", - } -} -Given the file resources.resjson\de-DE\resources.resjson: -{ - "loc.messages.GoodDay": "Guten Tag!" -} - -The net result from the import command would be one new key-value pair added to the internal dictionary: Key = 'GoodDay', Value = 'Guten Tag!' -#> -function Import-LocStrings { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - # Validate the file exists. - if (!(Test-Path -LiteralPath $LiteralPath -PathType Leaf)) { - Write-Warning (Get-LocString -Key PSLIB_FileNotFound0 -ArgumentList $LiteralPath) - return - } - - # Load the json. - Write-Verbose "Loading resource strings from: $LiteralPath" - $count = 0 - if ($messages = (Get-Content -LiteralPath $LiteralPath -Encoding UTF8 | Out-String | ConvertFrom-Json).messages) { - # Add each resource string to the hashtable. - foreach ($member in (Get-Member -InputObject $messages -MemberType NoteProperty)) { - [string]$key = $member.Name - $script:resourceStrings[$key] = $messages."$key" - $count++ - } - } - - Write-Verbose "Loaded $count strings." - - # Get the culture. - $culture = Get-TaskVariable -Name "System.Culture" -Default "en-US" - - # Load the resjson. - $resjsonPath = "$([System.IO.Path]::GetDirectoryName($LiteralPath))\Strings\resources.resjson\$culture\resources.resjson" - if (Test-Path -LiteralPath $resjsonPath) { - Write-Verbose "Loading resource strings from: $resjsonPath" - $count = 0 - $resjson = Get-Content -LiteralPath $resjsonPath -Encoding UTF8 | Out-String | ConvertFrom-Json - foreach ($member in (Get-Member -Name loc.messages.* -InputObject $resjson -MemberType NoteProperty)) { - if (!($value = $resjson."$($member.Name)")) { - continue - } - - [string]$key = $member.Name.Substring('loc.messages.'.Length) - $script:resourceStrings[$key] = $value - $count++ - } - - Write-Verbose "Loaded $count strings." - } -} diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 b/Tasks/feature/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 deleted file mode 100644 index 595a7d8..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 +++ /dev/null @@ -1,601 +0,0 @@ -$script:loggingCommandPrefix = '##vso[' -$script:loggingCommandEscapeMappings = @( # TODO: WHAT ABOUT "="? WHAT ABOUT "%"? - New-Object psobject -Property @{ Token = ';' ; Replacement = '%3B' } - New-Object psobject -Property @{ Token = "`r" ; Replacement = '%0D' } - New-Object psobject -Property @{ Token = "`n" ; Replacement = '%0A' } - New-Object psobject -Property @{ Token = "]" ; Replacement = '%5D' } -) -# TODO: BUG: Escape % ??? -# TODO: Add test to verify don't need to escape "=". - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddAttachment { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Type, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'addattachment' -Data $Path -Properties @{ - 'type' = $Type - 'name' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadSummary { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadsummary' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetEndpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [Parameter(Mandatory = $true)] - [string]$Field, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setendpoint' -Data $Value -Properties @{ - 'id' = $Id - 'field' = $Field - 'key' = $Key - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddBuildTag { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'addbuildtag' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AssociateArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - [string]$Type, - [hashtable]$Properties, - [switch]$AsOutput) - - $p = @{ } - if ($Properties) { - foreach ($key in $Properties.Keys) { - $p[$key] = $Properties[$key] - } - } - - $p['artifactname'] = $Name - $p['artifacttype'] = $Type - Write-LoggingCommand -Area 'artifact' -Event 'associate' -Data $Path -Properties $p -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-LogDetail { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [guid]$Id, - $ParentId, - [string]$Type, - [string]$Name, - $Order, - $StartTime, - $FinishTime, - $Progress, - [ValidateSet('Unknown', 'Initialized', 'InProgress', 'Completed')] - [Parameter()] - $State, - [ValidateSet('Succeeded', 'SucceededWithIssues', 'Failed', 'Cancelled', 'Skipped')] - [Parameter()] - $Result, - [string]$Message, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'logdetail' -Data $Message -Properties @{ - 'id' = $Id - 'parentid' = $ParentId - 'type' = $Type - 'name' = $Name - 'order' = $Order - 'starttime' = $StartTime - 'finishtime' = $FinishTime - 'progress' = $Progress - 'state' = $State - 'result' = $Result - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetProgress { - [CmdletBinding()] - param( - [ValidateRange(0, 100)] - [Parameter(Mandatory = $true)] - [int]$Percent, - [string]$CurrentOperation, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setprogress' -Data $CurrentOperation -Properties @{ - 'value' = $Percent - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetResult { - [CmdletBinding(DefaultParameterSetName = 'AsOutput')] - param( - [ValidateSet("Succeeded", "SucceededWithIssues", "Failed", "Cancelled", "Skipped")] - [Parameter(Mandatory = $true)] - [string]$Result, - [string]$Message, - [Parameter(ParameterSetName = 'AsOutput')] - [switch]$AsOutput, - [Parameter(ParameterSetName = 'DoNotThrow')] - [switch]$DoNotThrow) - - Write-LoggingCommand -Area 'task' -Event 'complete' -Data $Message -Properties @{ - 'result' = $Result - } -AsOutput:$AsOutput - if ($Result -eq 'Failed' -and !$AsOutput -and !$DoNotThrow) { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - throw (New-Object VstsTaskSdk.TerminationException($Message)) - } -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetSecret { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setsecret' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ - 'variable' = $Name - 'issecret' = $Secret - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskDebug { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskError { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type error @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskVerbose { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -AsVerbose -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskWarning { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type warning @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadFile { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadfile' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-PrependPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateBuildNumber { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'updatebuildnumber' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$ContainerFolder, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'artifact' -Event 'upload' -Data $Path -Properties @{ - 'containerfolder' = $ContainerFolder - 'artifactname' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadBuildLog { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'uploadlog' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateReleaseName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'release' -Event 'updatereleasename' -Data $Name -AsOutput:$AsOutput -} - -######################################## -# Private functions. -######################################## -function Format-LoggingCommandData { - [CmdletBinding()] - param([string]$Value, [switch]$Reverse) - - if (!$Value) { - return '' - } - - if (!$Reverse) { - foreach ($mapping in $script:loggingCommandEscapeMappings) { - $Value = $Value.Replace($mapping.Token, $mapping.Replacement) - } - } else { - for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { - $mapping = $script:loggingCommandEscapeMappings[$i] - $Value = $Value.Replace($mapping.Replacement, $mapping.Token) - } - } - - return $Value -} - -function Format-LoggingCommand { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Area, - [Parameter(Mandatory = $true)] - [string]$Event, - [string]$Data, - [hashtable]$Properties) - - # Append the preamble. - [System.Text.StringBuilder]$sb = New-Object -TypeName System.Text.StringBuilder - $null = $sb.Append($script:loggingCommandPrefix).Append($Area).Append('.').Append($Event) - - # Append the properties. - if ($Properties) { - $first = $true - foreach ($key in $Properties.Keys) { - [string]$value = Format-LoggingCommandData $Properties[$key] - if ($value) { - if ($first) { - $null = $sb.Append(' ') - $first = $false - } else { - $null = $sb.Append(';') - } - - $null = $sb.Append("$key=$value") - } - } - } - - # Append the tail and output the value. - $Data = Format-LoggingCommandData $Data - $sb.Append(']').Append($Data).ToString() -} - -function Write-LoggingCommand { - [CmdletBinding(DefaultParameterSetName = 'Parameters')] - param( - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Area, - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Event, - [Parameter(ParameterSetName = 'Parameters')] - [string]$Data, - [Parameter(ParameterSetName = 'Parameters')] - [hashtable]$Properties, - [Parameter(Mandatory = $true, ParameterSetName = 'Object')] - $Command, - [switch]$AsOutput) - - if ($PSCmdlet.ParameterSetName -eq 'Object') { - Write-LoggingCommand -Area $Command.Area -Event $Command.Event -Data $Command.Data -Properties $Command.Properties -AsOutput:$AsOutput - return - } - - $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties - if ($AsOutput) { - $command - } else { - Write-Host $command - } -} - -function Write-LogIssue { - [CmdletBinding()] - param( - [ValidateSet('warning', 'error')] - [Parameter(Mandatory = $true)] - [string]$Type, - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ - 'type' = $Type - 'code' = $ErrCode - 'sourcepath' = $SourcePath - 'linenumber' = $LineNumber - 'columnnumber' = $ColumnNumber - } - if ($AsOutput) { - return $command - } - - if ($Type -eq 'error') { - $foregroundColor = $host.PrivateData.ErrorForegroundColor - $backgroundColor = $host.PrivateData.ErrorBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Red - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.WarningForegroundColor - $backgroundColor = $host.PrivateData.WarningBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Yellow - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} - -function Write-TaskDebug_Internal { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsVerbose, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'debug' -Data $Message - if ($AsOutput) { - return $command - } - - if ($AsVerbose) { - $foregroundColor = $host.PrivateData.VerboseForegroundColor - $backgroundColor = $host.PrivateData.VerboseBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Cyan - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.DebugForegroundColor - $backgroundColor = $host.PrivateData.DebugBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::DarkGray - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host -Object $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 b/Tasks/feature/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 deleted file mode 100644 index d536111..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 +++ /dev/null @@ -1,205 +0,0 @@ -######################################## -# Private functions. -######################################## -function ConvertFrom-LongFormPath { - [CmdletBinding()] - param([string]$Path) - - if ($Path) { - if ($Path.StartsWith('\\?\UNC')) { - # E.g. \\?\UNC\server\share -> \\server\share - return $Path.Substring(1, '\?\UNC'.Length) - } elseif ($Path.StartsWith('\\?\')) { - # E.g. \\?\C:\directory -> C:\directory - return $Path.Substring('\\?\'.Length) - } - } - - return $Path -} -function ConvertTo-LongFormPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$longFormPath = Get-FullNormalizedPath -Path $Path - if ($longFormPath -and !$longFormPath.StartsWith('\\?')) { - if ($longFormPath.StartsWith('\\')) { - # E.g. \\server\share -> \\?\UNC\server\share - return "\\?\UNC$($longFormPath.Substring(1))" - } else { - # E.g. C:\directory -> \\?\C:\directory - return "\\?\$longFormPath" - } - } - - return $longFormPath -} - -# TODO: ADD A SWITCH TO EXCLUDE FILES, A SWITCH TO EXCLUDE DIRECTORIES, AND A SWITCH NOT TO FOLLOW REPARSE POINTS. -function Get-DirectoryChildItem { - [CmdletBinding()] - param( - [string]$Path, - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$Filter = "*", - [switch]$Force, - [VstsTaskSdk.FS.FindFlags]$Flags = [VstsTaskSdk.FS.FindFlags]::LargeFetch, - [VstsTaskSdk.FS.FindInfoLevel]$InfoLevel = [VstsTaskSdk.FS.FindInfoLevel]::Basic, - [switch]$Recurse) - - $stackOfDirectoryQueues = New-Object System.Collections.Stack - while ($true) { - $directoryQueue = New-Object System.Collections.Queue - $fileQueue = New-Object System.Collections.Queue - $findData = New-Object VstsTaskSdk.FS.FindData - $longFormPath = (ConvertTo-LongFormPath $Path) - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, $Filter), - $InfoLevel, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - # Output directories immediately. - if ($item.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - $item - # Append to the directory queue if recursive and default filter. - if ($Recurse -and $Filter -eq '*') { - $directoryQueue.Enqueue($item) - } - } else { - # Hold the files until all directories have been output. - $fileQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - - # If recursive and non-default filter, queue child directories. - if ($Recurse -and $Filter -ne '*') { - $findData = New-Object VstsTaskSdk.FS.FindData - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, '*'), - [VstsTaskSdk.FS.FindInfoLevel]::Basic, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Collect directories only. - if ($attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - $directoryQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - } - - # Output the files. - $fileQueue - - # Push the directory queue onto the stack if any directories were found. - if ($directoryQueue.Count) { $stackOfDirectoryQueues.Push($directoryQueue) } - - # Break out of the loop if no more directory queues to process. - if (!$stackOfDirectoryQueues.Count) { break } - - # Get the next path. - $directoryQueue = $stackOfDirectoryQueues.Peek() - $Path = $directoryQueue.Dequeue().FullName - - # Pop the directory queue if it's empty. - if (!$directoryQueue.Count) { $null = $stackOfDirectoryQueues.Pop() } - } -} - -function Get-FullNormalizedPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$outPath = $Path - [uint32]$bufferSize = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, 0, $null, $null) - [int]$lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($bufferSize -gt 0) { - $absolutePath = New-Object System.Text.StringBuilder([int]$bufferSize) - [uint32]$length = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, $bufferSize, $absolutePath, $null) - $lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($length -gt 0) { - $outPath = $absolutePath.ToString() - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - - if ($outPath.EndsWith('\') -and !$outPath.EndsWith(':\')) { - $outPath = $outPath.TrimEnd('\') - } - - $outPath -} \ No newline at end of file diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/Minimatch.dll b/Tasks/feature/ps_modules/VstsTaskSdk/Minimatch.dll deleted file mode 100644 index 700ddc426e56b08270c9dcbb1ade8ded248f98d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18432 zcmeHvd3amZweLFTNJpa;OY%U-U;wdJ(iE<^0Dr1eX+yVU^ZP<}CerFP{^D;NRAvpy{Upu7qdr-p#QQK0A=EE z*j@RF!K$=fum`{t+x7$Dj;_a3@mYu3X*)Y&L6B{wNj$7;1D=Y{x>+@ezQumUhi%iz zO@BY1=+-!qPq<}p%U-3n%sDf*P#@P|Wa1p%m=FXEn4%bhfB`=%h9F>|Q;H!781527 z5HJu1N4U|d+S*S|6A90AA zkcdZ#{0VeB+M>~Zr~5WKIT}ZR`3qry$+MxwZUCkMpp6A zlnP^-LRYHRWuXsdbCpqNodtCbjqPxWp&AP6_LosJK9}1uT+)sn=XT(TXp2E@Xam*5 zPMKe?G$W3ZWHq@`VV5-rby7Zf6F~r;o>=af9Y2q?MO$37yJW9;db*vutEt&Mw*dE= z6Nqt_Zdh=pf1--OAk^fxTE;9o}~-pGxds~dH31h<)Z!q6++rR>xk zJz{CdPk> z$z#Au8q!>Hj%Z+R9P=r84Bjb~FXeL3Xo0zLOs`}dQz|)u0CZuT4B8JLU=+i3e#c`5 z>ZG(pT_9Nx6GD)ydrh0*w^_f-@2TGv@TlHf=&gTgwIVz!+!m#uGV59+jt@)=-B*K# zw%l|9bmPBpVLRIJo5lp}bD84|Ep!cGdyFTQZk>y2&4K!NqElK^oqjK@(VamUUv(2K zE^LK()C`+76YznnE|^@Vd&PvPC+unHZ})g$bs%{*i1GFsPjfhI>UCZV;pvwe$trLC zuAou;@X>CFwo3HGXfed3lY(v8Zgq@!gPBL+fr@d}10i()iA+Y=_?q`qs zER3#yrUK4B$*9+7VMzV;Rx^vBU4I-d@GI_FGq_P-Q`pyH)F-vtsK3wxxo997Os=Sl zRwd5~2O`0ED|lgVxXQxx^~aHr{MIsNRn_l`R)wp=UJJ{BzwNu>VA#Ja8pO*7r2XM= zAW?u6sfkS8_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sTaskSdk/OutFunctions.ps1 deleted file mode 100644 index fd898d6..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/OutFunctions.ps1 +++ /dev/null @@ -1,79 +0,0 @@ -# TODO: It would be better if the Out-Default function resolved the underlying Out-Default -# command in the begin block. This would allow for supporting other modules that override -# Out-Default. -$script:outDefaultCmdlet = $ExecutionContext.InvokeCommand.GetCmdlet("Microsoft.PowerShell.Core\Out-Default") - -######################################## -# Public functions. -######################################## -function Out-Default { - [CmdletBinding(ConfirmImpact = "Medium")] - param( - [Parameter(ValueFromPipeline = $true)] - [System.Management.Automation.PSObject]$InputObject) - - begin { - #Write-Host '[Entering Begin Out-Default]' - $__sp = { & $script:outDefaultCmdlet @PSBoundParameters }.GetSteppablePipeline() - $__sp.Begin($pscmdlet) - #Write-Host '[Leaving Begin Out-Default]' - } - - process { - #Write-Host '[Entering Process Out-Default]' - if ($_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose -Message 'Error record:' 4>&1 | Out-Default - Write-Verbose -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) 4>&1 | Out-Default - Write-Verbose -Message 'Script stack trace:' 4>&1 | Out-Default - Write-Verbose -Message "$($_.ScriptStackTrace)" 4>&1 | Out-Default - Write-Verbose -Message 'Exception:' 4>&1 | Out-Default - Write-Verbose -Message $_.Exception.ToString() 4>&1 | Out-Default - Write-TaskError -Message $_.Exception.Message - } elseif ($_ -is [System.Management.Automation.WarningRecord]) { - Write-TaskWarning -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) - } elseif ($_ -is [System.Management.Automation.VerboseRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskVerbose -Message $private:str - } - } elseif ($_ -is [System.Management.Automation.DebugRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskDebug -Message $private:str - } - } else { -# TODO: Consider using out-string here to control the width. As a security precaution it would actually be best to set it to max so wrapping doesn't interfere with secret masking. - $__sp.Process($_) - } - - #Write-Host '[Leaving Process Out-Default]' - } - - end { - #Write-Host '[Entering End Out-Default]' - $__sp.End() - #Write-Host '[Leaving End Out-Default]' - } -} - -######################################## -# Private functions. -######################################## -function Format-DebugMessage { - [CmdletBinding()] - param([psobject]$Object) - - $private:str = Out-String -InputObject $Object -Width 2147483647 - $private:str = Remove-TrailingNewLine $private:str - "$private:str".Replace("`r`n", "`n").Replace("`r", "`n").Split("`n"[0]) -} - -function Remove-TrailingNewLine { - [CmdletBinding()] - param($Str) - if ([object]::ReferenceEquals($Str, $null)) { - return $Str - } elseif ($Str.EndsWith("`r`n")) { - return $Str.Substring(0, $Str.Length - 2) - } else { - return $Str - } -} diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml b/Tasks/feature/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml deleted file mode 100644 index 8c20388..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - Microsoft.PowerShell.Commands.PSRepositoryItemInfo - System.Management.Automation.PSCustomObject - System.Object - - - VstsTaskSdk - 0.11.0 - Module - VSTS Task SDK - Microsoft - VSTS - (c) 2016 Microsoft. All rights reserved. -

2018-05-21T03:27:56+01:00
- - - - https://github.com/Microsoft/vsts-task-lib - - - - System.Object[] - System.Array - System.Object - - - PSModule - - - - - System.Collections.Hashtable - System.Object - - - - DscResource - - - - - - - RoleCapability - - - - Cmdlet - - - - Workflow - - - - Command - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - Function - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - - - - - - - - https://www.powershellgallery.com/api/v2 - PSGallery - NuGet - - - System.Management.Automation.PSCustomObject - System.Object - - - (c) 2016 Microsoft. All rights reserved. - VSTS Task SDK - False - True - True - 12749 - 136204 - 71074 - 21/05/2018 03:27:56 +01:00 - 21/05/2018 03:27:56 +01:00 - 09/11/2018 22:20:20 +00:00 - PSModule PSFunction_Find-Match PSCommand_Find-Match PSFunction_New-FindOptions PSCommand_New-FindOptions PSFunction_New-MatchOptions PSCommand_New-MatchOptions PSFunction_Select-Match PSCommand_Select-Match PSFunction_Get-Endpoint PSCommand_Get-Endpoint PSFunction_Get-SecureFileTicket PSCommand_Get-SecureFileTicket PSFunction_Get-SecureFileName PSCommand_Get-SecureFileName PSFunction_Get-Input PSCommand_Get-Input PSFunction_Get-TaskVariable PSCommand_Get-TaskVariable PSFunction_Get-TaskVariableInfo PSCommand_Get-TaskVariableInfo PSFunction_Set-TaskVariable PSCommand_Set-TaskVariable PSFunction_Find-Files PSCommand_Find-Files PSFunction_Get-LocString PSCommand_Get-LocString PSFunction_Import-LocStrings PSCommand_Import-LocStrings PSFunction_Write-AddAttachment PSCommand_Write-AddAttachment PSFunction_Write-AddBuildTag PSCommand_Write-AddBuildTag PSFunction_Write-AssociateArtifact PSCommand_Write-AssociateArtifact PSFunction_Write-LogDetail PSCommand_Write-LogDetail PSFunction_Write-PrependPath PSCommand_Write-PrependPath PSFunction_Write-SetEndpoint PSCommand_Write-SetEndpoint PSFunction_Write-SetProgress PSCommand_Write-SetProgress PSFunction_Write-SetResult PSCommand_Write-SetResult PSFunction_Write-SetSecret PSCommand_Write-SetSecret PSFunction_Write-SetVariable PSCommand_Write-SetVariable PSFunction_Write-TaskDebug PSCommand_Write-TaskDebug PSFunction_Write-TaskError PSCommand_Write-TaskError PSFunction_Write-TaskVerbose PSCommand_Write-TaskVerbose PSFunction_Write-TaskWarning PSCommand_Write-TaskWarning PSFunction_Write-UpdateBuildNumber PSCommand_Write-UpdateBuildNumber PSFunction_Write-UpdateReleaseName PSCommand_Write-UpdateReleaseName PSFunction_Write-UploadArtifact PSCommand_Write-UploadArtifact PSFunction_Write-UploadBuildLog PSCommand_Write-UploadBuildLog PSFunction_Write-UploadFile PSCommand_Write-UploadFile PSFunction_Write-UploadSummary PSCommand_Write-UploadSummary PSFunction_Out-Default PSCommand_Out-Default PSFunction_Get-AssemblyReference PSCommand_Get-AssemblyReference PSFunction_Get-TfsClientCredentials PSCommand_Get-TfsClientCredentials PSFunction_Get-TfsService PSCommand_Get-TfsService PSFunction_Get-VssCredentials PSCommand_Get-VssCredentials PSFunction_Get-VssHttpClient PSCommand_Get-VssHttpClient PSFunction_Assert-Agent PSCommand_Assert-Agent PSFunction_Assert-Path PSCommand_Assert-Path PSFunction_Invoke-Tool PSCommand_Invoke-Tool PSFunction_Trace-EnteringInvocation PSCommand_Trace-EnteringInvocation PSFunction_Trace-LeavingInvocation PSCommand_Trace-LeavingInvocation PSFunction_Trace-Path PSCommand_Trace-Path PSFunction_Get-WebProxy PSCommand_Get-WebProxy PSFunction_Get-ClientCertificate PSCommand_Get-ClientCertificate PSIncludes_Function - False - 2018-11-09T22:20:20Z - 0.11.0 - Microsoft - false - Module - VstsTaskSdk.nuspec|FindFunctions.ps1|InputFunctions.ps1|LegacyFindFunctions.ps1|lib.json|LocalizationFunctions.ps1|LoggingCommandFunctions.ps1|LongPathFunctions.ps1|Minimatch.dll|OutFunctions.ps1|ServerOMFunctions.ps1|ToolFunctions.ps1|TraceFunctions.ps1|VstsTaskSdk.dll|VstsTaskSdk.psd1|VstsTaskSdk.psm1|Strings\resources.resjson\de-de\resources.resjson|Strings\resources.resjson\en-US\resources.resjson|Strings\resources.resjson\es-es\resources.resjson|Strings\resources.resjson\fr-fr\resources.resjson|Strings\resources.resjson\it-IT\resources.resjson|Strings\resources.resjson\ja-jp\resources.resjson|Strings\resources.resjson\ko-KR\resources.resjson|Strings\resources.resjson\ru-RU\resources.resjson|Strings\resources.resjson\zh-CN\resources.resjson|Strings\resources.resjson\zh-TW\resources.resjson - bbed04e2-4e8e-4089-90a2-58b858fed8d8 - 3.0 - Microsoft - - - /Users/gep13/github/gep13/chocolatey-azuredevops/Tasks/install/VstsTaskSdk/0.11.0 - - - diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 b/Tasks/feature/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 deleted file mode 100644 index 177820b..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 +++ /dev/null @@ -1,659 +0,0 @@ -<# -.SYNOPSIS -Gets assembly reference information. - -.DESCRIPTION -Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK. - -Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario. - -Walks an assembly's references to determine all of it's dependencies. Also walks the references of the dependencies, and so on until all nested dependencies have been traversed. Dependencies are searched for in the directory of the specified assembly. NET Framework assemblies are omitted. - -See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER LiteralPath -Assembly to walk. - -.EXAMPLE -Get-VstsAssemblyReference -LiteralPath C:\nuget\microsoft.teamfoundationserver.client.14.102.0\lib\net45\Microsoft.TeamFoundation.Build2.WebApi.dll -#> -function Get-AssemblyReference { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - $ErrorActionPreference = 'Stop' - Write-Warning "Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK." - Write-Output '' - Write-Warning "Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario." - $directory = [System.IO.Path]::GetDirectoryName($LiteralPath) - $hashtable = @{ } - $queue = @( [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($LiteralPath).GetName() ) - while ($queue.Count) { - # Add a blank line between assemblies. - Write-Output '' - - # Pop. - $assemblyName = $queue[0] - $queue = @( $queue | Select-Object -Skip 1 ) - - # Attempt to find the assembly in the same directory. - $assembly = $null - $path = "$directory\$($assemblyName.Name).dll" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } else { - $path = "$directory\$($assemblyName.Name).exe" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } - } - - # Make sure the assembly full name matches, not just the file name. - if ($assembly -and $assembly.GetName().FullName -ne $assemblyName.FullName) { - $assembly = $null - } - - # Print the assembly. - if ($assembly) { - Write-Output $assemblyName.FullName - } else { - if ($assemblyName.FullName -eq 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed') { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) *** This is an expected condition when using the HTTP clients from the 15.x VSTS REST SDK. Use Get-VstsVssHttpClient to load the HTTP clients (which applies a binding redirect assembly resolver for Newtonsoft.Json). Otherwise you will need to manage the binding redirect yourself." - } else { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) ***" - } - - continue - } - - # Walk the references. - $refAssemblyNames = @( $assembly.GetReferencedAssemblies() ) - for ($i = 0 ; $i -lt $refAssemblyNames.Count ; $i++) { - $refAssemblyName = $refAssemblyNames[$i] - - # Skip framework assemblies. - $fxPaths = @( - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\$($refAssemblyName.Name).dll" - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\WPF\$($refAssemblyName.Name).dll" - ) - $fxPath = $fxPaths | - Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } | - Where-Object { [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($_).GetName().FullName -eq $refAssemblyName.FullName } - if ($fxPath) { - continue - } - - # Print the reference. - Write-Output " $($refAssemblyName.FullName)" - - # Add new references to the queue. - if (!$hashtable[$refAssemblyName.FullName]) { - $queue += $refAssemblyName - $hashtable[$refAssemblyName.FullName] = $true - } - } - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the TFS extended client SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -Refer to Get-VstsTfsService for a more simple to get a TFS service object. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -$credentials = Get-VstsTfsClientCredentials -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.VersionControl.Client.dll" -$tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection( - (Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require), - $credentials) -$versionControlServer = $tfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer]) -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsClientCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Validate the type can be found. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsClientCredentials' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Construct the credentials. - $credentials = New-Object Microsoft.TeamFoundation.Client.TfsClientCredentials($false) # Do not use default credentials. - $credentials.AllowInteractive = $false - $credentials.Federated = New-Object Microsoft.TeamFoundation.Client.OAuthTokenCredential([string]$endpoint.auth.parameters.AccessToken) - return $credentials - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a TFS extended client service. - -.DESCRIPTION -Gets an instance of an ITfsTeamProjectCollectionObject. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the service to get. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER Uri -URI to use when initializing the service. If not specified, defaults to System.TeamFoundationCollectionUri. - -.PARAMETER TfsClientCredentials -Credentials to use when initializing the service. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -.EXAMPLE -$versionControlServer = Get-VstsTfsService -TypeName Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsService { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $TfsClientCredentials) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Default the credentials. - if (!$TfsClientCredentials) { - $TfsClientCredentials = Get-TfsClientCredentials -OMDirectory $OMDirectory - } - - # Validate the project collection type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsTeamProjectCollection' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Load the project collection object. - $tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection($Uri, $TfsClientCredentials) - - # Validate the requested type can be loaded. - $type = Get-OMType -TypeName $TypeName -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Return the service object. - return $tfsTeamProjectCollection.GetService($type) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the VSTS REST SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project service build/release identity). - -Refer to Get-VstsVssHttpClient for a more simple to get a VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -# This example works using the 14.x .NET SDK. A Newtonsoft.Json 6.0 to 8.0 binding -# redirect may be required when working with the 15.x SDK. Or use Get-VstsVssHttpClient -# to avoid managing the binding redirect. -# -$vssCredentials = Get-VstsVssCredentials -$collectionUrl = New-Object System.Uri((Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require)) -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.Core.WebApi.dll" -$projectHttpClient = New-Object Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient($collectionUrl, $vssCredentials) -$projectHttpClient.GetProjects().Result -#> -function Get-VssCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Check if the VssOAuthAccessTokenCredential type is available. - if ((Get-OMType -TypeName 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory)) { - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential($endpoint.auth.parameters.AccessToken) - } else { - # Validate the fallback type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.Client.VssOAuthCredential($endpoint.auth.parameters.AccessToken) - } - - # Return the credentials. - return New-Object Microsoft.VisualStudio.Services.Common.VssCredentials( - (New-Object Microsoft.VisualStudio.Services.Common.WindowsCredential($false)), # Do not use default credentials. - $federatedCredential, - [Microsoft.VisualStudio.Services.Common.CredentialPromptType]::DoNotPrompt) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VSS HTTP client. - -.DESCRIPTION -Gets an instance of an VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the HTTP client to get. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -# .PARAMETER Uri -# URI to use when initializing the HTTP client. If not specified, defaults to System.TeamFoundationCollectionUri. - -# .PARAMETER VssCredentials -# Credentials to use when initializing the HTTP client. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -# .PARAMETER WebProxy -# WebProxy to use when initializing the HTTP client. If not specified, the default uses the proxy configuration agent current has. - -# .PARAMETER ClientCert -# ClientCert to use when initializing the HTTP client. If not specified, the default uses the client certificate agent current has. - -# .PARAMETER IgnoreSslError -# Skip SSL server certificate validation on all requests made by this HTTP client. If not specified, the default is to validate SSL server certificate. - -.EXAMPLE -$projectHttpClient = Get-VstsVssHttpClient -TypeName Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient -$projectHttpClient.GetProjects().Result -#> -function Get-VssHttpClient { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $VssCredentials, - - $WebProxy = (Get-WebProxy), - - $ClientCert = (Get-ClientCertificate), - - [switch]$IgnoreSslError) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Cast the URI. - [uri]$Uri = New-Object System.Uri($Uri) - - # Default the credentials. - if (!$VssCredentials) { - $VssCredentials = Get-VssCredentials -OMDirectory $OMDirectory - } - - # Validate the type can be loaded. - $null = Get-OMType -TypeName $TypeName -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Update proxy setting for vss http client - [Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler]::DefaultWebProxy = $WebProxy - - # Update client certificate setting for vss http client - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - [Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings]$Settings = [Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings]::Default.Clone() - - if ($ClientCert) { - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance.ClientCertificates.Add($ClientCert) - - $Settings.ClientCertificateManager = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance - } - - # Skip SSL server certificate validation - [bool]$SkipCertValidation = (Get-TaskVariable -Name Agent.SkipCertValidation -AsBool) -or $IgnoreSslError - if ($SkipCertValidation) { - if ($Settings.GetType().GetProperty('ServerCertificateValidationCallback')) { - Write-Verbose "Ignore any SSL server certificate validation errors."; - $Settings.ServerCertificateValidationCallback = [VstsTaskSdk.VstsHttpHandlerSettings]::UnsafeSkipServerCertificateValidation - } - else { - # OMDirectory has older version of Microsoft.VisualStudio.Services.Common.dll - Write-Verbose "The version of 'Microsoft.VisualStudio.Services.Common.dll' does not support skip SSL server certificate validation." - } - } - - # Try to construct the HTTP client. - Write-Verbose "Constructing HTTP client." - try { - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } catch { - # Rethrow if the exception is not due to Newtonsoft.Json DLL not found. - if ($_.Exception.InnerException -isnot [System.IO.FileNotFoundException] -or - $_.Exception.InnerException.FileName -notlike 'Newtonsoft.Json, *') { - - throw - } - - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Test if the Newtonsoft.Json DLL exists in the OM directory. - $newtonsoftDll = [System.IO.Path]::Combine($OMDirectory, "Newtonsoft.Json.dll") - Write-Verbose "Testing file path: '$newtonsoftDll'" - if (!(Test-Path -LiteralPath $newtonsoftDll -PathType Leaf)) { - Write-Verbose 'Not found. Rethrowing exception.' - throw - } - - # Add a binding redirect and try again. Parts of the Dev15 preview SDK have a - # dependency on the 6.0.0.0 Newtonsoft.Json DLL, while other parts reference - # the 8.0.0.0 Newtonsoft.Json DLL. - Write-Verbose "Adding assembly resolver." - $onAssemblyResolve = [System.ResolveEventHandler] { - param($sender, $e) - - if ($e.Name -like 'Newtonsoft.Json, *') { - Write-Verbose "Resolving '$($e.Name)'" - return [System.Reflection.Assembly]::LoadFrom($newtonsoftDll) - } - - Write-Verbose "Unable to resolve assembly name '$($e.Name)'" - return $null - } - [System.AppDomain]::CurrentDomain.add_AssemblyResolve($onAssemblyResolve) - try { - # Try again to construct the HTTP client. - Write-Verbose "Trying again to construct the HTTP client." - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } finally { - # Unregister the assembly resolver. - Write-Verbose "Removing assemlby resolver." - [System.AppDomain]::CurrentDomain.remove_AssemblyResolve($onAssemblyResolve) - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VstsTaskSdk.VstsWebProxy - -.DESCRIPTION -Gets an instance of a VstsTaskSdk.VstsWebProxy that has same proxy configuration as Build/Release agent. - -VstsTaskSdk.VstsWebProxy implement System.Net.IWebProxy interface. - -.EXAMPLE -$webProxy = Get-VstsWebProxy -$webProxy.GetProxy(New-Object System.Uri("https://github.com/Microsoft/vsts-task-lib")) -#> -function Get-WebProxy { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports proxy - Assert-Agent -Minimum '2.105.7' - - $proxyUrl = Get-TaskVariable -Name Agent.ProxyUrl - $proxyUserName = Get-TaskVariable -Name Agent.ProxyUserName - $proxyPassword = Get-TaskVariable -Name Agent.ProxyPassword - $proxyBypassListJson = Get-TaskVariable -Name Agent.ProxyBypassList - [string[]]$ProxyBypassList = ConvertFrom-Json -InputObject $ProxyBypassListJson - - return New-Object -TypeName VstsTaskSdk.VstsWebProxy -ArgumentList @($proxyUrl, $proxyUserName, $proxyPassword, $proxyBypassList) - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a client certificate for current connected TFS instance - -.DESCRIPTION -Gets an instance of a X509Certificate2 that is the client certificate Build/Release agent used. - -.EXAMPLE -$x509cert = Get-ClientCertificate -WebRequestHandler.ClientCertificates.Add(x509cert) -#> -function Get-ClientCertificate { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports client certificate - Assert-Agent -Minimum '2.122.0' - - [string]$clientCert = Get-TaskVariable -Name Agent.ClientCertArchive - [string]$clientCertPassword = Get-TaskVariable -Name Agent.ClientCertPassword - - if ($clientCert -and (Test-Path -LiteralPath $clientCert -PathType Leaf)) { - return New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($clientCert, $clientCertPassword) - } - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -######################################## -# Private functions. -######################################## -function Get-OMType { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [ValidateSet('ExtendedClient', 'WebApi')] - [Parameter(Mandatory = $true)] - [string]$OMKind, - - [string]$OMDirectory, - - [switch]$Require) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Try to load the type. - $errorRecord = $null - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - # Store the error record. - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - - # Build a list of candidate DLL file paths from the namespace. - $dllPaths = @( ) - $namespace = $TypeName - while ($namespace.LastIndexOf('.') -gt 0) { - # Trim the next segment from the namespace. - $namespace = $namespace.SubString(0, $namespace.LastIndexOf('.')) - - # Derive potential DLL file paths based on the namespace and OM kind (i.e. extended client vs web API). - if ($OMKind -eq 'ExtendedClient') { - if ($namespace -like 'Microsoft.TeamFoundation.*') { - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } else { - if ($namespace -like 'Microsoft.TeamFoundation.*' -or - $namespace -like 'Microsoft.VisualStudio.Services' -or - $namespace -like 'Microsoft.VisualStudio.Services.*') { - - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.WebApi.dll") - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } - } - - foreach ($dllPath in $dllPaths) { - # Check whether the DLL exists. - Write-Verbose "Testing leaf path: '$dllPath'" - if (!(Test-Path -PathType Leaf -LiteralPath "$dllPath")) { - Write-Verbose "Not found." - continue - } - - # Load the DLL. - Write-Verbose "Loading assembly: $dllPath" - try { - Add-Type -LiteralPath $dllPath - } catch { - # Write the information to the verbose stream and proceed to attempt to load the requested type. - # - # The requested type may successfully load now. For example, the type used with the 14.0 Web API for the - # federated credential (VssOAuthCredential) resides in Microsoft.VisualStudio.Services.Client.dll. Even - # though loading the DLL results in a ReflectionTypeLoadException when Microsoft.ServiceBus.dll (approx 3.75mb) - # is not present, enough types are loaded to use the VssOAuthCredential federated credential with the Web API - # HTTP clients. - Write-Verbose "$($_.Exception.GetType().FullName): $($_.Exception.Message)" - if ($_.Exception -is [System.Reflection.ReflectionTypeLoadException]) { - for ($i = 0 ; $i -lt $_.Exception.LoaderExceptions.Length ; $i++) { - $loaderException = $_.Exception.LoaderExceptions[$i] - Write-Verbose "LoaderExceptions[$i]: $($loaderException.GetType().FullName): $($loaderException.Message)" - } - } - } - - # Try to load the type. - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - } - - # Check whether to propagate the error. - if ($Require) { - Write-Error $errorRecord - } - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson b/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson deleted file mode 100644 index 7871c36..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agentversion {0} oder höher ist erforderlich.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Der Containerpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "\"{0}\"-Dienstendpunkt-Anmeldeinformationen", - "loc.messages.PSLIB_EndpointUrl0": "\"{0}\"-Dienstendpunkt-URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Fehler beim Aufzählen von Unterverzeichnissen für den folgenden Pfad: \"{0}\"", - "loc.messages.PSLIB_FileNotFound0": "Die Datei wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Input0": "\"{0}\"-Eingabe", - "loc.messages.PSLIB_InvalidPattern0": "Ungültiges Muster: \"{0}\"", - "loc.messages.PSLIB_LeafPathNotFound0": "Der Blattpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Fehler bei der Normalisierung bzw. Erweiterung des Pfads. Die Pfadlänge wurde vom Kernel32-Subsystem nicht zurückgegeben für: \"{0}\"", - "loc.messages.PSLIB_PathNotFound0": "Der Pfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Der Prozess \"{0}\" wurde mit dem Code \"{1}\" beendet.", - "loc.messages.PSLIB_Required0": "Erforderlich: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Fehler beim Zeichenfolgenformat.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Der Zeichenfolgen-Ressourcenschlüssel wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "\"{0}\"-Taskvariable" -} \ No newline at end of file diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson b/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson deleted file mode 100644 index 66c17bc..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "File not found: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' input", - "loc.messages.PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Path not found: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "loc.messages.PSLIB_Required0": "Required: {0}", - "loc.messages.PSLIB_StringFormatFailed": "String format failed.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' task variable" -} \ No newline at end of file diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson b/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson deleted file mode 100644 index f5c9c23..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Se require la versión {0} o posterior del agente.", - "loc.messages.PSLIB_ContainerPathNotFound0": "No se encuentra la ruta de acceso del contenedor: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenciales del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "No se pudieron enumerar los subdirectorios de la ruta de acceso: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Archivo no encontrado: '{0}'", - "loc.messages.PSLIB_Input0": "Entrada '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Patrón no válido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "No se encuentra la ruta de acceso de la hoja: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "No se pudo normalizar o expandir la ruta de acceso. El subsistema Kernel32 no devolvió la longitud de la ruta de acceso para: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "No se encuentra la ruta de acceso: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "El proceso '{0}' finalizó con el código '{1}'.", - "loc.messages.PSLIB_Required0": "Se requiere: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Error de formato de cadena.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "No se encuentra la clave de recurso de la cadena: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tarea '{0}'" -} \ No newline at end of file diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson b/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson deleted file mode 100644 index 652870c..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "L'agent version {0} (ou une version ultérieure) est obligatoire.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Le chemin du conteneur est introuvable : '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Informations d'identification du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Échec de l'énumération des sous-répertoires pour le chemin : '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Fichier introuvable : {0}.", - "loc.messages.PSLIB_Input0": "Entrée '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Modèle non valide : '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Le chemin feuille est introuvable : '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Échec de la normalisation/l'expansion du chemin. La longueur du chemin n'a pas été retournée par le sous-système Kernel32 pour : '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Chemin introuvable : '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Le processus '{0}' s'est arrêté avec le code '{1}'.", - "loc.messages.PSLIB_Required0": "Obligatoire : {0}", - "loc.messages.PSLIB_StringFormatFailed": "Échec du format de la chaîne.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Clé de la ressource de type chaîne introuvable : '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tâche '{0}'" -} \ No newline at end of file diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson b/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson deleted file mode 100644 index 6aeb1df..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "È richiesta la versione dell'agente {0} o superiore.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Percorso del contenitore non trovato: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenziali dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "L'enumerazione delle sottodirectory per il percorso '{0}' non è riuscita", - "loc.messages.PSLIB_FileNotFound0": "File non trovato: '{0}'", - "loc.messages.PSLIB_Input0": "Input di '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Criterio non valido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Percorso foglia non trovato: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "La normalizzazione o l'espansione del percorso non è riuscita. Il sottosistema Kernel32 non ha restituito la lunghezza del percorso per '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Percorso non trovato: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Il processo '{0}' è stato terminato ed è stato restituito il codice '{1}'.", - "loc.messages.PSLIB_Required0": "Obbligatorio: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Errore nel formato della stringa.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "La chiave della risorsa stringa non è stata trovata: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variabile dell'attività '{0}'" -} \ No newline at end of file diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson b/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson deleted file mode 100644 index 6b07ab6..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "バージョン {0} 以降のエージェントが必要です。", - "loc.messages.PSLIB_ContainerPathNotFound0": "コンテナーのパスが見つかりません: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' サービス エンドポイントの資格情報", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' サービス エンドポイントの URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "パス '{0}' のサブディレクトリを列挙できませんでした", - "loc.messages.PSLIB_FileNotFound0": "ファイルが見つかりません: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 入力", - "loc.messages.PSLIB_InvalidPattern0": "使用できないパターンです: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "リーフ パスが見つかりません: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "パスの正規化/展開に失敗しました。Kernel32 サブシステムからパス '{0}' の長さが返されませんでした", - "loc.messages.PSLIB_PathNotFound0": "パスが見つかりません: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "プロセス '{0}' がコード '{1}' で終了しました。", - "loc.messages.PSLIB_Required0": "必要: {0}", - "loc.messages.PSLIB_StringFormatFailed": "文字列のフォーマットに失敗しました。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "文字列のリソース キーが見つかりません: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' タスク変数" -} \ No newline at end of file diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson b/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson deleted file mode 100644 index e58cbdc..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "에이전트 버전 {0} 이상이 필요합니다.", - "loc.messages.PSLIB_ContainerPathNotFound0": "컨테이너 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 서비스 끝점 자격 증명", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 서비스 끝점 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "경로에 대해 하위 디렉터리를 열거하지 못함: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "{0} 파일을 찾을 수 없습니다.", - "loc.messages.PSLIB_Input0": "'{0}' 입력", - "loc.messages.PSLIB_InvalidPattern0": "잘못된 패턴: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "경로 정규화/확장에 실패했습니다. 다음에 대해 Kernel32 subsystem에서 경로 길이를 반환하지 않음: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "'{1}' 코드로 '{0}' 프로세스가 종료되었습니다.", - "loc.messages.PSLIB_Required0": "필수: {0}", - "loc.messages.PSLIB_StringFormatFailed": "문자열을 포맷하지 못했습니다.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "문자열 리소스 키를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 작업 변수" -} \ No newline at end of file diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson b/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson deleted file mode 100644 index 38dd69d..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Требуется версия агента {0} или более поздняя.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Путь к контейнеру не найден: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "Учетные данные конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EndpointUrl0": "URL-адрес конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Сбой перечисления подкаталогов для пути: \"{0}\".", - "loc.messages.PSLIB_FileNotFound0": "Файл не найден: \"{0}\".", - "loc.messages.PSLIB_Input0": "Входные данные \"{0}\".", - "loc.messages.PSLIB_InvalidPattern0": "Недопустимый шаблон: \"{0}\".", - "loc.messages.PSLIB_LeafPathNotFound0": "Путь к конечному объекту не найден: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Сбой нормализации и расширения пути. Длина пути не была возвращена подсистемой Kernel32 для: \"{0}\".", - "loc.messages.PSLIB_PathNotFound0": "Путь не найден: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Процесс \"{0}\" завершил работу с кодом \"{1}\".", - "loc.messages.PSLIB_Required0": "Требуется: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Сбой формата строки.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Ключ ресурса строки не найден: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "Переменная задачи \"{0}\"" -} \ No newline at end of file diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson b/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson deleted file mode 100644 index 1d333de..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理版本 {0} 或更高版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路径:“{0}”", - "loc.messages.PSLIB_EndpointAuth0": "“{0}”服务终结点凭据", - "loc.messages.PSLIB_EndpointUrl0": "“{0}”服务终结点 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "枚举路径的子目录失败:“{0}”", - "loc.messages.PSLIB_FileNotFound0": "找不到文件: {0}。", - "loc.messages.PSLIB_Input0": "“{0}”输入", - "loc.messages.PSLIB_InvalidPattern0": "无效的模式:“{0}”", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到叶路径:“{0}”", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路径规范化/扩展失败。路径长度不是由“{0}”的 Kernel32 子系统返回的", - "loc.messages.PSLIB_PathNotFound0": "找不到路径:“{0}”", - "loc.messages.PSLIB_Process0ExitedWithCode1": "过程“{0}”已退出,代码为“{1}”。", - "loc.messages.PSLIB_Required0": "必需: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字符串格式无效。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字符串资源关键字:“{0}”", - "loc.messages.PSLIB_TaskVariable0": "“{0}”任务变量" -} \ No newline at end of file diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson b/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson deleted file mode 100644 index 512509b..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理程式版本 {0} 或更新的版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路徑: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 服務端點認證", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 服務端點 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "為路徑列舉子目錄失敗: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "找不到檔案: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 輸入", - "loc.messages.PSLIB_InvalidPattern0": "模式無效: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到分葉路徑: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路徑正規化/展開失敗。Kernel32 子系統未傳回 '{0}' 的路徑長度", - "loc.messages.PSLIB_PathNotFound0": "找不到路徑: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "處理序 '{0}' 以返回碼 '{1}' 結束。", - "loc.messages.PSLIB_Required0": "必要項: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字串格式失敗。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字串資源索引鍵: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 工作變數" -} \ No newline at end of file diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/ToolFunctions.ps1 b/Tasks/feature/ps_modules/VstsTaskSdk/ToolFunctions.ps1 deleted file mode 100644 index 0e82595..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/ToolFunctions.ps1 +++ /dev/null @@ -1,123 +0,0 @@ -<# -.SYNOPSIS -Asserts the agent version is at least the specified minimum. - -.PARAMETER Minimum -Minimum version - must be 2.104.1 or higher. -#> -function Assert-Agent { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [version]$Minimum) - - if (([version]'2.104.1').CompareTo($Minimum) -ge 1) { - Write-Error "Assert-Agent requires the parameter to be 2.104.1 or higher." - return - } - - $agent = Get-TaskVariable -Name 'agent.version' - if (!$agent -or $Minimum.CompareTo([version]$agent) -ge 1) { - Write-Error (Get-LocString -Key 'PSLIB_AgentVersion0Required' -ArgumentList $Minimum) - } -} - -<# -.SYNOPSIS -Asserts that a path exists. Throws if the path does not exist. - -.PARAMETER PassThru -True to return the path. -#> -function Assert-Path { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath, - [Microsoft.PowerShell.Commands.TestPathType]$PathType = [Microsoft.PowerShell.Commands.TestPathType]::Any, - [switch]$PassThru) - - if ($PathType -eq [Microsoft.PowerShell.Commands.TestPathType]::Any) { - Write-Verbose "Asserting path exists: '$LiteralPath'" - } else { - Write-Verbose "Asserting $("$PathType".ToLowerInvariant()) path exists: '$LiteralPath'" - } - - if (Test-Path -LiteralPath $LiteralPath -PathType $PathType) { - if ($PassThru) { - return $LiteralPath - } - - return - } - - $resourceKey = switch ($PathType) { - ([Microsoft.PowerShell.Commands.TestPathType]::Container) { "PSLIB_ContainerPathNotFound0" ; break } - ([Microsoft.PowerShell.Commands.TestPathType]::Leaf) { "PSLIB_LeafPathNotFound0" ; break } - default { "PSLIB_PathNotFound0" } - } - - throw (Get-LocString -Key $resourceKey -ArgumentList $LiteralPath) -} - -<# -.SYNOPSIS -Executes an external program. - -.DESCRIPTION -Executes an external program and waits for the process to exit. - -After calling this command, the exit code of the process can be retrieved from the variable $LASTEXITCODE. - -.PARAMETER Encoding -This parameter not required for most scenarios. Indicates how to interpret the encoding from the external program. An example use case would be if an external program outputs UTF-16 XML and the output needs to be parsed. - -.PARAMETER RequireExitCodeZero -Indicates whether to write an error to the error pipeline if the exit code is not zero. -#> -function Invoke-Tool { # TODO: RENAME TO INVOKE-PROCESS? - [CmdletBinding()] - param( - [ValidatePattern('^[^\r\n]*$')] - [Parameter(Mandatory = $true)] - [string]$FileName, - [ValidatePattern('^[^\r\n]*$')] - [Parameter()] - [string]$Arguments, - [string]$WorkingDirectory, - [System.Text.Encoding]$Encoding, - [switch]$RequireExitCodeZero) - - Trace-EnteringInvocation $MyInvocation - $isPushed = $false - $originalEncoding = $null - try { - if ($Encoding) { - $originalEncoding = [System.Console]::OutputEncoding - [System.Console]::OutputEncoding = $Encoding - } - - if ($WorkingDirectory) { - Push-Location -LiteralPath $WorkingDirectory -ErrorAction Stop - $isPushed = $true - } - - $FileName = $FileName.Replace('"', '').Replace("'", "''") - Write-Host "##[command]""$FileName"" $Arguments" - Invoke-Expression "& '$FileName' --% $Arguments" - Write-Verbose "Exit code: $LASTEXITCODE" - if ($RequireExitCodeZero -and $LASTEXITCODE -ne 0) { - Write-Error (Get-LocString -Key PSLIB_Process0ExitedWithCode1 -ArgumentList ([System.IO.Path]::GetFileName($FileName)), $LASTEXITCODE) - } - } finally { - if ($originalEncoding) { - [System.Console]::OutputEncoding = $originalEncoding - } - - if ($isPushed) { - Pop-Location - } - - Trace-LeavingInvocation $MyInvocation - } -} diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/TraceFunctions.ps1 b/Tasks/feature/ps_modules/VstsTaskSdk/TraceFunctions.ps1 deleted file mode 100644 index b8e084b..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/TraceFunctions.ps1 +++ /dev/null @@ -1,139 +0,0 @@ -<# -.SYNOPSIS -Writes verbose information about the invocation being entered. - -.DESCRIPTION -Used to trace verbose information when entering a function/script. Writes an entering message followed by a short description of the invocation. Additionally each bound parameter and unbound argument is also traced. - -.PARAMETER Parameter -Wildcard pattern to control which bound parameters are traced. -#> -function Trace-EnteringInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo, - [string[]]$Parameter = '*') - - Write-Verbose "Entering $(Get-InvocationDescription $InvocationInfo)." - $OFS = ", " - if ($InvocationInfo.BoundParameters.Count -and $Parameter.Count) { - if ($Parameter.Count -eq 1 -and $Parameter[0] -eq '*') { - # Trace all parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - } - } else { - # Trace matching parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - foreach ($p in $Parameter) { - if ($key -like $p) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - break - } - } - } - } - } - - # Trace all unbound arguments. - if (@($InvocationInfo.UnboundArguments).Count) { - for ($i = 0 ; $i -lt $InvocationInfo.UnboundArguments.Count ; $i++) { - Write-Verbose " args[$i]: '$($InvocationInfo.UnboundArguments[$i])'" - } - } -} - -<# -.SYNOPSIS -Writes verbose information about the invocation being left. - -.DESCRIPTION -Used to trace verbose information when leaving a function/script. Writes a leaving message followed by a short description of the invocation. -#> -function Trace-LeavingInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo) - - Write-Verbose "Leaving $(Get-InvocationDescription $InvocationInfo)." -} - -<# -.SYNOPSIS -Writes verbose information about paths. - -.DESCRIPTION -Writes verbose information about the paths. The paths are sorted and a the common root is written only once, followed by each relative path. - -.PARAMETER PassThru -Indicates whether to return the sorted paths. -#> -function Trace-Path { - [CmdletBinding()] - param( - [string[]]$Path, - [switch]$PassThru) - - if ($Path.Count -eq 0) { - Write-Verbose "No paths." - if ($PassThru) { - $Path - } - } elseif ($Path.Count -eq 1) { - Write-Verbose "Path: $($Path[0])" - if ($PassThru) { - $Path - } - } else { - # Find the greatest common root. - $sorted = $Path | Sort-Object - $firstPath = $sorted[0].ToCharArray() - $lastPath = $sorted[-1].ToCharArray() - $commonEndIndex = 0 - $j = if ($firstPath.Length -lt $lastPath.Length) { $firstPath.Length } else { $lastPath.Length } - for ($i = 0 ; $i -lt $j ; $i++) { - if ($firstPath[$i] -eq $lastPath[$i]) { - if ($firstPath[$i] -eq '\') { - $commonEndIndex = $i - } - } else { - break - } - } - - if ($commonEndIndex -eq 0) { - # No common root. - Write-Verbose "Paths:" - foreach ($p in $sorted) { - Write-Verbose " $p" - } - } else { - Write-Verbose "Paths: $($Path[0].Substring(0, $commonEndIndex + 1))" - foreach ($p in $sorted) { - Write-Verbose " $($p.Substring($commonEndIndex + 1))" - } - } - - if ($PassThru) { - $sorted - } - } -} - -######################################## -# Private functions. -######################################## -function Get-InvocationDescription { - [CmdletBinding()] - param([System.Management.Automation.InvocationInfo]$InvocationInfo) - - if ($InvocationInfo.MyCommand.Path) { - $InvocationInfo.MyCommand.Path - } elseif ($InvocationInfo.MyCommand.Name) { - $InvocationInfo.MyCommand.Name - } else { - $InvocationInfo.MyCommand.CommandType - } -} diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/VstsTaskSdk.dll b/Tasks/feature/ps_modules/VstsTaskSdk/VstsTaskSdk.dll deleted file mode 100644 index 54938ab05180ddaf77cf067f2501a1f97ee7e5cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25408 zcmeIa2Urx#@+jULfkmqhP%&pQASxi36%_+2 zidj)qRLqKkIbqJC|C%A{Ip^NgryDMlC=Tgb)?ppFa_* zgD?KL5%6Dw0*IE?-Y<)GNuATFBL$w*iA?2*n3+OBijbYbF+H{2L%K|95{8flQ0QIM^F!gwgx3vTgye}Z zxvSkc0dGI?6aWPJm*)uj%Ro(CG}HVlviga*LJ z%c-k5J<6tW2zm5FiQsmeukhe)BO@9rfIMER2uTstK5*O- zp@Kg2FGIRyijg8h3==K#1PZj)1PGIe078Q?3fcfUNeC&BMM{ur610*^HW~;)GR2%S z(3DOwQpV|!gi1A1fuOl0jrf|$kd2^S3?nFvZYo2j(nM-Ks4UeiN|q`Z1USRgS`itk zLr7Y}2zbjd*FzElyi6uY84`g=F$Rz);PpxhGy!R)7_=hD0z74yA8(aaL_bs@;b4I_ z5N?~0a2Z7DNP9M-fEba;C4D=PmlWs<)n2;ynO%^dBlgZ>Rq^tSz6oC$2 zv?L^!fW#)MCWA35S_S!`5egImFq~oTHhAt3D1C?uMW6?GHI>G^47@ zv1Mj?r2*#RTfM+#fs6quE5yL%5xJ1B%%Wk%f z1!iH5S+k%p1oD^;uuKvmy~!}2fCB|kj9!FT$m6Go@DwvZjPU8LHzEQp?+N>k@b?1R z2EfZ;EcHCn1&MfKc!1}m=wX$bQV>92N!AEt46hwHLe!5}3td7m`UD-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(1DzJ>%sS|AkPgw)t-el)B{!v%PXU|+Pz&4jbY(AL%HEt8Spib zPc<(?tZppIne|$c+|SB32$YYzT>e0{mtgSG^$e`!z1)IGJFu@RSev0mQr?$X4Q!rJP3>&`Zt!=+&?>AJf79Gr=vlfV zg4S?kF+F>fNu}K(Z=}gHBL`*nHQ9&g>ltj`!>A^FaraRJeb@VjRUoeQz@zZ9I|mDk zb7Yo!2RJVGI5#Ow?y=qmZv={jr^{*&IYR2*oz^L5G-brBv_Yz;wu5eD9@@M+Ao<_- zTJ<*aIe)M4x%zcPo;e*jhT|#q9?2=PugJgekDl<9dh6e&6yF`ar4mto>Tbqa^N9R^ J$g$t$@(XnB12_Nx diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 b/Tasks/feature/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 deleted file mode 100644 index a1bf2c6..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 +++ /dev/null @@ -1,168 +0,0 @@ -[CmdletBinding()] -param( - [ValidateNotNull()] - [Parameter()] - [hashtable]$ModuleParameters = @{ }) - -if ($host.Name -ne 'ConsoleHost') { - Write-Warning "VstsTaskSdk is designed for use with powershell.exe (ConsoleHost). Output may be different when used with other hosts." -} - -# Private module variables. -[bool]$script:nonInteractive = "$($ModuleParameters['NonInteractive'])" -eq 'true' -Write-Verbose "NonInteractive: $script:nonInteractive" - -# VstsTaskSdk.dll contains the TerminationException and NativeMethods for handle long path -# We used to do inline C# in this powershell module -# However when csc compile the inline C#, it will hit process env block size limit since it's not use unicode to encode env -# To solve the env block size problem, we choose to put all inline C# into an assembly VstsTaskSdk.dll, signing it, package with the PS modules. -Write-Verbose "Loading compiled helper $PSScriptRoot\VstsTaskSdk.dll." -Add-Type -LiteralPath $PSScriptRoot\VstsTaskSdk.dll - -# Import/export functions. -. "$PSScriptRoot\FindFunctions.ps1" -. "$PSScriptRoot\InputFunctions.ps1" -. "$PSScriptRoot\LegacyFindFunctions.ps1" -. "$PSScriptRoot\LocalizationFunctions.ps1" -. "$PSScriptRoot\LoggingCommandFunctions.ps1" -. "$PSScriptRoot\LongPathFunctions.ps1" -. "$PSScriptRoot\ServerOMFunctions.ps1" -. "$PSScriptRoot\ToolFunctions.ps1" -. "$PSScriptRoot\TraceFunctions.ps1" -. "$PSScriptRoot\OutFunctions.ps1" # Load the out functions after all of the other functions are loaded. -Export-ModuleMember -Function @( - # Find functions. - 'Find-Match' - 'New-FindOptions' - 'New-MatchOptions' - 'Select-Match' - # Input functions. - 'Get-Endpoint' - 'Get-SecureFileTicket' - 'Get-SecureFileName' - 'Get-Input' - 'Get-TaskVariable' - 'Get-TaskVariableInfo' - 'Set-TaskVariable' - # Legacy find functions. - 'Find-Files' - # Localization functions. - 'Get-LocString' - 'Import-LocStrings' - # Logging command functions. - 'Write-AddAttachment' - 'Write-AddBuildTag' - 'Write-AssociateArtifact' - 'Write-LogDetail' - 'Write-PrependPath' - 'Write-SetEndpoint' - 'Write-SetProgress' - 'Write-SetResult' - 'Write-SetSecret' - 'Write-SetVariable' - 'Write-TaskDebug' - 'Write-TaskError' - 'Write-TaskVerbose' - 'Write-TaskWarning' - 'Write-UpdateBuildNumber' - 'Write-UpdateReleaseName' - 'Write-UploadArtifact' - 'Write-UploadBuildLog' - 'Write-UploadFile' - 'Write-UploadSummary' - # Out functions. - 'Out-Default' - # Server OM functions. - 'Get-AssemblyReference' - 'Get-TfsClientCredentials' - 'Get-TfsService' - 'Get-VssCredentials' - 'Get-VssHttpClient' - # Tool functions. - 'Assert-Agent' - 'Assert-Path' - 'Invoke-Tool' - # Trace functions. - 'Trace-EnteringInvocation' - 'Trace-LeavingInvocation' - 'Trace-Path' - # Proxy functions - 'Get-WebProxy' - # Client cert functions - 'Get-ClientCertificate' - ) - -# Override Out-Default globally. -$null = New-Item -Force -Path "function:\global:Out-Default" -Value (Get-Command -CommandType Function -Name Out-Default -ListImported) -New-Alias -Name Out-Default -Value "global:Out-Default" -Scope global - -# Perform some initialization in a script block to enable merging the pipelines. -$scriptText = @" -# Load the SDK resource strings. -Import-LocStrings "$PSScriptRoot\lib.json" - -# Load the module that contains ConvertTo-SecureString. -if (!(Get-Module -Name Microsoft.PowerShell.Security)) { - Write-Verbose "Importing the module 'Microsoft.PowerShell.Security'." - Import-Module -Name Microsoft.PowerShell.Security 2>&1 | - ForEach-Object { - if (`$_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose `$_.Exception.Message - } else { - ,`$_ - } - } -} -"@ -. ([scriptblock]::Create($scriptText)) 2>&1 3>&1 4>&1 5>&1 | Out-Default - -# Create Invoke-VstsTaskScript in a special way so it is not bound to the module. -# Otherwise calling the task script block would run within the module context. -# -# An alternative way to solve the problem is to close the script block (i.e. closure). -# However, that introduces a different problem. Closed script blocks are created within -# a dynamic module. Each module gets it's own session state separate from the global -# session state. When running in a regular script context, Import-Module calls import -# the target module into the global session state. When running in a module context, -# Import-Module calls import the target module into the caller module's session state. -# -# The goal of a task may include executing ad-hoc scripts. Therefore, task scripts -# should run in regular script context. The end user specifying an ad-hoc script expects -# the module import rules to be consistent with the default behavior (i.e. imported -# into the global session state). -$null = New-Item -Force -Path "function:\global:Invoke-VstsTaskScript" -Value ([scriptblock]::Create(@' - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [scriptblock]$ScriptBlock) - - try { - $global:ErrorActionPreference = 'Stop' - - # Initialize the environment. - $vstsModule = Get-Module -Name VstsTaskSdk - Write-Verbose "$($vstsModule.Name) $($vstsModule.Version) commit $($vstsModule.PrivateData.PSData.CommitHash)" 4>&1 | Out-Default - & $vstsModule Initialize-Inputs 4>&1 | Out-Default - - # Remove the local variable before calling the user's script. - Remove-Variable -Name vstsModule - - # Call the user's script. - $ScriptBlock | - ForEach-Object { - # Remove the scriptblock variable before calling it. - Remove-Variable -Name ScriptBlock - & $_ 2>&1 3>&1 4>&1 5>&1 | Out-Default - } - } catch [VstsTaskSdk.TerminationException] { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Task script terminated." 4>&1 | Out-Default - } catch { - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Caught exception from task script." 4>&1 | Out-Default - $_ | Out-Default - Write-Host "##vso[task.complete result=Failed]" - } -'@)) diff --git a/Tasks/feature/ps_modules/VstsTaskSdk/lib.json b/Tasks/feature/ps_modules/VstsTaskSdk/lib.json deleted file mode 100644 index ecdc9d0..0000000 --- a/Tasks/feature/ps_modules/VstsTaskSdk/lib.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "messages": { - "PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "PSLIB_FileNotFound0": "File not found: '{0}'", - "PSLIB_Input0": "'{0}' input", - "PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "PSLIB_PathNotFound0": "Path not found: '{0}'", - "PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "PSLIB_Required0": "Required: {0}", - "PSLIB_StringFormatFailed": "String format failed.", - "PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "PSLIB_TaskVariable0": "'{0}' task variable" - } -} diff --git a/Tasks/feature/task.json b/Tasks/feature/task.json deleted file mode 100644 index 03062a5..0000000 --- a/Tasks/feature/task.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "id": "e4d2e352-32d1-415b-8901-bfbf7ff81ab6", - "name": "choco-feature", - "friendlyName": "Chocolatey - Feature", - "description": "Runs Chocolatey Feature with specified parameters", - "author": "gep13", - "helpMarkDown": "", - "category": "Build", - "visibility": [ - "Build", - "Release" - ], - "demands": [], - "version": { - "Major": "0", - "Minor": "1", - "Patch": "0" - }, - "minimumAgentVersion": "1.83.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced options", - "isExpanded": false - } - ], - "instanceNameFormat": "Chocolatey Feature", - "inputs": [ - { - "name": "operation", - "type": "radio", - "label": "Feature Operation", - "required": true, - "defaultValue": "enable", - "helpMarkDown": "Choose whether to enable or disable a feature.", - "options": { - "enable": "Enable Feature", - "disable": "Disable Feature" - } - }, - { - "name": "featureName", - "type": "pickList", - "label": "Feature Name", - "defaultValue": "", - "options": { - "checkSumFiles": "Checksum Files", - "autoUninstaller": "Auto Uninstaller", - "allowGlobalConfirmation": "Allow Global Confirmation", - "failOnAutoUninstaller": "Fail On Auto Uninstaller", - "failOnStandardError": "Fail On Standard Error", - "allowEmptyChecksums": "Allow Empty Checksums", - "allowEmptyChecksumsSecure": "Allow Empty Checksums Secure", - "powershellHost": "PowerShell Host", - "logEnvironmentValues": "Log Environment Values", - "virusCheck": "Virus Check", - "failOnInvalidOrMissingLicense": "Fail On Invalid or Missing License", - "ignoreInvalidOptionsSwitches": "Ignore Invalid Options and Switches", - "usePackageExitCodes": "Use Package Exit Codes", - "useFipsCompliantChecksums": "Use FIPS Compliant Checksums", - "showNonElevatedWarnings": "Show Non Elevated Warnings", - "showDownloadProgress": "Show Download Progress", - "stopOnFirstPackageFailure": "Stop On First Package Failure", - "useRememberedArgumentsForUpgrades": "Use Remembered Arguments", - "ignoreUnfoundPackagesOnUpgradeOutdated": "Ignore Unfound Packages", - "removePackageInformationOnUninstall": "Remove Package Information On Uninstall", - "logWithoutColor": "Log Without Color", - "scriptsCheckLastExitCode": "Script Check Last Exit Code" - }, - "required": true, - "helpMarkDown": "The feature name which is going to be enabled or disabled." - }, - { - "name": "debug", - "type": "boolean", - "label": "Show debug messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "", - "groupname": "advanced" - }, - { - "name": "verbose", - "type": "boolean", - "label": "Show verbose messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very verbose messaging, avoid using under normal circumstances.", - "groupname": "advanced" - }, - { - "name": "trace", - "type": "boolean", - "label": "Show trace messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very, very verbose trace messaging. Avoid except when needing super low-level .NET Framework debugging.", - "groupname": "advanced" - } - ], - "execution": { - "PowerShell3": { - "target": "$(currentDirectory)\\feature.ps1", - "argumentFormat": "", - "workingDirectory": "$(currentDirectory)" - } - } -} diff --git a/Tasks/install/icon.png b/Tasks/install/icon.png deleted file mode 100755 index ab05af71592b547960e4fcf1f5d527bece1fd5c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2656 zcmY*bc|6o>7yp&5nTW_XQyF7lXG|nABl{9z2o*AxVaQ;NEtRov*Bv(hrKxhFDVoxG4buln4OW*xUDC0l*�JDw&pneYk z1ijO)x9RU=K|Y38`~cu6-+>(hvL6Tmz@aMyD_gRysfoI?x0fQ$#oNhMG04kj9}NH+ zLF)UVmn#_u3-Y=_^ivN)!+#;v_v3>!0uK8HA$y|Xwx;GV9dD8=Ohr*y5edhDVKA5m z$px>D)z$x}egA}pyOYU2>Ig(&V4z~)8AWfB8$wAcFl({#nSu%ZdvvL%wT5M?USLS_lI1E z!e!!CZ!DnQx^^6xYv``$x*8e0n?0JCAsf>Qp7;U$7p&xazpS*`uL}azE7*a)DF3yb z^|}*gs<}`RziUQipLJfTsO8;iDp#orfd#)y-ea2Hp74-%+fWJ}o#Y5f)-&-fEfDP$ zjBd_<`3RY7KHG0m<=clw-ExluH{nEEj`KgR&3A`(MjQ#fCoR-GydGP}JEI?&QRFeO z@$E~f$S0P!i@NZFjLsv+iRk{V7^{oSiF~{KF7|{B$M2L3=HrV!lUwbWO%?3dOEayL z+$qxbu;cK^iJ($5z9$}DPp>d`QF^ZJ3IV|DZkcciX zew_MP0jJHyC}WQqlEe*-b{hvWVjHQw99iinXZdgmdINR#R=HIfSSbgI<#{vQh=Pik zF6T`JJsg|6J$P%GIvs>t$doa^89m@2tlsU&iKmW*2RhfF8`K1%B~())^hDT^pu21* zsi&mQha@=(zBeaqdQBBwm3ant;kM7u%)1>H*+Ha;bCk>4QaB}`E#poO)*5o3QUctF z!RbP@dh-WfYecr!px@L68vu3uW^TfF6BvcjedGtHYTDOK`Y?$vQQlVXPUU^hQHhcV zk31};rmeq!5ak(Z%#}^Z%ipeVnvxF*b0M&9edD1YcN?f>@3mt^Ve-8s=WPm}FcxHr~*67epRryKBr7m&(c;u*wp@#xTIEJ^BsApC)1! zrknNyjmpv3s5lYaCnAx$=IGOBpt}@pE&1l$^obZbtYL^rUl3_sUziCY>&)0hxdhFA-^v;UqjC~%l**cdnZbtWjz*|QGEG?J^TT)92CQLs`ymq0j7d4VJ zR0yfyTnh4)w?j`QKm|RbP(6#cA0cmjK`I=5)a|RJA8)C$v&&zZyd5iB^1Sh4(tfJ-OxONjdxdT(RDI9dXdvS0~U-I}u=u|Ogy3mq?uHkj4 zn?QSY{&XZn56{L3^9+wZhWg|~dqKRP&v2+c?#%qm>s(m%&{}DoYZThnAuekxmRP_v zo1<{TeakXFI}60nz4iiFC)9Tmqf9nC%IO$e-4TUI;0mLh-j zQLr41J|YehYI5OI`_@NoHlzD?aNb91=<9e4Ey;q;%(Y6g~nm{l+;F0(40p<{nF z>wcIBih?#=Uo-gDpTTn~l^|iFdOhERaair#%8cl}Wqppp9%8C)!L_msmh-7sSJ$au zwooOK-<{W5&PJZDhd-M}zxlK4y_LbHeTxE9(XO^rg{Qtw%ODc@`L)mpPD$at^AwMx zZM1Pfjq1Y{)dZcP`G)BvddP=(!1NTPx25UgVTtC6X@<8!WJT!5i=j|k-|wdS%Bc*v zi^*^zqSeu8c#$-AG#d+?&9_GeiqMdbK5QqW%C-P_Z -function Find-Match { - [CmdletBinding()] - param( - [Parameter()] - [string]$DefaultRoot, - [Parameter()] - [string[]]$Pattern, - $FindOptions, - $MatchOptions) - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Apply defaults for parameters and trace. - if (!$DefaultRoot) { - $DefaultRoot = Get-TaskVariable -Name 'System.DefaultWorkingDirectory' -Default (Get-Location).Path - } - - Write-Verbose "DefaultRoot: '$DefaultRoot'" - if (!$FindOptions) { - $FindOptions = New-FindOptions -FollowSpecifiedSymbolicLink -FollowSymbolicLinks - } - - Trace-FindOptions -Options $FindOptions - if (!$MatchOptions) { - $MatchOptions = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $MatchOptions - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Normalize slashes for root dir. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - $results = @{ } - $originalMatchOptions = $MatchOptions - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $MatchOptions = Copy-MatchOptions -Options $originalMatchOptions - - # Skip comments. - if (!$MatchOptions.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $MatchOptions.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$MatchOptions.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$MatchOptions.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $MatchOptions.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $MatchOptions.NoNegate = $true - $MatchOptions.FlipNegate = $false - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Expand braces - required to accurately interpret findPath. - $expanded = $null - $preExpanded = $pat - if ($MatchOptions.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - } - - # Set NoBrace. - $MatchOptions.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - if ($isIncludePattern) { - # Determine the findPath. - $findInfo = Get-FindInfoFromPattern -DefaultRoot $DefaultRoot -Pattern $pat -MatchOptions $MatchOptions - $findPath = $findInfo.FindPath - Write-Verbose "FindPath: '$findPath'" - - if (!$findPath) { - Write-Verbose "Skipping empty path." - continue - } - - # Perform the find. - Write-Verbose "StatOnly: '$($findInfo.StatOnly)'" - [string[]]$findResults = @( ) - if ($findInfo.StatOnly) { - # Simply stat the path - all path segments were used to build the path. - if ((Test-Path -LiteralPath $findPath)) { - $findResults += $findPath - } - } else { - $findResults = Get-FindResult -Path $findPath -Options $FindOptions - } - - Write-Verbose "Found $($findResults.Count) paths." - - # Apply the pattern. - Write-Verbose "Applying include pattern." - if ($findInfo.AdjustedPattern -ne $pat) { - Write-Verbose "AdjustedPattern: '$($findInfo.AdjustedPattern)'" - $pat = $findInfo.AdjustedPattern - } - - $matchResults = [Minimatch.Minimatcher]::Filter( - $findResults, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results[$matchResult.ToUpperInvariant()] = $matchResult - } - - Write-Verbose "$matchCount matches" - } else { - # Check if basename only and MatchBase=true. - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $pat) -and - ($pat -replace '\\', '/').IndexOf('/') -lt 0) { - - # Do not root the pattern. - Write-Verbose "MatchBase and basename only." - } else { - # Root the exclude pattern. - $pat = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - # Apply the pattern. - Write-Verbose 'Applying exclude pattern.' - $matchResults = [Minimatch.Minimatcher]::Filter( - [string[]]$results.Values, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results.Remove($matchResult.ToUpperInvariant()) - } - - Write-Verbose "$matchCount matches" - } - } - } - - $finalResult = @( $results.Values | Sort-Object ) - Write-Verbose "$($finalResult.Count) final results" - return $finalResult - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Creates FindOptions for use with Find-VstsMatch. - -.DESCRIPTION -Creates FindOptions for use with Find-VstsMatch. Contains switches to control whether to follow symlinks. - -.PARAMETER FollowSpecifiedSymbolicLink -Indicates whether to traverse descendants if the specified path is a symbolic link directory. Does not cause nested symbolic link directories to be traversed. - -.PARAMETER FollowSymbolicLinks -Indicates whether to traverse descendants of symbolic link directories. -#> -function New-FindOptions { - [CmdletBinding()] - param( - [switch]$FollowSpecifiedSymbolicLink, - [switch]$FollowSymbolicLinks) - - return New-Object psobject -Property @{ - FollowSpecifiedSymbolicLink = $FollowSpecifiedSymbolicLink.IsPresent - FollowSymbolicLinks = $FollowSymbolicLinks.IsPresent - } -} - -<# -.SYNOPSIS -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. - -.DESCRIPTION -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. Contains switches to control which pattern matching options are applied. -#> -function New-MatchOptions { - [CmdletBinding()] - param( - [switch]$Dot, - [switch]$FlipNegate, - [switch]$MatchBase, - [switch]$NoBrace, - [switch]$NoCase, - [switch]$NoComment, - [switch]$NoExt, - [switch]$NoGlobStar, - [switch]$NoNegate, - [switch]$NoNull) - - return New-Object psobject -Property @{ - Dot = $Dot.IsPresent - FlipNegate = $FlipNegate.IsPresent - MatchBase = $MatchBase.IsPresent - NoBrace = $NoBrace.IsPresent - NoCase = $NoCase.IsPresent - NoComment = $NoComment.IsPresent - NoExt = $NoExt.IsPresent - NoGlobStar = $NoGlobStar.IsPresent - NoNegate = $NoNegate.IsPresent - NoNull = $NoNull.IsPresent - } -} - -<# -.SYNOPSIS -Applies match patterns against a list of files. - -.DESCRIPTION -Applies match patterns to a list of paths. Supports interleaved exclude patterns. - -.PARAMETER ItemPath -Array of paths. - -.PARAMETER Pattern -Patterns to apply. Supports interleaved exclude patterns. - -.PARAMETER PatternRoot -Default root to apply to unrooted patterns. Not applied to basename-only patterns when Options.MatchBase is true. - -.PARAMETER Options -When the Options parameter is not specified, defaults to (New-VstsMatchOptions -Dot -NoBrace -NoCase). -#> -function Select-Match { - [CmdletBinding()] - param( - [Parameter()] - [string[]]$ItemPath, - [Parameter()] - [string[]]$Pattern, - [Parameter()] - [string]$PatternRoot, - $Options) - - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - if (!$Options) { - $Options = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $Options - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Hashtable to keep track of matches. - $map = @{ } - - $originalOptions = $Options - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $Options = Copy-MatchOptions -Options $originalOptions - - # Skip comments. - if (!$Options.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $Options.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$Options.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$Options.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $Options.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $Options.NoNegate = $true - $Options.FlipNegate = $false - - # Expand braces - required to accurately root patterns. - $expanded = $null - $preExpanded = $pat - if ($Options.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $Options)) - } - - # Set NoBrace. - $Options.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - # Root the pattern when all of the following conditions are true: - if ($PatternRoot -and # PatternRoot is supplied - !(Test-Rooted -Path $pat) -and # AND pattern is not rooted - # # AND MatchBase=false or not basename only - (!$Options.MatchBase -or ($pat -replace '\\', '/').IndexOf('/') -ge 0)) { - - # Root the include pattern. - $pat = Get-RootedPattern -DefaultRoot $PatternRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - if ($isIncludePattern) { - # Apply the pattern. - Write-Verbose 'Applying include pattern against original list.' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map[$matchResult] = $true - } - - Write-Verbose "$matchCount matches" - } else { - # Apply the pattern. - Write-Verbose 'Applying exclude pattern against original list' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map.Remove($matchResult) - } - - Write-Verbose "$matchCount matches" - } - } - } - - # return a filtered version of the original list (preserves order and prevents duplication) - $result = $ItemPath | Where-Object { $map[$_] } - Write-Verbose "$($result.Count) final results" - $result - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -################################################################################ -# Private functions. -################################################################################ - -function Copy-MatchOptions { - [CmdletBinding()] - param($Options) - - return New-Object psobject -Property @{ - Dot = $Options.Dot -eq $true - FlipNegate = $Options.FlipNegate -eq $true - MatchBase = $Options.MatchBase -eq $true - NoBrace = $Options.NoBrace -eq $true - NoCase = $Options.NoCase -eq $true - NoComment = $Options.NoComment -eq $true - NoExt = $Options.NoExt -eq $true - NoGlobStar = $Options.NoGlobStar -eq $true - NoNegate = $Options.NoNegate -eq $true - NoNull = $Options.NoNull -eq $true - } -} - -function ConvertTo-MinimatchOptions { - [CmdletBinding()] - param($Options) - - $opt = New-Object Minimatch.Options - $opt.AllowWindowsPaths = $true - $opt.Dot = $Options.Dot -eq $true - $opt.FlipNegate = $Options.FlipNegate -eq $true - $opt.MatchBase = $Options.MatchBase -eq $true - $opt.NoBrace = $Options.NoBrace -eq $true - $opt.NoCase = $Options.NoCase -eq $true - $opt.NoComment = $Options.NoComment -eq $true - $opt.NoExt = $Options.NoExt -eq $true - $opt.NoGlobStar = $Options.NoGlobStar -eq $true - $opt.NoNegate = $Options.NoNegate -eq $true - $opt.NoNull = $Options.NoNull -eq $true - return $opt -} - -function ConvertTo-NormalizedSeparators { - [CmdletBinding()] - param([string]$Path) - - # Convert slashes. - $Path = "$Path".Replace('/', '\') - - # Remove redundant slashes. - $isUnc = $Path -match '^\\\\+[^\\]' - $Path = $Path -replace '\\\\+', '\' - if ($isUnc) { - $Path = '\' + $Path - } - - return $Path -} - -function Get-FindInfoFromPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern, - [Parameter(Mandatory = $true)] - $MatchOptions) - - if (!$MatchOptions.NoBrace) { - throw "Get-FindInfoFromPattern expected MatchOptions.NoBrace to be true." - } - - # For the sake of determining the find path, pretend NoCase=false. - $MatchOptions = Copy-MatchOptions -Options $MatchOptions - $MatchOptions.NoCase = $false - - # Check if basename only and MatchBase=true - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $Pattern) -and - ($Pattern -replace '\\', '/').IndexOf('/') -lt 0) { - - return New-Object psobject -Property @{ - AdjustedPattern = $Pattern - FindPath = $DefaultRoot - StatOnly = $false - } - } - - # The technique applied by this function is to use the information on the Minimatch object determine - # the findPath. Minimatch breaks the pattern into path segments, and exposes information about which - # segments are literal vs patterns. - # - # Note, the technique currently imposes a limitation for drive-relative paths with a glob in the - # first segment, e.g. C:hello*/world. It's feasible to overcome this limitation, but is left unsolved - # for now. - $minimatchObj = New-Object Minimatch.Minimatcher($Pattern, (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # The "set" field is a two-dimensional enumerable of parsed path segment info. The outer enumerable should only - # contain one item, otherwise something went wrong. Brace expansion can result in multiple items in the outer - # enumerable, but that should be turned off by the time this function is reached. - # - # Note, "set" is a private field in the .NET implementation but is documented as a feature in the nodejs - # implementation. The .NET implementation is a port and is by a different author. - $setFieldInfo = $minimatchObj.GetType().GetField('set', 'Instance,NonPublic') - [object[]]$set = $setFieldInfo.GetValue($minimatchObj) - if ($set.Count -ne 1) { - throw "Get-FindInfoFromPattern expected Minimatch.Minimatcher(...).set.Count to be 1. Actual: '$($set.Count)'" - } - - [string[]]$literalSegments = @( ) - [object[]]$parsedSegments = $set[0] - foreach ($parsedSegment in $parsedSegments) { - if ($parsedSegment.GetType().Name -eq 'LiteralItem') { - # The item is a LiteralItem when the original input for the path segment does not contain any - # unescaped glob characters. - $literalSegments += $parsedSegment.Source; - continue - } - - break; - } - - # Join the literal segments back together. Minimatch converts '\' to '/' on Windows, then squashes - # consequetive slashes, and finally splits on slash. This means that UNC format is lost, but can - # be detected from the original pattern. - $joinedSegments = [string]::Join('/', $literalSegments) - if ($joinedSegments -and ($Pattern -replace '\\', '/').StartsWith('//')) { - $joinedSegments = '/' + $joinedSegments # restore UNC format - } - - # Determine the find path. - $findPath = '' - if ((Test-Rooted -Path $Pattern)) { # The pattern is rooted. - $findPath = $joinedSegments - } elseif ($joinedSegments) { # The pattern is not rooted, and literal segements were found. - $findPath = [System.IO.Path]::Combine($DefaultRoot, $joinedSegments) - } else { # The pattern is not rooted, and no literal segements were found. - $findPath = $DefaultRoot - } - - # Clean up the path. - if ($findPath) { - $findPath = [System.IO.Path]::GetDirectoryName(([System.IO.Path]::Combine($findPath, '_'))) # Hack to remove unnecessary trailing slash. - $findPath = ConvertTo-NormalizedSeparators -Path $findPath - } - - return New-Object psobject -Property @{ - AdjustedPattern = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $Pattern - FindPath = $findPath - StatOnly = $literalSegments.Count -eq $parsedSegments.Count - } -} - -function Get-FindResult { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - $Options) - - if (!(Test-Path -LiteralPath $Path)) { - Write-Verbose 'Path not found.' - return - } - - $Path = ConvertTo-NormalizedSeparators -Path $Path - - # Push the first item. - [System.Collections.Stack]$stack = New-Object System.Collections.Stack - $stack.Push((Get-Item -LiteralPath $Path)) - - $count = 0 - while ($stack.Count) { - # Pop the next item and yield the result. - $item = $stack.Pop() - $count++ - $item.FullName - - # Traverse. - if (($item.Attributes -band 0x00000010) -eq 0x00000010) { # Directory - if (($item.Attributes -band 0x00000400) -ne 0x00000400 -or # ReparsePoint - $Options.FollowSymbolicLinks -or - ($count -eq 1 -and $Options.FollowSpecifiedSymbolicLink)) { - - $childItems = @( Get-DirectoryChildItem -Path $Item.FullName -Force ) - [System.Array]::Reverse($childItems) - foreach ($childItem in $childItems) { - $stack.Push($childItem) - } - } - } - } -} - -function Get-RootedPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern) - - if ((Test-Rooted -Path $Pattern)) { - return $Pattern - } - - # Normalize root. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - # Escape special glob characters. - $DefaultRoot = $DefaultRoot -replace '(\[)(?=[^\/]+\])', '[[]' # Escape '[' when ']' follows within the path segment - $DefaultRoot = $DefaultRoot.Replace('?', '[?]') # Escape '?' - $DefaultRoot = $DefaultRoot.Replace('*', '[*]') # Escape '*' - $DefaultRoot = $DefaultRoot -replace '\+\(', '[+](' # Escape '+(' - $DefaultRoot = $DefaultRoot -replace '@\(', '[@](' # Escape '@(' - $DefaultRoot = $DefaultRoot -replace '!\(', '[!](' # Escape '!(' - - if ($DefaultRoot -like '[A-Z]:') { # e.g. C: - return "$DefaultRoot$Pattern" - } - - # Ensure root ends with a separator. - if (!$DefaultRoot.EndsWith('\')) { - $DefaultRoot = "$DefaultRoot\" - } - - return "$DefaultRoot$Pattern" -} - -function Test-Rooted { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - $Path = ConvertTo-NormalizedSeparators -Path $Path - return $Path.StartsWith('\') -or # e.g. \ or \hello or \\hello - $Path -like '[A-Z]:*' # e.g. C: or C:\hello -} - -function Trace-MatchOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "MatchOptions.Dot: '$($Options.Dot)'" - Write-Verbose "MatchOptions.FlipNegate: '$($Options.FlipNegate)'" - Write-Verbose "MatchOptions.MatchBase: '$($Options.MatchBase)'" - Write-Verbose "MatchOptions.NoBrace: '$($Options.NoBrace)'" - Write-Verbose "MatchOptions.NoCase: '$($Options.NoCase)'" - Write-Verbose "MatchOptions.NoComment: '$($Options.NoComment)'" - Write-Verbose "MatchOptions.NoExt: '$($Options.NoExt)'" - Write-Verbose "MatchOptions.NoGlobStar: '$($Options.NoGlobStar)'" - Write-Verbose "MatchOptions.NoNegate: '$($Options.NoNegate)'" - Write-Verbose "MatchOptions.NoNull: '$($Options.NoNull)'" -} - -function Trace-FindOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "FindOptions.FollowSpecifiedSymbolicLink: '$($FindOptions.FollowSpecifiedSymbolicLink)'" - Write-Verbose "FindOptions.FollowSymbolicLinks: '$($FindOptions.FollowSymbolicLinks)'" -} diff --git a/Tasks/install/ps_modules/VstsTaskSdk/InputFunctions.ps1 b/Tasks/install/ps_modules/VstsTaskSdk/InputFunctions.ps1 deleted file mode 100644 index 846492d..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/InputFunctions.ps1 +++ /dev/null @@ -1,493 +0,0 @@ -# Hash table of known variable info. The formatted env var name is the lookup key. -# -# The purpose of this hash table is to keep track of known variables. The hash table -# needs to be maintained for multiple reasons: -# 1) to distinguish between env vars and job vars -# 2) to distinguish between secret vars and public -# 3) to know the real variable name and not just the formatted env var name. -$script:knownVariables = @{ } -$script:vault = @{ } - -<# -.SYNOPSIS -Gets an endpoint. - -.DESCRIPTION -Gets an endpoint object for the specified endpoint name. The endpoint is returned as an object with three properties: Auth, Data, and Url. - -The Data property requires a 1.97 agent or higher. - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-Endpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the URL. - $description = Get-LocString -Key PSLIB_EndpointUrl0 -ArgumentList $Name - $key = "ENDPOINT_URL_$Name" - $url = Get-VaultValue -Description $description -Key $key -Require:$Require - - # Get the auth object. - $description = Get-LocString -Key PSLIB_EndpointAuth0 -ArgumentList $Name - $key = "ENDPOINT_AUTH_$Name" - if ($auth = (Get-VaultValue -Description $description -Key $key -Require:$Require)) { - $auth = ConvertFrom-Json -InputObject $auth - } - - # Get the data. - $description = "'$Name' service endpoint data" - $key = "ENDPOINT_DATA_$Name" - if ($data = (Get-VaultValue -Description $description -Key $key)) { - $data = ConvertFrom-Json -InputObject $data - } - - # Return the endpoint. - if ($url -or $auth -or $data) { - New-Object -TypeName psobject -Property @{ - Url = $url - Auth = $auth - Data = $data - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file ticket. - -.DESCRIPTION -Gets the secure file ticket that can be used to download the secure file contents. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileTicket { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_TICKET_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file name. - -.DESCRIPTION -Gets the name for a secure file. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_NAME_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets an input. - -.DESCRIPTION -Gets the value for the specified input name. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-Input { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - # Get the input from the vault. Splat the bound parameters hashtable. Splatting is required - # in order to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Name - $key = "INPUT_$($Name.Replace(' ', '_').ToUpperInvariant())" - Get-VaultValue @PSBoundParameters -Description $description -Key $key -} - -<# -.SYNOPSIS -Gets a task variable. - -.DESCRIPTION -Gets the value for the specified task variable. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-TaskVariable { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - $description = Get-LocString -Key PSLIB_TaskVariable0 -ArgumentList $Name - $variableKey = Get-VariableKey -Name $Name - if ($script:knownVariables.$variableKey.Secret) { - # Get secret variable. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $vaultKey = "SECRET_$variableKey" - Get-VaultValue @PSBoundParameters -Description $description -Key $vaultKey - } else { - # Get public variable. - $item = $null - $path = "Env:$variableKey" - if ((Test-Path -LiteralPath $path) -and ($item = Get-Item -LiteralPath $path).Value) { - # Intentionally empty. Value was successfully retrieved. - } elseif (!$script:nonInteractive) { - # The value wasn't found and the module is running in interactive dev mode. - # Prompt for the value. - Set-Item -LiteralPath $path -Value (Read-Host -Prompt $description) - if (Test-Path -LiteralPath $path) { - $item = Get-Item -LiteralPath $path - } - } - - # Get the converted value. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - Get-Value @PSBoundParameters -Description $description -Key $variableKey -Value $item.Value - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets all job variables available to the task. Requires 2.104.1 agent or higher. - -.DESCRIPTION -Gets a snapshot of the current state of all job variables available to the task. -Requires a 2.104.1 agent or higher for full functionality. - -Returns an array of objects with the following properties: - [string]Name - [string]Value - [bool]Secret - -Limitations on an agent prior to 2.104.1: - 1) The return value does not include all public variables. Only public variables - that have been added using setVariable are returned. - 2) The name returned for each secret variable is the formatted environment variable - name, not the actual variable name (unless it was set explicitly at runtime using - setVariable). -#> -function Get-TaskVariableInfo { - [CmdletBinding()] - param() - - foreach ($info in $script:knownVariables.Values) { - New-Object -TypeName psobject -Property @{ - Name = $info.Name - Value = Get-TaskVariable -Name $info.Name - Secret = $info.Secret - } - } -} - -<# -.SYNOPSIS -Sets a task variable. - -.DESCRIPTION -Sets a task variable in the current task context as well as in the current job context. This allows the task variable to retrieved by subsequent tasks within the same job. -#> -function Set-TaskVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret) - - # Once a secret always a secret. - $variableKey = Get-VariableKey -Name $Name - [bool]$Secret = $Secret -or $script:knownVariables.$variableKey.Secret - if ($Secret) { - $vaultKey = "SECRET_$variableKey" - if (!$Value) { - # Clear the secret. - Write-Verbose "Set $Name = ''" - $script:vault.Remove($vaultKey) - } else { - # Store the secret in the vault. - Write-Verbose "Set $Name = '********'" - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Set-Item -LiteralPath "Env:$variableKey" -Value '' - } else { - # Set the environment variable. - Write-Verbose "Set $Name = '$Value'" - Set-Item -LiteralPath "Env:$variableKey" -Value $Value - } - - # Store the metadata. - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $Secret - } - - # Persist the variable in the task context. - Write-SetVariable -Name $Name -Value $Value -Secret:$Secret -} - -######################################## -# Private functions. -######################################## -function Get-VaultValue { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - # Attempt to get the vault value. - $value = $null - if ($psCredential = $script:vault[$Key]) { - $value = $psCredential.GetNetworkCredential().Password - } elseif (!$script:nonInteractive) { - # The value wasn't found. Prompt for the value if running in interactive dev mode. - $value = Read-Host -Prompt $Description - if ($value) { - $script:vault[$Key] = New-Object System.Management.Automation.PSCredential( - $Key, - (ConvertTo-SecureString -String $value -AsPlainText -Force)) - } - } - - Get-Value -Value $value @PSBoundParameters -} - -function Get-Value { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [string]$Value, - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - $result = $Value - if ($result) { - if ($Key -like 'ENDPOINT_AUTH_*') { - Write-Verbose "$($Key): '********'" - } else { - Write-Verbose "$($Key): '$result'" - } - } else { - Write-Verbose "$Key (empty)" - - # Write error if required. - if ($Require) { - Write-Error "$(Get-LocString -Key PSLIB_Required0 $Description)" - return - } - - # Fallback to the default if provided. - if ($PSCmdlet.ParameterSetName -eq 'Default') { - $result = $Default - $OFS = ' ' - Write-Verbose " Defaulted to: '$result'" - } else { - $result = '' - } - } - - # Convert to bool if specified. - if ($AsBool) { - if ($result -isnot [bool]) { - $result = "$result" -in '1', 'true' - Write-Verbose " Converted to bool: $result" - } - - return $result - } - - # Convert to int if specified. - if ($AsInt) { - if ($result -isnot [int]) { - try { - $result = [int]"$result" - } catch { - $result = 0 - } - - Write-Verbose " Converted to int: $result" - } - - return $result - } - - return $result -} - -function Initialize-Inputs { - # Store endpoints, inputs, and secret variables in the vault. - foreach ($variable in (Get-ChildItem -Path Env:ENDPOINT_?*, Env:INPUT_?*, Env:SECRET_?*, Env:SECUREFILE_?*)) { - # Record the secret variable metadata. This is required by Get-TaskVariable to - # retrieve the value. In a 2.104.1 agent or higher, this metadata will be overwritten - # when $env:VSTS_SECRET_VARIABLES is processed. - if ($variable.Name -like 'SECRET_?*') { - $variableKey = $variable.Name.Substring('SECRET_'.Length) - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - # This is technically not the variable name (has underscores instead of dots), - # but it's good enough to make Get-TaskVariable work in a pre-2.104.1 agent - # where $env:VSTS_SECRET_VARIABLES is not defined. - Name = $variableKey - Secret = $true - } - } - - # Store the value in the vault. - $vaultKey = $variable.Name - if ($variable.Value) { - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $variable.Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Remove-Item -LiteralPath "Env:$($variable.Name)" - } - - # Record the public variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_PUBLIC_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_PUBLIC_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $false - } - } - - $env:VSTS_PUBLIC_VARIABLES = '' - } - - # Record the secret variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_SECRET_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_SECRET_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $true - } - } - - $env:VSTS_SECRET_VARIABLES = '' - } -} - -function Get-VariableKey { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name) - - if ($Name -ne 'agent.jobstatus') { - $Name = $Name.Replace('.', '_') - } - - $Name.ToUpperInvariant() -} diff --git a/Tasks/install/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 b/Tasks/install/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 deleted file mode 100644 index b4080ae..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 +++ /dev/null @@ -1,320 +0,0 @@ -<# -.SYNOPSIS -Finds files or directories. - -.DESCRIPTION -Finds files or directories using advanced pattern matching. - -.PARAMETER LiteralDirectory -Directory to search. - -.PARAMETER LegacyPattern -Proprietary pattern format. The LiteralDirectory parameter is used to root any unrooted patterns. - -Separate multiple patterns using ";". Escape actual ";" in the path by using ";;". -"?" indicates a wildcard that represents any single character within a path segment. -"*" indicates a wildcard that represents zero or more characters within a path segment. -"**" as the entire path segment indicates a recursive search. -"**" within a path segment indicates a recursive intersegment wildcard. -"+:" (can be omitted) indicates an include pattern. -"-:" indicates an exclude pattern. - -The result is from the command is a union of all the matches from the include patterns, minus the matches from the exclude patterns. - -.PARAMETER IncludeFiles -Indicates whether to include files in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER IncludeDirectories -Indicates whether to include directories in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER Force -Indicates whether to include hidden items. - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is?Match.txt" - -Given: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt -C:\Directory\IsNotMatch.txt - -Returns: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is*Match.txt" - -Given: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt -C:\Directory\NonMatch.txt - -Returns: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**\Match.txt" - -Given: -C:\Directory\Match.txt -C:\Directory\NotAMatch.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -Returns: -C:\Directory\Match.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**" - -Given: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -Returns: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Sub**Match.txt" - -Given: -C:\Directory\IsNotAMatch.txt -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\IsNot.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsNot.txt - -Returns: -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -#> -function Find-Files { - [CmdletBinding()] - param( - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$LiteralDirectory, - [Parameter(Mandatory = $true)] - [string]$LegacyPattern, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - # Note, due to subtle implementation details of Get-PathPrefix/Get-PathIterator, - # this function does not appear to be able to search the root of a drive and other - # cases where Path.GetDirectoryName() returns empty. More details in Get-PathPrefix. - - Trace-EnteringInvocation $MyInvocation - if (!$IncludeFiles -and !$IncludeDirectories) { - $IncludeFiles = $true - } - - $includePatterns = New-Object System.Collections.Generic.List[string] - $excludePatterns = New-Object System.Collections.Generic.List[System.Text.RegularExpressions.Regex] - $LegacyPattern = $LegacyPattern.Replace(';;', "`0") - foreach ($pattern in $LegacyPattern.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries)) { - $pattern = $pattern.Replace("`0", ';') - $isIncludePattern = Test-IsIncludePattern -Pattern ([ref]$pattern) - if ($LiteralDirectory -and !([System.IO.Path]::IsPathRooted($pattern))) { - # Use the root directory provided to make the pattern a rooted path. - $pattern = [System.IO.Path]::Combine($LiteralDirectory, $pattern) - } - - # Validate pattern does not end with a \. - if ($pattern[$pattern.Length - 1] -eq [System.IO.Path]::DirectorySeparatorChar) { - throw (Get-LocString -Key PSLIB_InvalidPattern0 -ArgumentList $pattern) - } - - if ($isIncludePattern) { - $includePatterns.Add($pattern) - } else { - $excludePatterns.Add((Convert-PatternToRegex -Pattern $pattern)) - } - } - - $count = 0 - foreach ($path in (Get-MatchingItems -IncludePatterns $includePatterns -ExcludePatterns $excludePatterns -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force)) { - $count++ - $path - } - - Write-Verbose "Total found: $count" - Trace-LeavingInvocation $MyInvocation -} - -######################################## -# Private functions. -######################################## -function Convert-PatternToRegex { - [CmdletBinding()] - param([string]$Pattern) - - $Pattern = [regex]::Escape($Pattern.Replace('\', '/')). # Normalize separators and regex escape. - Replace('/\*\*/', '((/.+/)|(/))'). # Replace directory globstar. - Replace('\*\*', '.*'). # Replace remaining globstars with a wildcard that can span directory separators. - Replace('\*', '[^/]*'). # Replace asterisks with a wildcard that cannot span directory separators. - # bug: should be '[^/]' instead of '.' - Replace('\?', '.') # Replace single character wildcards. - New-Object regex -ArgumentList "^$Pattern`$", ([System.Text.RegularExpressions.RegexOptions]::IgnoreCase) -} - -function Get-FileNameFilter { - [CmdletBinding()] - param([string]$Pattern) - - $index = $Pattern.LastIndexOf('\') - if ($index -eq -1 -or # Pattern does not contain a backslash. - !($Pattern = $Pattern.Substring($index + 1)) -or # Pattern ends in a backslash. - $Pattern.Contains('**')) # Last segment contains an inter-segment wildcard. - { - return '*' - } - - # bug? is this supposed to do substring? - return $Pattern -} - -function Get-MatchingItems { - [CmdletBinding()] - param( - [System.Collections.Generic.List[string]]$IncludePatterns, - [System.Collections.Generic.List[regex]]$ExcludePatterns, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - Trace-EnteringInvocation $MyInvocation - $allFiles = New-Object System.Collections.Generic.HashSet[string] - foreach ($pattern in $IncludePatterns) { - $pathPrefix = Get-PathPrefix -Pattern $pattern - $fileNameFilter = Get-FileNameFilter -Pattern $pattern - $patternRegex = Convert-PatternToRegex -Pattern $pattern - # Iterate over the directories and files under the pathPrefix. - Get-PathIterator -Path $pathPrefix -Filter $fileNameFilter -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force | - ForEach-Object { - # Normalize separators. - $normalizedPath = $_.Replace('\', '/') - # **/times/** will not match C:/fun/times because there isn't a trailing slash. - # So try both if including directories. - $alternatePath = "$normalizedPath/" # potential bug: it looks like this will result in a false - # positive if the item is a regular file and not a directory - - $isMatch = $false - if ($patternRegex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $patternRegex.IsMatch($alternatePath))) { - $isMatch = $true - - # Test whether the path should be excluded. - foreach ($regex in $ExcludePatterns) { - if ($regex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $regex.IsMatch($alternatePath))) { - $isMatch = $false - break - } - } - } - - if ($isMatch) { - $null = $allFiles.Add($_) - } - } - } - - Trace-Path -Path $allFiles -PassThru - Trace-LeavingInvocation $MyInvocation -} - -function Get-PathIterator { - [CmdletBinding()] - param( - [string]$Path, - [string]$Filter, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - if (!$Path) { - return - } - - # bug: this returns the dir without verifying whether exists - if ($IncludeDirectories) { - $Path - } - - Get-DirectoryChildItem -Path $Path -Filter $Filter -Force:$Force -Recurse | - ForEach-Object { - if ($_.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - if ($IncludeDirectories) { - $_.FullName - } - } elseif ($IncludeFiles) { - $_.FullName - } - } -} - -function Get-PathPrefix { - [CmdletBinding()] - param([string]$Pattern) - - # Note, unable to search root directories is a limitation due to subtleties of this function - # and downstream code in Get-PathIterator that short-circuits when the path prefix is empty. - # This function uses Path.GetDirectoryName() to determine the path prefix, which will yield - # empty in some cases. See the following examples of Path.GetDirectoryName() input => output: - # C:/ => - # C:/hello => C:\ - # C:/hello/ => C:\hello - # C:/hello/world => C:\hello - # C:/hello/world/ => C:\hello\world - # C: => - # C:hello => C: - # C:hello/ => C:hello - # / => - # /hello => \ - # /hello/ => \hello - # //hello => - # //hello/ => - # //hello/world => - # //hello/world/ => \\hello\world - - $index = $Pattern.IndexOfAny([char[]]@('*'[0], '?'[0])) - if ($index -eq -1) { - # If no wildcards are found, return the directory name portion of the path. - # If there is no directory name (file name only in pattern), this will return empty string. - return [System.IO.Path]::GetDirectoryName($Pattern) - } - - [System.IO.Path]::GetDirectoryName($Pattern.Substring(0, $index)) -} - -function Test-IsIncludePattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [ref]$Pattern) - - # Include patterns start with +: or anything except -: - # Exclude patterns start with -: - if ($Pattern.value.StartsWith("+:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $true - } elseif ($Pattern.value.StartsWith("-:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $false - } else { - # No prefix, so leave the string alone. - $true; - } -} diff --git a/Tasks/install/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 b/Tasks/install/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 deleted file mode 100644 index c31790c..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 +++ /dev/null @@ -1,150 +0,0 @@ -$script:resourceStrings = @{ } - -<# -.SYNOPSIS -Gets a localized resource string. - -.DESCRIPTION -Gets a localized resource string and optionally formats the string with arguments. - -If the format fails (due to a bad format string or incorrect expected arguments in the format string), then the format string is returned followed by each of the arguments (delimited by a space). - -If the lookup key is not found, then the lookup key is returned followed by each of the arguments (delimited by a space). - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-LocString { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true, Position = 1)] - [string]$Key, - [Parameter(Position = 2)] - [object[]]$ArgumentList = @( )) - - # Due to the dynamically typed nature of PowerShell, a single null argument passed - # to an array parameter is interpreted as a null array. - if ([object]::ReferenceEquals($null, $ArgumentList)) { - $ArgumentList = @( $null ) - } - - # Lookup the format string. - $format = '' - if (!($format = $script:resourceStrings[$Key])) { - # Warn the key was not found. Prevent recursion if the lookup key is the - # "string resource key not found" lookup key. - $resourceNotFoundKey = 'PSLIB_StringResourceKeyNotFound0' - if ($key -ne $resourceNotFoundKey) { - Write-Warning (Get-LocString -Key $resourceNotFoundKey -ArgumentList $Key) - } - - # Fallback to just the key itself if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $key } - - # Otherwise fallback to the key followed by the arguments. - $OFS = " " - return "$key $ArgumentList" - } - - # Return the string if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $format } - - try { - [string]::Format($format, $ArgumentList) - } catch { - Write-Warning (Get-LocString -Key 'PSLIB_StringFormatFailed') - $OFS = " " - "$format $ArgumentList" - } -} - -<# -.SYNOPSIS -Imports resource strings for use with Get-VstsLocString. - -.DESCRIPTION -Imports resource strings for use with Get-VstsLocString. The imported strings are stored in an internal resource string dictionary. Optionally, if a separate resource file for the current culture exists, then the localized strings from that file then imported (overlaid) into the same internal resource string dictionary. - -Resource strings from the SDK are prefixed with "PSLIB_". This prefix should be avoided for custom resource strings. - -.Parameter LiteralPath -JSON file containing resource strings. - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Imports strings from messages section in the JSON file. If a messages section is not defined, then no strings are imported. Example messages section: -{ - "messages": { - "Hello": "Hello you!", - "Hello0": "Hello {0}!" - } -} - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Overlays strings from an optional separate resource file for the current culture. - -Given the task variable System.Culture is set to 'de-DE'. This variable is set by the agent based on the current culture for the job. -Given the file Task.json contains: -{ - "messages": { - "GoodDay": "Good day!", - } -} -Given the file resources.resjson\de-DE\resources.resjson: -{ - "loc.messages.GoodDay": "Guten Tag!" -} - -The net result from the import command would be one new key-value pair added to the internal dictionary: Key = 'GoodDay', Value = 'Guten Tag!' -#> -function Import-LocStrings { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - # Validate the file exists. - if (!(Test-Path -LiteralPath $LiteralPath -PathType Leaf)) { - Write-Warning (Get-LocString -Key PSLIB_FileNotFound0 -ArgumentList $LiteralPath) - return - } - - # Load the json. - Write-Verbose "Loading resource strings from: $LiteralPath" - $count = 0 - if ($messages = (Get-Content -LiteralPath $LiteralPath -Encoding UTF8 | Out-String | ConvertFrom-Json).messages) { - # Add each resource string to the hashtable. - foreach ($member in (Get-Member -InputObject $messages -MemberType NoteProperty)) { - [string]$key = $member.Name - $script:resourceStrings[$key] = $messages."$key" - $count++ - } - } - - Write-Verbose "Loaded $count strings." - - # Get the culture. - $culture = Get-TaskVariable -Name "System.Culture" -Default "en-US" - - # Load the resjson. - $resjsonPath = "$([System.IO.Path]::GetDirectoryName($LiteralPath))\Strings\resources.resjson\$culture\resources.resjson" - if (Test-Path -LiteralPath $resjsonPath) { - Write-Verbose "Loading resource strings from: $resjsonPath" - $count = 0 - $resjson = Get-Content -LiteralPath $resjsonPath -Encoding UTF8 | Out-String | ConvertFrom-Json - foreach ($member in (Get-Member -Name loc.messages.* -InputObject $resjson -MemberType NoteProperty)) { - if (!($value = $resjson."$($member.Name)")) { - continue - } - - [string]$key = $member.Name.Substring('loc.messages.'.Length) - $script:resourceStrings[$key] = $value - $count++ - } - - Write-Verbose "Loaded $count strings." - } -} diff --git a/Tasks/install/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 b/Tasks/install/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 deleted file mode 100644 index 595a7d8..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 +++ /dev/null @@ -1,601 +0,0 @@ -$script:loggingCommandPrefix = '##vso[' -$script:loggingCommandEscapeMappings = @( # TODO: WHAT ABOUT "="? WHAT ABOUT "%"? - New-Object psobject -Property @{ Token = ';' ; Replacement = '%3B' } - New-Object psobject -Property @{ Token = "`r" ; Replacement = '%0D' } - New-Object psobject -Property @{ Token = "`n" ; Replacement = '%0A' } - New-Object psobject -Property @{ Token = "]" ; Replacement = '%5D' } -) -# TODO: BUG: Escape % ??? -# TODO: Add test to verify don't need to escape "=". - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddAttachment { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Type, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'addattachment' -Data $Path -Properties @{ - 'type' = $Type - 'name' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadSummary { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadsummary' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetEndpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [Parameter(Mandatory = $true)] - [string]$Field, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setendpoint' -Data $Value -Properties @{ - 'id' = $Id - 'field' = $Field - 'key' = $Key - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddBuildTag { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'addbuildtag' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AssociateArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - [string]$Type, - [hashtable]$Properties, - [switch]$AsOutput) - - $p = @{ } - if ($Properties) { - foreach ($key in $Properties.Keys) { - $p[$key] = $Properties[$key] - } - } - - $p['artifactname'] = $Name - $p['artifacttype'] = $Type - Write-LoggingCommand -Area 'artifact' -Event 'associate' -Data $Path -Properties $p -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-LogDetail { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [guid]$Id, - $ParentId, - [string]$Type, - [string]$Name, - $Order, - $StartTime, - $FinishTime, - $Progress, - [ValidateSet('Unknown', 'Initialized', 'InProgress', 'Completed')] - [Parameter()] - $State, - [ValidateSet('Succeeded', 'SucceededWithIssues', 'Failed', 'Cancelled', 'Skipped')] - [Parameter()] - $Result, - [string]$Message, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'logdetail' -Data $Message -Properties @{ - 'id' = $Id - 'parentid' = $ParentId - 'type' = $Type - 'name' = $Name - 'order' = $Order - 'starttime' = $StartTime - 'finishtime' = $FinishTime - 'progress' = $Progress - 'state' = $State - 'result' = $Result - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetProgress { - [CmdletBinding()] - param( - [ValidateRange(0, 100)] - [Parameter(Mandatory = $true)] - [int]$Percent, - [string]$CurrentOperation, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setprogress' -Data $CurrentOperation -Properties @{ - 'value' = $Percent - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetResult { - [CmdletBinding(DefaultParameterSetName = 'AsOutput')] - param( - [ValidateSet("Succeeded", "SucceededWithIssues", "Failed", "Cancelled", "Skipped")] - [Parameter(Mandatory = $true)] - [string]$Result, - [string]$Message, - [Parameter(ParameterSetName = 'AsOutput')] - [switch]$AsOutput, - [Parameter(ParameterSetName = 'DoNotThrow')] - [switch]$DoNotThrow) - - Write-LoggingCommand -Area 'task' -Event 'complete' -Data $Message -Properties @{ - 'result' = $Result - } -AsOutput:$AsOutput - if ($Result -eq 'Failed' -and !$AsOutput -and !$DoNotThrow) { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - throw (New-Object VstsTaskSdk.TerminationException($Message)) - } -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetSecret { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setsecret' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ - 'variable' = $Name - 'issecret' = $Secret - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskDebug { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskError { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type error @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskVerbose { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -AsVerbose -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskWarning { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type warning @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadFile { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadfile' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-PrependPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateBuildNumber { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'updatebuildnumber' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$ContainerFolder, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'artifact' -Event 'upload' -Data $Path -Properties @{ - 'containerfolder' = $ContainerFolder - 'artifactname' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadBuildLog { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'uploadlog' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateReleaseName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'release' -Event 'updatereleasename' -Data $Name -AsOutput:$AsOutput -} - -######################################## -# Private functions. -######################################## -function Format-LoggingCommandData { - [CmdletBinding()] - param([string]$Value, [switch]$Reverse) - - if (!$Value) { - return '' - } - - if (!$Reverse) { - foreach ($mapping in $script:loggingCommandEscapeMappings) { - $Value = $Value.Replace($mapping.Token, $mapping.Replacement) - } - } else { - for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { - $mapping = $script:loggingCommandEscapeMappings[$i] - $Value = $Value.Replace($mapping.Replacement, $mapping.Token) - } - } - - return $Value -} - -function Format-LoggingCommand { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Area, - [Parameter(Mandatory = $true)] - [string]$Event, - [string]$Data, - [hashtable]$Properties) - - # Append the preamble. - [System.Text.StringBuilder]$sb = New-Object -TypeName System.Text.StringBuilder - $null = $sb.Append($script:loggingCommandPrefix).Append($Area).Append('.').Append($Event) - - # Append the properties. - if ($Properties) { - $first = $true - foreach ($key in $Properties.Keys) { - [string]$value = Format-LoggingCommandData $Properties[$key] - if ($value) { - if ($first) { - $null = $sb.Append(' ') - $first = $false - } else { - $null = $sb.Append(';') - } - - $null = $sb.Append("$key=$value") - } - } - } - - # Append the tail and output the value. - $Data = Format-LoggingCommandData $Data - $sb.Append(']').Append($Data).ToString() -} - -function Write-LoggingCommand { - [CmdletBinding(DefaultParameterSetName = 'Parameters')] - param( - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Area, - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Event, - [Parameter(ParameterSetName = 'Parameters')] - [string]$Data, - [Parameter(ParameterSetName = 'Parameters')] - [hashtable]$Properties, - [Parameter(Mandatory = $true, ParameterSetName = 'Object')] - $Command, - [switch]$AsOutput) - - if ($PSCmdlet.ParameterSetName -eq 'Object') { - Write-LoggingCommand -Area $Command.Area -Event $Command.Event -Data $Command.Data -Properties $Command.Properties -AsOutput:$AsOutput - return - } - - $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties - if ($AsOutput) { - $command - } else { - Write-Host $command - } -} - -function Write-LogIssue { - [CmdletBinding()] - param( - [ValidateSet('warning', 'error')] - [Parameter(Mandatory = $true)] - [string]$Type, - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ - 'type' = $Type - 'code' = $ErrCode - 'sourcepath' = $SourcePath - 'linenumber' = $LineNumber - 'columnnumber' = $ColumnNumber - } - if ($AsOutput) { - return $command - } - - if ($Type -eq 'error') { - $foregroundColor = $host.PrivateData.ErrorForegroundColor - $backgroundColor = $host.PrivateData.ErrorBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Red - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.WarningForegroundColor - $backgroundColor = $host.PrivateData.WarningBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Yellow - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} - -function Write-TaskDebug_Internal { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsVerbose, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'debug' -Data $Message - if ($AsOutput) { - return $command - } - - if ($AsVerbose) { - $foregroundColor = $host.PrivateData.VerboseForegroundColor - $backgroundColor = $host.PrivateData.VerboseBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Cyan - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.DebugForegroundColor - $backgroundColor = $host.PrivateData.DebugBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::DarkGray - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host -Object $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} diff --git a/Tasks/install/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 b/Tasks/install/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 deleted file mode 100644 index d536111..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 +++ /dev/null @@ -1,205 +0,0 @@ -######################################## -# Private functions. -######################################## -function ConvertFrom-LongFormPath { - [CmdletBinding()] - param([string]$Path) - - if ($Path) { - if ($Path.StartsWith('\\?\UNC')) { - # E.g. \\?\UNC\server\share -> \\server\share - return $Path.Substring(1, '\?\UNC'.Length) - } elseif ($Path.StartsWith('\\?\')) { - # E.g. \\?\C:\directory -> C:\directory - return $Path.Substring('\\?\'.Length) - } - } - - return $Path -} -function ConvertTo-LongFormPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$longFormPath = Get-FullNormalizedPath -Path $Path - if ($longFormPath -and !$longFormPath.StartsWith('\\?')) { - if ($longFormPath.StartsWith('\\')) { - # E.g. \\server\share -> \\?\UNC\server\share - return "\\?\UNC$($longFormPath.Substring(1))" - } else { - # E.g. C:\directory -> \\?\C:\directory - return "\\?\$longFormPath" - } - } - - return $longFormPath -} - -# TODO: ADD A SWITCH TO EXCLUDE FILES, A SWITCH TO EXCLUDE DIRECTORIES, AND A SWITCH NOT TO FOLLOW REPARSE POINTS. -function Get-DirectoryChildItem { - [CmdletBinding()] - param( - [string]$Path, - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$Filter = "*", - [switch]$Force, - [VstsTaskSdk.FS.FindFlags]$Flags = [VstsTaskSdk.FS.FindFlags]::LargeFetch, - [VstsTaskSdk.FS.FindInfoLevel]$InfoLevel = [VstsTaskSdk.FS.FindInfoLevel]::Basic, - [switch]$Recurse) - - $stackOfDirectoryQueues = New-Object System.Collections.Stack - while ($true) { - $directoryQueue = New-Object System.Collections.Queue - $fileQueue = New-Object System.Collections.Queue - $findData = New-Object VstsTaskSdk.FS.FindData - $longFormPath = (ConvertTo-LongFormPath $Path) - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, $Filter), - $InfoLevel, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - # Output directories immediately. - if ($item.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - $item - # Append to the directory queue if recursive and default filter. - if ($Recurse -and $Filter -eq '*') { - $directoryQueue.Enqueue($item) - } - } else { - # Hold the files until all directories have been output. - $fileQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - - # If recursive and non-default filter, queue child directories. - if ($Recurse -and $Filter -ne '*') { - $findData = New-Object VstsTaskSdk.FS.FindData - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, '*'), - [VstsTaskSdk.FS.FindInfoLevel]::Basic, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Collect directories only. - if ($attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - $directoryQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - } - - # Output the files. - $fileQueue - - # Push the directory queue onto the stack if any directories were found. - if ($directoryQueue.Count) { $stackOfDirectoryQueues.Push($directoryQueue) } - - # Break out of the loop if no more directory queues to process. - if (!$stackOfDirectoryQueues.Count) { break } - - # Get the next path. - $directoryQueue = $stackOfDirectoryQueues.Peek() - $Path = $directoryQueue.Dequeue().FullName - - # Pop the directory queue if it's empty. - if (!$directoryQueue.Count) { $null = $stackOfDirectoryQueues.Pop() } - } -} - -function Get-FullNormalizedPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$outPath = $Path - [uint32]$bufferSize = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, 0, $null, $null) - [int]$lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($bufferSize -gt 0) { - $absolutePath = New-Object System.Text.StringBuilder([int]$bufferSize) - [uint32]$length = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, $bufferSize, $absolutePath, $null) - $lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($length -gt 0) { - $outPath = $absolutePath.ToString() - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - - if ($outPath.EndsWith('\') -and !$outPath.EndsWith(':\')) { - $outPath = $outPath.TrimEnd('\') - } - - $outPath -} \ No newline at end of file diff --git a/Tasks/install/ps_modules/VstsTaskSdk/Minimatch.dll b/Tasks/install/ps_modules/VstsTaskSdk/Minimatch.dll deleted file mode 100644 index 700ddc426e56b08270c9dcbb1ade8ded248f98d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18432 zcmeHvd3amZweLFTNJpa;OY%U-U;wdJ(iE<^0Dr1eX+yVU^ZP<}CerFP{^D;NRAvpy{Upu7qdr-p#QQK0A=EE z*j@RF!K$=fum`{t+x7$Dj;_a3@mYu3X*)Y&L6B{wNj$7;1D=Y{x>+@ezQumUhi%iz zO@BY1=+-!qPq<}p%U-3n%sDf*P#@P|Wa1p%m=FXEn4%bhfB`=%h9F>|Q;H!781527 z5HJu1N4U|d+S*S|6A90AA zkcdZ#{0VeB+M>~Zr~5WKIT}ZR`3qry$+MxwZUCkMpp6A zlnP^-LRYHRWuXsdbCpqNodtCbjqPxWp&AP6_LosJK9}1uT+)sn=XT(TXp2E@Xam*5 zPMKe?G$W3ZWHq@`VV5-rby7Zf6F~r;o>=af9Y2q?MO$37yJW9;db*vutEt&Mw*dE= z6Nqt_Zdh=pf1--OAk^fxTE;9o}~-pGxds~dH31h<)Z!q6++rR>xk zJz{CdPk> z$z#Au8q!>Hj%Z+R9P=r84Bjb~FXeL3Xo0zLOs`}dQz|)u0CZuT4B8JLU=+i3e#c`5 z>ZG(pT_9Nx6GD)ydrh0*w^_f-@2TGv@TlHf=&gTgwIVz!+!m#uGV59+jt@)=-B*K# zw%l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CXQ`(eW-H<5Yn`5?jbXtG5NDp!qZSh!nE9zb< ztrseM(26}cKP~cbpO68?i={JC27M@7HoJ{94MJiBHg6Jt^rDR+*ghhj8AZR?(joL5 zXRI^uV)Ov~6T{i41(qQF;Jm}5U)G~Wa1eUgi?-tx2;$Q%_HJ|9;1T4OOVPlT^5`4c zy-fVO9Xc%ZWemP8R`eKu26_g+E)%~_uQSuTGkx13bviM61?kHHSb7va|F7z)p8hw( X?dtd6e<)43|K{fYzxw~TJn(-2*CUr_ diff --git a/Tasks/install/ps_modules/VstsTaskSdk/OutFunctions.ps1 b/Tasks/install/ps_modules/VstsTaskSdk/OutFunctions.ps1 deleted file mode 100644 index fd898d6..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/OutFunctions.ps1 +++ /dev/null @@ -1,79 +0,0 @@ -# TODO: It would be better if the Out-Default function resolved the underlying Out-Default -# command in the begin block. This would allow for supporting other modules that override -# Out-Default. -$script:outDefaultCmdlet = $ExecutionContext.InvokeCommand.GetCmdlet("Microsoft.PowerShell.Core\Out-Default") - -######################################## -# Public functions. -######################################## -function Out-Default { - [CmdletBinding(ConfirmImpact = "Medium")] - param( - [Parameter(ValueFromPipeline = $true)] - [System.Management.Automation.PSObject]$InputObject) - - begin { - #Write-Host '[Entering Begin Out-Default]' - $__sp = { & $script:outDefaultCmdlet @PSBoundParameters }.GetSteppablePipeline() - $__sp.Begin($pscmdlet) - #Write-Host '[Leaving Begin Out-Default]' - } - - process { - #Write-Host '[Entering Process Out-Default]' - if ($_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose -Message 'Error record:' 4>&1 | Out-Default - Write-Verbose -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) 4>&1 | Out-Default - Write-Verbose -Message 'Script stack trace:' 4>&1 | Out-Default - Write-Verbose -Message "$($_.ScriptStackTrace)" 4>&1 | Out-Default - Write-Verbose -Message 'Exception:' 4>&1 | Out-Default - Write-Verbose -Message $_.Exception.ToString() 4>&1 | Out-Default - Write-TaskError -Message $_.Exception.Message - } elseif ($_ -is [System.Management.Automation.WarningRecord]) { - Write-TaskWarning -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) - } elseif ($_ -is [System.Management.Automation.VerboseRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskVerbose -Message $private:str - } - } elseif ($_ -is [System.Management.Automation.DebugRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskDebug -Message $private:str - } - } else { -# TODO: Consider using out-string here to control the width. As a security precaution it would actually be best to set it to max so wrapping doesn't interfere with secret masking. - $__sp.Process($_) - } - - #Write-Host '[Leaving Process Out-Default]' - } - - end { - #Write-Host '[Entering End Out-Default]' - $__sp.End() - #Write-Host '[Leaving End Out-Default]' - } -} - -######################################## -# Private functions. -######################################## -function Format-DebugMessage { - [CmdletBinding()] - param([psobject]$Object) - - $private:str = Out-String -InputObject $Object -Width 2147483647 - $private:str = Remove-TrailingNewLine $private:str - "$private:str".Replace("`r`n", "`n").Replace("`r", "`n").Split("`n"[0]) -} - -function Remove-TrailingNewLine { - [CmdletBinding()] - param($Str) - if ([object]::ReferenceEquals($Str, $null)) { - return $Str - } elseif ($Str.EndsWith("`r`n")) { - return $Str.Substring(0, $Str.Length - 2) - } else { - return $Str - } -} diff --git a/Tasks/install/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml b/Tasks/install/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml deleted file mode 100644 index 8c20388..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - Microsoft.PowerShell.Commands.PSRepositoryItemInfo - System.Management.Automation.PSCustomObject - System.Object - - - VstsTaskSdk - 0.11.0 - Module - VSTS Task SDK - Microsoft - VSTS - (c) 2016 Microsoft. All rights reserved. -

2018-05-21T03:27:56+01:00
- - - - https://github.com/Microsoft/vsts-task-lib - - - - System.Object[] - System.Array - System.Object - - - PSModule - - - - - System.Collections.Hashtable - System.Object - - - - DscResource - - - - - - - RoleCapability - - - - Cmdlet - - - - Workflow - - - - Command - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - Function - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - - - - - - - - https://www.powershellgallery.com/api/v2 - PSGallery - NuGet - - - System.Management.Automation.PSCustomObject - System.Object - - - (c) 2016 Microsoft. All rights reserved. - VSTS Task SDK - False - True - True - 12749 - 136204 - 71074 - 21/05/2018 03:27:56 +01:00 - 21/05/2018 03:27:56 +01:00 - 09/11/2018 22:20:20 +00:00 - PSModule PSFunction_Find-Match PSCommand_Find-Match PSFunction_New-FindOptions PSCommand_New-FindOptions PSFunction_New-MatchOptions PSCommand_New-MatchOptions PSFunction_Select-Match PSCommand_Select-Match PSFunction_Get-Endpoint PSCommand_Get-Endpoint PSFunction_Get-SecureFileTicket PSCommand_Get-SecureFileTicket PSFunction_Get-SecureFileName PSCommand_Get-SecureFileName PSFunction_Get-Input PSCommand_Get-Input PSFunction_Get-TaskVariable PSCommand_Get-TaskVariable PSFunction_Get-TaskVariableInfo PSCommand_Get-TaskVariableInfo PSFunction_Set-TaskVariable PSCommand_Set-TaskVariable PSFunction_Find-Files PSCommand_Find-Files PSFunction_Get-LocString PSCommand_Get-LocString PSFunction_Import-LocStrings PSCommand_Import-LocStrings PSFunction_Write-AddAttachment PSCommand_Write-AddAttachment PSFunction_Write-AddBuildTag PSCommand_Write-AddBuildTag PSFunction_Write-AssociateArtifact PSCommand_Write-AssociateArtifact PSFunction_Write-LogDetail PSCommand_Write-LogDetail PSFunction_Write-PrependPath PSCommand_Write-PrependPath PSFunction_Write-SetEndpoint PSCommand_Write-SetEndpoint PSFunction_Write-SetProgress PSCommand_Write-SetProgress PSFunction_Write-SetResult PSCommand_Write-SetResult PSFunction_Write-SetSecret PSCommand_Write-SetSecret PSFunction_Write-SetVariable PSCommand_Write-SetVariable PSFunction_Write-TaskDebug PSCommand_Write-TaskDebug PSFunction_Write-TaskError PSCommand_Write-TaskError PSFunction_Write-TaskVerbose PSCommand_Write-TaskVerbose PSFunction_Write-TaskWarning PSCommand_Write-TaskWarning PSFunction_Write-UpdateBuildNumber PSCommand_Write-UpdateBuildNumber PSFunction_Write-UpdateReleaseName PSCommand_Write-UpdateReleaseName PSFunction_Write-UploadArtifact PSCommand_Write-UploadArtifact PSFunction_Write-UploadBuildLog PSCommand_Write-UploadBuildLog PSFunction_Write-UploadFile PSCommand_Write-UploadFile PSFunction_Write-UploadSummary PSCommand_Write-UploadSummary PSFunction_Out-Default PSCommand_Out-Default PSFunction_Get-AssemblyReference PSCommand_Get-AssemblyReference PSFunction_Get-TfsClientCredentials PSCommand_Get-TfsClientCredentials PSFunction_Get-TfsService PSCommand_Get-TfsService PSFunction_Get-VssCredentials PSCommand_Get-VssCredentials PSFunction_Get-VssHttpClient PSCommand_Get-VssHttpClient PSFunction_Assert-Agent PSCommand_Assert-Agent PSFunction_Assert-Path PSCommand_Assert-Path PSFunction_Invoke-Tool PSCommand_Invoke-Tool PSFunction_Trace-EnteringInvocation PSCommand_Trace-EnteringInvocation PSFunction_Trace-LeavingInvocation PSCommand_Trace-LeavingInvocation PSFunction_Trace-Path PSCommand_Trace-Path PSFunction_Get-WebProxy PSCommand_Get-WebProxy PSFunction_Get-ClientCertificate PSCommand_Get-ClientCertificate PSIncludes_Function - False - 2018-11-09T22:20:20Z - 0.11.0 - Microsoft - false - Module - VstsTaskSdk.nuspec|FindFunctions.ps1|InputFunctions.ps1|LegacyFindFunctions.ps1|lib.json|LocalizationFunctions.ps1|LoggingCommandFunctions.ps1|LongPathFunctions.ps1|Minimatch.dll|OutFunctions.ps1|ServerOMFunctions.ps1|ToolFunctions.ps1|TraceFunctions.ps1|VstsTaskSdk.dll|VstsTaskSdk.psd1|VstsTaskSdk.psm1|Strings\resources.resjson\de-de\resources.resjson|Strings\resources.resjson\en-US\resources.resjson|Strings\resources.resjson\es-es\resources.resjson|Strings\resources.resjson\fr-fr\resources.resjson|Strings\resources.resjson\it-IT\resources.resjson|Strings\resources.resjson\ja-jp\resources.resjson|Strings\resources.resjson\ko-KR\resources.resjson|Strings\resources.resjson\ru-RU\resources.resjson|Strings\resources.resjson\zh-CN\resources.resjson|Strings\resources.resjson\zh-TW\resources.resjson - bbed04e2-4e8e-4089-90a2-58b858fed8d8 - 3.0 - Microsoft - - - /Users/gep13/github/gep13/chocolatey-azuredevops/Tasks/install/VstsTaskSdk/0.11.0 - - - diff --git a/Tasks/install/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 b/Tasks/install/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 deleted file mode 100644 index 177820b..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 +++ /dev/null @@ -1,659 +0,0 @@ -<# -.SYNOPSIS -Gets assembly reference information. - -.DESCRIPTION -Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK. - -Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario. - -Walks an assembly's references to determine all of it's dependencies. Also walks the references of the dependencies, and so on until all nested dependencies have been traversed. Dependencies are searched for in the directory of the specified assembly. NET Framework assemblies are omitted. - -See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER LiteralPath -Assembly to walk. - -.EXAMPLE -Get-VstsAssemblyReference -LiteralPath C:\nuget\microsoft.teamfoundationserver.client.14.102.0\lib\net45\Microsoft.TeamFoundation.Build2.WebApi.dll -#> -function Get-AssemblyReference { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - $ErrorActionPreference = 'Stop' - Write-Warning "Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK." - Write-Output '' - Write-Warning "Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario." - $directory = [System.IO.Path]::GetDirectoryName($LiteralPath) - $hashtable = @{ } - $queue = @( [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($LiteralPath).GetName() ) - while ($queue.Count) { - # Add a blank line between assemblies. - Write-Output '' - - # Pop. - $assemblyName = $queue[0] - $queue = @( $queue | Select-Object -Skip 1 ) - - # Attempt to find the assembly in the same directory. - $assembly = $null - $path = "$directory\$($assemblyName.Name).dll" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } else { - $path = "$directory\$($assemblyName.Name).exe" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } - } - - # Make sure the assembly full name matches, not just the file name. - if ($assembly -and $assembly.GetName().FullName -ne $assemblyName.FullName) { - $assembly = $null - } - - # Print the assembly. - if ($assembly) { - Write-Output $assemblyName.FullName - } else { - if ($assemblyName.FullName -eq 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed') { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) *** This is an expected condition when using the HTTP clients from the 15.x VSTS REST SDK. Use Get-VstsVssHttpClient to load the HTTP clients (which applies a binding redirect assembly resolver for Newtonsoft.Json). Otherwise you will need to manage the binding redirect yourself." - } else { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) ***" - } - - continue - } - - # Walk the references. - $refAssemblyNames = @( $assembly.GetReferencedAssemblies() ) - for ($i = 0 ; $i -lt $refAssemblyNames.Count ; $i++) { - $refAssemblyName = $refAssemblyNames[$i] - - # Skip framework assemblies. - $fxPaths = @( - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\$($refAssemblyName.Name).dll" - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\WPF\$($refAssemblyName.Name).dll" - ) - $fxPath = $fxPaths | - Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } | - Where-Object { [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($_).GetName().FullName -eq $refAssemblyName.FullName } - if ($fxPath) { - continue - } - - # Print the reference. - Write-Output " $($refAssemblyName.FullName)" - - # Add new references to the queue. - if (!$hashtable[$refAssemblyName.FullName]) { - $queue += $refAssemblyName - $hashtable[$refAssemblyName.FullName] = $true - } - } - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the TFS extended client SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -Refer to Get-VstsTfsService for a more simple to get a TFS service object. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -$credentials = Get-VstsTfsClientCredentials -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.VersionControl.Client.dll" -$tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection( - (Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require), - $credentials) -$versionControlServer = $tfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer]) -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsClientCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Validate the type can be found. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsClientCredentials' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Construct the credentials. - $credentials = New-Object Microsoft.TeamFoundation.Client.TfsClientCredentials($false) # Do not use default credentials. - $credentials.AllowInteractive = $false - $credentials.Federated = New-Object Microsoft.TeamFoundation.Client.OAuthTokenCredential([string]$endpoint.auth.parameters.AccessToken) - return $credentials - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a TFS extended client service. - -.DESCRIPTION -Gets an instance of an ITfsTeamProjectCollectionObject. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the service to get. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER Uri -URI to use when initializing the service. If not specified, defaults to System.TeamFoundationCollectionUri. - -.PARAMETER TfsClientCredentials -Credentials to use when initializing the service. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -.EXAMPLE -$versionControlServer = Get-VstsTfsService -TypeName Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsService { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $TfsClientCredentials) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Default the credentials. - if (!$TfsClientCredentials) { - $TfsClientCredentials = Get-TfsClientCredentials -OMDirectory $OMDirectory - } - - # Validate the project collection type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsTeamProjectCollection' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Load the project collection object. - $tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection($Uri, $TfsClientCredentials) - - # Validate the requested type can be loaded. - $type = Get-OMType -TypeName $TypeName -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Return the service object. - return $tfsTeamProjectCollection.GetService($type) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the VSTS REST SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project service build/release identity). - -Refer to Get-VstsVssHttpClient for a more simple to get a VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -# This example works using the 14.x .NET SDK. A Newtonsoft.Json 6.0 to 8.0 binding -# redirect may be required when working with the 15.x SDK. Or use Get-VstsVssHttpClient -# to avoid managing the binding redirect. -# -$vssCredentials = Get-VstsVssCredentials -$collectionUrl = New-Object System.Uri((Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require)) -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.Core.WebApi.dll" -$projectHttpClient = New-Object Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient($collectionUrl, $vssCredentials) -$projectHttpClient.GetProjects().Result -#> -function Get-VssCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Check if the VssOAuthAccessTokenCredential type is available. - if ((Get-OMType -TypeName 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory)) { - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential($endpoint.auth.parameters.AccessToken) - } else { - # Validate the fallback type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.Client.VssOAuthCredential($endpoint.auth.parameters.AccessToken) - } - - # Return the credentials. - return New-Object Microsoft.VisualStudio.Services.Common.VssCredentials( - (New-Object Microsoft.VisualStudio.Services.Common.WindowsCredential($false)), # Do not use default credentials. - $federatedCredential, - [Microsoft.VisualStudio.Services.Common.CredentialPromptType]::DoNotPrompt) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VSS HTTP client. - -.DESCRIPTION -Gets an instance of an VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the HTTP client to get. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -# .PARAMETER Uri -# URI to use when initializing the HTTP client. If not specified, defaults to System.TeamFoundationCollectionUri. - -# .PARAMETER VssCredentials -# Credentials to use when initializing the HTTP client. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -# .PARAMETER WebProxy -# WebProxy to use when initializing the HTTP client. If not specified, the default uses the proxy configuration agent current has. - -# .PARAMETER ClientCert -# ClientCert to use when initializing the HTTP client. If not specified, the default uses the client certificate agent current has. - -# .PARAMETER IgnoreSslError -# Skip SSL server certificate validation on all requests made by this HTTP client. If not specified, the default is to validate SSL server certificate. - -.EXAMPLE -$projectHttpClient = Get-VstsVssHttpClient -TypeName Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient -$projectHttpClient.GetProjects().Result -#> -function Get-VssHttpClient { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $VssCredentials, - - $WebProxy = (Get-WebProxy), - - $ClientCert = (Get-ClientCertificate), - - [switch]$IgnoreSslError) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Cast the URI. - [uri]$Uri = New-Object System.Uri($Uri) - - # Default the credentials. - if (!$VssCredentials) { - $VssCredentials = Get-VssCredentials -OMDirectory $OMDirectory - } - - # Validate the type can be loaded. - $null = Get-OMType -TypeName $TypeName -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Update proxy setting for vss http client - [Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler]::DefaultWebProxy = $WebProxy - - # Update client certificate setting for vss http client - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - [Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings]$Settings = [Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings]::Default.Clone() - - if ($ClientCert) { - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance.ClientCertificates.Add($ClientCert) - - $Settings.ClientCertificateManager = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance - } - - # Skip SSL server certificate validation - [bool]$SkipCertValidation = (Get-TaskVariable -Name Agent.SkipCertValidation -AsBool) -or $IgnoreSslError - if ($SkipCertValidation) { - if ($Settings.GetType().GetProperty('ServerCertificateValidationCallback')) { - Write-Verbose "Ignore any SSL server certificate validation errors."; - $Settings.ServerCertificateValidationCallback = [VstsTaskSdk.VstsHttpHandlerSettings]::UnsafeSkipServerCertificateValidation - } - else { - # OMDirectory has older version of Microsoft.VisualStudio.Services.Common.dll - Write-Verbose "The version of 'Microsoft.VisualStudio.Services.Common.dll' does not support skip SSL server certificate validation." - } - } - - # Try to construct the HTTP client. - Write-Verbose "Constructing HTTP client." - try { - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } catch { - # Rethrow if the exception is not due to Newtonsoft.Json DLL not found. - if ($_.Exception.InnerException -isnot [System.IO.FileNotFoundException] -or - $_.Exception.InnerException.FileName -notlike 'Newtonsoft.Json, *') { - - throw - } - - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Test if the Newtonsoft.Json DLL exists in the OM directory. - $newtonsoftDll = [System.IO.Path]::Combine($OMDirectory, "Newtonsoft.Json.dll") - Write-Verbose "Testing file path: '$newtonsoftDll'" - if (!(Test-Path -LiteralPath $newtonsoftDll -PathType Leaf)) { - Write-Verbose 'Not found. Rethrowing exception.' - throw - } - - # Add a binding redirect and try again. Parts of the Dev15 preview SDK have a - # dependency on the 6.0.0.0 Newtonsoft.Json DLL, while other parts reference - # the 8.0.0.0 Newtonsoft.Json DLL. - Write-Verbose "Adding assembly resolver." - $onAssemblyResolve = [System.ResolveEventHandler] { - param($sender, $e) - - if ($e.Name -like 'Newtonsoft.Json, *') { - Write-Verbose "Resolving '$($e.Name)'" - return [System.Reflection.Assembly]::LoadFrom($newtonsoftDll) - } - - Write-Verbose "Unable to resolve assembly name '$($e.Name)'" - return $null - } - [System.AppDomain]::CurrentDomain.add_AssemblyResolve($onAssemblyResolve) - try { - # Try again to construct the HTTP client. - Write-Verbose "Trying again to construct the HTTP client." - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } finally { - # Unregister the assembly resolver. - Write-Verbose "Removing assemlby resolver." - [System.AppDomain]::CurrentDomain.remove_AssemblyResolve($onAssemblyResolve) - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VstsTaskSdk.VstsWebProxy - -.DESCRIPTION -Gets an instance of a VstsTaskSdk.VstsWebProxy that has same proxy configuration as Build/Release agent. - -VstsTaskSdk.VstsWebProxy implement System.Net.IWebProxy interface. - -.EXAMPLE -$webProxy = Get-VstsWebProxy -$webProxy.GetProxy(New-Object System.Uri("https://github.com/Microsoft/vsts-task-lib")) -#> -function Get-WebProxy { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports proxy - Assert-Agent -Minimum '2.105.7' - - $proxyUrl = Get-TaskVariable -Name Agent.ProxyUrl - $proxyUserName = Get-TaskVariable -Name Agent.ProxyUserName - $proxyPassword = Get-TaskVariable -Name Agent.ProxyPassword - $proxyBypassListJson = Get-TaskVariable -Name Agent.ProxyBypassList - [string[]]$ProxyBypassList = ConvertFrom-Json -InputObject $ProxyBypassListJson - - return New-Object -TypeName VstsTaskSdk.VstsWebProxy -ArgumentList @($proxyUrl, $proxyUserName, $proxyPassword, $proxyBypassList) - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a client certificate for current connected TFS instance - -.DESCRIPTION -Gets an instance of a X509Certificate2 that is the client certificate Build/Release agent used. - -.EXAMPLE -$x509cert = Get-ClientCertificate -WebRequestHandler.ClientCertificates.Add(x509cert) -#> -function Get-ClientCertificate { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports client certificate - Assert-Agent -Minimum '2.122.0' - - [string]$clientCert = Get-TaskVariable -Name Agent.ClientCertArchive - [string]$clientCertPassword = Get-TaskVariable -Name Agent.ClientCertPassword - - if ($clientCert -and (Test-Path -LiteralPath $clientCert -PathType Leaf)) { - return New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($clientCert, $clientCertPassword) - } - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -######################################## -# Private functions. -######################################## -function Get-OMType { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [ValidateSet('ExtendedClient', 'WebApi')] - [Parameter(Mandatory = $true)] - [string]$OMKind, - - [string]$OMDirectory, - - [switch]$Require) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Try to load the type. - $errorRecord = $null - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - # Store the error record. - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - - # Build a list of candidate DLL file paths from the namespace. - $dllPaths = @( ) - $namespace = $TypeName - while ($namespace.LastIndexOf('.') -gt 0) { - # Trim the next segment from the namespace. - $namespace = $namespace.SubString(0, $namespace.LastIndexOf('.')) - - # Derive potential DLL file paths based on the namespace and OM kind (i.e. extended client vs web API). - if ($OMKind -eq 'ExtendedClient') { - if ($namespace -like 'Microsoft.TeamFoundation.*') { - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } else { - if ($namespace -like 'Microsoft.TeamFoundation.*' -or - $namespace -like 'Microsoft.VisualStudio.Services' -or - $namespace -like 'Microsoft.VisualStudio.Services.*') { - - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.WebApi.dll") - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } - } - - foreach ($dllPath in $dllPaths) { - # Check whether the DLL exists. - Write-Verbose "Testing leaf path: '$dllPath'" - if (!(Test-Path -PathType Leaf -LiteralPath "$dllPath")) { - Write-Verbose "Not found." - continue - } - - # Load the DLL. - Write-Verbose "Loading assembly: $dllPath" - try { - Add-Type -LiteralPath $dllPath - } catch { - # Write the information to the verbose stream and proceed to attempt to load the requested type. - # - # The requested type may successfully load now. For example, the type used with the 14.0 Web API for the - # federated credential (VssOAuthCredential) resides in Microsoft.VisualStudio.Services.Client.dll. Even - # though loading the DLL results in a ReflectionTypeLoadException when Microsoft.ServiceBus.dll (approx 3.75mb) - # is not present, enough types are loaded to use the VssOAuthCredential federated credential with the Web API - # HTTP clients. - Write-Verbose "$($_.Exception.GetType().FullName): $($_.Exception.Message)" - if ($_.Exception -is [System.Reflection.ReflectionTypeLoadException]) { - for ($i = 0 ; $i -lt $_.Exception.LoaderExceptions.Length ; $i++) { - $loaderException = $_.Exception.LoaderExceptions[$i] - Write-Verbose "LoaderExceptions[$i]: $($loaderException.GetType().FullName): $($loaderException.Message)" - } - } - } - - # Try to load the type. - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - } - - # Check whether to propagate the error. - if ($Require) { - Write-Error $errorRecord - } - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} diff --git a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson b/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson deleted file mode 100644 index 7871c36..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agentversion {0} oder höher ist erforderlich.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Der Containerpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "\"{0}\"-Dienstendpunkt-Anmeldeinformationen", - "loc.messages.PSLIB_EndpointUrl0": "\"{0}\"-Dienstendpunkt-URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Fehler beim Aufzählen von Unterverzeichnissen für den folgenden Pfad: \"{0}\"", - "loc.messages.PSLIB_FileNotFound0": "Die Datei wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Input0": "\"{0}\"-Eingabe", - "loc.messages.PSLIB_InvalidPattern0": "Ungültiges Muster: \"{0}\"", - "loc.messages.PSLIB_LeafPathNotFound0": "Der Blattpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Fehler bei der Normalisierung bzw. Erweiterung des Pfads. Die Pfadlänge wurde vom Kernel32-Subsystem nicht zurückgegeben für: \"{0}\"", - "loc.messages.PSLIB_PathNotFound0": "Der Pfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Der Prozess \"{0}\" wurde mit dem Code \"{1}\" beendet.", - "loc.messages.PSLIB_Required0": "Erforderlich: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Fehler beim Zeichenfolgenformat.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Der Zeichenfolgen-Ressourcenschlüssel wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "\"{0}\"-Taskvariable" -} \ No newline at end of file diff --git a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson b/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson deleted file mode 100644 index 66c17bc..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "File not found: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' input", - "loc.messages.PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Path not found: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "loc.messages.PSLIB_Required0": "Required: {0}", - "loc.messages.PSLIB_StringFormatFailed": "String format failed.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' task variable" -} \ No newline at end of file diff --git a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson b/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson deleted file mode 100644 index f5c9c23..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Se require la versión {0} o posterior del agente.", - "loc.messages.PSLIB_ContainerPathNotFound0": "No se encuentra la ruta de acceso del contenedor: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenciales del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "No se pudieron enumerar los subdirectorios de la ruta de acceso: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Archivo no encontrado: '{0}'", - "loc.messages.PSLIB_Input0": "Entrada '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Patrón no válido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "No se encuentra la ruta de acceso de la hoja: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "No se pudo normalizar o expandir la ruta de acceso. El subsistema Kernel32 no devolvió la longitud de la ruta de acceso para: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "No se encuentra la ruta de acceso: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "El proceso '{0}' finalizó con el código '{1}'.", - "loc.messages.PSLIB_Required0": "Se requiere: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Error de formato de cadena.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "No se encuentra la clave de recurso de la cadena: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tarea '{0}'" -} \ No newline at end of file diff --git a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson b/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson deleted file mode 100644 index 652870c..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "L'agent version {0} (ou une version ultérieure) est obligatoire.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Le chemin du conteneur est introuvable : '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Informations d'identification du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Échec de l'énumération des sous-répertoires pour le chemin : '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Fichier introuvable : {0}.", - "loc.messages.PSLIB_Input0": "Entrée '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Modèle non valide : '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Le chemin feuille est introuvable : '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Échec de la normalisation/l'expansion du chemin. La longueur du chemin n'a pas été retournée par le sous-système Kernel32 pour : '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Chemin introuvable : '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Le processus '{0}' s'est arrêté avec le code '{1}'.", - "loc.messages.PSLIB_Required0": "Obligatoire : {0}", - "loc.messages.PSLIB_StringFormatFailed": "Échec du format de la chaîne.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Clé de la ressource de type chaîne introuvable : '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tâche '{0}'" -} \ No newline at end of file diff --git a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson b/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson deleted file mode 100644 index 6aeb1df..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "È richiesta la versione dell'agente {0} o superiore.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Percorso del contenitore non trovato: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenziali dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "L'enumerazione delle sottodirectory per il percorso '{0}' non è riuscita", - "loc.messages.PSLIB_FileNotFound0": "File non trovato: '{0}'", - "loc.messages.PSLIB_Input0": "Input di '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Criterio non valido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Percorso foglia non trovato: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "La normalizzazione o l'espansione del percorso non è riuscita. Il sottosistema Kernel32 non ha restituito la lunghezza del percorso per '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Percorso non trovato: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Il processo '{0}' è stato terminato ed è stato restituito il codice '{1}'.", - "loc.messages.PSLIB_Required0": "Obbligatorio: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Errore nel formato della stringa.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "La chiave della risorsa stringa non è stata trovata: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variabile dell'attività '{0}'" -} \ No newline at end of file diff --git a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson b/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson deleted file mode 100644 index 6b07ab6..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "バージョン {0} 以降のエージェントが必要です。", - "loc.messages.PSLIB_ContainerPathNotFound0": "コンテナーのパスが見つかりません: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' サービス エンドポイントの資格情報", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' サービス エンドポイントの URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "パス '{0}' のサブディレクトリを列挙できませんでした", - "loc.messages.PSLIB_FileNotFound0": "ファイルが見つかりません: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 入力", - "loc.messages.PSLIB_InvalidPattern0": "使用できないパターンです: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "リーフ パスが見つかりません: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "パスの正規化/展開に失敗しました。Kernel32 サブシステムからパス '{0}' の長さが返されませんでした", - "loc.messages.PSLIB_PathNotFound0": "パスが見つかりません: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "プロセス '{0}' がコード '{1}' で終了しました。", - "loc.messages.PSLIB_Required0": "必要: {0}", - "loc.messages.PSLIB_StringFormatFailed": "文字列のフォーマットに失敗しました。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "文字列のリソース キーが見つかりません: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' タスク変数" -} \ No newline at end of file diff --git a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson b/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson deleted file mode 100644 index e58cbdc..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "에이전트 버전 {0} 이상이 필요합니다.", - "loc.messages.PSLIB_ContainerPathNotFound0": "컨테이너 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 서비스 끝점 자격 증명", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 서비스 끝점 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "경로에 대해 하위 디렉터리를 열거하지 못함: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "{0} 파일을 찾을 수 없습니다.", - "loc.messages.PSLIB_Input0": "'{0}' 입력", - "loc.messages.PSLIB_InvalidPattern0": "잘못된 패턴: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "경로 정규화/확장에 실패했습니다. 다음에 대해 Kernel32 subsystem에서 경로 길이를 반환하지 않음: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "'{1}' 코드로 '{0}' 프로세스가 종료되었습니다.", - "loc.messages.PSLIB_Required0": "필수: {0}", - "loc.messages.PSLIB_StringFormatFailed": "문자열을 포맷하지 못했습니다.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "문자열 리소스 키를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 작업 변수" -} \ No newline at end of file diff --git a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson b/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson deleted file mode 100644 index 38dd69d..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Требуется версия агента {0} или более поздняя.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Путь к контейнеру не найден: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "Учетные данные конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EndpointUrl0": "URL-адрес конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Сбой перечисления подкаталогов для пути: \"{0}\".", - "loc.messages.PSLIB_FileNotFound0": "Файл не найден: \"{0}\".", - "loc.messages.PSLIB_Input0": "Входные данные \"{0}\".", - "loc.messages.PSLIB_InvalidPattern0": "Недопустимый шаблон: \"{0}\".", - "loc.messages.PSLIB_LeafPathNotFound0": "Путь к конечному объекту не найден: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Сбой нормализации и расширения пути. Длина пути не была возвращена подсистемой Kernel32 для: \"{0}\".", - "loc.messages.PSLIB_PathNotFound0": "Путь не найден: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Процесс \"{0}\" завершил работу с кодом \"{1}\".", - "loc.messages.PSLIB_Required0": "Требуется: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Сбой формата строки.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Ключ ресурса строки не найден: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "Переменная задачи \"{0}\"" -} \ No newline at end of file diff --git a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson b/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson deleted file mode 100644 index 1d333de..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理版本 {0} 或更高版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路径:“{0}”", - "loc.messages.PSLIB_EndpointAuth0": "“{0}”服务终结点凭据", - "loc.messages.PSLIB_EndpointUrl0": "“{0}”服务终结点 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "枚举路径的子目录失败:“{0}”", - "loc.messages.PSLIB_FileNotFound0": "找不到文件: {0}。", - "loc.messages.PSLIB_Input0": "“{0}”输入", - "loc.messages.PSLIB_InvalidPattern0": "无效的模式:“{0}”", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到叶路径:“{0}”", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路径规范化/扩展失败。路径长度不是由“{0}”的 Kernel32 子系统返回的", - "loc.messages.PSLIB_PathNotFound0": "找不到路径:“{0}”", - "loc.messages.PSLIB_Process0ExitedWithCode1": "过程“{0}”已退出,代码为“{1}”。", - "loc.messages.PSLIB_Required0": "必需: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字符串格式无效。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字符串资源关键字:“{0}”", - "loc.messages.PSLIB_TaskVariable0": "“{0}”任务变量" -} \ No newline at end of file diff --git a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson b/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson deleted file mode 100644 index 512509b..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理程式版本 {0} 或更新的版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路徑: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 服務端點認證", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 服務端點 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "為路徑列舉子目錄失敗: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "找不到檔案: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 輸入", - "loc.messages.PSLIB_InvalidPattern0": "模式無效: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到分葉路徑: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路徑正規化/展開失敗。Kernel32 子系統未傳回 '{0}' 的路徑長度", - "loc.messages.PSLIB_PathNotFound0": "找不到路徑: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "處理序 '{0}' 以返回碼 '{1}' 結束。", - "loc.messages.PSLIB_Required0": "必要項: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字串格式失敗。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字串資源索引鍵: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 工作變數" -} \ No newline at end of file diff --git a/Tasks/install/ps_modules/VstsTaskSdk/ToolFunctions.ps1 b/Tasks/install/ps_modules/VstsTaskSdk/ToolFunctions.ps1 deleted file mode 100644 index 0e82595..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/ToolFunctions.ps1 +++ /dev/null @@ -1,123 +0,0 @@ -<# -.SYNOPSIS -Asserts the agent version is at least the specified minimum. - -.PARAMETER Minimum -Minimum version - must be 2.104.1 or higher. -#> -function Assert-Agent { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [version]$Minimum) - - if (([version]'2.104.1').CompareTo($Minimum) -ge 1) { - Write-Error "Assert-Agent requires the parameter to be 2.104.1 or higher." - return - } - - $agent = Get-TaskVariable -Name 'agent.version' - if (!$agent -or $Minimum.CompareTo([version]$agent) -ge 1) { - Write-Error (Get-LocString -Key 'PSLIB_AgentVersion0Required' -ArgumentList $Minimum) - } -} - -<# -.SYNOPSIS -Asserts that a path exists. Throws if the path does not exist. - -.PARAMETER PassThru -True to return the path. -#> -function Assert-Path { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath, - [Microsoft.PowerShell.Commands.TestPathType]$PathType = [Microsoft.PowerShell.Commands.TestPathType]::Any, - [switch]$PassThru) - - if ($PathType -eq [Microsoft.PowerShell.Commands.TestPathType]::Any) { - Write-Verbose "Asserting path exists: '$LiteralPath'" - } else { - Write-Verbose "Asserting $("$PathType".ToLowerInvariant()) path exists: '$LiteralPath'" - } - - if (Test-Path -LiteralPath $LiteralPath -PathType $PathType) { - if ($PassThru) { - return $LiteralPath - } - - return - } - - $resourceKey = switch ($PathType) { - ([Microsoft.PowerShell.Commands.TestPathType]::Container) { "PSLIB_ContainerPathNotFound0" ; break } - ([Microsoft.PowerShell.Commands.TestPathType]::Leaf) { "PSLIB_LeafPathNotFound0" ; break } - default { "PSLIB_PathNotFound0" } - } - - throw (Get-LocString -Key $resourceKey -ArgumentList $LiteralPath) -} - -<# -.SYNOPSIS -Executes an external program. - -.DESCRIPTION -Executes an external program and waits for the process to exit. - -After calling this command, the exit code of the process can be retrieved from the variable $LASTEXITCODE. - -.PARAMETER Encoding -This parameter not required for most scenarios. Indicates how to interpret the encoding from the external program. An example use case would be if an external program outputs UTF-16 XML and the output needs to be parsed. - -.PARAMETER RequireExitCodeZero -Indicates whether to write an error to the error pipeline if the exit code is not zero. -#> -function Invoke-Tool { # TODO: RENAME TO INVOKE-PROCESS? - [CmdletBinding()] - param( - [ValidatePattern('^[^\r\n]*$')] - [Parameter(Mandatory = $true)] - [string]$FileName, - [ValidatePattern('^[^\r\n]*$')] - [Parameter()] - [string]$Arguments, - [string]$WorkingDirectory, - [System.Text.Encoding]$Encoding, - [switch]$RequireExitCodeZero) - - Trace-EnteringInvocation $MyInvocation - $isPushed = $false - $originalEncoding = $null - try { - if ($Encoding) { - $originalEncoding = [System.Console]::OutputEncoding - [System.Console]::OutputEncoding = $Encoding - } - - if ($WorkingDirectory) { - Push-Location -LiteralPath $WorkingDirectory -ErrorAction Stop - $isPushed = $true - } - - $FileName = $FileName.Replace('"', '').Replace("'", "''") - Write-Host "##[command]""$FileName"" $Arguments" - Invoke-Expression "& '$FileName' --% $Arguments" - Write-Verbose "Exit code: $LASTEXITCODE" - if ($RequireExitCodeZero -and $LASTEXITCODE -ne 0) { - Write-Error (Get-LocString -Key PSLIB_Process0ExitedWithCode1 -ArgumentList ([System.IO.Path]::GetFileName($FileName)), $LASTEXITCODE) - } - } finally { - if ($originalEncoding) { - [System.Console]::OutputEncoding = $originalEncoding - } - - if ($isPushed) { - Pop-Location - } - - Trace-LeavingInvocation $MyInvocation - } -} diff --git a/Tasks/install/ps_modules/VstsTaskSdk/TraceFunctions.ps1 b/Tasks/install/ps_modules/VstsTaskSdk/TraceFunctions.ps1 deleted file mode 100644 index b8e084b..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/TraceFunctions.ps1 +++ /dev/null @@ -1,139 +0,0 @@ -<# -.SYNOPSIS -Writes verbose information about the invocation being entered. - -.DESCRIPTION -Used to trace verbose information when entering a function/script. Writes an entering message followed by a short description of the invocation. Additionally each bound parameter and unbound argument is also traced. - -.PARAMETER Parameter -Wildcard pattern to control which bound parameters are traced. -#> -function Trace-EnteringInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo, - [string[]]$Parameter = '*') - - Write-Verbose "Entering $(Get-InvocationDescription $InvocationInfo)." - $OFS = ", " - if ($InvocationInfo.BoundParameters.Count -and $Parameter.Count) { - if ($Parameter.Count -eq 1 -and $Parameter[0] -eq '*') { - # Trace all parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - } - } else { - # Trace matching parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - foreach ($p in $Parameter) { - if ($key -like $p) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - break - } - } - } - } - } - - # Trace all unbound arguments. - if (@($InvocationInfo.UnboundArguments).Count) { - for ($i = 0 ; $i -lt $InvocationInfo.UnboundArguments.Count ; $i++) { - Write-Verbose " args[$i]: '$($InvocationInfo.UnboundArguments[$i])'" - } - } -} - -<# -.SYNOPSIS -Writes verbose information about the invocation being left. - -.DESCRIPTION -Used to trace verbose information when leaving a function/script. Writes a leaving message followed by a short description of the invocation. -#> -function Trace-LeavingInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo) - - Write-Verbose "Leaving $(Get-InvocationDescription $InvocationInfo)." -} - -<# -.SYNOPSIS -Writes verbose information about paths. - -.DESCRIPTION -Writes verbose information about the paths. The paths are sorted and a the common root is written only once, followed by each relative path. - -.PARAMETER PassThru -Indicates whether to return the sorted paths. -#> -function Trace-Path { - [CmdletBinding()] - param( - [string[]]$Path, - [switch]$PassThru) - - if ($Path.Count -eq 0) { - Write-Verbose "No paths." - if ($PassThru) { - $Path - } - } elseif ($Path.Count -eq 1) { - Write-Verbose "Path: $($Path[0])" - if ($PassThru) { - $Path - } - } else { - # Find the greatest common root. - $sorted = $Path | Sort-Object - $firstPath = $sorted[0].ToCharArray() - $lastPath = $sorted[-1].ToCharArray() - $commonEndIndex = 0 - $j = if ($firstPath.Length -lt $lastPath.Length) { $firstPath.Length } else { $lastPath.Length } - for ($i = 0 ; $i -lt $j ; $i++) { - if ($firstPath[$i] -eq $lastPath[$i]) { - if ($firstPath[$i] -eq '\') { - $commonEndIndex = $i - } - } else { - break - } - } - - if ($commonEndIndex -eq 0) { - # No common root. - Write-Verbose "Paths:" - foreach ($p in $sorted) { - Write-Verbose " $p" - } - } else { - Write-Verbose "Paths: $($Path[0].Substring(0, $commonEndIndex + 1))" - foreach ($p in $sorted) { - Write-Verbose " $($p.Substring($commonEndIndex + 1))" - } - } - - if ($PassThru) { - $sorted - } - } -} - -######################################## -# Private functions. -######################################## -function Get-InvocationDescription { - [CmdletBinding()] - param([System.Management.Automation.InvocationInfo]$InvocationInfo) - - if ($InvocationInfo.MyCommand.Path) { - $InvocationInfo.MyCommand.Path - } elseif ($InvocationInfo.MyCommand.Name) { - $InvocationInfo.MyCommand.Name - } else { - $InvocationInfo.MyCommand.CommandType - } -} diff --git a/Tasks/install/ps_modules/VstsTaskSdk/VstsTaskSdk.dll b/Tasks/install/ps_modules/VstsTaskSdk/VstsTaskSdk.dll deleted file mode 100644 index 54938ab05180ddaf77cf067f2501a1f97ee7e5cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25408 zcmeIa2Urx#@+jULfkmqhP%&pQASxi36%_+2 zidj)qRLqKkIbqJC|C%A{Ip^NgryDMlC=Tgb)?ppFa_* zgD?KL5%6Dw0*IE?-Y<)GNuATFBL$w*iA?2*n3+OBijbYbF+H{2L%K|95{8flQ0QIM^F!gwgx3vTgye}Z zxvSkc0dGI?6aWPJm*)uj%Ro(CG}HVlviga*LJ z%c-k5J<6tW2zm5FiQsmeukhe)BO@9rfIMER2uTstK5*O- zp@Kg2FGIRyijg8h3==K#1PZj)1PGIe078Q?3fcfUNeC&BMM{ur610*^HW~;)GR2%S z(3DOwQpV|!gi1A1fuOl0jrf|$kd2^S3?nFvZYo2j(nM-Ks4UeiN|q`Z1USRgS`itk zLr7Y}2zbjd*FzElyi6uY84`g=F$Rz);PpxhGy!R)7_=hD0z74yA8(aaL_bs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ja^T>9>#dtpq1fu`P*NFZHp(A2-`rOF$QP^=qQE&uZkj*RKB7W5c!g? z0_h7Fa_}j-8E?fE5Mv6OoV^RAgq4Z;iP6kh*Od}!VRko2B_4I{(pGl8rg&SSx!qlx z-#KrM7|InfHJ`AO_eUAYF?sl^#S$BqNIJ}W(y+OYtWqR>*+<$(n%M4ZR$_+Esaf{H z-LF;mfQ%IN3Y0$53He+YYQ>eZU+u`D<)c|Fspn^AR|nVK$5^ki+Yn_&WbKc$d_mNg zeC?4#OS(vZ`qJ(l(1DzJ>%sS|AkPgw)t-el)B{!v%PXU|+Pz&4jbY(AL%HEt8Spib zPc<(?tZppIne|$c+|SB32$YYzT>e0{mtgSG^$e`!z1)IGJFu@RSev0mQr?$X4Q!rJP3>&`Zt!=+&?>AJf79Gr=vlfV zg4S?kF+F>fNu}K(Z=}gHBL`*nHQ9&g>ltj`!>A^FaraRJeb@VjRUoeQz@zZ9I|mDk zb7Yo!2RJVGI5#Ow?y=qmZv={jr^{*&IYR2*oz^L5G-brBv_Yz;wu5eD9@@M+Ao<_- zTJ<*aIe)M4x%zcPo;e*jhT|#q9?2=PugJgekDl<9dh6e&6yF`ar4mto>Tbqa^N9R^ J$g$t$@(XnB12_Nx diff --git a/Tasks/install/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 b/Tasks/install/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 deleted file mode 100644 index a1bf2c6..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 +++ /dev/null @@ -1,168 +0,0 @@ -[CmdletBinding()] -param( - [ValidateNotNull()] - [Parameter()] - [hashtable]$ModuleParameters = @{ }) - -if ($host.Name -ne 'ConsoleHost') { - Write-Warning "VstsTaskSdk is designed for use with powershell.exe (ConsoleHost). Output may be different when used with other hosts." -} - -# Private module variables. -[bool]$script:nonInteractive = "$($ModuleParameters['NonInteractive'])" -eq 'true' -Write-Verbose "NonInteractive: $script:nonInteractive" - -# VstsTaskSdk.dll contains the TerminationException and NativeMethods for handle long path -# We used to do inline C# in this powershell module -# However when csc compile the inline C#, it will hit process env block size limit since it's not use unicode to encode env -# To solve the env block size problem, we choose to put all inline C# into an assembly VstsTaskSdk.dll, signing it, package with the PS modules. -Write-Verbose "Loading compiled helper $PSScriptRoot\VstsTaskSdk.dll." -Add-Type -LiteralPath $PSScriptRoot\VstsTaskSdk.dll - -# Import/export functions. -. "$PSScriptRoot\FindFunctions.ps1" -. "$PSScriptRoot\InputFunctions.ps1" -. "$PSScriptRoot\LegacyFindFunctions.ps1" -. "$PSScriptRoot\LocalizationFunctions.ps1" -. "$PSScriptRoot\LoggingCommandFunctions.ps1" -. "$PSScriptRoot\LongPathFunctions.ps1" -. "$PSScriptRoot\ServerOMFunctions.ps1" -. "$PSScriptRoot\ToolFunctions.ps1" -. "$PSScriptRoot\TraceFunctions.ps1" -. "$PSScriptRoot\OutFunctions.ps1" # Load the out functions after all of the other functions are loaded. -Export-ModuleMember -Function @( - # Find functions. - 'Find-Match' - 'New-FindOptions' - 'New-MatchOptions' - 'Select-Match' - # Input functions. - 'Get-Endpoint' - 'Get-SecureFileTicket' - 'Get-SecureFileName' - 'Get-Input' - 'Get-TaskVariable' - 'Get-TaskVariableInfo' - 'Set-TaskVariable' - # Legacy find functions. - 'Find-Files' - # Localization functions. - 'Get-LocString' - 'Import-LocStrings' - # Logging command functions. - 'Write-AddAttachment' - 'Write-AddBuildTag' - 'Write-AssociateArtifact' - 'Write-LogDetail' - 'Write-PrependPath' - 'Write-SetEndpoint' - 'Write-SetProgress' - 'Write-SetResult' - 'Write-SetSecret' - 'Write-SetVariable' - 'Write-TaskDebug' - 'Write-TaskError' - 'Write-TaskVerbose' - 'Write-TaskWarning' - 'Write-UpdateBuildNumber' - 'Write-UpdateReleaseName' - 'Write-UploadArtifact' - 'Write-UploadBuildLog' - 'Write-UploadFile' - 'Write-UploadSummary' - # Out functions. - 'Out-Default' - # Server OM functions. - 'Get-AssemblyReference' - 'Get-TfsClientCredentials' - 'Get-TfsService' - 'Get-VssCredentials' - 'Get-VssHttpClient' - # Tool functions. - 'Assert-Agent' - 'Assert-Path' - 'Invoke-Tool' - # Trace functions. - 'Trace-EnteringInvocation' - 'Trace-LeavingInvocation' - 'Trace-Path' - # Proxy functions - 'Get-WebProxy' - # Client cert functions - 'Get-ClientCertificate' - ) - -# Override Out-Default globally. -$null = New-Item -Force -Path "function:\global:Out-Default" -Value (Get-Command -CommandType Function -Name Out-Default -ListImported) -New-Alias -Name Out-Default -Value "global:Out-Default" -Scope global - -# Perform some initialization in a script block to enable merging the pipelines. -$scriptText = @" -# Load the SDK resource strings. -Import-LocStrings "$PSScriptRoot\lib.json" - -# Load the module that contains ConvertTo-SecureString. -if (!(Get-Module -Name Microsoft.PowerShell.Security)) { - Write-Verbose "Importing the module 'Microsoft.PowerShell.Security'." - Import-Module -Name Microsoft.PowerShell.Security 2>&1 | - ForEach-Object { - if (`$_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose `$_.Exception.Message - } else { - ,`$_ - } - } -} -"@ -. ([scriptblock]::Create($scriptText)) 2>&1 3>&1 4>&1 5>&1 | Out-Default - -# Create Invoke-VstsTaskScript in a special way so it is not bound to the module. -# Otherwise calling the task script block would run within the module context. -# -# An alternative way to solve the problem is to close the script block (i.e. closure). -# However, that introduces a different problem. Closed script blocks are created within -# a dynamic module. Each module gets it's own session state separate from the global -# session state. When running in a regular script context, Import-Module calls import -# the target module into the global session state. When running in a module context, -# Import-Module calls import the target module into the caller module's session state. -# -# The goal of a task may include executing ad-hoc scripts. Therefore, task scripts -# should run in regular script context. The end user specifying an ad-hoc script expects -# the module import rules to be consistent with the default behavior (i.e. imported -# into the global session state). -$null = New-Item -Force -Path "function:\global:Invoke-VstsTaskScript" -Value ([scriptblock]::Create(@' - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [scriptblock]$ScriptBlock) - - try { - $global:ErrorActionPreference = 'Stop' - - # Initialize the environment. - $vstsModule = Get-Module -Name VstsTaskSdk - Write-Verbose "$($vstsModule.Name) $($vstsModule.Version) commit $($vstsModule.PrivateData.PSData.CommitHash)" 4>&1 | Out-Default - & $vstsModule Initialize-Inputs 4>&1 | Out-Default - - # Remove the local variable before calling the user's script. - Remove-Variable -Name vstsModule - - # Call the user's script. - $ScriptBlock | - ForEach-Object { - # Remove the scriptblock variable before calling it. - Remove-Variable -Name ScriptBlock - & $_ 2>&1 3>&1 4>&1 5>&1 | Out-Default - } - } catch [VstsTaskSdk.TerminationException] { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Task script terminated." 4>&1 | Out-Default - } catch { - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Caught exception from task script." 4>&1 | Out-Default - $_ | Out-Default - Write-Host "##vso[task.complete result=Failed]" - } -'@)) diff --git a/Tasks/install/ps_modules/VstsTaskSdk/lib.json b/Tasks/install/ps_modules/VstsTaskSdk/lib.json deleted file mode 100644 index ecdc9d0..0000000 --- a/Tasks/install/ps_modules/VstsTaskSdk/lib.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "messages": { - "PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "PSLIB_FileNotFound0": "File not found: '{0}'", - "PSLIB_Input0": "'{0}' input", - "PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "PSLIB_PathNotFound0": "Path not found: '{0}'", - "PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "PSLIB_Required0": "Required: {0}", - "PSLIB_StringFormatFailed": "String format failed.", - "PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "PSLIB_TaskVariable0": "'{0}' task variable" - } -} diff --git a/Tasks/install/task.json b/Tasks/install/task.json deleted file mode 100644 index 3c0a885..0000000 --- a/Tasks/install/task.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "id": "1d2c4261-127c-4ff1-8762-681b608858ad", - "name": "choco-install", - "friendlyName": "Chocolatey - Install", - "description": "Runs Chocolatey Install with specified parameters", - "author": "gep13", - "helpMarkDown": "", - "category": "Build", - "visibility": [ - "Build", - "Release" - ], - "demands": [], - "version": { - "Major": "0", - "Minor": "1", - "Patch": "0" - }, - "minimumAgentVersion": "1.83.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced options", - "isExpanded": false - } - ], - "instanceNameFormat": "Chocolatey Install", - "inputs": [ - { - "name": "packageId", - "type": "string", - "label": "The id of the package(s) that are to be installed.", - "defaultValue": "", - "required": true, - "helpMarkDown": "For example, windirstat." - }, - { - "name": "packageVersion", - "type": "string", - "label": "The version of the package that is to be installed.", - "defaultValue": "", - "required": false, - "helpMarkDown": "For example, 1.2.3." - }, - { - "name": "pre", - "type": "boolean", - "label": "Prerelease.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Include Prereleases?" - }, - { - "name": "source", - "type": "string", - "label": "The source to find the package(s) to install.", - "defaultValue": "", - "required": false, - "helpMarkDown": "Special sources include: ruby, webpi, cygwin, windowsfeatures, and python. To specify more than one source, pass it with a semi-colon separating the values (e.g. \"'source1;source2'\"). Defaults to default feeds." - }, - { - "name": "installargs", - "type": "string", - "label": "Install Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Install Arguments to pass to the native installer in the package.", - "groupname": "advanced" - }, - { - "name": "params", - "type": "string", - "label": "Package Parameters", - "defaultValue": "", - "required": false, - "helpMarkDown": "Parameters to pass to the package.", - "groupname": "advanced" - }, - { - "name": "force", - "type": "boolean", - "label": "Force the behavior.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Do not use force during normal operation - it subverts some of the smart behavior for commands.", - "groupname": "advanced" - }, - { - "name": "x86", - "type": "boolean", - "label": "Force X86.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Force x86 (32bit) installation on 64 bit systems.", - "groupname": "advanced" - }, - { - "name": "override", - "type": "boolean", - "label": "Override Arguments", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Should install arguments be used exclusively without appending to current package passed arguments?", - "groupname": "advanced" - }, - { - "name": "debug", - "type": "boolean", - "label": "Show debug messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "", - "groupname": "advanced" - }, - { - "name": "verbose", - "type": "boolean", - "label": "Show verbose messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very verbose messaging, avoid using under normal circumstances.", - "groupname": "advanced" - }, - { - "name": "trace", - "type": "boolean", - "label": "Show trace messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very, very verbose trace messaging. Avoid except when needing super low-level .NET Framework debugging.", - "groupname": "advanced" - }, - { - "name": "extraArguments", - "type": "string", - "label": "Extra Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional Chocolatey Arguments that are not catered for above.", - "groupname": "advanced" - } - ], - "execution": { - "PowerShell3": { - "target": "$(currentDirectory)\\install.ps1", - "argumentFormat": "", - "workingDirectory": "$(currentDirectory)" - } - } -} diff --git a/Tasks/pack/icon.png b/Tasks/pack/icon.png deleted file mode 100755 index ab05af71592b547960e4fcf1f5d527bece1fd5c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2656 zcmY*bc|6o>7yp&5nTW_XQyF7lXG|nABl{9z2o*AxVaQ;NEtRov*Bv(hrKxhFDVoxG4buln4OW*xUDC0l*�JDw&pneYk z1ijO)x9RU=K|Y38`~cu6-+>(hvL6Tmz@aMyD_gRysfoI?x0fQ$#oNhMG04kj9}NH+ zLF)UVmn#_u3-Y=_^ivN)!+#;v_v3>!0uK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}DoYZThnAuekxmRP_v zo1<{TeakXFI}60nz4iiFC)9Tmqf9nC%IO$e-4TUI;0mLh-j zQLr41J|YehYI5OI`_@NoHlzD?aNb91=<9e4Ey;q;%(Y6g~nm{l+;F0(40p<{nF z>wcIBih?#=Uo-gDpTTn~l^|iFdOhERaair#%8cl}Wqppp9%8C)!L_msmh-7sSJ$au zwooOK-<{W5&PJZDhd-M}zxlK4y_LbHeTxE9(XO^rg{Qtw%ODc@`L)mpPD$at^AwMx zZM1Pfjq1Y{)dZcP`G)BvddP=(!1NTPx25UgVTtC6X@<8!WJT!5i=j|k-|wdS%Bc*v zi^*^zqSeu8c#$-AG#d+?&9_GeiqMdbK5QqW%C-P_Z -function Find-Match { - [CmdletBinding()] - param( - [Parameter()] - [string]$DefaultRoot, - [Parameter()] - [string[]]$Pattern, - $FindOptions, - $MatchOptions) - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Apply defaults for parameters and trace. - if (!$DefaultRoot) { - $DefaultRoot = Get-TaskVariable -Name 'System.DefaultWorkingDirectory' -Default (Get-Location).Path - } - - Write-Verbose "DefaultRoot: '$DefaultRoot'" - if (!$FindOptions) { - $FindOptions = New-FindOptions -FollowSpecifiedSymbolicLink -FollowSymbolicLinks - } - - Trace-FindOptions -Options $FindOptions - if (!$MatchOptions) { - $MatchOptions = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $MatchOptions - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Normalize slashes for root dir. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - $results = @{ } - $originalMatchOptions = $MatchOptions - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $MatchOptions = Copy-MatchOptions -Options $originalMatchOptions - - # Skip comments. - if (!$MatchOptions.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $MatchOptions.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$MatchOptions.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$MatchOptions.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $MatchOptions.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $MatchOptions.NoNegate = $true - $MatchOptions.FlipNegate = $false - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Expand braces - required to accurately interpret findPath. - $expanded = $null - $preExpanded = $pat - if ($MatchOptions.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - } - - # Set NoBrace. - $MatchOptions.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - if ($isIncludePattern) { - # Determine the findPath. - $findInfo = Get-FindInfoFromPattern -DefaultRoot $DefaultRoot -Pattern $pat -MatchOptions $MatchOptions - $findPath = $findInfo.FindPath - Write-Verbose "FindPath: '$findPath'" - - if (!$findPath) { - Write-Verbose "Skipping empty path." - continue - } - - # Perform the find. - Write-Verbose "StatOnly: '$($findInfo.StatOnly)'" - [string[]]$findResults = @( ) - if ($findInfo.StatOnly) { - # Simply stat the path - all path segments were used to build the path. - if ((Test-Path -LiteralPath $findPath)) { - $findResults += $findPath - } - } else { - $findResults = Get-FindResult -Path $findPath -Options $FindOptions - } - - Write-Verbose "Found $($findResults.Count) paths." - - # Apply the pattern. - Write-Verbose "Applying include pattern." - if ($findInfo.AdjustedPattern -ne $pat) { - Write-Verbose "AdjustedPattern: '$($findInfo.AdjustedPattern)'" - $pat = $findInfo.AdjustedPattern - } - - $matchResults = [Minimatch.Minimatcher]::Filter( - $findResults, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results[$matchResult.ToUpperInvariant()] = $matchResult - } - - Write-Verbose "$matchCount matches" - } else { - # Check if basename only and MatchBase=true. - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $pat) -and - ($pat -replace '\\', '/').IndexOf('/') -lt 0) { - - # Do not root the pattern. - Write-Verbose "MatchBase and basename only." - } else { - # Root the exclude pattern. - $pat = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - # Apply the pattern. - Write-Verbose 'Applying exclude pattern.' - $matchResults = [Minimatch.Minimatcher]::Filter( - [string[]]$results.Values, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results.Remove($matchResult.ToUpperInvariant()) - } - - Write-Verbose "$matchCount matches" - } - } - } - - $finalResult = @( $results.Values | Sort-Object ) - Write-Verbose "$($finalResult.Count) final results" - return $finalResult - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Creates FindOptions for use with Find-VstsMatch. - -.DESCRIPTION -Creates FindOptions for use with Find-VstsMatch. Contains switches to control whether to follow symlinks. - -.PARAMETER FollowSpecifiedSymbolicLink -Indicates whether to traverse descendants if the specified path is a symbolic link directory. Does not cause nested symbolic link directories to be traversed. - -.PARAMETER FollowSymbolicLinks -Indicates whether to traverse descendants of symbolic link directories. -#> -function New-FindOptions { - [CmdletBinding()] - param( - [switch]$FollowSpecifiedSymbolicLink, - [switch]$FollowSymbolicLinks) - - return New-Object psobject -Property @{ - FollowSpecifiedSymbolicLink = $FollowSpecifiedSymbolicLink.IsPresent - FollowSymbolicLinks = $FollowSymbolicLinks.IsPresent - } -} - -<# -.SYNOPSIS -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. - -.DESCRIPTION -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. Contains switches to control which pattern matching options are applied. -#> -function New-MatchOptions { - [CmdletBinding()] - param( - [switch]$Dot, - [switch]$FlipNegate, - [switch]$MatchBase, - [switch]$NoBrace, - [switch]$NoCase, - [switch]$NoComment, - [switch]$NoExt, - [switch]$NoGlobStar, - [switch]$NoNegate, - [switch]$NoNull) - - return New-Object psobject -Property @{ - Dot = $Dot.IsPresent - FlipNegate = $FlipNegate.IsPresent - MatchBase = $MatchBase.IsPresent - NoBrace = $NoBrace.IsPresent - NoCase = $NoCase.IsPresent - NoComment = $NoComment.IsPresent - NoExt = $NoExt.IsPresent - NoGlobStar = $NoGlobStar.IsPresent - NoNegate = $NoNegate.IsPresent - NoNull = $NoNull.IsPresent - } -} - -<# -.SYNOPSIS -Applies match patterns against a list of files. - -.DESCRIPTION -Applies match patterns to a list of paths. Supports interleaved exclude patterns. - -.PARAMETER ItemPath -Array of paths. - -.PARAMETER Pattern -Patterns to apply. Supports interleaved exclude patterns. - -.PARAMETER PatternRoot -Default root to apply to unrooted patterns. Not applied to basename-only patterns when Options.MatchBase is true. - -.PARAMETER Options -When the Options parameter is not specified, defaults to (New-VstsMatchOptions -Dot -NoBrace -NoCase). -#> -function Select-Match { - [CmdletBinding()] - param( - [Parameter()] - [string[]]$ItemPath, - [Parameter()] - [string[]]$Pattern, - [Parameter()] - [string]$PatternRoot, - $Options) - - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - if (!$Options) { - $Options = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $Options - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Hashtable to keep track of matches. - $map = @{ } - - $originalOptions = $Options - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $Options = Copy-MatchOptions -Options $originalOptions - - # Skip comments. - if (!$Options.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $Options.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$Options.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$Options.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $Options.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $Options.NoNegate = $true - $Options.FlipNegate = $false - - # Expand braces - required to accurately root patterns. - $expanded = $null - $preExpanded = $pat - if ($Options.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $Options)) - } - - # Set NoBrace. - $Options.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - # Root the pattern when all of the following conditions are true: - if ($PatternRoot -and # PatternRoot is supplied - !(Test-Rooted -Path $pat) -and # AND pattern is not rooted - # # AND MatchBase=false or not basename only - (!$Options.MatchBase -or ($pat -replace '\\', '/').IndexOf('/') -ge 0)) { - - # Root the include pattern. - $pat = Get-RootedPattern -DefaultRoot $PatternRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - if ($isIncludePattern) { - # Apply the pattern. - Write-Verbose 'Applying include pattern against original list.' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map[$matchResult] = $true - } - - Write-Verbose "$matchCount matches" - } else { - # Apply the pattern. - Write-Verbose 'Applying exclude pattern against original list' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map.Remove($matchResult) - } - - Write-Verbose "$matchCount matches" - } - } - } - - # return a filtered version of the original list (preserves order and prevents duplication) - $result = $ItemPath | Where-Object { $map[$_] } - Write-Verbose "$($result.Count) final results" - $result - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -################################################################################ -# Private functions. -################################################################################ - -function Copy-MatchOptions { - [CmdletBinding()] - param($Options) - - return New-Object psobject -Property @{ - Dot = $Options.Dot -eq $true - FlipNegate = $Options.FlipNegate -eq $true - MatchBase = $Options.MatchBase -eq $true - NoBrace = $Options.NoBrace -eq $true - NoCase = $Options.NoCase -eq $true - NoComment = $Options.NoComment -eq $true - NoExt = $Options.NoExt -eq $true - NoGlobStar = $Options.NoGlobStar -eq $true - NoNegate = $Options.NoNegate -eq $true - NoNull = $Options.NoNull -eq $true - } -} - -function ConvertTo-MinimatchOptions { - [CmdletBinding()] - param($Options) - - $opt = New-Object Minimatch.Options - $opt.AllowWindowsPaths = $true - $opt.Dot = $Options.Dot -eq $true - $opt.FlipNegate = $Options.FlipNegate -eq $true - $opt.MatchBase = $Options.MatchBase -eq $true - $opt.NoBrace = $Options.NoBrace -eq $true - $opt.NoCase = $Options.NoCase -eq $true - $opt.NoComment = $Options.NoComment -eq $true - $opt.NoExt = $Options.NoExt -eq $true - $opt.NoGlobStar = $Options.NoGlobStar -eq $true - $opt.NoNegate = $Options.NoNegate -eq $true - $opt.NoNull = $Options.NoNull -eq $true - return $opt -} - -function ConvertTo-NormalizedSeparators { - [CmdletBinding()] - param([string]$Path) - - # Convert slashes. - $Path = "$Path".Replace('/', '\') - - # Remove redundant slashes. - $isUnc = $Path -match '^\\\\+[^\\]' - $Path = $Path -replace '\\\\+', '\' - if ($isUnc) { - $Path = '\' + $Path - } - - return $Path -} - -function Get-FindInfoFromPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern, - [Parameter(Mandatory = $true)] - $MatchOptions) - - if (!$MatchOptions.NoBrace) { - throw "Get-FindInfoFromPattern expected MatchOptions.NoBrace to be true." - } - - # For the sake of determining the find path, pretend NoCase=false. - $MatchOptions = Copy-MatchOptions -Options $MatchOptions - $MatchOptions.NoCase = $false - - # Check if basename only and MatchBase=true - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $Pattern) -and - ($Pattern -replace '\\', '/').IndexOf('/') -lt 0) { - - return New-Object psobject -Property @{ - AdjustedPattern = $Pattern - FindPath = $DefaultRoot - StatOnly = $false - } - } - - # The technique applied by this function is to use the information on the Minimatch object determine - # the findPath. Minimatch breaks the pattern into path segments, and exposes information about which - # segments are literal vs patterns. - # - # Note, the technique currently imposes a limitation for drive-relative paths with a glob in the - # first segment, e.g. C:hello*/world. It's feasible to overcome this limitation, but is left unsolved - # for now. - $minimatchObj = New-Object Minimatch.Minimatcher($Pattern, (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # The "set" field is a two-dimensional enumerable of parsed path segment info. The outer enumerable should only - # contain one item, otherwise something went wrong. Brace expansion can result in multiple items in the outer - # enumerable, but that should be turned off by the time this function is reached. - # - # Note, "set" is a private field in the .NET implementation but is documented as a feature in the nodejs - # implementation. The .NET implementation is a port and is by a different author. - $setFieldInfo = $minimatchObj.GetType().GetField('set', 'Instance,NonPublic') - [object[]]$set = $setFieldInfo.GetValue($minimatchObj) - if ($set.Count -ne 1) { - throw "Get-FindInfoFromPattern expected Minimatch.Minimatcher(...).set.Count to be 1. Actual: '$($set.Count)'" - } - - [string[]]$literalSegments = @( ) - [object[]]$parsedSegments = $set[0] - foreach ($parsedSegment in $parsedSegments) { - if ($parsedSegment.GetType().Name -eq 'LiteralItem') { - # The item is a LiteralItem when the original input for the path segment does not contain any - # unescaped glob characters. - $literalSegments += $parsedSegment.Source; - continue - } - - break; - } - - # Join the literal segments back together. Minimatch converts '\' to '/' on Windows, then squashes - # consequetive slashes, and finally splits on slash. This means that UNC format is lost, but can - # be detected from the original pattern. - $joinedSegments = [string]::Join('/', $literalSegments) - if ($joinedSegments -and ($Pattern -replace '\\', '/').StartsWith('//')) { - $joinedSegments = '/' + $joinedSegments # restore UNC format - } - - # Determine the find path. - $findPath = '' - if ((Test-Rooted -Path $Pattern)) { # The pattern is rooted. - $findPath = $joinedSegments - } elseif ($joinedSegments) { # The pattern is not rooted, and literal segements were found. - $findPath = [System.IO.Path]::Combine($DefaultRoot, $joinedSegments) - } else { # The pattern is not rooted, and no literal segements were found. - $findPath = $DefaultRoot - } - - # Clean up the path. - if ($findPath) { - $findPath = [System.IO.Path]::GetDirectoryName(([System.IO.Path]::Combine($findPath, '_'))) # Hack to remove unnecessary trailing slash. - $findPath = ConvertTo-NormalizedSeparators -Path $findPath - } - - return New-Object psobject -Property @{ - AdjustedPattern = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $Pattern - FindPath = $findPath - StatOnly = $literalSegments.Count -eq $parsedSegments.Count - } -} - -function Get-FindResult { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - $Options) - - if (!(Test-Path -LiteralPath $Path)) { - Write-Verbose 'Path not found.' - return - } - - $Path = ConvertTo-NormalizedSeparators -Path $Path - - # Push the first item. - [System.Collections.Stack]$stack = New-Object System.Collections.Stack - $stack.Push((Get-Item -LiteralPath $Path)) - - $count = 0 - while ($stack.Count) { - # Pop the next item and yield the result. - $item = $stack.Pop() - $count++ - $item.FullName - - # Traverse. - if (($item.Attributes -band 0x00000010) -eq 0x00000010) { # Directory - if (($item.Attributes -band 0x00000400) -ne 0x00000400 -or # ReparsePoint - $Options.FollowSymbolicLinks -or - ($count -eq 1 -and $Options.FollowSpecifiedSymbolicLink)) { - - $childItems = @( Get-DirectoryChildItem -Path $Item.FullName -Force ) - [System.Array]::Reverse($childItems) - foreach ($childItem in $childItems) { - $stack.Push($childItem) - } - } - } - } -} - -function Get-RootedPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern) - - if ((Test-Rooted -Path $Pattern)) { - return $Pattern - } - - # Normalize root. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - # Escape special glob characters. - $DefaultRoot = $DefaultRoot -replace '(\[)(?=[^\/]+\])', '[[]' # Escape '[' when ']' follows within the path segment - $DefaultRoot = $DefaultRoot.Replace('?', '[?]') # Escape '?' - $DefaultRoot = $DefaultRoot.Replace('*', '[*]') # Escape '*' - $DefaultRoot = $DefaultRoot -replace '\+\(', '[+](' # Escape '+(' - $DefaultRoot = $DefaultRoot -replace '@\(', '[@](' # Escape '@(' - $DefaultRoot = $DefaultRoot -replace '!\(', '[!](' # Escape '!(' - - if ($DefaultRoot -like '[A-Z]:') { # e.g. C: - return "$DefaultRoot$Pattern" - } - - # Ensure root ends with a separator. - if (!$DefaultRoot.EndsWith('\')) { - $DefaultRoot = "$DefaultRoot\" - } - - return "$DefaultRoot$Pattern" -} - -function Test-Rooted { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - $Path = ConvertTo-NormalizedSeparators -Path $Path - return $Path.StartsWith('\') -or # e.g. \ or \hello or \\hello - $Path -like '[A-Z]:*' # e.g. C: or C:\hello -} - -function Trace-MatchOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "MatchOptions.Dot: '$($Options.Dot)'" - Write-Verbose "MatchOptions.FlipNegate: '$($Options.FlipNegate)'" - Write-Verbose "MatchOptions.MatchBase: '$($Options.MatchBase)'" - Write-Verbose "MatchOptions.NoBrace: '$($Options.NoBrace)'" - Write-Verbose "MatchOptions.NoCase: '$($Options.NoCase)'" - Write-Verbose "MatchOptions.NoComment: '$($Options.NoComment)'" - Write-Verbose "MatchOptions.NoExt: '$($Options.NoExt)'" - Write-Verbose "MatchOptions.NoGlobStar: '$($Options.NoGlobStar)'" - Write-Verbose "MatchOptions.NoNegate: '$($Options.NoNegate)'" - Write-Verbose "MatchOptions.NoNull: '$($Options.NoNull)'" -} - -function Trace-FindOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "FindOptions.FollowSpecifiedSymbolicLink: '$($FindOptions.FollowSpecifiedSymbolicLink)'" - Write-Verbose "FindOptions.FollowSymbolicLinks: '$($FindOptions.FollowSymbolicLinks)'" -} diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/InputFunctions.ps1 b/Tasks/pack/ps_modules/VstsTaskSdk/InputFunctions.ps1 deleted file mode 100644 index 846492d..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/InputFunctions.ps1 +++ /dev/null @@ -1,493 +0,0 @@ -# Hash table of known variable info. The formatted env var name is the lookup key. -# -# The purpose of this hash table is to keep track of known variables. The hash table -# needs to be maintained for multiple reasons: -# 1) to distinguish between env vars and job vars -# 2) to distinguish between secret vars and public -# 3) to know the real variable name and not just the formatted env var name. -$script:knownVariables = @{ } -$script:vault = @{ } - -<# -.SYNOPSIS -Gets an endpoint. - -.DESCRIPTION -Gets an endpoint object for the specified endpoint name. The endpoint is returned as an object with three properties: Auth, Data, and Url. - -The Data property requires a 1.97 agent or higher. - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-Endpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the URL. - $description = Get-LocString -Key PSLIB_EndpointUrl0 -ArgumentList $Name - $key = "ENDPOINT_URL_$Name" - $url = Get-VaultValue -Description $description -Key $key -Require:$Require - - # Get the auth object. - $description = Get-LocString -Key PSLIB_EndpointAuth0 -ArgumentList $Name - $key = "ENDPOINT_AUTH_$Name" - if ($auth = (Get-VaultValue -Description $description -Key $key -Require:$Require)) { - $auth = ConvertFrom-Json -InputObject $auth - } - - # Get the data. - $description = "'$Name' service endpoint data" - $key = "ENDPOINT_DATA_$Name" - if ($data = (Get-VaultValue -Description $description -Key $key)) { - $data = ConvertFrom-Json -InputObject $data - } - - # Return the endpoint. - if ($url -or $auth -or $data) { - New-Object -TypeName psobject -Property @{ - Url = $url - Auth = $auth - Data = $data - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file ticket. - -.DESCRIPTION -Gets the secure file ticket that can be used to download the secure file contents. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileTicket { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_TICKET_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file name. - -.DESCRIPTION -Gets the name for a secure file. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_NAME_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets an input. - -.DESCRIPTION -Gets the value for the specified input name. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-Input { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - # Get the input from the vault. Splat the bound parameters hashtable. Splatting is required - # in order to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Name - $key = "INPUT_$($Name.Replace(' ', '_').ToUpperInvariant())" - Get-VaultValue @PSBoundParameters -Description $description -Key $key -} - -<# -.SYNOPSIS -Gets a task variable. - -.DESCRIPTION -Gets the value for the specified task variable. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-TaskVariable { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - $description = Get-LocString -Key PSLIB_TaskVariable0 -ArgumentList $Name - $variableKey = Get-VariableKey -Name $Name - if ($script:knownVariables.$variableKey.Secret) { - # Get secret variable. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $vaultKey = "SECRET_$variableKey" - Get-VaultValue @PSBoundParameters -Description $description -Key $vaultKey - } else { - # Get public variable. - $item = $null - $path = "Env:$variableKey" - if ((Test-Path -LiteralPath $path) -and ($item = Get-Item -LiteralPath $path).Value) { - # Intentionally empty. Value was successfully retrieved. - } elseif (!$script:nonInteractive) { - # The value wasn't found and the module is running in interactive dev mode. - # Prompt for the value. - Set-Item -LiteralPath $path -Value (Read-Host -Prompt $description) - if (Test-Path -LiteralPath $path) { - $item = Get-Item -LiteralPath $path - } - } - - # Get the converted value. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - Get-Value @PSBoundParameters -Description $description -Key $variableKey -Value $item.Value - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets all job variables available to the task. Requires 2.104.1 agent or higher. - -.DESCRIPTION -Gets a snapshot of the current state of all job variables available to the task. -Requires a 2.104.1 agent or higher for full functionality. - -Returns an array of objects with the following properties: - [string]Name - [string]Value - [bool]Secret - -Limitations on an agent prior to 2.104.1: - 1) The return value does not include all public variables. Only public variables - that have been added using setVariable are returned. - 2) The name returned for each secret variable is the formatted environment variable - name, not the actual variable name (unless it was set explicitly at runtime using - setVariable). -#> -function Get-TaskVariableInfo { - [CmdletBinding()] - param() - - foreach ($info in $script:knownVariables.Values) { - New-Object -TypeName psobject -Property @{ - Name = $info.Name - Value = Get-TaskVariable -Name $info.Name - Secret = $info.Secret - } - } -} - -<# -.SYNOPSIS -Sets a task variable. - -.DESCRIPTION -Sets a task variable in the current task context as well as in the current job context. This allows the task variable to retrieved by subsequent tasks within the same job. -#> -function Set-TaskVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret) - - # Once a secret always a secret. - $variableKey = Get-VariableKey -Name $Name - [bool]$Secret = $Secret -or $script:knownVariables.$variableKey.Secret - if ($Secret) { - $vaultKey = "SECRET_$variableKey" - if (!$Value) { - # Clear the secret. - Write-Verbose "Set $Name = ''" - $script:vault.Remove($vaultKey) - } else { - # Store the secret in the vault. - Write-Verbose "Set $Name = '********'" - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Set-Item -LiteralPath "Env:$variableKey" -Value '' - } else { - # Set the environment variable. - Write-Verbose "Set $Name = '$Value'" - Set-Item -LiteralPath "Env:$variableKey" -Value $Value - } - - # Store the metadata. - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $Secret - } - - # Persist the variable in the task context. - Write-SetVariable -Name $Name -Value $Value -Secret:$Secret -} - -######################################## -# Private functions. -######################################## -function Get-VaultValue { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - # Attempt to get the vault value. - $value = $null - if ($psCredential = $script:vault[$Key]) { - $value = $psCredential.GetNetworkCredential().Password - } elseif (!$script:nonInteractive) { - # The value wasn't found. Prompt for the value if running in interactive dev mode. - $value = Read-Host -Prompt $Description - if ($value) { - $script:vault[$Key] = New-Object System.Management.Automation.PSCredential( - $Key, - (ConvertTo-SecureString -String $value -AsPlainText -Force)) - } - } - - Get-Value -Value $value @PSBoundParameters -} - -function Get-Value { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [string]$Value, - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - $result = $Value - if ($result) { - if ($Key -like 'ENDPOINT_AUTH_*') { - Write-Verbose "$($Key): '********'" - } else { - Write-Verbose "$($Key): '$result'" - } - } else { - Write-Verbose "$Key (empty)" - - # Write error if required. - if ($Require) { - Write-Error "$(Get-LocString -Key PSLIB_Required0 $Description)" - return - } - - # Fallback to the default if provided. - if ($PSCmdlet.ParameterSetName -eq 'Default') { - $result = $Default - $OFS = ' ' - Write-Verbose " Defaulted to: '$result'" - } else { - $result = '' - } - } - - # Convert to bool if specified. - if ($AsBool) { - if ($result -isnot [bool]) { - $result = "$result" -in '1', 'true' - Write-Verbose " Converted to bool: $result" - } - - return $result - } - - # Convert to int if specified. - if ($AsInt) { - if ($result -isnot [int]) { - try { - $result = [int]"$result" - } catch { - $result = 0 - } - - Write-Verbose " Converted to int: $result" - } - - return $result - } - - return $result -} - -function Initialize-Inputs { - # Store endpoints, inputs, and secret variables in the vault. - foreach ($variable in (Get-ChildItem -Path Env:ENDPOINT_?*, Env:INPUT_?*, Env:SECRET_?*, Env:SECUREFILE_?*)) { - # Record the secret variable metadata. This is required by Get-TaskVariable to - # retrieve the value. In a 2.104.1 agent or higher, this metadata will be overwritten - # when $env:VSTS_SECRET_VARIABLES is processed. - if ($variable.Name -like 'SECRET_?*') { - $variableKey = $variable.Name.Substring('SECRET_'.Length) - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - # This is technically not the variable name (has underscores instead of dots), - # but it's good enough to make Get-TaskVariable work in a pre-2.104.1 agent - # where $env:VSTS_SECRET_VARIABLES is not defined. - Name = $variableKey - Secret = $true - } - } - - # Store the value in the vault. - $vaultKey = $variable.Name - if ($variable.Value) { - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $variable.Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Remove-Item -LiteralPath "Env:$($variable.Name)" - } - - # Record the public variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_PUBLIC_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_PUBLIC_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $false - } - } - - $env:VSTS_PUBLIC_VARIABLES = '' - } - - # Record the secret variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_SECRET_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_SECRET_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $true - } - } - - $env:VSTS_SECRET_VARIABLES = '' - } -} - -function Get-VariableKey { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name) - - if ($Name -ne 'agent.jobstatus') { - $Name = $Name.Replace('.', '_') - } - - $Name.ToUpperInvariant() -} diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 b/Tasks/pack/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 deleted file mode 100644 index b4080ae..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 +++ /dev/null @@ -1,320 +0,0 @@ -<# -.SYNOPSIS -Finds files or directories. - -.DESCRIPTION -Finds files or directories using advanced pattern matching. - -.PARAMETER LiteralDirectory -Directory to search. - -.PARAMETER LegacyPattern -Proprietary pattern format. The LiteralDirectory parameter is used to root any unrooted patterns. - -Separate multiple patterns using ";". Escape actual ";" in the path by using ";;". -"?" indicates a wildcard that represents any single character within a path segment. -"*" indicates a wildcard that represents zero or more characters within a path segment. -"**" as the entire path segment indicates a recursive search. -"**" within a path segment indicates a recursive intersegment wildcard. -"+:" (can be omitted) indicates an include pattern. -"-:" indicates an exclude pattern. - -The result is from the command is a union of all the matches from the include patterns, minus the matches from the exclude patterns. - -.PARAMETER IncludeFiles -Indicates whether to include files in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER IncludeDirectories -Indicates whether to include directories in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER Force -Indicates whether to include hidden items. - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is?Match.txt" - -Given: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt -C:\Directory\IsNotMatch.txt - -Returns: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is*Match.txt" - -Given: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt -C:\Directory\NonMatch.txt - -Returns: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**\Match.txt" - -Given: -C:\Directory\Match.txt -C:\Directory\NotAMatch.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -Returns: -C:\Directory\Match.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**" - -Given: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -Returns: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Sub**Match.txt" - -Given: -C:\Directory\IsNotAMatch.txt -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\IsNot.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsNot.txt - -Returns: -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -#> -function Find-Files { - [CmdletBinding()] - param( - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$LiteralDirectory, - [Parameter(Mandatory = $true)] - [string]$LegacyPattern, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - # Note, due to subtle implementation details of Get-PathPrefix/Get-PathIterator, - # this function does not appear to be able to search the root of a drive and other - # cases where Path.GetDirectoryName() returns empty. More details in Get-PathPrefix. - - Trace-EnteringInvocation $MyInvocation - if (!$IncludeFiles -and !$IncludeDirectories) { - $IncludeFiles = $true - } - - $includePatterns = New-Object System.Collections.Generic.List[string] - $excludePatterns = New-Object System.Collections.Generic.List[System.Text.RegularExpressions.Regex] - $LegacyPattern = $LegacyPattern.Replace(';;', "`0") - foreach ($pattern in $LegacyPattern.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries)) { - $pattern = $pattern.Replace("`0", ';') - $isIncludePattern = Test-IsIncludePattern -Pattern ([ref]$pattern) - if ($LiteralDirectory -and !([System.IO.Path]::IsPathRooted($pattern))) { - # Use the root directory provided to make the pattern a rooted path. - $pattern = [System.IO.Path]::Combine($LiteralDirectory, $pattern) - } - - # Validate pattern does not end with a \. - if ($pattern[$pattern.Length - 1] -eq [System.IO.Path]::DirectorySeparatorChar) { - throw (Get-LocString -Key PSLIB_InvalidPattern0 -ArgumentList $pattern) - } - - if ($isIncludePattern) { - $includePatterns.Add($pattern) - } else { - $excludePatterns.Add((Convert-PatternToRegex -Pattern $pattern)) - } - } - - $count = 0 - foreach ($path in (Get-MatchingItems -IncludePatterns $includePatterns -ExcludePatterns $excludePatterns -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force)) { - $count++ - $path - } - - Write-Verbose "Total found: $count" - Trace-LeavingInvocation $MyInvocation -} - -######################################## -# Private functions. -######################################## -function Convert-PatternToRegex { - [CmdletBinding()] - param([string]$Pattern) - - $Pattern = [regex]::Escape($Pattern.Replace('\', '/')). # Normalize separators and regex escape. - Replace('/\*\*/', '((/.+/)|(/))'). # Replace directory globstar. - Replace('\*\*', '.*'). # Replace remaining globstars with a wildcard that can span directory separators. - Replace('\*', '[^/]*'). # Replace asterisks with a wildcard that cannot span directory separators. - # bug: should be '[^/]' instead of '.' - Replace('\?', '.') # Replace single character wildcards. - New-Object regex -ArgumentList "^$Pattern`$", ([System.Text.RegularExpressions.RegexOptions]::IgnoreCase) -} - -function Get-FileNameFilter { - [CmdletBinding()] - param([string]$Pattern) - - $index = $Pattern.LastIndexOf('\') - if ($index -eq -1 -or # Pattern does not contain a backslash. - !($Pattern = $Pattern.Substring($index + 1)) -or # Pattern ends in a backslash. - $Pattern.Contains('**')) # Last segment contains an inter-segment wildcard. - { - return '*' - } - - # bug? is this supposed to do substring? - return $Pattern -} - -function Get-MatchingItems { - [CmdletBinding()] - param( - [System.Collections.Generic.List[string]]$IncludePatterns, - [System.Collections.Generic.List[regex]]$ExcludePatterns, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - Trace-EnteringInvocation $MyInvocation - $allFiles = New-Object System.Collections.Generic.HashSet[string] - foreach ($pattern in $IncludePatterns) { - $pathPrefix = Get-PathPrefix -Pattern $pattern - $fileNameFilter = Get-FileNameFilter -Pattern $pattern - $patternRegex = Convert-PatternToRegex -Pattern $pattern - # Iterate over the directories and files under the pathPrefix. - Get-PathIterator -Path $pathPrefix -Filter $fileNameFilter -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force | - ForEach-Object { - # Normalize separators. - $normalizedPath = $_.Replace('\', '/') - # **/times/** will not match C:/fun/times because there isn't a trailing slash. - # So try both if including directories. - $alternatePath = "$normalizedPath/" # potential bug: it looks like this will result in a false - # positive if the item is a regular file and not a directory - - $isMatch = $false - if ($patternRegex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $patternRegex.IsMatch($alternatePath))) { - $isMatch = $true - - # Test whether the path should be excluded. - foreach ($regex in $ExcludePatterns) { - if ($regex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $regex.IsMatch($alternatePath))) { - $isMatch = $false - break - } - } - } - - if ($isMatch) { - $null = $allFiles.Add($_) - } - } - } - - Trace-Path -Path $allFiles -PassThru - Trace-LeavingInvocation $MyInvocation -} - -function Get-PathIterator { - [CmdletBinding()] - param( - [string]$Path, - [string]$Filter, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - if (!$Path) { - return - } - - # bug: this returns the dir without verifying whether exists - if ($IncludeDirectories) { - $Path - } - - Get-DirectoryChildItem -Path $Path -Filter $Filter -Force:$Force -Recurse | - ForEach-Object { - if ($_.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - if ($IncludeDirectories) { - $_.FullName - } - } elseif ($IncludeFiles) { - $_.FullName - } - } -} - -function Get-PathPrefix { - [CmdletBinding()] - param([string]$Pattern) - - # Note, unable to search root directories is a limitation due to subtleties of this function - # and downstream code in Get-PathIterator that short-circuits when the path prefix is empty. - # This function uses Path.GetDirectoryName() to determine the path prefix, which will yield - # empty in some cases. See the following examples of Path.GetDirectoryName() input => output: - # C:/ => - # C:/hello => C:\ - # C:/hello/ => C:\hello - # C:/hello/world => C:\hello - # C:/hello/world/ => C:\hello\world - # C: => - # C:hello => C: - # C:hello/ => C:hello - # / => - # /hello => \ - # /hello/ => \hello - # //hello => - # //hello/ => - # //hello/world => - # //hello/world/ => \\hello\world - - $index = $Pattern.IndexOfAny([char[]]@('*'[0], '?'[0])) - if ($index -eq -1) { - # If no wildcards are found, return the directory name portion of the path. - # If there is no directory name (file name only in pattern), this will return empty string. - return [System.IO.Path]::GetDirectoryName($Pattern) - } - - [System.IO.Path]::GetDirectoryName($Pattern.Substring(0, $index)) -} - -function Test-IsIncludePattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [ref]$Pattern) - - # Include patterns start with +: or anything except -: - # Exclude patterns start with -: - if ($Pattern.value.StartsWith("+:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $true - } elseif ($Pattern.value.StartsWith("-:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $false - } else { - # No prefix, so leave the string alone. - $true; - } -} diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 b/Tasks/pack/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 deleted file mode 100644 index c31790c..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 +++ /dev/null @@ -1,150 +0,0 @@ -$script:resourceStrings = @{ } - -<# -.SYNOPSIS -Gets a localized resource string. - -.DESCRIPTION -Gets a localized resource string and optionally formats the string with arguments. - -If the format fails (due to a bad format string or incorrect expected arguments in the format string), then the format string is returned followed by each of the arguments (delimited by a space). - -If the lookup key is not found, then the lookup key is returned followed by each of the arguments (delimited by a space). - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-LocString { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true, Position = 1)] - [string]$Key, - [Parameter(Position = 2)] - [object[]]$ArgumentList = @( )) - - # Due to the dynamically typed nature of PowerShell, a single null argument passed - # to an array parameter is interpreted as a null array. - if ([object]::ReferenceEquals($null, $ArgumentList)) { - $ArgumentList = @( $null ) - } - - # Lookup the format string. - $format = '' - if (!($format = $script:resourceStrings[$Key])) { - # Warn the key was not found. Prevent recursion if the lookup key is the - # "string resource key not found" lookup key. - $resourceNotFoundKey = 'PSLIB_StringResourceKeyNotFound0' - if ($key -ne $resourceNotFoundKey) { - Write-Warning (Get-LocString -Key $resourceNotFoundKey -ArgumentList $Key) - } - - # Fallback to just the key itself if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $key } - - # Otherwise fallback to the key followed by the arguments. - $OFS = " " - return "$key $ArgumentList" - } - - # Return the string if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $format } - - try { - [string]::Format($format, $ArgumentList) - } catch { - Write-Warning (Get-LocString -Key 'PSLIB_StringFormatFailed') - $OFS = " " - "$format $ArgumentList" - } -} - -<# -.SYNOPSIS -Imports resource strings for use with Get-VstsLocString. - -.DESCRIPTION -Imports resource strings for use with Get-VstsLocString. The imported strings are stored in an internal resource string dictionary. Optionally, if a separate resource file for the current culture exists, then the localized strings from that file then imported (overlaid) into the same internal resource string dictionary. - -Resource strings from the SDK are prefixed with "PSLIB_". This prefix should be avoided for custom resource strings. - -.Parameter LiteralPath -JSON file containing resource strings. - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Imports strings from messages section in the JSON file. If a messages section is not defined, then no strings are imported. Example messages section: -{ - "messages": { - "Hello": "Hello you!", - "Hello0": "Hello {0}!" - } -} - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Overlays strings from an optional separate resource file for the current culture. - -Given the task variable System.Culture is set to 'de-DE'. This variable is set by the agent based on the current culture for the job. -Given the file Task.json contains: -{ - "messages": { - "GoodDay": "Good day!", - } -} -Given the file resources.resjson\de-DE\resources.resjson: -{ - "loc.messages.GoodDay": "Guten Tag!" -} - -The net result from the import command would be one new key-value pair added to the internal dictionary: Key = 'GoodDay', Value = 'Guten Tag!' -#> -function Import-LocStrings { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - # Validate the file exists. - if (!(Test-Path -LiteralPath $LiteralPath -PathType Leaf)) { - Write-Warning (Get-LocString -Key PSLIB_FileNotFound0 -ArgumentList $LiteralPath) - return - } - - # Load the json. - Write-Verbose "Loading resource strings from: $LiteralPath" - $count = 0 - if ($messages = (Get-Content -LiteralPath $LiteralPath -Encoding UTF8 | Out-String | ConvertFrom-Json).messages) { - # Add each resource string to the hashtable. - foreach ($member in (Get-Member -InputObject $messages -MemberType NoteProperty)) { - [string]$key = $member.Name - $script:resourceStrings[$key] = $messages."$key" - $count++ - } - } - - Write-Verbose "Loaded $count strings." - - # Get the culture. - $culture = Get-TaskVariable -Name "System.Culture" -Default "en-US" - - # Load the resjson. - $resjsonPath = "$([System.IO.Path]::GetDirectoryName($LiteralPath))\Strings\resources.resjson\$culture\resources.resjson" - if (Test-Path -LiteralPath $resjsonPath) { - Write-Verbose "Loading resource strings from: $resjsonPath" - $count = 0 - $resjson = Get-Content -LiteralPath $resjsonPath -Encoding UTF8 | Out-String | ConvertFrom-Json - foreach ($member in (Get-Member -Name loc.messages.* -InputObject $resjson -MemberType NoteProperty)) { - if (!($value = $resjson."$($member.Name)")) { - continue - } - - [string]$key = $member.Name.Substring('loc.messages.'.Length) - $script:resourceStrings[$key] = $value - $count++ - } - - Write-Verbose "Loaded $count strings." - } -} diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 b/Tasks/pack/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 deleted file mode 100644 index 595a7d8..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 +++ /dev/null @@ -1,601 +0,0 @@ -$script:loggingCommandPrefix = '##vso[' -$script:loggingCommandEscapeMappings = @( # TODO: WHAT ABOUT "="? WHAT ABOUT "%"? - New-Object psobject -Property @{ Token = ';' ; Replacement = '%3B' } - New-Object psobject -Property @{ Token = "`r" ; Replacement = '%0D' } - New-Object psobject -Property @{ Token = "`n" ; Replacement = '%0A' } - New-Object psobject -Property @{ Token = "]" ; Replacement = '%5D' } -) -# TODO: BUG: Escape % ??? -# TODO: Add test to verify don't need to escape "=". - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddAttachment { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Type, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'addattachment' -Data $Path -Properties @{ - 'type' = $Type - 'name' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadSummary { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadsummary' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetEndpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [Parameter(Mandatory = $true)] - [string]$Field, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setendpoint' -Data $Value -Properties @{ - 'id' = $Id - 'field' = $Field - 'key' = $Key - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddBuildTag { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'addbuildtag' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AssociateArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - [string]$Type, - [hashtable]$Properties, - [switch]$AsOutput) - - $p = @{ } - if ($Properties) { - foreach ($key in $Properties.Keys) { - $p[$key] = $Properties[$key] - } - } - - $p['artifactname'] = $Name - $p['artifacttype'] = $Type - Write-LoggingCommand -Area 'artifact' -Event 'associate' -Data $Path -Properties $p -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-LogDetail { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [guid]$Id, - $ParentId, - [string]$Type, - [string]$Name, - $Order, - $StartTime, - $FinishTime, - $Progress, - [ValidateSet('Unknown', 'Initialized', 'InProgress', 'Completed')] - [Parameter()] - $State, - [ValidateSet('Succeeded', 'SucceededWithIssues', 'Failed', 'Cancelled', 'Skipped')] - [Parameter()] - $Result, - [string]$Message, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'logdetail' -Data $Message -Properties @{ - 'id' = $Id - 'parentid' = $ParentId - 'type' = $Type - 'name' = $Name - 'order' = $Order - 'starttime' = $StartTime - 'finishtime' = $FinishTime - 'progress' = $Progress - 'state' = $State - 'result' = $Result - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetProgress { - [CmdletBinding()] - param( - [ValidateRange(0, 100)] - [Parameter(Mandatory = $true)] - [int]$Percent, - [string]$CurrentOperation, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setprogress' -Data $CurrentOperation -Properties @{ - 'value' = $Percent - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetResult { - [CmdletBinding(DefaultParameterSetName = 'AsOutput')] - param( - [ValidateSet("Succeeded", "SucceededWithIssues", "Failed", "Cancelled", "Skipped")] - [Parameter(Mandatory = $true)] - [string]$Result, - [string]$Message, - [Parameter(ParameterSetName = 'AsOutput')] - [switch]$AsOutput, - [Parameter(ParameterSetName = 'DoNotThrow')] - [switch]$DoNotThrow) - - Write-LoggingCommand -Area 'task' -Event 'complete' -Data $Message -Properties @{ - 'result' = $Result - } -AsOutput:$AsOutput - if ($Result -eq 'Failed' -and !$AsOutput -and !$DoNotThrow) { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - throw (New-Object VstsTaskSdk.TerminationException($Message)) - } -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetSecret { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setsecret' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ - 'variable' = $Name - 'issecret' = $Secret - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskDebug { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskError { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type error @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskVerbose { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -AsVerbose -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskWarning { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type warning @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadFile { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadfile' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-PrependPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateBuildNumber { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'updatebuildnumber' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$ContainerFolder, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'artifact' -Event 'upload' -Data $Path -Properties @{ - 'containerfolder' = $ContainerFolder - 'artifactname' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadBuildLog { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'uploadlog' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateReleaseName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'release' -Event 'updatereleasename' -Data $Name -AsOutput:$AsOutput -} - -######################################## -# Private functions. -######################################## -function Format-LoggingCommandData { - [CmdletBinding()] - param([string]$Value, [switch]$Reverse) - - if (!$Value) { - return '' - } - - if (!$Reverse) { - foreach ($mapping in $script:loggingCommandEscapeMappings) { - $Value = $Value.Replace($mapping.Token, $mapping.Replacement) - } - } else { - for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { - $mapping = $script:loggingCommandEscapeMappings[$i] - $Value = $Value.Replace($mapping.Replacement, $mapping.Token) - } - } - - return $Value -} - -function Format-LoggingCommand { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Area, - [Parameter(Mandatory = $true)] - [string]$Event, - [string]$Data, - [hashtable]$Properties) - - # Append the preamble. - [System.Text.StringBuilder]$sb = New-Object -TypeName System.Text.StringBuilder - $null = $sb.Append($script:loggingCommandPrefix).Append($Area).Append('.').Append($Event) - - # Append the properties. - if ($Properties) { - $first = $true - foreach ($key in $Properties.Keys) { - [string]$value = Format-LoggingCommandData $Properties[$key] - if ($value) { - if ($first) { - $null = $sb.Append(' ') - $first = $false - } else { - $null = $sb.Append(';') - } - - $null = $sb.Append("$key=$value") - } - } - } - - # Append the tail and output the value. - $Data = Format-LoggingCommandData $Data - $sb.Append(']').Append($Data).ToString() -} - -function Write-LoggingCommand { - [CmdletBinding(DefaultParameterSetName = 'Parameters')] - param( - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Area, - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Event, - [Parameter(ParameterSetName = 'Parameters')] - [string]$Data, - [Parameter(ParameterSetName = 'Parameters')] - [hashtable]$Properties, - [Parameter(Mandatory = $true, ParameterSetName = 'Object')] - $Command, - [switch]$AsOutput) - - if ($PSCmdlet.ParameterSetName -eq 'Object') { - Write-LoggingCommand -Area $Command.Area -Event $Command.Event -Data $Command.Data -Properties $Command.Properties -AsOutput:$AsOutput - return - } - - $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties - if ($AsOutput) { - $command - } else { - Write-Host $command - } -} - -function Write-LogIssue { - [CmdletBinding()] - param( - [ValidateSet('warning', 'error')] - [Parameter(Mandatory = $true)] - [string]$Type, - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ - 'type' = $Type - 'code' = $ErrCode - 'sourcepath' = $SourcePath - 'linenumber' = $LineNumber - 'columnnumber' = $ColumnNumber - } - if ($AsOutput) { - return $command - } - - if ($Type -eq 'error') { - $foregroundColor = $host.PrivateData.ErrorForegroundColor - $backgroundColor = $host.PrivateData.ErrorBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Red - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.WarningForegroundColor - $backgroundColor = $host.PrivateData.WarningBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Yellow - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} - -function Write-TaskDebug_Internal { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsVerbose, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'debug' -Data $Message - if ($AsOutput) { - return $command - } - - if ($AsVerbose) { - $foregroundColor = $host.PrivateData.VerboseForegroundColor - $backgroundColor = $host.PrivateData.VerboseBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Cyan - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.DebugForegroundColor - $backgroundColor = $host.PrivateData.DebugBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::DarkGray - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host -Object $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 b/Tasks/pack/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 deleted file mode 100644 index d536111..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 +++ /dev/null @@ -1,205 +0,0 @@ -######################################## -# Private functions. -######################################## -function ConvertFrom-LongFormPath { - [CmdletBinding()] - param([string]$Path) - - if ($Path) { - if ($Path.StartsWith('\\?\UNC')) { - # E.g. \\?\UNC\server\share -> \\server\share - return $Path.Substring(1, '\?\UNC'.Length) - } elseif ($Path.StartsWith('\\?\')) { - # E.g. \\?\C:\directory -> C:\directory - return $Path.Substring('\\?\'.Length) - } - } - - return $Path -} -function ConvertTo-LongFormPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$longFormPath = Get-FullNormalizedPath -Path $Path - if ($longFormPath -and !$longFormPath.StartsWith('\\?')) { - if ($longFormPath.StartsWith('\\')) { - # E.g. \\server\share -> \\?\UNC\server\share - return "\\?\UNC$($longFormPath.Substring(1))" - } else { - # E.g. C:\directory -> \\?\C:\directory - return "\\?\$longFormPath" - } - } - - return $longFormPath -} - -# TODO: ADD A SWITCH TO EXCLUDE FILES, A SWITCH TO EXCLUDE DIRECTORIES, AND A SWITCH NOT TO FOLLOW REPARSE POINTS. -function Get-DirectoryChildItem { - [CmdletBinding()] - param( - [string]$Path, - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$Filter = "*", - [switch]$Force, - [VstsTaskSdk.FS.FindFlags]$Flags = [VstsTaskSdk.FS.FindFlags]::LargeFetch, - [VstsTaskSdk.FS.FindInfoLevel]$InfoLevel = [VstsTaskSdk.FS.FindInfoLevel]::Basic, - [switch]$Recurse) - - $stackOfDirectoryQueues = New-Object System.Collections.Stack - while ($true) { - $directoryQueue = New-Object System.Collections.Queue - $fileQueue = New-Object System.Collections.Queue - $findData = New-Object VstsTaskSdk.FS.FindData - $longFormPath = (ConvertTo-LongFormPath $Path) - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, $Filter), - $InfoLevel, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - # Output directories immediately. - if ($item.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - $item - # Append to the directory queue if recursive and default filter. - if ($Recurse -and $Filter -eq '*') { - $directoryQueue.Enqueue($item) - } - } else { - # Hold the files until all directories have been output. - $fileQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - - # If recursive and non-default filter, queue child directories. - if ($Recurse -and $Filter -ne '*') { - $findData = New-Object VstsTaskSdk.FS.FindData - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, '*'), - [VstsTaskSdk.FS.FindInfoLevel]::Basic, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Collect directories only. - if ($attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - $directoryQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - } - - # Output the files. - $fileQueue - - # Push the directory queue onto the stack if any directories were found. - if ($directoryQueue.Count) { $stackOfDirectoryQueues.Push($directoryQueue) } - - # Break out of the loop if no more directory queues to process. - if (!$stackOfDirectoryQueues.Count) { break } - - # Get the next path. - $directoryQueue = $stackOfDirectoryQueues.Peek() - $Path = $directoryQueue.Dequeue().FullName - - # Pop the directory queue if it's empty. - if (!$directoryQueue.Count) { $null = $stackOfDirectoryQueues.Pop() } - } -} - -function Get-FullNormalizedPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$outPath = $Path - [uint32]$bufferSize = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, 0, $null, $null) - [int]$lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($bufferSize -gt 0) { - $absolutePath = New-Object System.Text.StringBuilder([int]$bufferSize) - [uint32]$length = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, $bufferSize, $absolutePath, $null) - $lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($length -gt 0) { - $outPath = $absolutePath.ToString() - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - - if ($outPath.EndsWith('\') -and !$outPath.EndsWith(':\')) { - $outPath = $outPath.TrimEnd('\') - } - - $outPath -} \ No newline at end of file diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/Minimatch.dll b/Tasks/pack/ps_modules/VstsTaskSdk/Minimatch.dll deleted file mode 100644 index 700ddc426e56b08270c9dcbb1ade8ded248f98d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18432 zcmeHvd3amZweLFTNJpa;OY%U-U;wdJ(iE<^0Dr1eX+yVU^ZP<}CerFP{^D;NRAvpy{Upu7qdr-p#QQK0A=EE z*j@RF!K$=fum`{t+x7$Dj;_a3@mYu3X*)Y&L6B{wNj$7;1D=Y{x>+@ezQumUhi%iz zO@BY1=+-!qPq<}p%U-3n%sDf*P#@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Y)>E!ekmZ+mS7JOJ0e1gE5&RYTEm`K4ejh?~5E;L%bA3wjduM>CcH7;A0Z2 z39Y*cGcOcTN}LL!0@ai${3@*|MWHUcm42xHg|Sx z`{tfwk3Rjs-`(@)7u#+*@b2&fb<3*0nqD`t;EumPyk`7E?55KHhkzXnS5bT)o=#3d z-F+{9yXNOFH5^~}{vRh_efj-=znQJ>TG@X|0T&zneSN+C-Px<~SNNlRlIX`lH6K&= zS^XHJY=2iHztz#b0<#WW(T^L9EUuHv-1O++0s1PME`6S3JXWHnze|6@uekfVEW3MT zWD8De>Y6p1mBYT2o^FDY>gm-hDgI`N@NExGR&rJ1CG65?^I2{ao?ZKiy45!v%mU6o z{-pd7xp#x)`K^9S*368ckzJK@|eeCHK|wh@#b0Crf~9w6M#pe4dt zz?`bfXOcXA%di!1*2AAZ>IHR3^sUCXQ`(eW-H<5Yn`5?jbXtG5NDp!qZSh!nE9zb< ztrseM(26}cKP~cbpO68?i={JC27M@7HoJ{94MJiBHg6Jt^rDR+*ghhj8AZR?(joL5 zXRI^uV)Ov~6T{i41(qQF;Jm}5U)G~Wa1eUgi?-tx2;$Q%_HJ|9;1T4OOVPlT^5`4c zy-fVO9Xc%ZWemP8R`eKu26_g+E)%~_uQSuTGkx13bviM61?kHHSb7va|F7z)p8hw( X?dtd6e<)43|K{fYzxw~TJn(-2*CUr_ diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/OutFunctions.ps1 b/Tasks/pack/ps_modules/VstsTaskSdk/OutFunctions.ps1 deleted file mode 100644 index fd898d6..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/OutFunctions.ps1 +++ /dev/null @@ -1,79 +0,0 @@ -# TODO: It would be better if the Out-Default function resolved the underlying Out-Default -# command in the begin block. This would allow for supporting other modules that override -# Out-Default. -$script:outDefaultCmdlet = $ExecutionContext.InvokeCommand.GetCmdlet("Microsoft.PowerShell.Core\Out-Default") - -######################################## -# Public functions. -######################################## -function Out-Default { - [CmdletBinding(ConfirmImpact = "Medium")] - param( - [Parameter(ValueFromPipeline = $true)] - [System.Management.Automation.PSObject]$InputObject) - - begin { - #Write-Host '[Entering Begin Out-Default]' - $__sp = { & $script:outDefaultCmdlet @PSBoundParameters }.GetSteppablePipeline() - $__sp.Begin($pscmdlet) - #Write-Host '[Leaving Begin Out-Default]' - } - - process { - #Write-Host '[Entering Process Out-Default]' - if ($_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose -Message 'Error record:' 4>&1 | Out-Default - Write-Verbose -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) 4>&1 | Out-Default - Write-Verbose -Message 'Script stack trace:' 4>&1 | Out-Default - Write-Verbose -Message "$($_.ScriptStackTrace)" 4>&1 | Out-Default - Write-Verbose -Message 'Exception:' 4>&1 | Out-Default - Write-Verbose -Message $_.Exception.ToString() 4>&1 | Out-Default - Write-TaskError -Message $_.Exception.Message - } elseif ($_ -is [System.Management.Automation.WarningRecord]) { - Write-TaskWarning -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) - } elseif ($_ -is [System.Management.Automation.VerboseRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskVerbose -Message $private:str - } - } elseif ($_ -is [System.Management.Automation.DebugRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskDebug -Message $private:str - } - } else { -# TODO: Consider using out-string here to control the width. As a security precaution it would actually be best to set it to max so wrapping doesn't interfere with secret masking. - $__sp.Process($_) - } - - #Write-Host '[Leaving Process Out-Default]' - } - - end { - #Write-Host '[Entering End Out-Default]' - $__sp.End() - #Write-Host '[Leaving End Out-Default]' - } -} - -######################################## -# Private functions. -######################################## -function Format-DebugMessage { - [CmdletBinding()] - param([psobject]$Object) - - $private:str = Out-String -InputObject $Object -Width 2147483647 - $private:str = Remove-TrailingNewLine $private:str - "$private:str".Replace("`r`n", "`n").Replace("`r", "`n").Split("`n"[0]) -} - -function Remove-TrailingNewLine { - [CmdletBinding()] - param($Str) - if ([object]::ReferenceEquals($Str, $null)) { - return $Str - } elseif ($Str.EndsWith("`r`n")) { - return $Str.Substring(0, $Str.Length - 2) - } else { - return $Str - } -} diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml b/Tasks/pack/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml deleted file mode 100644 index 8c20388..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - Microsoft.PowerShell.Commands.PSRepositoryItemInfo - System.Management.Automation.PSCustomObject - System.Object - - - VstsTaskSdk - 0.11.0 - Module - VSTS Task SDK - Microsoft - VSTS - (c) 2016 Microsoft. All rights reserved. -

2018-05-21T03:27:56+01:00
- - - - https://github.com/Microsoft/vsts-task-lib - - - - System.Object[] - System.Array - System.Object - - - PSModule - - - - - System.Collections.Hashtable - System.Object - - - - DscResource - - - - - - - RoleCapability - - - - Cmdlet - - - - Workflow - - - - Command - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - Function - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - - - - - - - - https://www.powershellgallery.com/api/v2 - PSGallery - NuGet - - - System.Management.Automation.PSCustomObject - System.Object - - - (c) 2016 Microsoft. All rights reserved. - VSTS Task SDK - False - True - True - 12749 - 136204 - 71074 - 21/05/2018 03:27:56 +01:00 - 21/05/2018 03:27:56 +01:00 - 09/11/2018 22:20:20 +00:00 - PSModule PSFunction_Find-Match PSCommand_Find-Match PSFunction_New-FindOptions PSCommand_New-FindOptions PSFunction_New-MatchOptions PSCommand_New-MatchOptions PSFunction_Select-Match PSCommand_Select-Match PSFunction_Get-Endpoint PSCommand_Get-Endpoint PSFunction_Get-SecureFileTicket PSCommand_Get-SecureFileTicket PSFunction_Get-SecureFileName PSCommand_Get-SecureFileName PSFunction_Get-Input PSCommand_Get-Input PSFunction_Get-TaskVariable PSCommand_Get-TaskVariable PSFunction_Get-TaskVariableInfo PSCommand_Get-TaskVariableInfo PSFunction_Set-TaskVariable PSCommand_Set-TaskVariable PSFunction_Find-Files PSCommand_Find-Files PSFunction_Get-LocString PSCommand_Get-LocString PSFunction_Import-LocStrings PSCommand_Import-LocStrings PSFunction_Write-AddAttachment PSCommand_Write-AddAttachment PSFunction_Write-AddBuildTag PSCommand_Write-AddBuildTag PSFunction_Write-AssociateArtifact PSCommand_Write-AssociateArtifact PSFunction_Write-LogDetail PSCommand_Write-LogDetail PSFunction_Write-PrependPath PSCommand_Write-PrependPath PSFunction_Write-SetEndpoint PSCommand_Write-SetEndpoint PSFunction_Write-SetProgress PSCommand_Write-SetProgress PSFunction_Write-SetResult PSCommand_Write-SetResult PSFunction_Write-SetSecret PSCommand_Write-SetSecret PSFunction_Write-SetVariable PSCommand_Write-SetVariable PSFunction_Write-TaskDebug PSCommand_Write-TaskDebug PSFunction_Write-TaskError PSCommand_Write-TaskError PSFunction_Write-TaskVerbose PSCommand_Write-TaskVerbose PSFunction_Write-TaskWarning PSCommand_Write-TaskWarning PSFunction_Write-UpdateBuildNumber PSCommand_Write-UpdateBuildNumber PSFunction_Write-UpdateReleaseName PSCommand_Write-UpdateReleaseName PSFunction_Write-UploadArtifact PSCommand_Write-UploadArtifact PSFunction_Write-UploadBuildLog PSCommand_Write-UploadBuildLog PSFunction_Write-UploadFile PSCommand_Write-UploadFile PSFunction_Write-UploadSummary PSCommand_Write-UploadSummary PSFunction_Out-Default PSCommand_Out-Default PSFunction_Get-AssemblyReference PSCommand_Get-AssemblyReference PSFunction_Get-TfsClientCredentials PSCommand_Get-TfsClientCredentials PSFunction_Get-TfsService PSCommand_Get-TfsService PSFunction_Get-VssCredentials PSCommand_Get-VssCredentials PSFunction_Get-VssHttpClient PSCommand_Get-VssHttpClient PSFunction_Assert-Agent PSCommand_Assert-Agent PSFunction_Assert-Path PSCommand_Assert-Path PSFunction_Invoke-Tool PSCommand_Invoke-Tool PSFunction_Trace-EnteringInvocation PSCommand_Trace-EnteringInvocation PSFunction_Trace-LeavingInvocation PSCommand_Trace-LeavingInvocation PSFunction_Trace-Path PSCommand_Trace-Path PSFunction_Get-WebProxy PSCommand_Get-WebProxy PSFunction_Get-ClientCertificate PSCommand_Get-ClientCertificate PSIncludes_Function - False - 2018-11-09T22:20:20Z - 0.11.0 - Microsoft - false - Module - VstsTaskSdk.nuspec|FindFunctions.ps1|InputFunctions.ps1|LegacyFindFunctions.ps1|lib.json|LocalizationFunctions.ps1|LoggingCommandFunctions.ps1|LongPathFunctions.ps1|Minimatch.dll|OutFunctions.ps1|ServerOMFunctions.ps1|ToolFunctions.ps1|TraceFunctions.ps1|VstsTaskSdk.dll|VstsTaskSdk.psd1|VstsTaskSdk.psm1|Strings\resources.resjson\de-de\resources.resjson|Strings\resources.resjson\en-US\resources.resjson|Strings\resources.resjson\es-es\resources.resjson|Strings\resources.resjson\fr-fr\resources.resjson|Strings\resources.resjson\it-IT\resources.resjson|Strings\resources.resjson\ja-jp\resources.resjson|Strings\resources.resjson\ko-KR\resources.resjson|Strings\resources.resjson\ru-RU\resources.resjson|Strings\resources.resjson\zh-CN\resources.resjson|Strings\resources.resjson\zh-TW\resources.resjson - bbed04e2-4e8e-4089-90a2-58b858fed8d8 - 3.0 - Microsoft - - - /Users/gep13/github/gep13/chocolatey-azuredevops/Tasks/install/VstsTaskSdk/0.11.0 - - - diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 b/Tasks/pack/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 deleted file mode 100644 index 177820b..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 +++ /dev/null @@ -1,659 +0,0 @@ -<# -.SYNOPSIS -Gets assembly reference information. - -.DESCRIPTION -Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK. - -Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario. - -Walks an assembly's references to determine all of it's dependencies. Also walks the references of the dependencies, and so on until all nested dependencies have been traversed. Dependencies are searched for in the directory of the specified assembly. NET Framework assemblies are omitted. - -See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER LiteralPath -Assembly to walk. - -.EXAMPLE -Get-VstsAssemblyReference -LiteralPath C:\nuget\microsoft.teamfoundationserver.client.14.102.0\lib\net45\Microsoft.TeamFoundation.Build2.WebApi.dll -#> -function Get-AssemblyReference { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - $ErrorActionPreference = 'Stop' - Write-Warning "Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK." - Write-Output '' - Write-Warning "Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario." - $directory = [System.IO.Path]::GetDirectoryName($LiteralPath) - $hashtable = @{ } - $queue = @( [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($LiteralPath).GetName() ) - while ($queue.Count) { - # Add a blank line between assemblies. - Write-Output '' - - # Pop. - $assemblyName = $queue[0] - $queue = @( $queue | Select-Object -Skip 1 ) - - # Attempt to find the assembly in the same directory. - $assembly = $null - $path = "$directory\$($assemblyName.Name).dll" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } else { - $path = "$directory\$($assemblyName.Name).exe" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } - } - - # Make sure the assembly full name matches, not just the file name. - if ($assembly -and $assembly.GetName().FullName -ne $assemblyName.FullName) { - $assembly = $null - } - - # Print the assembly. - if ($assembly) { - Write-Output $assemblyName.FullName - } else { - if ($assemblyName.FullName -eq 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed') { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) *** This is an expected condition when using the HTTP clients from the 15.x VSTS REST SDK. Use Get-VstsVssHttpClient to load the HTTP clients (which applies a binding redirect assembly resolver for Newtonsoft.Json). Otherwise you will need to manage the binding redirect yourself." - } else { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) ***" - } - - continue - } - - # Walk the references. - $refAssemblyNames = @( $assembly.GetReferencedAssemblies() ) - for ($i = 0 ; $i -lt $refAssemblyNames.Count ; $i++) { - $refAssemblyName = $refAssemblyNames[$i] - - # Skip framework assemblies. - $fxPaths = @( - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\$($refAssemblyName.Name).dll" - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\WPF\$($refAssemblyName.Name).dll" - ) - $fxPath = $fxPaths | - Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } | - Where-Object { [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($_).GetName().FullName -eq $refAssemblyName.FullName } - if ($fxPath) { - continue - } - - # Print the reference. - Write-Output " $($refAssemblyName.FullName)" - - # Add new references to the queue. - if (!$hashtable[$refAssemblyName.FullName]) { - $queue += $refAssemblyName - $hashtable[$refAssemblyName.FullName] = $true - } - } - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the TFS extended client SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -Refer to Get-VstsTfsService for a more simple to get a TFS service object. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -$credentials = Get-VstsTfsClientCredentials -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.VersionControl.Client.dll" -$tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection( - (Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require), - $credentials) -$versionControlServer = $tfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer]) -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsClientCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Validate the type can be found. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsClientCredentials' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Construct the credentials. - $credentials = New-Object Microsoft.TeamFoundation.Client.TfsClientCredentials($false) # Do not use default credentials. - $credentials.AllowInteractive = $false - $credentials.Federated = New-Object Microsoft.TeamFoundation.Client.OAuthTokenCredential([string]$endpoint.auth.parameters.AccessToken) - return $credentials - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a TFS extended client service. - -.DESCRIPTION -Gets an instance of an ITfsTeamProjectCollectionObject. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the service to get. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER Uri -URI to use when initializing the service. If not specified, defaults to System.TeamFoundationCollectionUri. - -.PARAMETER TfsClientCredentials -Credentials to use when initializing the service. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -.EXAMPLE -$versionControlServer = Get-VstsTfsService -TypeName Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsService { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $TfsClientCredentials) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Default the credentials. - if (!$TfsClientCredentials) { - $TfsClientCredentials = Get-TfsClientCredentials -OMDirectory $OMDirectory - } - - # Validate the project collection type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsTeamProjectCollection' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Load the project collection object. - $tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection($Uri, $TfsClientCredentials) - - # Validate the requested type can be loaded. - $type = Get-OMType -TypeName $TypeName -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Return the service object. - return $tfsTeamProjectCollection.GetService($type) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the VSTS REST SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project service build/release identity). - -Refer to Get-VstsVssHttpClient for a more simple to get a VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -# This example works using the 14.x .NET SDK. A Newtonsoft.Json 6.0 to 8.0 binding -# redirect may be required when working with the 15.x SDK. Or use Get-VstsVssHttpClient -# to avoid managing the binding redirect. -# -$vssCredentials = Get-VstsVssCredentials -$collectionUrl = New-Object System.Uri((Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require)) -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.Core.WebApi.dll" -$projectHttpClient = New-Object Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient($collectionUrl, $vssCredentials) -$projectHttpClient.GetProjects().Result -#> -function Get-VssCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Check if the VssOAuthAccessTokenCredential type is available. - if ((Get-OMType -TypeName 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory)) { - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential($endpoint.auth.parameters.AccessToken) - } else { - # Validate the fallback type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.Client.VssOAuthCredential($endpoint.auth.parameters.AccessToken) - } - - # Return the credentials. - return New-Object Microsoft.VisualStudio.Services.Common.VssCredentials( - (New-Object Microsoft.VisualStudio.Services.Common.WindowsCredential($false)), # Do not use default credentials. - $federatedCredential, - [Microsoft.VisualStudio.Services.Common.CredentialPromptType]::DoNotPrompt) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VSS HTTP client. - -.DESCRIPTION -Gets an instance of an VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the HTTP client to get. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -# .PARAMETER Uri -# URI to use when initializing the HTTP client. If not specified, defaults to System.TeamFoundationCollectionUri. - -# .PARAMETER VssCredentials -# Credentials to use when initializing the HTTP client. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -# .PARAMETER WebProxy -# WebProxy to use when initializing the HTTP client. If not specified, the default uses the proxy configuration agent current has. - -# .PARAMETER ClientCert -# ClientCert to use when initializing the HTTP client. If not specified, the default uses the client certificate agent current has. - -# .PARAMETER IgnoreSslError -# Skip SSL server certificate validation on all requests made by this HTTP client. If not specified, the default is to validate SSL server certificate. - -.EXAMPLE -$projectHttpClient = Get-VstsVssHttpClient -TypeName Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient -$projectHttpClient.GetProjects().Result -#> -function Get-VssHttpClient { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $VssCredentials, - - $WebProxy = (Get-WebProxy), - - $ClientCert = (Get-ClientCertificate), - - [switch]$IgnoreSslError) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Cast the URI. - [uri]$Uri = New-Object System.Uri($Uri) - - # Default the credentials. - if (!$VssCredentials) { - $VssCredentials = Get-VssCredentials -OMDirectory $OMDirectory - } - - # Validate the type can be loaded. - $null = Get-OMType -TypeName $TypeName -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Update proxy setting for vss http client - [Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler]::DefaultWebProxy = $WebProxy - - # Update client certificate setting for vss http client - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - [Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings]$Settings = [Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings]::Default.Clone() - - if ($ClientCert) { - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance.ClientCertificates.Add($ClientCert) - - $Settings.ClientCertificateManager = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance - } - - # Skip SSL server certificate validation - [bool]$SkipCertValidation = (Get-TaskVariable -Name Agent.SkipCertValidation -AsBool) -or $IgnoreSslError - if ($SkipCertValidation) { - if ($Settings.GetType().GetProperty('ServerCertificateValidationCallback')) { - Write-Verbose "Ignore any SSL server certificate validation errors."; - $Settings.ServerCertificateValidationCallback = [VstsTaskSdk.VstsHttpHandlerSettings]::UnsafeSkipServerCertificateValidation - } - else { - # OMDirectory has older version of Microsoft.VisualStudio.Services.Common.dll - Write-Verbose "The version of 'Microsoft.VisualStudio.Services.Common.dll' does not support skip SSL server certificate validation." - } - } - - # Try to construct the HTTP client. - Write-Verbose "Constructing HTTP client." - try { - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } catch { - # Rethrow if the exception is not due to Newtonsoft.Json DLL not found. - if ($_.Exception.InnerException -isnot [System.IO.FileNotFoundException] -or - $_.Exception.InnerException.FileName -notlike 'Newtonsoft.Json, *') { - - throw - } - - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Test if the Newtonsoft.Json DLL exists in the OM directory. - $newtonsoftDll = [System.IO.Path]::Combine($OMDirectory, "Newtonsoft.Json.dll") - Write-Verbose "Testing file path: '$newtonsoftDll'" - if (!(Test-Path -LiteralPath $newtonsoftDll -PathType Leaf)) { - Write-Verbose 'Not found. Rethrowing exception.' - throw - } - - # Add a binding redirect and try again. Parts of the Dev15 preview SDK have a - # dependency on the 6.0.0.0 Newtonsoft.Json DLL, while other parts reference - # the 8.0.0.0 Newtonsoft.Json DLL. - Write-Verbose "Adding assembly resolver." - $onAssemblyResolve = [System.ResolveEventHandler] { - param($sender, $e) - - if ($e.Name -like 'Newtonsoft.Json, *') { - Write-Verbose "Resolving '$($e.Name)'" - return [System.Reflection.Assembly]::LoadFrom($newtonsoftDll) - } - - Write-Verbose "Unable to resolve assembly name '$($e.Name)'" - return $null - } - [System.AppDomain]::CurrentDomain.add_AssemblyResolve($onAssemblyResolve) - try { - # Try again to construct the HTTP client. - Write-Verbose "Trying again to construct the HTTP client." - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } finally { - # Unregister the assembly resolver. - Write-Verbose "Removing assemlby resolver." - [System.AppDomain]::CurrentDomain.remove_AssemblyResolve($onAssemblyResolve) - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VstsTaskSdk.VstsWebProxy - -.DESCRIPTION -Gets an instance of a VstsTaskSdk.VstsWebProxy that has same proxy configuration as Build/Release agent. - -VstsTaskSdk.VstsWebProxy implement System.Net.IWebProxy interface. - -.EXAMPLE -$webProxy = Get-VstsWebProxy -$webProxy.GetProxy(New-Object System.Uri("https://github.com/Microsoft/vsts-task-lib")) -#> -function Get-WebProxy { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports proxy - Assert-Agent -Minimum '2.105.7' - - $proxyUrl = Get-TaskVariable -Name Agent.ProxyUrl - $proxyUserName = Get-TaskVariable -Name Agent.ProxyUserName - $proxyPassword = Get-TaskVariable -Name Agent.ProxyPassword - $proxyBypassListJson = Get-TaskVariable -Name Agent.ProxyBypassList - [string[]]$ProxyBypassList = ConvertFrom-Json -InputObject $ProxyBypassListJson - - return New-Object -TypeName VstsTaskSdk.VstsWebProxy -ArgumentList @($proxyUrl, $proxyUserName, $proxyPassword, $proxyBypassList) - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a client certificate for current connected TFS instance - -.DESCRIPTION -Gets an instance of a X509Certificate2 that is the client certificate Build/Release agent used. - -.EXAMPLE -$x509cert = Get-ClientCertificate -WebRequestHandler.ClientCertificates.Add(x509cert) -#> -function Get-ClientCertificate { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports client certificate - Assert-Agent -Minimum '2.122.0' - - [string]$clientCert = Get-TaskVariable -Name Agent.ClientCertArchive - [string]$clientCertPassword = Get-TaskVariable -Name Agent.ClientCertPassword - - if ($clientCert -and (Test-Path -LiteralPath $clientCert -PathType Leaf)) { - return New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($clientCert, $clientCertPassword) - } - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -######################################## -# Private functions. -######################################## -function Get-OMType { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [ValidateSet('ExtendedClient', 'WebApi')] - [Parameter(Mandatory = $true)] - [string]$OMKind, - - [string]$OMDirectory, - - [switch]$Require) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Try to load the type. - $errorRecord = $null - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - # Store the error record. - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - - # Build a list of candidate DLL file paths from the namespace. - $dllPaths = @( ) - $namespace = $TypeName - while ($namespace.LastIndexOf('.') -gt 0) { - # Trim the next segment from the namespace. - $namespace = $namespace.SubString(0, $namespace.LastIndexOf('.')) - - # Derive potential DLL file paths based on the namespace and OM kind (i.e. extended client vs web API). - if ($OMKind -eq 'ExtendedClient') { - if ($namespace -like 'Microsoft.TeamFoundation.*') { - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } else { - if ($namespace -like 'Microsoft.TeamFoundation.*' -or - $namespace -like 'Microsoft.VisualStudio.Services' -or - $namespace -like 'Microsoft.VisualStudio.Services.*') { - - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.WebApi.dll") - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } - } - - foreach ($dllPath in $dllPaths) { - # Check whether the DLL exists. - Write-Verbose "Testing leaf path: '$dllPath'" - if (!(Test-Path -PathType Leaf -LiteralPath "$dllPath")) { - Write-Verbose "Not found." - continue - } - - # Load the DLL. - Write-Verbose "Loading assembly: $dllPath" - try { - Add-Type -LiteralPath $dllPath - } catch { - # Write the information to the verbose stream and proceed to attempt to load the requested type. - # - # The requested type may successfully load now. For example, the type used with the 14.0 Web API for the - # federated credential (VssOAuthCredential) resides in Microsoft.VisualStudio.Services.Client.dll. Even - # though loading the DLL results in a ReflectionTypeLoadException when Microsoft.ServiceBus.dll (approx 3.75mb) - # is not present, enough types are loaded to use the VssOAuthCredential federated credential with the Web API - # HTTP clients. - Write-Verbose "$($_.Exception.GetType().FullName): $($_.Exception.Message)" - if ($_.Exception -is [System.Reflection.ReflectionTypeLoadException]) { - for ($i = 0 ; $i -lt $_.Exception.LoaderExceptions.Length ; $i++) { - $loaderException = $_.Exception.LoaderExceptions[$i] - Write-Verbose "LoaderExceptions[$i]: $($loaderException.GetType().FullName): $($loaderException.Message)" - } - } - } - - # Try to load the type. - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - } - - # Check whether to propagate the error. - if ($Require) { - Write-Error $errorRecord - } - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson b/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson deleted file mode 100644 index 7871c36..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agentversion {0} oder höher ist erforderlich.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Der Containerpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "\"{0}\"-Dienstendpunkt-Anmeldeinformationen", - "loc.messages.PSLIB_EndpointUrl0": "\"{0}\"-Dienstendpunkt-URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Fehler beim Aufzählen von Unterverzeichnissen für den folgenden Pfad: \"{0}\"", - "loc.messages.PSLIB_FileNotFound0": "Die Datei wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Input0": "\"{0}\"-Eingabe", - "loc.messages.PSLIB_InvalidPattern0": "Ungültiges Muster: \"{0}\"", - "loc.messages.PSLIB_LeafPathNotFound0": "Der Blattpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Fehler bei der Normalisierung bzw. Erweiterung des Pfads. Die Pfadlänge wurde vom Kernel32-Subsystem nicht zurückgegeben für: \"{0}\"", - "loc.messages.PSLIB_PathNotFound0": "Der Pfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Der Prozess \"{0}\" wurde mit dem Code \"{1}\" beendet.", - "loc.messages.PSLIB_Required0": "Erforderlich: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Fehler beim Zeichenfolgenformat.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Der Zeichenfolgen-Ressourcenschlüssel wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "\"{0}\"-Taskvariable" -} \ No newline at end of file diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson b/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson deleted file mode 100644 index 66c17bc..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "File not found: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' input", - "loc.messages.PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Path not found: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "loc.messages.PSLIB_Required0": "Required: {0}", - "loc.messages.PSLIB_StringFormatFailed": "String format failed.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' task variable" -} \ No newline at end of file diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson b/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson deleted file mode 100644 index f5c9c23..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Se require la versión {0} o posterior del agente.", - "loc.messages.PSLIB_ContainerPathNotFound0": "No se encuentra la ruta de acceso del contenedor: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenciales del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "No se pudieron enumerar los subdirectorios de la ruta de acceso: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Archivo no encontrado: '{0}'", - "loc.messages.PSLIB_Input0": "Entrada '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Patrón no válido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "No se encuentra la ruta de acceso de la hoja: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "No se pudo normalizar o expandir la ruta de acceso. El subsistema Kernel32 no devolvió la longitud de la ruta de acceso para: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "No se encuentra la ruta de acceso: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "El proceso '{0}' finalizó con el código '{1}'.", - "loc.messages.PSLIB_Required0": "Se requiere: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Error de formato de cadena.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "No se encuentra la clave de recurso de la cadena: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tarea '{0}'" -} \ No newline at end of file diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson b/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson deleted file mode 100644 index 652870c..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "L'agent version {0} (ou une version ultérieure) est obligatoire.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Le chemin du conteneur est introuvable : '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Informations d'identification du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Échec de l'énumération des sous-répertoires pour le chemin : '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Fichier introuvable : {0}.", - "loc.messages.PSLIB_Input0": "Entrée '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Modèle non valide : '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Le chemin feuille est introuvable : '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Échec de la normalisation/l'expansion du chemin. La longueur du chemin n'a pas été retournée par le sous-système Kernel32 pour : '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Chemin introuvable : '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Le processus '{0}' s'est arrêté avec le code '{1}'.", - "loc.messages.PSLIB_Required0": "Obligatoire : {0}", - "loc.messages.PSLIB_StringFormatFailed": "Échec du format de la chaîne.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Clé de la ressource de type chaîne introuvable : '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tâche '{0}'" -} \ No newline at end of file diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson b/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson deleted file mode 100644 index 6aeb1df..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "È richiesta la versione dell'agente {0} o superiore.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Percorso del contenitore non trovato: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenziali dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "L'enumerazione delle sottodirectory per il percorso '{0}' non è riuscita", - "loc.messages.PSLIB_FileNotFound0": "File non trovato: '{0}'", - "loc.messages.PSLIB_Input0": "Input di '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Criterio non valido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Percorso foglia non trovato: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "La normalizzazione o l'espansione del percorso non è riuscita. Il sottosistema Kernel32 non ha restituito la lunghezza del percorso per '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Percorso non trovato: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Il processo '{0}' è stato terminato ed è stato restituito il codice '{1}'.", - "loc.messages.PSLIB_Required0": "Obbligatorio: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Errore nel formato della stringa.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "La chiave della risorsa stringa non è stata trovata: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variabile dell'attività '{0}'" -} \ No newline at end of file diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson b/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson deleted file mode 100644 index 6b07ab6..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "バージョン {0} 以降のエージェントが必要です。", - "loc.messages.PSLIB_ContainerPathNotFound0": "コンテナーのパスが見つかりません: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' サービス エンドポイントの資格情報", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' サービス エンドポイントの URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "パス '{0}' のサブディレクトリを列挙できませんでした", - "loc.messages.PSLIB_FileNotFound0": "ファイルが見つかりません: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 入力", - "loc.messages.PSLIB_InvalidPattern0": "使用できないパターンです: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "リーフ パスが見つかりません: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "パスの正規化/展開に失敗しました。Kernel32 サブシステムからパス '{0}' の長さが返されませんでした", - "loc.messages.PSLIB_PathNotFound0": "パスが見つかりません: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "プロセス '{0}' がコード '{1}' で終了しました。", - "loc.messages.PSLIB_Required0": "必要: {0}", - "loc.messages.PSLIB_StringFormatFailed": "文字列のフォーマットに失敗しました。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "文字列のリソース キーが見つかりません: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' タスク変数" -} \ No newline at end of file diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson b/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson deleted file mode 100644 index e58cbdc..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "에이전트 버전 {0} 이상이 필요합니다.", - "loc.messages.PSLIB_ContainerPathNotFound0": "컨테이너 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 서비스 끝점 자격 증명", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 서비스 끝점 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "경로에 대해 하위 디렉터리를 열거하지 못함: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "{0} 파일을 찾을 수 없습니다.", - "loc.messages.PSLIB_Input0": "'{0}' 입력", - "loc.messages.PSLIB_InvalidPattern0": "잘못된 패턴: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "경로 정규화/확장에 실패했습니다. 다음에 대해 Kernel32 subsystem에서 경로 길이를 반환하지 않음: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "'{1}' 코드로 '{0}' 프로세스가 종료되었습니다.", - "loc.messages.PSLIB_Required0": "필수: {0}", - "loc.messages.PSLIB_StringFormatFailed": "문자열을 포맷하지 못했습니다.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "문자열 리소스 키를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 작업 변수" -} \ No newline at end of file diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson b/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson deleted file mode 100644 index 38dd69d..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Требуется версия агента {0} или более поздняя.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Путь к контейнеру не найден: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "Учетные данные конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EndpointUrl0": "URL-адрес конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Сбой перечисления подкаталогов для пути: \"{0}\".", - "loc.messages.PSLIB_FileNotFound0": "Файл не найден: \"{0}\".", - "loc.messages.PSLIB_Input0": "Входные данные \"{0}\".", - "loc.messages.PSLIB_InvalidPattern0": "Недопустимый шаблон: \"{0}\".", - "loc.messages.PSLIB_LeafPathNotFound0": "Путь к конечному объекту не найден: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Сбой нормализации и расширения пути. Длина пути не была возвращена подсистемой Kernel32 для: \"{0}\".", - "loc.messages.PSLIB_PathNotFound0": "Путь не найден: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Процесс \"{0}\" завершил работу с кодом \"{1}\".", - "loc.messages.PSLIB_Required0": "Требуется: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Сбой формата строки.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Ключ ресурса строки не найден: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "Переменная задачи \"{0}\"" -} \ No newline at end of file diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson b/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson deleted file mode 100644 index 1d333de..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理版本 {0} 或更高版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路径:“{0}”", - "loc.messages.PSLIB_EndpointAuth0": "“{0}”服务终结点凭据", - "loc.messages.PSLIB_EndpointUrl0": "“{0}”服务终结点 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "枚举路径的子目录失败:“{0}”", - "loc.messages.PSLIB_FileNotFound0": "找不到文件: {0}。", - "loc.messages.PSLIB_Input0": "“{0}”输入", - "loc.messages.PSLIB_InvalidPattern0": "无效的模式:“{0}”", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到叶路径:“{0}”", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路径规范化/扩展失败。路径长度不是由“{0}”的 Kernel32 子系统返回的", - "loc.messages.PSLIB_PathNotFound0": "找不到路径:“{0}”", - "loc.messages.PSLIB_Process0ExitedWithCode1": "过程“{0}”已退出,代码为“{1}”。", - "loc.messages.PSLIB_Required0": "必需: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字符串格式无效。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字符串资源关键字:“{0}”", - "loc.messages.PSLIB_TaskVariable0": "“{0}”任务变量" -} \ No newline at end of file diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson b/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson deleted file mode 100644 index 512509b..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理程式版本 {0} 或更新的版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路徑: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 服務端點認證", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 服務端點 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "為路徑列舉子目錄失敗: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "找不到檔案: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 輸入", - "loc.messages.PSLIB_InvalidPattern0": "模式無效: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到分葉路徑: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路徑正規化/展開失敗。Kernel32 子系統未傳回 '{0}' 的路徑長度", - "loc.messages.PSLIB_PathNotFound0": "找不到路徑: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "處理序 '{0}' 以返回碼 '{1}' 結束。", - "loc.messages.PSLIB_Required0": "必要項: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字串格式失敗。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字串資源索引鍵: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 工作變數" -} \ No newline at end of file diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/ToolFunctions.ps1 b/Tasks/pack/ps_modules/VstsTaskSdk/ToolFunctions.ps1 deleted file mode 100644 index 0e82595..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/ToolFunctions.ps1 +++ /dev/null @@ -1,123 +0,0 @@ -<# -.SYNOPSIS -Asserts the agent version is at least the specified minimum. - -.PARAMETER Minimum -Minimum version - must be 2.104.1 or higher. -#> -function Assert-Agent { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [version]$Minimum) - - if (([version]'2.104.1').CompareTo($Minimum) -ge 1) { - Write-Error "Assert-Agent requires the parameter to be 2.104.1 or higher." - return - } - - $agent = Get-TaskVariable -Name 'agent.version' - if (!$agent -or $Minimum.CompareTo([version]$agent) -ge 1) { - Write-Error (Get-LocString -Key 'PSLIB_AgentVersion0Required' -ArgumentList $Minimum) - } -} - -<# -.SYNOPSIS -Asserts that a path exists. Throws if the path does not exist. - -.PARAMETER PassThru -True to return the path. -#> -function Assert-Path { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath, - [Microsoft.PowerShell.Commands.TestPathType]$PathType = [Microsoft.PowerShell.Commands.TestPathType]::Any, - [switch]$PassThru) - - if ($PathType -eq [Microsoft.PowerShell.Commands.TestPathType]::Any) { - Write-Verbose "Asserting path exists: '$LiteralPath'" - } else { - Write-Verbose "Asserting $("$PathType".ToLowerInvariant()) path exists: '$LiteralPath'" - } - - if (Test-Path -LiteralPath $LiteralPath -PathType $PathType) { - if ($PassThru) { - return $LiteralPath - } - - return - } - - $resourceKey = switch ($PathType) { - ([Microsoft.PowerShell.Commands.TestPathType]::Container) { "PSLIB_ContainerPathNotFound0" ; break } - ([Microsoft.PowerShell.Commands.TestPathType]::Leaf) { "PSLIB_LeafPathNotFound0" ; break } - default { "PSLIB_PathNotFound0" } - } - - throw (Get-LocString -Key $resourceKey -ArgumentList $LiteralPath) -} - -<# -.SYNOPSIS -Executes an external program. - -.DESCRIPTION -Executes an external program and waits for the process to exit. - -After calling this command, the exit code of the process can be retrieved from the variable $LASTEXITCODE. - -.PARAMETER Encoding -This parameter not required for most scenarios. Indicates how to interpret the encoding from the external program. An example use case would be if an external program outputs UTF-16 XML and the output needs to be parsed. - -.PARAMETER RequireExitCodeZero -Indicates whether to write an error to the error pipeline if the exit code is not zero. -#> -function Invoke-Tool { # TODO: RENAME TO INVOKE-PROCESS? - [CmdletBinding()] - param( - [ValidatePattern('^[^\r\n]*$')] - [Parameter(Mandatory = $true)] - [string]$FileName, - [ValidatePattern('^[^\r\n]*$')] - [Parameter()] - [string]$Arguments, - [string]$WorkingDirectory, - [System.Text.Encoding]$Encoding, - [switch]$RequireExitCodeZero) - - Trace-EnteringInvocation $MyInvocation - $isPushed = $false - $originalEncoding = $null - try { - if ($Encoding) { - $originalEncoding = [System.Console]::OutputEncoding - [System.Console]::OutputEncoding = $Encoding - } - - if ($WorkingDirectory) { - Push-Location -LiteralPath $WorkingDirectory -ErrorAction Stop - $isPushed = $true - } - - $FileName = $FileName.Replace('"', '').Replace("'", "''") - Write-Host "##[command]""$FileName"" $Arguments" - Invoke-Expression "& '$FileName' --% $Arguments" - Write-Verbose "Exit code: $LASTEXITCODE" - if ($RequireExitCodeZero -and $LASTEXITCODE -ne 0) { - Write-Error (Get-LocString -Key PSLIB_Process0ExitedWithCode1 -ArgumentList ([System.IO.Path]::GetFileName($FileName)), $LASTEXITCODE) - } - } finally { - if ($originalEncoding) { - [System.Console]::OutputEncoding = $originalEncoding - } - - if ($isPushed) { - Pop-Location - } - - Trace-LeavingInvocation $MyInvocation - } -} diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/TraceFunctions.ps1 b/Tasks/pack/ps_modules/VstsTaskSdk/TraceFunctions.ps1 deleted file mode 100644 index b8e084b..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/TraceFunctions.ps1 +++ /dev/null @@ -1,139 +0,0 @@ -<# -.SYNOPSIS -Writes verbose information about the invocation being entered. - -.DESCRIPTION -Used to trace verbose information when entering a function/script. Writes an entering message followed by a short description of the invocation. Additionally each bound parameter and unbound argument is also traced. - -.PARAMETER Parameter -Wildcard pattern to control which bound parameters are traced. -#> -function Trace-EnteringInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo, - [string[]]$Parameter = '*') - - Write-Verbose "Entering $(Get-InvocationDescription $InvocationInfo)." - $OFS = ", " - if ($InvocationInfo.BoundParameters.Count -and $Parameter.Count) { - if ($Parameter.Count -eq 1 -and $Parameter[0] -eq '*') { - # Trace all parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - } - } else { - # Trace matching parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - foreach ($p in $Parameter) { - if ($key -like $p) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - break - } - } - } - } - } - - # Trace all unbound arguments. - if (@($InvocationInfo.UnboundArguments).Count) { - for ($i = 0 ; $i -lt $InvocationInfo.UnboundArguments.Count ; $i++) { - Write-Verbose " args[$i]: '$($InvocationInfo.UnboundArguments[$i])'" - } - } -} - -<# -.SYNOPSIS -Writes verbose information about the invocation being left. - -.DESCRIPTION -Used to trace verbose information when leaving a function/script. Writes a leaving message followed by a short description of the invocation. -#> -function Trace-LeavingInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo) - - Write-Verbose "Leaving $(Get-InvocationDescription $InvocationInfo)." -} - -<# -.SYNOPSIS -Writes verbose information about paths. - -.DESCRIPTION -Writes verbose information about the paths. The paths are sorted and a the common root is written only once, followed by each relative path. - -.PARAMETER PassThru -Indicates whether to return the sorted paths. -#> -function Trace-Path { - [CmdletBinding()] - param( - [string[]]$Path, - [switch]$PassThru) - - if ($Path.Count -eq 0) { - Write-Verbose "No paths." - if ($PassThru) { - $Path - } - } elseif ($Path.Count -eq 1) { - Write-Verbose "Path: $($Path[0])" - if ($PassThru) { - $Path - } - } else { - # Find the greatest common root. - $sorted = $Path | Sort-Object - $firstPath = $sorted[0].ToCharArray() - $lastPath = $sorted[-1].ToCharArray() - $commonEndIndex = 0 - $j = if ($firstPath.Length -lt $lastPath.Length) { $firstPath.Length } else { $lastPath.Length } - for ($i = 0 ; $i -lt $j ; $i++) { - if ($firstPath[$i] -eq $lastPath[$i]) { - if ($firstPath[$i] -eq '\') { - $commonEndIndex = $i - } - } else { - break - } - } - - if ($commonEndIndex -eq 0) { - # No common root. - Write-Verbose "Paths:" - foreach ($p in $sorted) { - Write-Verbose " $p" - } - } else { - Write-Verbose "Paths: $($Path[0].Substring(0, $commonEndIndex + 1))" - foreach ($p in $sorted) { - Write-Verbose " $($p.Substring($commonEndIndex + 1))" - } - } - - if ($PassThru) { - $sorted - } - } -} - -######################################## -# Private functions. -######################################## -function Get-InvocationDescription { - [CmdletBinding()] - param([System.Management.Automation.InvocationInfo]$InvocationInfo) - - if ($InvocationInfo.MyCommand.Path) { - $InvocationInfo.MyCommand.Path - } elseif ($InvocationInfo.MyCommand.Name) { - $InvocationInfo.MyCommand.Name - } else { - $InvocationInfo.MyCommand.CommandType - } -} diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/VstsTaskSdk.dll b/Tasks/pack/ps_modules/VstsTaskSdk/VstsTaskSdk.dll deleted file mode 100644 index 54938ab05180ddaf77cf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@@M+Ao<_- zTJ<*aIe)M4x%zcPo;e*jhT|#q9?2=PugJgekDl<9dh6e&6yF`ar4mto>Tbqa^N9R^ J$g$t$@(XnB12_Nx diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 b/Tasks/pack/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 deleted file mode 100644 index a1bf2c6..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 +++ /dev/null @@ -1,168 +0,0 @@ -[CmdletBinding()] -param( - [ValidateNotNull()] - [Parameter()] - [hashtable]$ModuleParameters = @{ }) - -if ($host.Name -ne 'ConsoleHost') { - Write-Warning "VstsTaskSdk is designed for use with powershell.exe (ConsoleHost). Output may be different when used with other hosts." -} - -# Private module variables. -[bool]$script:nonInteractive = "$($ModuleParameters['NonInteractive'])" -eq 'true' -Write-Verbose "NonInteractive: $script:nonInteractive" - -# VstsTaskSdk.dll contains the TerminationException and NativeMethods for handle long path -# We used to do inline C# in this powershell module -# However when csc compile the inline C#, it will hit process env block size limit since it's not use unicode to encode env -# To solve the env block size problem, we choose to put all inline C# into an assembly VstsTaskSdk.dll, signing it, package with the PS modules. -Write-Verbose "Loading compiled helper $PSScriptRoot\VstsTaskSdk.dll." -Add-Type -LiteralPath $PSScriptRoot\VstsTaskSdk.dll - -# Import/export functions. -. "$PSScriptRoot\FindFunctions.ps1" -. "$PSScriptRoot\InputFunctions.ps1" -. "$PSScriptRoot\LegacyFindFunctions.ps1" -. "$PSScriptRoot\LocalizationFunctions.ps1" -. "$PSScriptRoot\LoggingCommandFunctions.ps1" -. "$PSScriptRoot\LongPathFunctions.ps1" -. "$PSScriptRoot\ServerOMFunctions.ps1" -. "$PSScriptRoot\ToolFunctions.ps1" -. "$PSScriptRoot\TraceFunctions.ps1" -. "$PSScriptRoot\OutFunctions.ps1" # Load the out functions after all of the other functions are loaded. -Export-ModuleMember -Function @( - # Find functions. - 'Find-Match' - 'New-FindOptions' - 'New-MatchOptions' - 'Select-Match' - # Input functions. - 'Get-Endpoint' - 'Get-SecureFileTicket' - 'Get-SecureFileName' - 'Get-Input' - 'Get-TaskVariable' - 'Get-TaskVariableInfo' - 'Set-TaskVariable' - # Legacy find functions. - 'Find-Files' - # Localization functions. - 'Get-LocString' - 'Import-LocStrings' - # Logging command functions. - 'Write-AddAttachment' - 'Write-AddBuildTag' - 'Write-AssociateArtifact' - 'Write-LogDetail' - 'Write-PrependPath' - 'Write-SetEndpoint' - 'Write-SetProgress' - 'Write-SetResult' - 'Write-SetSecret' - 'Write-SetVariable' - 'Write-TaskDebug' - 'Write-TaskError' - 'Write-TaskVerbose' - 'Write-TaskWarning' - 'Write-UpdateBuildNumber' - 'Write-UpdateReleaseName' - 'Write-UploadArtifact' - 'Write-UploadBuildLog' - 'Write-UploadFile' - 'Write-UploadSummary' - # Out functions. - 'Out-Default' - # Server OM functions. - 'Get-AssemblyReference' - 'Get-TfsClientCredentials' - 'Get-TfsService' - 'Get-VssCredentials' - 'Get-VssHttpClient' - # Tool functions. - 'Assert-Agent' - 'Assert-Path' - 'Invoke-Tool' - # Trace functions. - 'Trace-EnteringInvocation' - 'Trace-LeavingInvocation' - 'Trace-Path' - # Proxy functions - 'Get-WebProxy' - # Client cert functions - 'Get-ClientCertificate' - ) - -# Override Out-Default globally. -$null = New-Item -Force -Path "function:\global:Out-Default" -Value (Get-Command -CommandType Function -Name Out-Default -ListImported) -New-Alias -Name Out-Default -Value "global:Out-Default" -Scope global - -# Perform some initialization in a script block to enable merging the pipelines. -$scriptText = @" -# Load the SDK resource strings. -Import-LocStrings "$PSScriptRoot\lib.json" - -# Load the module that contains ConvertTo-SecureString. -if (!(Get-Module -Name Microsoft.PowerShell.Security)) { - Write-Verbose "Importing the module 'Microsoft.PowerShell.Security'." - Import-Module -Name Microsoft.PowerShell.Security 2>&1 | - ForEach-Object { - if (`$_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose `$_.Exception.Message - } else { - ,`$_ - } - } -} -"@ -. ([scriptblock]::Create($scriptText)) 2>&1 3>&1 4>&1 5>&1 | Out-Default - -# Create Invoke-VstsTaskScript in a special way so it is not bound to the module. -# Otherwise calling the task script block would run within the module context. -# -# An alternative way to solve the problem is to close the script block (i.e. closure). -# However, that introduces a different problem. Closed script blocks are created within -# a dynamic module. Each module gets it's own session state separate from the global -# session state. When running in a regular script context, Import-Module calls import -# the target module into the global session state. When running in a module context, -# Import-Module calls import the target module into the caller module's session state. -# -# The goal of a task may include executing ad-hoc scripts. Therefore, task scripts -# should run in regular script context. The end user specifying an ad-hoc script expects -# the module import rules to be consistent with the default behavior (i.e. imported -# into the global session state). -$null = New-Item -Force -Path "function:\global:Invoke-VstsTaskScript" -Value ([scriptblock]::Create(@' - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [scriptblock]$ScriptBlock) - - try { - $global:ErrorActionPreference = 'Stop' - - # Initialize the environment. - $vstsModule = Get-Module -Name VstsTaskSdk - Write-Verbose "$($vstsModule.Name) $($vstsModule.Version) commit $($vstsModule.PrivateData.PSData.CommitHash)" 4>&1 | Out-Default - & $vstsModule Initialize-Inputs 4>&1 | Out-Default - - # Remove the local variable before calling the user's script. - Remove-Variable -Name vstsModule - - # Call the user's script. - $ScriptBlock | - ForEach-Object { - # Remove the scriptblock variable before calling it. - Remove-Variable -Name ScriptBlock - & $_ 2>&1 3>&1 4>&1 5>&1 | Out-Default - } - } catch [VstsTaskSdk.TerminationException] { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Task script terminated." 4>&1 | Out-Default - } catch { - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Caught exception from task script." 4>&1 | Out-Default - $_ | Out-Default - Write-Host "##vso[task.complete result=Failed]" - } -'@)) diff --git a/Tasks/pack/ps_modules/VstsTaskSdk/lib.json b/Tasks/pack/ps_modules/VstsTaskSdk/lib.json deleted file mode 100644 index ecdc9d0..0000000 --- a/Tasks/pack/ps_modules/VstsTaskSdk/lib.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "messages": { - "PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "PSLIB_FileNotFound0": "File not found: '{0}'", - "PSLIB_Input0": "'{0}' input", - "PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "PSLIB_PathNotFound0": "Path not found: '{0}'", - "PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "PSLIB_Required0": "Required: {0}", - "PSLIB_StringFormatFailed": "String format failed.", - "PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "PSLIB_TaskVariable0": "'{0}' task variable" - } -} diff --git a/Tasks/pack/task.json b/Tasks/pack/task.json deleted file mode 100644 index cf47a2e..0000000 --- a/Tasks/pack/task.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "id": "0b0412d5-5314-4d5f-a013-e328ee76bb3a", - "name": "choco-pack", - "friendlyName": "Chocolatey - Pack", - "description": "Runs Chocolatey Pack with specified parameters", - "author": "gep13", - "helpMarkDown": "", - "category": "Build", - "visibility": [ - "Build", - "Release" - ], - "demands": [], - "version": { - "Major": "0", - "Minor": "1", - "Patch": "0" - }, - "minimumAgentVersion": "1.83.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced options", - "isExpanded": false - } - ], - "instanceNameFormat": "Chocolatey Pack", - "inputs": [ - { - "name": "operation", - "type": "radio", - "label": "How many nuspec files?", - "required": true, - "defaultValue": "single", - "helpMarkDown": "Choose whether to pack a single nuspec file, or multiple.", - "options": { - "single": "One nuspec file", - "multiple": "Multiple nuspec files" - } - }, - { - "name": "workingDirectory", - "type": "string", - "label": "Working Directory", - "defaultValue": "", - "required": true, - "helpMarkDown": "The location of the nuspec file(s)." - }, - { - "name": "nuspecFileName", - "type": "string", - "label": "NuSpec File Name.", - "defaultValue": "", - "required": true, - "helpMarkDown": "The file name of the NuSpec File that should be packed.", - "visibleRule": "operation=single" - }, - { - "name": "version", - "type": "string", - "label": "Version", - "defaultValue": "", - "required": false, - "helpMarkDown": "The version you would like to insert into the package." - }, - { - "name": "outputDirectory", - "type": "string", - "label": "Output Directory", - "defaultValue": "", - "required": false, - "helpMarkDown": "The location where the generated nupkg(s) should be placed." - }, - { - "name": "pushPackages", - "type": "boolean", - "label": "Push generated nupkg(s).", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Should the generated nupkg(s) also be pushed to the " - }, - { - "name": "source", - "type": "string", - "label": "Source", - "defaultValue": "https://push.chocolatey.org/", - "required": false, - "helpMarkDown": "The source to push the generated nupkg(s) to.", - "visibleRule": "pushPackages=true" - }, - { - "name": "apikey", - "type": "string", - "label": "API Key", - "defaultValue": "", - "required": false, - "helpMarkDown": "The API Key that should be used to push the nupkg(s) to specified source.", - "visibleRule": "pushPackages=true" - }, - { - "name": "force", - "type": "boolean", - "label": "Force.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Force the operation to continue.", - "visibleRule": "pushPackages=true" - }, - { - "name": "timeout", - "type": "string", - "label": "Timeout", - "defaultValue": "", - "required": false, - "helpMarkDown": "The time, in seconds, to allow a package push to occur before timing out.", - "visibleRule": "pushPackages=true" - }, - { - "name": "debug", - "type": "boolean", - "label": "Show debug messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "", - "groupname": "advanced" - }, - { - "name": "verbose", - "type": "boolean", - "label": "Show verbose messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very verbose messaging, avoid using under normal circumstances.", - "groupname": "advanced" - }, - { - "name": "trace", - "type": "boolean", - "label": "Show trace messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very, very verbose trace messaging. Avoid except when needing super low-level .NET Framework debugging.", - "groupname": "advanced" - }, - { - "name": "extraArguments", - "type": "string", - "label": "Extra Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional Chocolatey Arguments that are not catered for above.", - "groupname": "advanced" - } - ], - "execution": { - "PowerShell3": { - "target": "$(currentDirectory)\\pack.ps1", - "argumentFormat": "", - "workingDirectory": "$(currentDirectory)" - } - } -} \ No newline at end of file diff --git a/Tasks/push/icon.png b/Tasks/push/icon.png deleted file mode 100755 index ab05af71592b547960e4fcf1f5d527bece1fd5c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2656 zcmY*bc|6o>7yp&5nTW_XQyF7lXG|nABl{9z2o*AxVaQ;NEtRov*Bv(hrKxhFDVoxG4buln4OW*xUDC0l*�JDw&pneYk z1ijO)x9RU=K|Y38`~cu6-+>(hvL6Tmz@aMyD_gRysfoI?x0fQ$#oNhMG04kj9}NH+ zLF)UVmn#_u3-Y=_^ivN)!+#;v_v3>!0uK8HA$y|Xwx;GV9dD8=Ohr*y5edhDVKA5m z$px>D)z$x}egA}pyOYU2>Ig(&V4z~)8AWfB8$wAcFl({#nSu%ZdvvL%wT5M?USLS_lI1E z!e!!CZ!DnQx^^6xYv``$x*8e0n?0JCAsf>Qp7;U$7p&xazpS*`uL}azE7*a)DF3yb z^|}*gs<}`RziUQipLJfTsO8;iDp#orfd#)y-ea2Hp74-%+fWJ}o#Y5f)-&-fEfDP$ zjBd_<`3RY7KHG0m<=clw-ExluH{nEEj`KgR&3A`(MjQ#fCoR-GydGP}JEI?&QRFeO z@$E~f$S0P!i@NZFjLsv+iRk{V7^{oSiF~{KF7|{B$M2L3=HrV!lUwbWO%?3dOEayL z+$qxbu;cK^iJ($5z9$}DPp>d`QF^ZJ3IV|DZkcciX zew_MP0jJHyC}WQqlEe*-b{hvWVjHQw99iinXZdgmdINR#R=HIfSSbgI<#{vQh=Pik zF6T`JJsg|6J$P%GIvs>t$doa^89m@2tlsU&iKmW*2RhfF8`K1%B~())^hDT^pu21* zsi&mQha@=(zBeaqdQBBwm3ant;kM7u%)1>H*+Ha;bCk>4QaB}`E#poO)*5o3QUctF z!RbP@dh-WfYecr!px@L68vu3uW^TfF6BvcjedGtHYTDOK`Y?$vQQlVXPUU^hQHhcV zk31};rmeq!5ak(Z%#}^Z%ipeVnvxF*b0M&9edD1YcN?f>@3mt^Ve-8s=WPm}FcxHr~*67epRryKBr7m&(c;u*wp@#xTIEJ^BsApC)1! zrknNyjmpv3s5lYaCnAx$=IGOBpt}@pE&1l$^obZbtYL^rUl3_sUziCY>&)0hxdhFA-^v;UqjC~%l**cdnZbtWjz*|QGEG?J^TT)92CQLs`ymq0j7d4VJ zR0yfyTnh4)w?j`QKm|RbP(6#cA0cmjK`I=5)a|RJA8)C$v&&zZyd5iB^1Sh4(tfJ-OxONjdxdT(RDI9dXdvS0~U-I}u=u|Ogy3mq?uHkj4 zn?QSY{&XZn56{L3^9+wZhWg|~dqKRP&v2+c?#%qm>s(m%&{}DoYZThnAuekxmRP_v zo1<{TeakXFI}60nz4iiFC)9Tmqf9nC%IO$e-4TUI;0mLh-j zQLr41J|YehYI5OI`_@NoHlzD?aNb91=<9e4Ey;q;%(Y6g~nm{l+;F0(40p<{nF z>wcIBih?#=Uo-gDpTTn~l^|iFdOhERaair#%8cl}Wqppp9%8C)!L_msmh-7sSJ$au zwooOK-<{W5&PJZDhd-M}zxlK4y_LbHeTxE9(XO^rg{Qtw%ODc@`L)mpPD$at^AwMx zZM1Pfjq1Y{)dZcP`G)BvddP=(!1NTPx25UgVTtC6X@<8!WJT!5i=j|k-|wdS%Bc*v zi^*^zqSeu8c#$-AG#d+?&9_GeiqMdbK5QqW%C-P_Z -function Find-Match { - [CmdletBinding()] - param( - [Parameter()] - [string]$DefaultRoot, - [Parameter()] - [string[]]$Pattern, - $FindOptions, - $MatchOptions) - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Apply defaults for parameters and trace. - if (!$DefaultRoot) { - $DefaultRoot = Get-TaskVariable -Name 'System.DefaultWorkingDirectory' -Default (Get-Location).Path - } - - Write-Verbose "DefaultRoot: '$DefaultRoot'" - if (!$FindOptions) { - $FindOptions = New-FindOptions -FollowSpecifiedSymbolicLink -FollowSymbolicLinks - } - - Trace-FindOptions -Options $FindOptions - if (!$MatchOptions) { - $MatchOptions = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $MatchOptions - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Normalize slashes for root dir. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - $results = @{ } - $originalMatchOptions = $MatchOptions - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $MatchOptions = Copy-MatchOptions -Options $originalMatchOptions - - # Skip comments. - if (!$MatchOptions.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $MatchOptions.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$MatchOptions.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$MatchOptions.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $MatchOptions.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $MatchOptions.NoNegate = $true - $MatchOptions.FlipNegate = $false - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Expand braces - required to accurately interpret findPath. - $expanded = $null - $preExpanded = $pat - if ($MatchOptions.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - } - - # Set NoBrace. - $MatchOptions.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - if ($isIncludePattern) { - # Determine the findPath. - $findInfo = Get-FindInfoFromPattern -DefaultRoot $DefaultRoot -Pattern $pat -MatchOptions $MatchOptions - $findPath = $findInfo.FindPath - Write-Verbose "FindPath: '$findPath'" - - if (!$findPath) { - Write-Verbose "Skipping empty path." - continue - } - - # Perform the find. - Write-Verbose "StatOnly: '$($findInfo.StatOnly)'" - [string[]]$findResults = @( ) - if ($findInfo.StatOnly) { - # Simply stat the path - all path segments were used to build the path. - if ((Test-Path -LiteralPath $findPath)) { - $findResults += $findPath - } - } else { - $findResults = Get-FindResult -Path $findPath -Options $FindOptions - } - - Write-Verbose "Found $($findResults.Count) paths." - - # Apply the pattern. - Write-Verbose "Applying include pattern." - if ($findInfo.AdjustedPattern -ne $pat) { - Write-Verbose "AdjustedPattern: '$($findInfo.AdjustedPattern)'" - $pat = $findInfo.AdjustedPattern - } - - $matchResults = [Minimatch.Minimatcher]::Filter( - $findResults, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results[$matchResult.ToUpperInvariant()] = $matchResult - } - - Write-Verbose "$matchCount matches" - } else { - # Check if basename only and MatchBase=true. - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $pat) -and - ($pat -replace '\\', '/').IndexOf('/') -lt 0) { - - # Do not root the pattern. - Write-Verbose "MatchBase and basename only." - } else { - # Root the exclude pattern. - $pat = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - # Apply the pattern. - Write-Verbose 'Applying exclude pattern.' - $matchResults = [Minimatch.Minimatcher]::Filter( - [string[]]$results.Values, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results.Remove($matchResult.ToUpperInvariant()) - } - - Write-Verbose "$matchCount matches" - } - } - } - - $finalResult = @( $results.Values | Sort-Object ) - Write-Verbose "$($finalResult.Count) final results" - return $finalResult - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Creates FindOptions for use with Find-VstsMatch. - -.DESCRIPTION -Creates FindOptions for use with Find-VstsMatch. Contains switches to control whether to follow symlinks. - -.PARAMETER FollowSpecifiedSymbolicLink -Indicates whether to traverse descendants if the specified path is a symbolic link directory. Does not cause nested symbolic link directories to be traversed. - -.PARAMETER FollowSymbolicLinks -Indicates whether to traverse descendants of symbolic link directories. -#> -function New-FindOptions { - [CmdletBinding()] - param( - [switch]$FollowSpecifiedSymbolicLink, - [switch]$FollowSymbolicLinks) - - return New-Object psobject -Property @{ - FollowSpecifiedSymbolicLink = $FollowSpecifiedSymbolicLink.IsPresent - FollowSymbolicLinks = $FollowSymbolicLinks.IsPresent - } -} - -<# -.SYNOPSIS -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. - -.DESCRIPTION -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. Contains switches to control which pattern matching options are applied. -#> -function New-MatchOptions { - [CmdletBinding()] - param( - [switch]$Dot, - [switch]$FlipNegate, - [switch]$MatchBase, - [switch]$NoBrace, - [switch]$NoCase, - [switch]$NoComment, - [switch]$NoExt, - [switch]$NoGlobStar, - [switch]$NoNegate, - [switch]$NoNull) - - return New-Object psobject -Property @{ - Dot = $Dot.IsPresent - FlipNegate = $FlipNegate.IsPresent - MatchBase = $MatchBase.IsPresent - NoBrace = $NoBrace.IsPresent - NoCase = $NoCase.IsPresent - NoComment = $NoComment.IsPresent - NoExt = $NoExt.IsPresent - NoGlobStar = $NoGlobStar.IsPresent - NoNegate = $NoNegate.IsPresent - NoNull = $NoNull.IsPresent - } -} - -<# -.SYNOPSIS -Applies match patterns against a list of files. - -.DESCRIPTION -Applies match patterns to a list of paths. Supports interleaved exclude patterns. - -.PARAMETER ItemPath -Array of paths. - -.PARAMETER Pattern -Patterns to apply. Supports interleaved exclude patterns. - -.PARAMETER PatternRoot -Default root to apply to unrooted patterns. Not applied to basename-only patterns when Options.MatchBase is true. - -.PARAMETER Options -When the Options parameter is not specified, defaults to (New-VstsMatchOptions -Dot -NoBrace -NoCase). -#> -function Select-Match { - [CmdletBinding()] - param( - [Parameter()] - [string[]]$ItemPath, - [Parameter()] - [string[]]$Pattern, - [Parameter()] - [string]$PatternRoot, - $Options) - - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - if (!$Options) { - $Options = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $Options - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Hashtable to keep track of matches. - $map = @{ } - - $originalOptions = $Options - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $Options = Copy-MatchOptions -Options $originalOptions - - # Skip comments. - if (!$Options.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $Options.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$Options.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$Options.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $Options.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $Options.NoNegate = $true - $Options.FlipNegate = $false - - # Expand braces - required to accurately root patterns. - $expanded = $null - $preExpanded = $pat - if ($Options.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $Options)) - } - - # Set NoBrace. - $Options.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - # Root the pattern when all of the following conditions are true: - if ($PatternRoot -and # PatternRoot is supplied - !(Test-Rooted -Path $pat) -and # AND pattern is not rooted - # # AND MatchBase=false or not basename only - (!$Options.MatchBase -or ($pat -replace '\\', '/').IndexOf('/') -ge 0)) { - - # Root the include pattern. - $pat = Get-RootedPattern -DefaultRoot $PatternRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - if ($isIncludePattern) { - # Apply the pattern. - Write-Verbose 'Applying include pattern against original list.' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map[$matchResult] = $true - } - - Write-Verbose "$matchCount matches" - } else { - # Apply the pattern. - Write-Verbose 'Applying exclude pattern against original list' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map.Remove($matchResult) - } - - Write-Verbose "$matchCount matches" - } - } - } - - # return a filtered version of the original list (preserves order and prevents duplication) - $result = $ItemPath | Where-Object { $map[$_] } - Write-Verbose "$($result.Count) final results" - $result - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -################################################################################ -# Private functions. -################################################################################ - -function Copy-MatchOptions { - [CmdletBinding()] - param($Options) - - return New-Object psobject -Property @{ - Dot = $Options.Dot -eq $true - FlipNegate = $Options.FlipNegate -eq $true - MatchBase = $Options.MatchBase -eq $true - NoBrace = $Options.NoBrace -eq $true - NoCase = $Options.NoCase -eq $true - NoComment = $Options.NoComment -eq $true - NoExt = $Options.NoExt -eq $true - NoGlobStar = $Options.NoGlobStar -eq $true - NoNegate = $Options.NoNegate -eq $true - NoNull = $Options.NoNull -eq $true - } -} - -function ConvertTo-MinimatchOptions { - [CmdletBinding()] - param($Options) - - $opt = New-Object Minimatch.Options - $opt.AllowWindowsPaths = $true - $opt.Dot = $Options.Dot -eq $true - $opt.FlipNegate = $Options.FlipNegate -eq $true - $opt.MatchBase = $Options.MatchBase -eq $true - $opt.NoBrace = $Options.NoBrace -eq $true - $opt.NoCase = $Options.NoCase -eq $true - $opt.NoComment = $Options.NoComment -eq $true - $opt.NoExt = $Options.NoExt -eq $true - $opt.NoGlobStar = $Options.NoGlobStar -eq $true - $opt.NoNegate = $Options.NoNegate -eq $true - $opt.NoNull = $Options.NoNull -eq $true - return $opt -} - -function ConvertTo-NormalizedSeparators { - [CmdletBinding()] - param([string]$Path) - - # Convert slashes. - $Path = "$Path".Replace('/', '\') - - # Remove redundant slashes. - $isUnc = $Path -match '^\\\\+[^\\]' - $Path = $Path -replace '\\\\+', '\' - if ($isUnc) { - $Path = '\' + $Path - } - - return $Path -} - -function Get-FindInfoFromPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern, - [Parameter(Mandatory = $true)] - $MatchOptions) - - if (!$MatchOptions.NoBrace) { - throw "Get-FindInfoFromPattern expected MatchOptions.NoBrace to be true." - } - - # For the sake of determining the find path, pretend NoCase=false. - $MatchOptions = Copy-MatchOptions -Options $MatchOptions - $MatchOptions.NoCase = $false - - # Check if basename only and MatchBase=true - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $Pattern) -and - ($Pattern -replace '\\', '/').IndexOf('/') -lt 0) { - - return New-Object psobject -Property @{ - AdjustedPattern = $Pattern - FindPath = $DefaultRoot - StatOnly = $false - } - } - - # The technique applied by this function is to use the information on the Minimatch object determine - # the findPath. Minimatch breaks the pattern into path segments, and exposes information about which - # segments are literal vs patterns. - # - # Note, the technique currently imposes a limitation for drive-relative paths with a glob in the - # first segment, e.g. C:hello*/world. It's feasible to overcome this limitation, but is left unsolved - # for now. - $minimatchObj = New-Object Minimatch.Minimatcher($Pattern, (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # The "set" field is a two-dimensional enumerable of parsed path segment info. The outer enumerable should only - # contain one item, otherwise something went wrong. Brace expansion can result in multiple items in the outer - # enumerable, but that should be turned off by the time this function is reached. - # - # Note, "set" is a private field in the .NET implementation but is documented as a feature in the nodejs - # implementation. The .NET implementation is a port and is by a different author. - $setFieldInfo = $minimatchObj.GetType().GetField('set', 'Instance,NonPublic') - [object[]]$set = $setFieldInfo.GetValue($minimatchObj) - if ($set.Count -ne 1) { - throw "Get-FindInfoFromPattern expected Minimatch.Minimatcher(...).set.Count to be 1. Actual: '$($set.Count)'" - } - - [string[]]$literalSegments = @( ) - [object[]]$parsedSegments = $set[0] - foreach ($parsedSegment in $parsedSegments) { - if ($parsedSegment.GetType().Name -eq 'LiteralItem') { - # The item is a LiteralItem when the original input for the path segment does not contain any - # unescaped glob characters. - $literalSegments += $parsedSegment.Source; - continue - } - - break; - } - - # Join the literal segments back together. Minimatch converts '\' to '/' on Windows, then squashes - # consequetive slashes, and finally splits on slash. This means that UNC format is lost, but can - # be detected from the original pattern. - $joinedSegments = [string]::Join('/', $literalSegments) - if ($joinedSegments -and ($Pattern -replace '\\', '/').StartsWith('//')) { - $joinedSegments = '/' + $joinedSegments # restore UNC format - } - - # Determine the find path. - $findPath = '' - if ((Test-Rooted -Path $Pattern)) { # The pattern is rooted. - $findPath = $joinedSegments - } elseif ($joinedSegments) { # The pattern is not rooted, and literal segements were found. - $findPath = [System.IO.Path]::Combine($DefaultRoot, $joinedSegments) - } else { # The pattern is not rooted, and no literal segements were found. - $findPath = $DefaultRoot - } - - # Clean up the path. - if ($findPath) { - $findPath = [System.IO.Path]::GetDirectoryName(([System.IO.Path]::Combine($findPath, '_'))) # Hack to remove unnecessary trailing slash. - $findPath = ConvertTo-NormalizedSeparators -Path $findPath - } - - return New-Object psobject -Property @{ - AdjustedPattern = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $Pattern - FindPath = $findPath - StatOnly = $literalSegments.Count -eq $parsedSegments.Count - } -} - -function Get-FindResult { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - $Options) - - if (!(Test-Path -LiteralPath $Path)) { - Write-Verbose 'Path not found.' - return - } - - $Path = ConvertTo-NormalizedSeparators -Path $Path - - # Push the first item. - [System.Collections.Stack]$stack = New-Object System.Collections.Stack - $stack.Push((Get-Item -LiteralPath $Path)) - - $count = 0 - while ($stack.Count) { - # Pop the next item and yield the result. - $item = $stack.Pop() - $count++ - $item.FullName - - # Traverse. - if (($item.Attributes -band 0x00000010) -eq 0x00000010) { # Directory - if (($item.Attributes -band 0x00000400) -ne 0x00000400 -or # ReparsePoint - $Options.FollowSymbolicLinks -or - ($count -eq 1 -and $Options.FollowSpecifiedSymbolicLink)) { - - $childItems = @( Get-DirectoryChildItem -Path $Item.FullName -Force ) - [System.Array]::Reverse($childItems) - foreach ($childItem in $childItems) { - $stack.Push($childItem) - } - } - } - } -} - -function Get-RootedPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern) - - if ((Test-Rooted -Path $Pattern)) { - return $Pattern - } - - # Normalize root. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - # Escape special glob characters. - $DefaultRoot = $DefaultRoot -replace '(\[)(?=[^\/]+\])', '[[]' # Escape '[' when ']' follows within the path segment - $DefaultRoot = $DefaultRoot.Replace('?', '[?]') # Escape '?' - $DefaultRoot = $DefaultRoot.Replace('*', '[*]') # Escape '*' - $DefaultRoot = $DefaultRoot -replace '\+\(', '[+](' # Escape '+(' - $DefaultRoot = $DefaultRoot -replace '@\(', '[@](' # Escape '@(' - $DefaultRoot = $DefaultRoot -replace '!\(', '[!](' # Escape '!(' - - if ($DefaultRoot -like '[A-Z]:') { # e.g. C: - return "$DefaultRoot$Pattern" - } - - # Ensure root ends with a separator. - if (!$DefaultRoot.EndsWith('\')) { - $DefaultRoot = "$DefaultRoot\" - } - - return "$DefaultRoot$Pattern" -} - -function Test-Rooted { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - $Path = ConvertTo-NormalizedSeparators -Path $Path - return $Path.StartsWith('\') -or # e.g. \ or \hello or \\hello - $Path -like '[A-Z]:*' # e.g. C: or C:\hello -} - -function Trace-MatchOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "MatchOptions.Dot: '$($Options.Dot)'" - Write-Verbose "MatchOptions.FlipNegate: '$($Options.FlipNegate)'" - Write-Verbose "MatchOptions.MatchBase: '$($Options.MatchBase)'" - Write-Verbose "MatchOptions.NoBrace: '$($Options.NoBrace)'" - Write-Verbose "MatchOptions.NoCase: '$($Options.NoCase)'" - Write-Verbose "MatchOptions.NoComment: '$($Options.NoComment)'" - Write-Verbose "MatchOptions.NoExt: '$($Options.NoExt)'" - Write-Verbose "MatchOptions.NoGlobStar: '$($Options.NoGlobStar)'" - Write-Verbose "MatchOptions.NoNegate: '$($Options.NoNegate)'" - Write-Verbose "MatchOptions.NoNull: '$($Options.NoNull)'" -} - -function Trace-FindOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "FindOptions.FollowSpecifiedSymbolicLink: '$($FindOptions.FollowSpecifiedSymbolicLink)'" - Write-Verbose "FindOptions.FollowSymbolicLinks: '$($FindOptions.FollowSymbolicLinks)'" -} diff --git a/Tasks/push/ps_modules/VstsTaskSdk/InputFunctions.ps1 b/Tasks/push/ps_modules/VstsTaskSdk/InputFunctions.ps1 deleted file mode 100644 index 846492d..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/InputFunctions.ps1 +++ /dev/null @@ -1,493 +0,0 @@ -# Hash table of known variable info. The formatted env var name is the lookup key. -# -# The purpose of this hash table is to keep track of known variables. The hash table -# needs to be maintained for multiple reasons: -# 1) to distinguish between env vars and job vars -# 2) to distinguish between secret vars and public -# 3) to know the real variable name and not just the formatted env var name. -$script:knownVariables = @{ } -$script:vault = @{ } - -<# -.SYNOPSIS -Gets an endpoint. - -.DESCRIPTION -Gets an endpoint object for the specified endpoint name. The endpoint is returned as an object with three properties: Auth, Data, and Url. - -The Data property requires a 1.97 agent or higher. - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-Endpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the URL. - $description = Get-LocString -Key PSLIB_EndpointUrl0 -ArgumentList $Name - $key = "ENDPOINT_URL_$Name" - $url = Get-VaultValue -Description $description -Key $key -Require:$Require - - # Get the auth object. - $description = Get-LocString -Key PSLIB_EndpointAuth0 -ArgumentList $Name - $key = "ENDPOINT_AUTH_$Name" - if ($auth = (Get-VaultValue -Description $description -Key $key -Require:$Require)) { - $auth = ConvertFrom-Json -InputObject $auth - } - - # Get the data. - $description = "'$Name' service endpoint data" - $key = "ENDPOINT_DATA_$Name" - if ($data = (Get-VaultValue -Description $description -Key $key)) { - $data = ConvertFrom-Json -InputObject $data - } - - # Return the endpoint. - if ($url -or $auth -or $data) { - New-Object -TypeName psobject -Property @{ - Url = $url - Auth = $auth - Data = $data - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file ticket. - -.DESCRIPTION -Gets the secure file ticket that can be used to download the secure file contents. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileTicket { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_TICKET_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file name. - -.DESCRIPTION -Gets the name for a secure file. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_NAME_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets an input. - -.DESCRIPTION -Gets the value for the specified input name. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-Input { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - # Get the input from the vault. Splat the bound parameters hashtable. Splatting is required - # in order to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Name - $key = "INPUT_$($Name.Replace(' ', '_').ToUpperInvariant())" - Get-VaultValue @PSBoundParameters -Description $description -Key $key -} - -<# -.SYNOPSIS -Gets a task variable. - -.DESCRIPTION -Gets the value for the specified task variable. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-TaskVariable { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - $description = Get-LocString -Key PSLIB_TaskVariable0 -ArgumentList $Name - $variableKey = Get-VariableKey -Name $Name - if ($script:knownVariables.$variableKey.Secret) { - # Get secret variable. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $vaultKey = "SECRET_$variableKey" - Get-VaultValue @PSBoundParameters -Description $description -Key $vaultKey - } else { - # Get public variable. - $item = $null - $path = "Env:$variableKey" - if ((Test-Path -LiteralPath $path) -and ($item = Get-Item -LiteralPath $path).Value) { - # Intentionally empty. Value was successfully retrieved. - } elseif (!$script:nonInteractive) { - # The value wasn't found and the module is running in interactive dev mode. - # Prompt for the value. - Set-Item -LiteralPath $path -Value (Read-Host -Prompt $description) - if (Test-Path -LiteralPath $path) { - $item = Get-Item -LiteralPath $path - } - } - - # Get the converted value. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - Get-Value @PSBoundParameters -Description $description -Key $variableKey -Value $item.Value - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets all job variables available to the task. Requires 2.104.1 agent or higher. - -.DESCRIPTION -Gets a snapshot of the current state of all job variables available to the task. -Requires a 2.104.1 agent or higher for full functionality. - -Returns an array of objects with the following properties: - [string]Name - [string]Value - [bool]Secret - -Limitations on an agent prior to 2.104.1: - 1) The return value does not include all public variables. Only public variables - that have been added using setVariable are returned. - 2) The name returned for each secret variable is the formatted environment variable - name, not the actual variable name (unless it was set explicitly at runtime using - setVariable). -#> -function Get-TaskVariableInfo { - [CmdletBinding()] - param() - - foreach ($info in $script:knownVariables.Values) { - New-Object -TypeName psobject -Property @{ - Name = $info.Name - Value = Get-TaskVariable -Name $info.Name - Secret = $info.Secret - } - } -} - -<# -.SYNOPSIS -Sets a task variable. - -.DESCRIPTION -Sets a task variable in the current task context as well as in the current job context. This allows the task variable to retrieved by subsequent tasks within the same job. -#> -function Set-TaskVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret) - - # Once a secret always a secret. - $variableKey = Get-VariableKey -Name $Name - [bool]$Secret = $Secret -or $script:knownVariables.$variableKey.Secret - if ($Secret) { - $vaultKey = "SECRET_$variableKey" - if (!$Value) { - # Clear the secret. - Write-Verbose "Set $Name = ''" - $script:vault.Remove($vaultKey) - } else { - # Store the secret in the vault. - Write-Verbose "Set $Name = '********'" - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Set-Item -LiteralPath "Env:$variableKey" -Value '' - } else { - # Set the environment variable. - Write-Verbose "Set $Name = '$Value'" - Set-Item -LiteralPath "Env:$variableKey" -Value $Value - } - - # Store the metadata. - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $Secret - } - - # Persist the variable in the task context. - Write-SetVariable -Name $Name -Value $Value -Secret:$Secret -} - -######################################## -# Private functions. -######################################## -function Get-VaultValue { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - # Attempt to get the vault value. - $value = $null - if ($psCredential = $script:vault[$Key]) { - $value = $psCredential.GetNetworkCredential().Password - } elseif (!$script:nonInteractive) { - # The value wasn't found. Prompt for the value if running in interactive dev mode. - $value = Read-Host -Prompt $Description - if ($value) { - $script:vault[$Key] = New-Object System.Management.Automation.PSCredential( - $Key, - (ConvertTo-SecureString -String $value -AsPlainText -Force)) - } - } - - Get-Value -Value $value @PSBoundParameters -} - -function Get-Value { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [string]$Value, - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - $result = $Value - if ($result) { - if ($Key -like 'ENDPOINT_AUTH_*') { - Write-Verbose "$($Key): '********'" - } else { - Write-Verbose "$($Key): '$result'" - } - } else { - Write-Verbose "$Key (empty)" - - # Write error if required. - if ($Require) { - Write-Error "$(Get-LocString -Key PSLIB_Required0 $Description)" - return - } - - # Fallback to the default if provided. - if ($PSCmdlet.ParameterSetName -eq 'Default') { - $result = $Default - $OFS = ' ' - Write-Verbose " Defaulted to: '$result'" - } else { - $result = '' - } - } - - # Convert to bool if specified. - if ($AsBool) { - if ($result -isnot [bool]) { - $result = "$result" -in '1', 'true' - Write-Verbose " Converted to bool: $result" - } - - return $result - } - - # Convert to int if specified. - if ($AsInt) { - if ($result -isnot [int]) { - try { - $result = [int]"$result" - } catch { - $result = 0 - } - - Write-Verbose " Converted to int: $result" - } - - return $result - } - - return $result -} - -function Initialize-Inputs { - # Store endpoints, inputs, and secret variables in the vault. - foreach ($variable in (Get-ChildItem -Path Env:ENDPOINT_?*, Env:INPUT_?*, Env:SECRET_?*, Env:SECUREFILE_?*)) { - # Record the secret variable metadata. This is required by Get-TaskVariable to - # retrieve the value. In a 2.104.1 agent or higher, this metadata will be overwritten - # when $env:VSTS_SECRET_VARIABLES is processed. - if ($variable.Name -like 'SECRET_?*') { - $variableKey = $variable.Name.Substring('SECRET_'.Length) - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - # This is technically not the variable name (has underscores instead of dots), - # but it's good enough to make Get-TaskVariable work in a pre-2.104.1 agent - # where $env:VSTS_SECRET_VARIABLES is not defined. - Name = $variableKey - Secret = $true - } - } - - # Store the value in the vault. - $vaultKey = $variable.Name - if ($variable.Value) { - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $variable.Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Remove-Item -LiteralPath "Env:$($variable.Name)" - } - - # Record the public variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_PUBLIC_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_PUBLIC_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $false - } - } - - $env:VSTS_PUBLIC_VARIABLES = '' - } - - # Record the secret variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_SECRET_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_SECRET_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $true - } - } - - $env:VSTS_SECRET_VARIABLES = '' - } -} - -function Get-VariableKey { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name) - - if ($Name -ne 'agent.jobstatus') { - $Name = $Name.Replace('.', '_') - } - - $Name.ToUpperInvariant() -} diff --git a/Tasks/push/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 b/Tasks/push/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 deleted file mode 100644 index b4080ae..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 +++ /dev/null @@ -1,320 +0,0 @@ -<# -.SYNOPSIS -Finds files or directories. - -.DESCRIPTION -Finds files or directories using advanced pattern matching. - -.PARAMETER LiteralDirectory -Directory to search. - -.PARAMETER LegacyPattern -Proprietary pattern format. The LiteralDirectory parameter is used to root any unrooted patterns. - -Separate multiple patterns using ";". Escape actual ";" in the path by using ";;". -"?" indicates a wildcard that represents any single character within a path segment. -"*" indicates a wildcard that represents zero or more characters within a path segment. -"**" as the entire path segment indicates a recursive search. -"**" within a path segment indicates a recursive intersegment wildcard. -"+:" (can be omitted) indicates an include pattern. -"-:" indicates an exclude pattern. - -The result is from the command is a union of all the matches from the include patterns, minus the matches from the exclude patterns. - -.PARAMETER IncludeFiles -Indicates whether to include files in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER IncludeDirectories -Indicates whether to include directories in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER Force -Indicates whether to include hidden items. - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is?Match.txt" - -Given: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt -C:\Directory\IsNotMatch.txt - -Returns: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is*Match.txt" - -Given: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt -C:\Directory\NonMatch.txt - -Returns: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**\Match.txt" - -Given: -C:\Directory\Match.txt -C:\Directory\NotAMatch.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -Returns: -C:\Directory\Match.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**" - -Given: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -Returns: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Sub**Match.txt" - -Given: -C:\Directory\IsNotAMatch.txt -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\IsNot.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsNot.txt - -Returns: -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -#> -function Find-Files { - [CmdletBinding()] - param( - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$LiteralDirectory, - [Parameter(Mandatory = $true)] - [string]$LegacyPattern, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - # Note, due to subtle implementation details of Get-PathPrefix/Get-PathIterator, - # this function does not appear to be able to search the root of a drive and other - # cases where Path.GetDirectoryName() returns empty. More details in Get-PathPrefix. - - Trace-EnteringInvocation $MyInvocation - if (!$IncludeFiles -and !$IncludeDirectories) { - $IncludeFiles = $true - } - - $includePatterns = New-Object System.Collections.Generic.List[string] - $excludePatterns = New-Object System.Collections.Generic.List[System.Text.RegularExpressions.Regex] - $LegacyPattern = $LegacyPattern.Replace(';;', "`0") - foreach ($pattern in $LegacyPattern.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries)) { - $pattern = $pattern.Replace("`0", ';') - $isIncludePattern = Test-IsIncludePattern -Pattern ([ref]$pattern) - if ($LiteralDirectory -and !([System.IO.Path]::IsPathRooted($pattern))) { - # Use the root directory provided to make the pattern a rooted path. - $pattern = [System.IO.Path]::Combine($LiteralDirectory, $pattern) - } - - # Validate pattern does not end with a \. - if ($pattern[$pattern.Length - 1] -eq [System.IO.Path]::DirectorySeparatorChar) { - throw (Get-LocString -Key PSLIB_InvalidPattern0 -ArgumentList $pattern) - } - - if ($isIncludePattern) { - $includePatterns.Add($pattern) - } else { - $excludePatterns.Add((Convert-PatternToRegex -Pattern $pattern)) - } - } - - $count = 0 - foreach ($path in (Get-MatchingItems -IncludePatterns $includePatterns -ExcludePatterns $excludePatterns -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force)) { - $count++ - $path - } - - Write-Verbose "Total found: $count" - Trace-LeavingInvocation $MyInvocation -} - -######################################## -# Private functions. -######################################## -function Convert-PatternToRegex { - [CmdletBinding()] - param([string]$Pattern) - - $Pattern = [regex]::Escape($Pattern.Replace('\', '/')). # Normalize separators and regex escape. - Replace('/\*\*/', '((/.+/)|(/))'). # Replace directory globstar. - Replace('\*\*', '.*'). # Replace remaining globstars with a wildcard that can span directory separators. - Replace('\*', '[^/]*'). # Replace asterisks with a wildcard that cannot span directory separators. - # bug: should be '[^/]' instead of '.' - Replace('\?', '.') # Replace single character wildcards. - New-Object regex -ArgumentList "^$Pattern`$", ([System.Text.RegularExpressions.RegexOptions]::IgnoreCase) -} - -function Get-FileNameFilter { - [CmdletBinding()] - param([string]$Pattern) - - $index = $Pattern.LastIndexOf('\') - if ($index -eq -1 -or # Pattern does not contain a backslash. - !($Pattern = $Pattern.Substring($index + 1)) -or # Pattern ends in a backslash. - $Pattern.Contains('**')) # Last segment contains an inter-segment wildcard. - { - return '*' - } - - # bug? is this supposed to do substring? - return $Pattern -} - -function Get-MatchingItems { - [CmdletBinding()] - param( - [System.Collections.Generic.List[string]]$IncludePatterns, - [System.Collections.Generic.List[regex]]$ExcludePatterns, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - Trace-EnteringInvocation $MyInvocation - $allFiles = New-Object System.Collections.Generic.HashSet[string] - foreach ($pattern in $IncludePatterns) { - $pathPrefix = Get-PathPrefix -Pattern $pattern - $fileNameFilter = Get-FileNameFilter -Pattern $pattern - $patternRegex = Convert-PatternToRegex -Pattern $pattern - # Iterate over the directories and files under the pathPrefix. - Get-PathIterator -Path $pathPrefix -Filter $fileNameFilter -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force | - ForEach-Object { - # Normalize separators. - $normalizedPath = $_.Replace('\', '/') - # **/times/** will not match C:/fun/times because there isn't a trailing slash. - # So try both if including directories. - $alternatePath = "$normalizedPath/" # potential bug: it looks like this will result in a false - # positive if the item is a regular file and not a directory - - $isMatch = $false - if ($patternRegex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $patternRegex.IsMatch($alternatePath))) { - $isMatch = $true - - # Test whether the path should be excluded. - foreach ($regex in $ExcludePatterns) { - if ($regex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $regex.IsMatch($alternatePath))) { - $isMatch = $false - break - } - } - } - - if ($isMatch) { - $null = $allFiles.Add($_) - } - } - } - - Trace-Path -Path $allFiles -PassThru - Trace-LeavingInvocation $MyInvocation -} - -function Get-PathIterator { - [CmdletBinding()] - param( - [string]$Path, - [string]$Filter, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - if (!$Path) { - return - } - - # bug: this returns the dir without verifying whether exists - if ($IncludeDirectories) { - $Path - } - - Get-DirectoryChildItem -Path $Path -Filter $Filter -Force:$Force -Recurse | - ForEach-Object { - if ($_.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - if ($IncludeDirectories) { - $_.FullName - } - } elseif ($IncludeFiles) { - $_.FullName - } - } -} - -function Get-PathPrefix { - [CmdletBinding()] - param([string]$Pattern) - - # Note, unable to search root directories is a limitation due to subtleties of this function - # and downstream code in Get-PathIterator that short-circuits when the path prefix is empty. - # This function uses Path.GetDirectoryName() to determine the path prefix, which will yield - # empty in some cases. See the following examples of Path.GetDirectoryName() input => output: - # C:/ => - # C:/hello => C:\ - # C:/hello/ => C:\hello - # C:/hello/world => C:\hello - # C:/hello/world/ => C:\hello\world - # C: => - # C:hello => C: - # C:hello/ => C:hello - # / => - # /hello => \ - # /hello/ => \hello - # //hello => - # //hello/ => - # //hello/world => - # //hello/world/ => \\hello\world - - $index = $Pattern.IndexOfAny([char[]]@('*'[0], '?'[0])) - if ($index -eq -1) { - # If no wildcards are found, return the directory name portion of the path. - # If there is no directory name (file name only in pattern), this will return empty string. - return [System.IO.Path]::GetDirectoryName($Pattern) - } - - [System.IO.Path]::GetDirectoryName($Pattern.Substring(0, $index)) -} - -function Test-IsIncludePattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [ref]$Pattern) - - # Include patterns start with +: or anything except -: - # Exclude patterns start with -: - if ($Pattern.value.StartsWith("+:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $true - } elseif ($Pattern.value.StartsWith("-:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $false - } else { - # No prefix, so leave the string alone. - $true; - } -} diff --git a/Tasks/push/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 b/Tasks/push/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 deleted file mode 100644 index c31790c..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 +++ /dev/null @@ -1,150 +0,0 @@ -$script:resourceStrings = @{ } - -<# -.SYNOPSIS -Gets a localized resource string. - -.DESCRIPTION -Gets a localized resource string and optionally formats the string with arguments. - -If the format fails (due to a bad format string or incorrect expected arguments in the format string), then the format string is returned followed by each of the arguments (delimited by a space). - -If the lookup key is not found, then the lookup key is returned followed by each of the arguments (delimited by a space). - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-LocString { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true, Position = 1)] - [string]$Key, - [Parameter(Position = 2)] - [object[]]$ArgumentList = @( )) - - # Due to the dynamically typed nature of PowerShell, a single null argument passed - # to an array parameter is interpreted as a null array. - if ([object]::ReferenceEquals($null, $ArgumentList)) { - $ArgumentList = @( $null ) - } - - # Lookup the format string. - $format = '' - if (!($format = $script:resourceStrings[$Key])) { - # Warn the key was not found. Prevent recursion if the lookup key is the - # "string resource key not found" lookup key. - $resourceNotFoundKey = 'PSLIB_StringResourceKeyNotFound0' - if ($key -ne $resourceNotFoundKey) { - Write-Warning (Get-LocString -Key $resourceNotFoundKey -ArgumentList $Key) - } - - # Fallback to just the key itself if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $key } - - # Otherwise fallback to the key followed by the arguments. - $OFS = " " - return "$key $ArgumentList" - } - - # Return the string if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $format } - - try { - [string]::Format($format, $ArgumentList) - } catch { - Write-Warning (Get-LocString -Key 'PSLIB_StringFormatFailed') - $OFS = " " - "$format $ArgumentList" - } -} - -<# -.SYNOPSIS -Imports resource strings for use with Get-VstsLocString. - -.DESCRIPTION -Imports resource strings for use with Get-VstsLocString. The imported strings are stored in an internal resource string dictionary. Optionally, if a separate resource file for the current culture exists, then the localized strings from that file then imported (overlaid) into the same internal resource string dictionary. - -Resource strings from the SDK are prefixed with "PSLIB_". This prefix should be avoided for custom resource strings. - -.Parameter LiteralPath -JSON file containing resource strings. - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Imports strings from messages section in the JSON file. If a messages section is not defined, then no strings are imported. Example messages section: -{ - "messages": { - "Hello": "Hello you!", - "Hello0": "Hello {0}!" - } -} - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Overlays strings from an optional separate resource file for the current culture. - -Given the task variable System.Culture is set to 'de-DE'. This variable is set by the agent based on the current culture for the job. -Given the file Task.json contains: -{ - "messages": { - "GoodDay": "Good day!", - } -} -Given the file resources.resjson\de-DE\resources.resjson: -{ - "loc.messages.GoodDay": "Guten Tag!" -} - -The net result from the import command would be one new key-value pair added to the internal dictionary: Key = 'GoodDay', Value = 'Guten Tag!' -#> -function Import-LocStrings { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - # Validate the file exists. - if (!(Test-Path -LiteralPath $LiteralPath -PathType Leaf)) { - Write-Warning (Get-LocString -Key PSLIB_FileNotFound0 -ArgumentList $LiteralPath) - return - } - - # Load the json. - Write-Verbose "Loading resource strings from: $LiteralPath" - $count = 0 - if ($messages = (Get-Content -LiteralPath $LiteralPath -Encoding UTF8 | Out-String | ConvertFrom-Json).messages) { - # Add each resource string to the hashtable. - foreach ($member in (Get-Member -InputObject $messages -MemberType NoteProperty)) { - [string]$key = $member.Name - $script:resourceStrings[$key] = $messages."$key" - $count++ - } - } - - Write-Verbose "Loaded $count strings." - - # Get the culture. - $culture = Get-TaskVariable -Name "System.Culture" -Default "en-US" - - # Load the resjson. - $resjsonPath = "$([System.IO.Path]::GetDirectoryName($LiteralPath))\Strings\resources.resjson\$culture\resources.resjson" - if (Test-Path -LiteralPath $resjsonPath) { - Write-Verbose "Loading resource strings from: $resjsonPath" - $count = 0 - $resjson = Get-Content -LiteralPath $resjsonPath -Encoding UTF8 | Out-String | ConvertFrom-Json - foreach ($member in (Get-Member -Name loc.messages.* -InputObject $resjson -MemberType NoteProperty)) { - if (!($value = $resjson."$($member.Name)")) { - continue - } - - [string]$key = $member.Name.Substring('loc.messages.'.Length) - $script:resourceStrings[$key] = $value - $count++ - } - - Write-Verbose "Loaded $count strings." - } -} diff --git a/Tasks/push/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 b/Tasks/push/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 deleted file mode 100644 index 595a7d8..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 +++ /dev/null @@ -1,601 +0,0 @@ -$script:loggingCommandPrefix = '##vso[' -$script:loggingCommandEscapeMappings = @( # TODO: WHAT ABOUT "="? WHAT ABOUT "%"? - New-Object psobject -Property @{ Token = ';' ; Replacement = '%3B' } - New-Object psobject -Property @{ Token = "`r" ; Replacement = '%0D' } - New-Object psobject -Property @{ Token = "`n" ; Replacement = '%0A' } - New-Object psobject -Property @{ Token = "]" ; Replacement = '%5D' } -) -# TODO: BUG: Escape % ??? -# TODO: Add test to verify don't need to escape "=". - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddAttachment { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Type, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'addattachment' -Data $Path -Properties @{ - 'type' = $Type - 'name' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadSummary { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadsummary' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetEndpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [Parameter(Mandatory = $true)] - [string]$Field, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setendpoint' -Data $Value -Properties @{ - 'id' = $Id - 'field' = $Field - 'key' = $Key - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddBuildTag { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'addbuildtag' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AssociateArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - [string]$Type, - [hashtable]$Properties, - [switch]$AsOutput) - - $p = @{ } - if ($Properties) { - foreach ($key in $Properties.Keys) { - $p[$key] = $Properties[$key] - } - } - - $p['artifactname'] = $Name - $p['artifacttype'] = $Type - Write-LoggingCommand -Area 'artifact' -Event 'associate' -Data $Path -Properties $p -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-LogDetail { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [guid]$Id, - $ParentId, - [string]$Type, - [string]$Name, - $Order, - $StartTime, - $FinishTime, - $Progress, - [ValidateSet('Unknown', 'Initialized', 'InProgress', 'Completed')] - [Parameter()] - $State, - [ValidateSet('Succeeded', 'SucceededWithIssues', 'Failed', 'Cancelled', 'Skipped')] - [Parameter()] - $Result, - [string]$Message, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'logdetail' -Data $Message -Properties @{ - 'id' = $Id - 'parentid' = $ParentId - 'type' = $Type - 'name' = $Name - 'order' = $Order - 'starttime' = $StartTime - 'finishtime' = $FinishTime - 'progress' = $Progress - 'state' = $State - 'result' = $Result - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetProgress { - [CmdletBinding()] - param( - [ValidateRange(0, 100)] - [Parameter(Mandatory = $true)] - [int]$Percent, - [string]$CurrentOperation, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setprogress' -Data $CurrentOperation -Properties @{ - 'value' = $Percent - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetResult { - [CmdletBinding(DefaultParameterSetName = 'AsOutput')] - param( - [ValidateSet("Succeeded", "SucceededWithIssues", "Failed", "Cancelled", "Skipped")] - [Parameter(Mandatory = $true)] - [string]$Result, - [string]$Message, - [Parameter(ParameterSetName = 'AsOutput')] - [switch]$AsOutput, - [Parameter(ParameterSetName = 'DoNotThrow')] - [switch]$DoNotThrow) - - Write-LoggingCommand -Area 'task' -Event 'complete' -Data $Message -Properties @{ - 'result' = $Result - } -AsOutput:$AsOutput - if ($Result -eq 'Failed' -and !$AsOutput -and !$DoNotThrow) { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - throw (New-Object VstsTaskSdk.TerminationException($Message)) - } -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetSecret { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setsecret' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ - 'variable' = $Name - 'issecret' = $Secret - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskDebug { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskError { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type error @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskVerbose { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -AsVerbose -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskWarning { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type warning @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadFile { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadfile' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-PrependPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateBuildNumber { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'updatebuildnumber' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$ContainerFolder, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'artifact' -Event 'upload' -Data $Path -Properties @{ - 'containerfolder' = $ContainerFolder - 'artifactname' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadBuildLog { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'uploadlog' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateReleaseName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'release' -Event 'updatereleasename' -Data $Name -AsOutput:$AsOutput -} - -######################################## -# Private functions. -######################################## -function Format-LoggingCommandData { - [CmdletBinding()] - param([string]$Value, [switch]$Reverse) - - if (!$Value) { - return '' - } - - if (!$Reverse) { - foreach ($mapping in $script:loggingCommandEscapeMappings) { - $Value = $Value.Replace($mapping.Token, $mapping.Replacement) - } - } else { - for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { - $mapping = $script:loggingCommandEscapeMappings[$i] - $Value = $Value.Replace($mapping.Replacement, $mapping.Token) - } - } - - return $Value -} - -function Format-LoggingCommand { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Area, - [Parameter(Mandatory = $true)] - [string]$Event, - [string]$Data, - [hashtable]$Properties) - - # Append the preamble. - [System.Text.StringBuilder]$sb = New-Object -TypeName System.Text.StringBuilder - $null = $sb.Append($script:loggingCommandPrefix).Append($Area).Append('.').Append($Event) - - # Append the properties. - if ($Properties) { - $first = $true - foreach ($key in $Properties.Keys) { - [string]$value = Format-LoggingCommandData $Properties[$key] - if ($value) { - if ($first) { - $null = $sb.Append(' ') - $first = $false - } else { - $null = $sb.Append(';') - } - - $null = $sb.Append("$key=$value") - } - } - } - - # Append the tail and output the value. - $Data = Format-LoggingCommandData $Data - $sb.Append(']').Append($Data).ToString() -} - -function Write-LoggingCommand { - [CmdletBinding(DefaultParameterSetName = 'Parameters')] - param( - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Area, - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Event, - [Parameter(ParameterSetName = 'Parameters')] - [string]$Data, - [Parameter(ParameterSetName = 'Parameters')] - [hashtable]$Properties, - [Parameter(Mandatory = $true, ParameterSetName = 'Object')] - $Command, - [switch]$AsOutput) - - if ($PSCmdlet.ParameterSetName -eq 'Object') { - Write-LoggingCommand -Area $Command.Area -Event $Command.Event -Data $Command.Data -Properties $Command.Properties -AsOutput:$AsOutput - return - } - - $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties - if ($AsOutput) { - $command - } else { - Write-Host $command - } -} - -function Write-LogIssue { - [CmdletBinding()] - param( - [ValidateSet('warning', 'error')] - [Parameter(Mandatory = $true)] - [string]$Type, - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ - 'type' = $Type - 'code' = $ErrCode - 'sourcepath' = $SourcePath - 'linenumber' = $LineNumber - 'columnnumber' = $ColumnNumber - } - if ($AsOutput) { - return $command - } - - if ($Type -eq 'error') { - $foregroundColor = $host.PrivateData.ErrorForegroundColor - $backgroundColor = $host.PrivateData.ErrorBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Red - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.WarningForegroundColor - $backgroundColor = $host.PrivateData.WarningBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Yellow - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} - -function Write-TaskDebug_Internal { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsVerbose, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'debug' -Data $Message - if ($AsOutput) { - return $command - } - - if ($AsVerbose) { - $foregroundColor = $host.PrivateData.VerboseForegroundColor - $backgroundColor = $host.PrivateData.VerboseBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Cyan - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.DebugForegroundColor - $backgroundColor = $host.PrivateData.DebugBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::DarkGray - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host -Object $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} diff --git a/Tasks/push/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 b/Tasks/push/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 deleted file mode 100644 index d536111..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 +++ /dev/null @@ -1,205 +0,0 @@ -######################################## -# Private functions. -######################################## -function ConvertFrom-LongFormPath { - [CmdletBinding()] - param([string]$Path) - - if ($Path) { - if ($Path.StartsWith('\\?\UNC')) { - # E.g. \\?\UNC\server\share -> \\server\share - return $Path.Substring(1, '\?\UNC'.Length) - } elseif ($Path.StartsWith('\\?\')) { - # E.g. \\?\C:\directory -> C:\directory - return $Path.Substring('\\?\'.Length) - } - } - - return $Path -} -function ConvertTo-LongFormPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$longFormPath = Get-FullNormalizedPath -Path $Path - if ($longFormPath -and !$longFormPath.StartsWith('\\?')) { - if ($longFormPath.StartsWith('\\')) { - # E.g. \\server\share -> \\?\UNC\server\share - return "\\?\UNC$($longFormPath.Substring(1))" - } else { - # E.g. C:\directory -> \\?\C:\directory - return "\\?\$longFormPath" - } - } - - return $longFormPath -} - -# TODO: ADD A SWITCH TO EXCLUDE FILES, A SWITCH TO EXCLUDE DIRECTORIES, AND A SWITCH NOT TO FOLLOW REPARSE POINTS. -function Get-DirectoryChildItem { - [CmdletBinding()] - param( - [string]$Path, - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$Filter = "*", - [switch]$Force, - [VstsTaskSdk.FS.FindFlags]$Flags = [VstsTaskSdk.FS.FindFlags]::LargeFetch, - [VstsTaskSdk.FS.FindInfoLevel]$InfoLevel = [VstsTaskSdk.FS.FindInfoLevel]::Basic, - [switch]$Recurse) - - $stackOfDirectoryQueues = New-Object System.Collections.Stack - while ($true) { - $directoryQueue = New-Object System.Collections.Queue - $fileQueue = New-Object System.Collections.Queue - $findData = New-Object VstsTaskSdk.FS.FindData - $longFormPath = (ConvertTo-LongFormPath $Path) - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, $Filter), - $InfoLevel, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - # Output directories immediately. - if ($item.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - $item - # Append to the directory queue if recursive and default filter. - if ($Recurse -and $Filter -eq '*') { - $directoryQueue.Enqueue($item) - } - } else { - # Hold the files until all directories have been output. - $fileQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - - # If recursive and non-default filter, queue child directories. - if ($Recurse -and $Filter -ne '*') { - $findData = New-Object VstsTaskSdk.FS.FindData - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, '*'), - [VstsTaskSdk.FS.FindInfoLevel]::Basic, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Collect directories only. - if ($attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - $directoryQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - } - - # Output the files. - $fileQueue - - # Push the directory queue onto the stack if any directories were found. - if ($directoryQueue.Count) { $stackOfDirectoryQueues.Push($directoryQueue) } - - # Break out of the loop if no more directory queues to process. - if (!$stackOfDirectoryQueues.Count) { break } - - # Get the next path. - $directoryQueue = $stackOfDirectoryQueues.Peek() - $Path = $directoryQueue.Dequeue().FullName - - # Pop the directory queue if it's empty. - if (!$directoryQueue.Count) { $null = $stackOfDirectoryQueues.Pop() } - } -} - -function Get-FullNormalizedPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$outPath = $Path - [uint32]$bufferSize = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, 0, $null, $null) - [int]$lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($bufferSize -gt 0) { - $absolutePath = New-Object System.Text.StringBuilder([int]$bufferSize) - [uint32]$length = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, $bufferSize, $absolutePath, $null) - $lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($length -gt 0) { - $outPath = $absolutePath.ToString() - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - - if ($outPath.EndsWith('\') -and !$outPath.EndsWith(':\')) { - $outPath = $outPath.TrimEnd('\') - } - - $outPath -} \ No newline at end of file diff --git a/Tasks/push/ps_modules/VstsTaskSdk/Minimatch.dll b/Tasks/push/ps_modules/VstsTaskSdk/Minimatch.dll deleted file mode 100644 index 700ddc426e56b08270c9dcbb1ade8ded248f98d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18432 zcmeHvd3amZweLFTNJpa;OY%U-U;wdJ(iE<^0Dr1eX+yVU^ZP<}CerFP{^D;NRAvpy{Upu7qdr-p#QQK0A=EE z*j@RF!K$=fum`{t+x7$Dj;_a3@mYu3X*)Y&L6B{wNj$7;1D=Y{x>+@ezQumUhi%iz zO@BY1=+-!qPq<}p%U-3n%sDf*P#@P|Wa1p%m=FXEn4%bhfB`=%h9F>|Q;H!781527 z5HJu1N4U|d+S*S|6A90AA zkcdZ#{0VeB+M>~Zr~5WKIT}ZR`3qry$+MxwZUCkMpp6A zlnP^-LRYHRWuXsdbCpqNodtCbjqPxWp&AP6_LosJK9}1uT+)sn=XT(TXp2E@Xam*5 zPMKe?G$W3ZWHq@`VV5-rby7Zf6F~r;o>=af9Y2q?MO$37yJW9;db*vutEt&Mw*dE= z6Nqt_Zdh=pf1--OAk^fxTE;9o}~-pGxds~dH31h<)Z!q6++rR>xk zJz{CdPk> z$z#Au8q!>Hj%Z+R9P=r84Bjb~FXeL3Xo0zLOs`}dQz|)u0CZuT4B8JLU=+i3e#c`5 z>ZG(pT_9Nx6GD)ydrh0*w^_f-@2TGv@TlHf=&gTgwIVz!+!m#uGV59+jt@)=-B*K# zw%l|9bmPBpVLRIJo5lp}b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jbXtG5NDp!qZSh!nE9zb< ztrseM(26}cKP~cbpO68?i={JC27M@7HoJ{94MJiBHg6Jt^rDR+*ghhj8AZR?(joL5 zXRI^uV)Ov~6T{i41(qQF;Jm}5U)G~Wa1eUgi?-tx2;$Q%_HJ|9;1T4OOVPlT^5`4c zy-fVO9Xc%ZWemP8R`eKu26_g+E)%~_uQSuTGkx13bviM61?kHHSb7va|F7z)p8hw( X?dtd6e<)43|K{fYzxw~TJn(-2*CUr_ diff --git a/Tasks/push/ps_modules/VstsTaskSdk/OutFunctions.ps1 b/Tasks/push/ps_modules/VstsTaskSdk/OutFunctions.ps1 deleted file mode 100644 index fd898d6..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/OutFunctions.ps1 +++ /dev/null @@ -1,79 +0,0 @@ -# TODO: It would be better if the Out-Default function resolved the underlying Out-Default -# command in the begin block. This would allow for supporting other modules that override -# Out-Default. -$script:outDefaultCmdlet = $ExecutionContext.InvokeCommand.GetCmdlet("Microsoft.PowerShell.Core\Out-Default") - -######################################## -# Public functions. -######################################## -function Out-Default { - [CmdletBinding(ConfirmImpact = "Medium")] - param( - [Parameter(ValueFromPipeline = $true)] - [System.Management.Automation.PSObject]$InputObject) - - begin { - #Write-Host '[Entering Begin Out-Default]' - $__sp = { & $script:outDefaultCmdlet @PSBoundParameters }.GetSteppablePipeline() - $__sp.Begin($pscmdlet) - #Write-Host '[Leaving Begin Out-Default]' - } - - process { - #Write-Host '[Entering Process Out-Default]' - if ($_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose -Message 'Error record:' 4>&1 | Out-Default - Write-Verbose -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) 4>&1 | Out-Default - Write-Verbose -Message 'Script stack trace:' 4>&1 | Out-Default - Write-Verbose -Message "$($_.ScriptStackTrace)" 4>&1 | Out-Default - Write-Verbose -Message 'Exception:' 4>&1 | Out-Default - Write-Verbose -Message $_.Exception.ToString() 4>&1 | Out-Default - Write-TaskError -Message $_.Exception.Message - } elseif ($_ -is [System.Management.Automation.WarningRecord]) { - Write-TaskWarning -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) - } elseif ($_ -is [System.Management.Automation.VerboseRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskVerbose -Message $private:str - } - } elseif ($_ -is [System.Management.Automation.DebugRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskDebug -Message $private:str - } - } else { -# TODO: Consider using out-string here to control the width. As a security precaution it would actually be best to set it to max so wrapping doesn't interfere with secret masking. - $__sp.Process($_) - } - - #Write-Host '[Leaving Process Out-Default]' - } - - end { - #Write-Host '[Entering End Out-Default]' - $__sp.End() - #Write-Host '[Leaving End Out-Default]' - } -} - -######################################## -# Private functions. -######################################## -function Format-DebugMessage { - [CmdletBinding()] - param([psobject]$Object) - - $private:str = Out-String -InputObject $Object -Width 2147483647 - $private:str = Remove-TrailingNewLine $private:str - "$private:str".Replace("`r`n", "`n").Replace("`r", "`n").Split("`n"[0]) -} - -function Remove-TrailingNewLine { - [CmdletBinding()] - param($Str) - if ([object]::ReferenceEquals($Str, $null)) { - return $Str - } elseif ($Str.EndsWith("`r`n")) { - return $Str.Substring(0, $Str.Length - 2) - } else { - return $Str - } -} diff --git a/Tasks/push/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml b/Tasks/push/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml deleted file mode 100644 index 8c20388..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - Microsoft.PowerShell.Commands.PSRepositoryItemInfo - System.Management.Automation.PSCustomObject - System.Object - - - VstsTaskSdk - 0.11.0 - Module - VSTS Task SDK - Microsoft - VSTS - (c) 2016 Microsoft. All rights reserved. -

2018-05-21T03:27:56+01:00
- - - - https://github.com/Microsoft/vsts-task-lib - - - - System.Object[] - System.Array - System.Object - - - PSModule - - - - - System.Collections.Hashtable - System.Object - - - - DscResource - - - - - - - RoleCapability - - - - Cmdlet - - - - Workflow - - - - Command - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - Function - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - - - - - - - - https://www.powershellgallery.com/api/v2 - PSGallery - NuGet - - - System.Management.Automation.PSCustomObject - System.Object - - - (c) 2016 Microsoft. All rights reserved. - VSTS Task SDK - False - True - True - 12749 - 136204 - 71074 - 21/05/2018 03:27:56 +01:00 - 21/05/2018 03:27:56 +01:00 - 09/11/2018 22:20:20 +00:00 - PSModule PSFunction_Find-Match PSCommand_Find-Match PSFunction_New-FindOptions PSCommand_New-FindOptions PSFunction_New-MatchOptions PSCommand_New-MatchOptions PSFunction_Select-Match PSCommand_Select-Match PSFunction_Get-Endpoint PSCommand_Get-Endpoint PSFunction_Get-SecureFileTicket PSCommand_Get-SecureFileTicket PSFunction_Get-SecureFileName PSCommand_Get-SecureFileName PSFunction_Get-Input PSCommand_Get-Input PSFunction_Get-TaskVariable PSCommand_Get-TaskVariable PSFunction_Get-TaskVariableInfo PSCommand_Get-TaskVariableInfo PSFunction_Set-TaskVariable PSCommand_Set-TaskVariable PSFunction_Find-Files PSCommand_Find-Files PSFunction_Get-LocString PSCommand_Get-LocString PSFunction_Import-LocStrings PSCommand_Import-LocStrings PSFunction_Write-AddAttachment PSCommand_Write-AddAttachment PSFunction_Write-AddBuildTag PSCommand_Write-AddBuildTag PSFunction_Write-AssociateArtifact PSCommand_Write-AssociateArtifact PSFunction_Write-LogDetail PSCommand_Write-LogDetail PSFunction_Write-PrependPath PSCommand_Write-PrependPath PSFunction_Write-SetEndpoint PSCommand_Write-SetEndpoint PSFunction_Write-SetProgress PSCommand_Write-SetProgress PSFunction_Write-SetResult PSCommand_Write-SetResult PSFunction_Write-SetSecret PSCommand_Write-SetSecret PSFunction_Write-SetVariable PSCommand_Write-SetVariable PSFunction_Write-TaskDebug PSCommand_Write-TaskDebug PSFunction_Write-TaskError PSCommand_Write-TaskError PSFunction_Write-TaskVerbose PSCommand_Write-TaskVerbose PSFunction_Write-TaskWarning PSCommand_Write-TaskWarning PSFunction_Write-UpdateBuildNumber PSCommand_Write-UpdateBuildNumber PSFunction_Write-UpdateReleaseName PSCommand_Write-UpdateReleaseName PSFunction_Write-UploadArtifact PSCommand_Write-UploadArtifact PSFunction_Write-UploadBuildLog PSCommand_Write-UploadBuildLog PSFunction_Write-UploadFile PSCommand_Write-UploadFile PSFunction_Write-UploadSummary PSCommand_Write-UploadSummary PSFunction_Out-Default PSCommand_Out-Default PSFunction_Get-AssemblyReference PSCommand_Get-AssemblyReference PSFunction_Get-TfsClientCredentials PSCommand_Get-TfsClientCredentials PSFunction_Get-TfsService PSCommand_Get-TfsService PSFunction_Get-VssCredentials PSCommand_Get-VssCredentials PSFunction_Get-VssHttpClient PSCommand_Get-VssHttpClient PSFunction_Assert-Agent PSCommand_Assert-Agent PSFunction_Assert-Path PSCommand_Assert-Path PSFunction_Invoke-Tool PSCommand_Invoke-Tool PSFunction_Trace-EnteringInvocation PSCommand_Trace-EnteringInvocation PSFunction_Trace-LeavingInvocation PSCommand_Trace-LeavingInvocation PSFunction_Trace-Path PSCommand_Trace-Path PSFunction_Get-WebProxy PSCommand_Get-WebProxy PSFunction_Get-ClientCertificate PSCommand_Get-ClientCertificate PSIncludes_Function - False - 2018-11-09T22:20:20Z - 0.11.0 - Microsoft - false - Module - VstsTaskSdk.nuspec|FindFunctions.ps1|InputFunctions.ps1|LegacyFindFunctions.ps1|lib.json|LocalizationFunctions.ps1|LoggingCommandFunctions.ps1|LongPathFunctions.ps1|Minimatch.dll|OutFunctions.ps1|ServerOMFunctions.ps1|ToolFunctions.ps1|TraceFunctions.ps1|VstsTaskSdk.dll|VstsTaskSdk.psd1|VstsTaskSdk.psm1|Strings\resources.resjson\de-de\resources.resjson|Strings\resources.resjson\en-US\resources.resjson|Strings\resources.resjson\es-es\resources.resjson|Strings\resources.resjson\fr-fr\resources.resjson|Strings\resources.resjson\it-IT\resources.resjson|Strings\resources.resjson\ja-jp\resources.resjson|Strings\resources.resjson\ko-KR\resources.resjson|Strings\resources.resjson\ru-RU\resources.resjson|Strings\resources.resjson\zh-CN\resources.resjson|Strings\resources.resjson\zh-TW\resources.resjson - bbed04e2-4e8e-4089-90a2-58b858fed8d8 - 3.0 - Microsoft - - - /Users/gep13/github/gep13/chocolatey-azuredevops/Tasks/install/VstsTaskSdk/0.11.0 - - - diff --git a/Tasks/push/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 b/Tasks/push/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 deleted file mode 100644 index 177820b..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 +++ /dev/null @@ -1,659 +0,0 @@ -<# -.SYNOPSIS -Gets assembly reference information. - -.DESCRIPTION -Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK. - -Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario. - -Walks an assembly's references to determine all of it's dependencies. Also walks the references of the dependencies, and so on until all nested dependencies have been traversed. Dependencies are searched for in the directory of the specified assembly. NET Framework assemblies are omitted. - -See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER LiteralPath -Assembly to walk. - -.EXAMPLE -Get-VstsAssemblyReference -LiteralPath C:\nuget\microsoft.teamfoundationserver.client.14.102.0\lib\net45\Microsoft.TeamFoundation.Build2.WebApi.dll -#> -function Get-AssemblyReference { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - $ErrorActionPreference = 'Stop' - Write-Warning "Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK." - Write-Output '' - Write-Warning "Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario." - $directory = [System.IO.Path]::GetDirectoryName($LiteralPath) - $hashtable = @{ } - $queue = @( [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($LiteralPath).GetName() ) - while ($queue.Count) { - # Add a blank line between assemblies. - Write-Output '' - - # Pop. - $assemblyName = $queue[0] - $queue = @( $queue | Select-Object -Skip 1 ) - - # Attempt to find the assembly in the same directory. - $assembly = $null - $path = "$directory\$($assemblyName.Name).dll" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } else { - $path = "$directory\$($assemblyName.Name).exe" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } - } - - # Make sure the assembly full name matches, not just the file name. - if ($assembly -and $assembly.GetName().FullName -ne $assemblyName.FullName) { - $assembly = $null - } - - # Print the assembly. - if ($assembly) { - Write-Output $assemblyName.FullName - } else { - if ($assemblyName.FullName -eq 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed') { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) *** This is an expected condition when using the HTTP clients from the 15.x VSTS REST SDK. Use Get-VstsVssHttpClient to load the HTTP clients (which applies a binding redirect assembly resolver for Newtonsoft.Json). Otherwise you will need to manage the binding redirect yourself." - } else { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) ***" - } - - continue - } - - # Walk the references. - $refAssemblyNames = @( $assembly.GetReferencedAssemblies() ) - for ($i = 0 ; $i -lt $refAssemblyNames.Count ; $i++) { - $refAssemblyName = $refAssemblyNames[$i] - - # Skip framework assemblies. - $fxPaths = @( - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\$($refAssemblyName.Name).dll" - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\WPF\$($refAssemblyName.Name).dll" - ) - $fxPath = $fxPaths | - Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } | - Where-Object { [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($_).GetName().FullName -eq $refAssemblyName.FullName } - if ($fxPath) { - continue - } - - # Print the reference. - Write-Output " $($refAssemblyName.FullName)" - - # Add new references to the queue. - if (!$hashtable[$refAssemblyName.FullName]) { - $queue += $refAssemblyName - $hashtable[$refAssemblyName.FullName] = $true - } - } - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the TFS extended client SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -Refer to Get-VstsTfsService for a more simple to get a TFS service object. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -$credentials = Get-VstsTfsClientCredentials -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.VersionControl.Client.dll" -$tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection( - (Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require), - $credentials) -$versionControlServer = $tfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer]) -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsClientCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Validate the type can be found. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsClientCredentials' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Construct the credentials. - $credentials = New-Object Microsoft.TeamFoundation.Client.TfsClientCredentials($false) # Do not use default credentials. - $credentials.AllowInteractive = $false - $credentials.Federated = New-Object Microsoft.TeamFoundation.Client.OAuthTokenCredential([string]$endpoint.auth.parameters.AccessToken) - return $credentials - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a TFS extended client service. - -.DESCRIPTION -Gets an instance of an ITfsTeamProjectCollectionObject. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the service to get. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER Uri -URI to use when initializing the service. If not specified, defaults to System.TeamFoundationCollectionUri. - -.PARAMETER TfsClientCredentials -Credentials to use when initializing the service. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -.EXAMPLE -$versionControlServer = Get-VstsTfsService -TypeName Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsService { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $TfsClientCredentials) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Default the credentials. - if (!$TfsClientCredentials) { - $TfsClientCredentials = Get-TfsClientCredentials -OMDirectory $OMDirectory - } - - # Validate the project collection type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsTeamProjectCollection' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Load the project collection object. - $tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection($Uri, $TfsClientCredentials) - - # Validate the requested type can be loaded. - $type = Get-OMType -TypeName $TypeName -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Return the service object. - return $tfsTeamProjectCollection.GetService($type) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the VSTS REST SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project service build/release identity). - -Refer to Get-VstsVssHttpClient for a more simple to get a VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -# This example works using the 14.x .NET SDK. A Newtonsoft.Json 6.0 to 8.0 binding -# redirect may be required when working with the 15.x SDK. Or use Get-VstsVssHttpClient -# to avoid managing the binding redirect. -# -$vssCredentials = Get-VstsVssCredentials -$collectionUrl = New-Object System.Uri((Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require)) -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.Core.WebApi.dll" -$projectHttpClient = New-Object Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient($collectionUrl, $vssCredentials) -$projectHttpClient.GetProjects().Result -#> -function Get-VssCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Check if the VssOAuthAccessTokenCredential type is available. - if ((Get-OMType -TypeName 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory)) { - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential($endpoint.auth.parameters.AccessToken) - } else { - # Validate the fallback type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.Client.VssOAuthCredential($endpoint.auth.parameters.AccessToken) - } - - # Return the credentials. - return New-Object Microsoft.VisualStudio.Services.Common.VssCredentials( - (New-Object Microsoft.VisualStudio.Services.Common.WindowsCredential($false)), # Do not use default credentials. - $federatedCredential, - [Microsoft.VisualStudio.Services.Common.CredentialPromptType]::DoNotPrompt) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VSS HTTP client. - -.DESCRIPTION -Gets an instance of an VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the HTTP client to get. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -# .PARAMETER Uri -# URI to use when initializing the HTTP client. If not specified, defaults to System.TeamFoundationCollectionUri. - -# .PARAMETER VssCredentials -# Credentials to use when initializing the HTTP client. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -# .PARAMETER WebProxy -# WebProxy to use when initializing the HTTP client. If not specified, the default uses the proxy configuration agent current has. - -# .PARAMETER ClientCert -# ClientCert to use when initializing the HTTP client. If not specified, the default uses the client certificate agent current has. - -# .PARAMETER IgnoreSslError -# Skip SSL server certificate validation on all requests made by this HTTP client. If not specified, the default is to validate SSL server certificate. - -.EXAMPLE -$projectHttpClient = Get-VstsVssHttpClient -TypeName Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient -$projectHttpClient.GetProjects().Result -#> -function Get-VssHttpClient { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $VssCredentials, - - $WebProxy = (Get-WebProxy), - - $ClientCert = (Get-ClientCertificate), - - [switch]$IgnoreSslError) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Cast the URI. - [uri]$Uri = New-Object System.Uri($Uri) - - # Default the credentials. - if (!$VssCredentials) { - $VssCredentials = Get-VssCredentials -OMDirectory $OMDirectory - } - - # Validate the type can be loaded. - $null = Get-OMType -TypeName $TypeName -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Update proxy setting for vss http client - [Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler]::DefaultWebProxy = $WebProxy - - # Update client certificate setting for vss http client - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - [Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings]$Settings = [Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings]::Default.Clone() - - if ($ClientCert) { - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance.ClientCertificates.Add($ClientCert) - - $Settings.ClientCertificateManager = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance - } - - # Skip SSL server certificate validation - [bool]$SkipCertValidation = (Get-TaskVariable -Name Agent.SkipCertValidation -AsBool) -or $IgnoreSslError - if ($SkipCertValidation) { - if ($Settings.GetType().GetProperty('ServerCertificateValidationCallback')) { - Write-Verbose "Ignore any SSL server certificate validation errors."; - $Settings.ServerCertificateValidationCallback = [VstsTaskSdk.VstsHttpHandlerSettings]::UnsafeSkipServerCertificateValidation - } - else { - # OMDirectory has older version of Microsoft.VisualStudio.Services.Common.dll - Write-Verbose "The version of 'Microsoft.VisualStudio.Services.Common.dll' does not support skip SSL server certificate validation." - } - } - - # Try to construct the HTTP client. - Write-Verbose "Constructing HTTP client." - try { - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } catch { - # Rethrow if the exception is not due to Newtonsoft.Json DLL not found. - if ($_.Exception.InnerException -isnot [System.IO.FileNotFoundException] -or - $_.Exception.InnerException.FileName -notlike 'Newtonsoft.Json, *') { - - throw - } - - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Test if the Newtonsoft.Json DLL exists in the OM directory. - $newtonsoftDll = [System.IO.Path]::Combine($OMDirectory, "Newtonsoft.Json.dll") - Write-Verbose "Testing file path: '$newtonsoftDll'" - if (!(Test-Path -LiteralPath $newtonsoftDll -PathType Leaf)) { - Write-Verbose 'Not found. Rethrowing exception.' - throw - } - - # Add a binding redirect and try again. Parts of the Dev15 preview SDK have a - # dependency on the 6.0.0.0 Newtonsoft.Json DLL, while other parts reference - # the 8.0.0.0 Newtonsoft.Json DLL. - Write-Verbose "Adding assembly resolver." - $onAssemblyResolve = [System.ResolveEventHandler] { - param($sender, $e) - - if ($e.Name -like 'Newtonsoft.Json, *') { - Write-Verbose "Resolving '$($e.Name)'" - return [System.Reflection.Assembly]::LoadFrom($newtonsoftDll) - } - - Write-Verbose "Unable to resolve assembly name '$($e.Name)'" - return $null - } - [System.AppDomain]::CurrentDomain.add_AssemblyResolve($onAssemblyResolve) - try { - # Try again to construct the HTTP client. - Write-Verbose "Trying again to construct the HTTP client." - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } finally { - # Unregister the assembly resolver. - Write-Verbose "Removing assemlby resolver." - [System.AppDomain]::CurrentDomain.remove_AssemblyResolve($onAssemblyResolve) - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VstsTaskSdk.VstsWebProxy - -.DESCRIPTION -Gets an instance of a VstsTaskSdk.VstsWebProxy that has same proxy configuration as Build/Release agent. - -VstsTaskSdk.VstsWebProxy implement System.Net.IWebProxy interface. - -.EXAMPLE -$webProxy = Get-VstsWebProxy -$webProxy.GetProxy(New-Object System.Uri("https://github.com/Microsoft/vsts-task-lib")) -#> -function Get-WebProxy { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports proxy - Assert-Agent -Minimum '2.105.7' - - $proxyUrl = Get-TaskVariable -Name Agent.ProxyUrl - $proxyUserName = Get-TaskVariable -Name Agent.ProxyUserName - $proxyPassword = Get-TaskVariable -Name Agent.ProxyPassword - $proxyBypassListJson = Get-TaskVariable -Name Agent.ProxyBypassList - [string[]]$ProxyBypassList = ConvertFrom-Json -InputObject $ProxyBypassListJson - - return New-Object -TypeName VstsTaskSdk.VstsWebProxy -ArgumentList @($proxyUrl, $proxyUserName, $proxyPassword, $proxyBypassList) - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a client certificate for current connected TFS instance - -.DESCRIPTION -Gets an instance of a X509Certificate2 that is the client certificate Build/Release agent used. - -.EXAMPLE -$x509cert = Get-ClientCertificate -WebRequestHandler.ClientCertificates.Add(x509cert) -#> -function Get-ClientCertificate { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports client certificate - Assert-Agent -Minimum '2.122.0' - - [string]$clientCert = Get-TaskVariable -Name Agent.ClientCertArchive - [string]$clientCertPassword = Get-TaskVariable -Name Agent.ClientCertPassword - - if ($clientCert -and (Test-Path -LiteralPath $clientCert -PathType Leaf)) { - return New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($clientCert, $clientCertPassword) - } - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -######################################## -# Private functions. -######################################## -function Get-OMType { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [ValidateSet('ExtendedClient', 'WebApi')] - [Parameter(Mandatory = $true)] - [string]$OMKind, - - [string]$OMDirectory, - - [switch]$Require) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Try to load the type. - $errorRecord = $null - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - # Store the error record. - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - - # Build a list of candidate DLL file paths from the namespace. - $dllPaths = @( ) - $namespace = $TypeName - while ($namespace.LastIndexOf('.') -gt 0) { - # Trim the next segment from the namespace. - $namespace = $namespace.SubString(0, $namespace.LastIndexOf('.')) - - # Derive potential DLL file paths based on the namespace and OM kind (i.e. extended client vs web API). - if ($OMKind -eq 'ExtendedClient') { - if ($namespace -like 'Microsoft.TeamFoundation.*') { - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } else { - if ($namespace -like 'Microsoft.TeamFoundation.*' -or - $namespace -like 'Microsoft.VisualStudio.Services' -or - $namespace -like 'Microsoft.VisualStudio.Services.*') { - - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.WebApi.dll") - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } - } - - foreach ($dllPath in $dllPaths) { - # Check whether the DLL exists. - Write-Verbose "Testing leaf path: '$dllPath'" - if (!(Test-Path -PathType Leaf -LiteralPath "$dllPath")) { - Write-Verbose "Not found." - continue - } - - # Load the DLL. - Write-Verbose "Loading assembly: $dllPath" - try { - Add-Type -LiteralPath $dllPath - } catch { - # Write the information to the verbose stream and proceed to attempt to load the requested type. - # - # The requested type may successfully load now. For example, the type used with the 14.0 Web API for the - # federated credential (VssOAuthCredential) resides in Microsoft.VisualStudio.Services.Client.dll. Even - # though loading the DLL results in a ReflectionTypeLoadException when Microsoft.ServiceBus.dll (approx 3.75mb) - # is not present, enough types are loaded to use the VssOAuthCredential federated credential with the Web API - # HTTP clients. - Write-Verbose "$($_.Exception.GetType().FullName): $($_.Exception.Message)" - if ($_.Exception -is [System.Reflection.ReflectionTypeLoadException]) { - for ($i = 0 ; $i -lt $_.Exception.LoaderExceptions.Length ; $i++) { - $loaderException = $_.Exception.LoaderExceptions[$i] - Write-Verbose "LoaderExceptions[$i]: $($loaderException.GetType().FullName): $($loaderException.Message)" - } - } - } - - # Try to load the type. - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - } - - # Check whether to propagate the error. - if ($Require) { - Write-Error $errorRecord - } - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} diff --git a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson b/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson deleted file mode 100644 index 7871c36..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agentversion {0} oder höher ist erforderlich.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Der Containerpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "\"{0}\"-Dienstendpunkt-Anmeldeinformationen", - "loc.messages.PSLIB_EndpointUrl0": "\"{0}\"-Dienstendpunkt-URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Fehler beim Aufzählen von Unterverzeichnissen für den folgenden Pfad: \"{0}\"", - "loc.messages.PSLIB_FileNotFound0": "Die Datei wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Input0": "\"{0}\"-Eingabe", - "loc.messages.PSLIB_InvalidPattern0": "Ungültiges Muster: \"{0}\"", - "loc.messages.PSLIB_LeafPathNotFound0": "Der Blattpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Fehler bei der Normalisierung bzw. Erweiterung des Pfads. Die Pfadlänge wurde vom Kernel32-Subsystem nicht zurückgegeben für: \"{0}\"", - "loc.messages.PSLIB_PathNotFound0": "Der Pfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Der Prozess \"{0}\" wurde mit dem Code \"{1}\" beendet.", - "loc.messages.PSLIB_Required0": "Erforderlich: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Fehler beim Zeichenfolgenformat.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Der Zeichenfolgen-Ressourcenschlüssel wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "\"{0}\"-Taskvariable" -} \ No newline at end of file diff --git a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson b/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson deleted file mode 100644 index 66c17bc..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "File not found: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' input", - "loc.messages.PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Path not found: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "loc.messages.PSLIB_Required0": "Required: {0}", - "loc.messages.PSLIB_StringFormatFailed": "String format failed.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' task variable" -} \ No newline at end of file diff --git a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson b/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson deleted file mode 100644 index f5c9c23..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Se require la versión {0} o posterior del agente.", - "loc.messages.PSLIB_ContainerPathNotFound0": "No se encuentra la ruta de acceso del contenedor: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenciales del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "No se pudieron enumerar los subdirectorios de la ruta de acceso: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Archivo no encontrado: '{0}'", - "loc.messages.PSLIB_Input0": "Entrada '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Patrón no válido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "No se encuentra la ruta de acceso de la hoja: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "No se pudo normalizar o expandir la ruta de acceso. El subsistema Kernel32 no devolvió la longitud de la ruta de acceso para: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "No se encuentra la ruta de acceso: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "El proceso '{0}' finalizó con el código '{1}'.", - "loc.messages.PSLIB_Required0": "Se requiere: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Error de formato de cadena.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "No se encuentra la clave de recurso de la cadena: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tarea '{0}'" -} \ No newline at end of file diff --git a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson b/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson deleted file mode 100644 index 652870c..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "L'agent version {0} (ou une version ultérieure) est obligatoire.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Le chemin du conteneur est introuvable : '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Informations d'identification du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Échec de l'énumération des sous-répertoires pour le chemin : '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Fichier introuvable : {0}.", - "loc.messages.PSLIB_Input0": "Entrée '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Modèle non valide : '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Le chemin feuille est introuvable : '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Échec de la normalisation/l'expansion du chemin. La longueur du chemin n'a pas été retournée par le sous-système Kernel32 pour : '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Chemin introuvable : '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Le processus '{0}' s'est arrêté avec le code '{1}'.", - "loc.messages.PSLIB_Required0": "Obligatoire : {0}", - "loc.messages.PSLIB_StringFormatFailed": "Échec du format de la chaîne.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Clé de la ressource de type chaîne introuvable : '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tâche '{0}'" -} \ No newline at end of file diff --git a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson b/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson deleted file mode 100644 index 6aeb1df..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "È richiesta la versione dell'agente {0} o superiore.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Percorso del contenitore non trovato: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenziali dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "L'enumerazione delle sottodirectory per il percorso '{0}' non è riuscita", - "loc.messages.PSLIB_FileNotFound0": "File non trovato: '{0}'", - "loc.messages.PSLIB_Input0": "Input di '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Criterio non valido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Percorso foglia non trovato: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "La normalizzazione o l'espansione del percorso non è riuscita. Il sottosistema Kernel32 non ha restituito la lunghezza del percorso per '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Percorso non trovato: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Il processo '{0}' è stato terminato ed è stato restituito il codice '{1}'.", - "loc.messages.PSLIB_Required0": "Obbligatorio: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Errore nel formato della stringa.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "La chiave della risorsa stringa non è stata trovata: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variabile dell'attività '{0}'" -} \ No newline at end of file diff --git a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson b/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson deleted file mode 100644 index 6b07ab6..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "バージョン {0} 以降のエージェントが必要です。", - "loc.messages.PSLIB_ContainerPathNotFound0": "コンテナーのパスが見つかりません: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' サービス エンドポイントの資格情報", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' サービス エンドポイントの URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "パス '{0}' のサブディレクトリを列挙できませんでした", - "loc.messages.PSLIB_FileNotFound0": "ファイルが見つかりません: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 入力", - "loc.messages.PSLIB_InvalidPattern0": "使用できないパターンです: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "リーフ パスが見つかりません: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "パスの正規化/展開に失敗しました。Kernel32 サブシステムからパス '{0}' の長さが返されませんでした", - "loc.messages.PSLIB_PathNotFound0": "パスが見つかりません: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "プロセス '{0}' がコード '{1}' で終了しました。", - "loc.messages.PSLIB_Required0": "必要: {0}", - "loc.messages.PSLIB_StringFormatFailed": "文字列のフォーマットに失敗しました。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "文字列のリソース キーが見つかりません: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' タスク変数" -} \ No newline at end of file diff --git a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson b/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson deleted file mode 100644 index e58cbdc..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "에이전트 버전 {0} 이상이 필요합니다.", - "loc.messages.PSLIB_ContainerPathNotFound0": "컨테이너 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 서비스 끝점 자격 증명", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 서비스 끝점 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "경로에 대해 하위 디렉터리를 열거하지 못함: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "{0} 파일을 찾을 수 없습니다.", - "loc.messages.PSLIB_Input0": "'{0}' 입력", - "loc.messages.PSLIB_InvalidPattern0": "잘못된 패턴: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "경로 정규화/확장에 실패했습니다. 다음에 대해 Kernel32 subsystem에서 경로 길이를 반환하지 않음: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "'{1}' 코드로 '{0}' 프로세스가 종료되었습니다.", - "loc.messages.PSLIB_Required0": "필수: {0}", - "loc.messages.PSLIB_StringFormatFailed": "문자열을 포맷하지 못했습니다.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "문자열 리소스 키를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 작업 변수" -} \ No newline at end of file diff --git a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson b/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson deleted file mode 100644 index 38dd69d..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Требуется версия агента {0} или более поздняя.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Путь к контейнеру не найден: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "Учетные данные конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EndpointUrl0": "URL-адрес конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Сбой перечисления подкаталогов для пути: \"{0}\".", - "loc.messages.PSLIB_FileNotFound0": "Файл не найден: \"{0}\".", - "loc.messages.PSLIB_Input0": "Входные данные \"{0}\".", - "loc.messages.PSLIB_InvalidPattern0": "Недопустимый шаблон: \"{0}\".", - "loc.messages.PSLIB_LeafPathNotFound0": "Путь к конечному объекту не найден: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Сбой нормализации и расширения пути. Длина пути не была возвращена подсистемой Kernel32 для: \"{0}\".", - "loc.messages.PSLIB_PathNotFound0": "Путь не найден: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Процесс \"{0}\" завершил работу с кодом \"{1}\".", - "loc.messages.PSLIB_Required0": "Требуется: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Сбой формата строки.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Ключ ресурса строки не найден: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "Переменная задачи \"{0}\"" -} \ No newline at end of file diff --git a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson b/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson deleted file mode 100644 index 1d333de..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理版本 {0} 或更高版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路径:“{0}”", - "loc.messages.PSLIB_EndpointAuth0": "“{0}”服务终结点凭据", - "loc.messages.PSLIB_EndpointUrl0": "“{0}”服务终结点 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "枚举路径的子目录失败:“{0}”", - "loc.messages.PSLIB_FileNotFound0": "找不到文件: {0}。", - "loc.messages.PSLIB_Input0": "“{0}”输入", - "loc.messages.PSLIB_InvalidPattern0": "无效的模式:“{0}”", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到叶路径:“{0}”", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路径规范化/扩展失败。路径长度不是由“{0}”的 Kernel32 子系统返回的", - "loc.messages.PSLIB_PathNotFound0": "找不到路径:“{0}”", - "loc.messages.PSLIB_Process0ExitedWithCode1": "过程“{0}”已退出,代码为“{1}”。", - "loc.messages.PSLIB_Required0": "必需: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字符串格式无效。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字符串资源关键字:“{0}”", - "loc.messages.PSLIB_TaskVariable0": "“{0}”任务变量" -} \ No newline at end of file diff --git a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson b/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson deleted file mode 100644 index 512509b..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理程式版本 {0} 或更新的版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路徑: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 服務端點認證", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 服務端點 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "為路徑列舉子目錄失敗: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "找不到檔案: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 輸入", - "loc.messages.PSLIB_InvalidPattern0": "模式無效: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到分葉路徑: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路徑正規化/展開失敗。Kernel32 子系統未傳回 '{0}' 的路徑長度", - "loc.messages.PSLIB_PathNotFound0": "找不到路徑: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "處理序 '{0}' 以返回碼 '{1}' 結束。", - "loc.messages.PSLIB_Required0": "必要項: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字串格式失敗。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字串資源索引鍵: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 工作變數" -} \ No newline at end of file diff --git a/Tasks/push/ps_modules/VstsTaskSdk/ToolFunctions.ps1 b/Tasks/push/ps_modules/VstsTaskSdk/ToolFunctions.ps1 deleted file mode 100644 index 0e82595..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/ToolFunctions.ps1 +++ /dev/null @@ -1,123 +0,0 @@ -<# -.SYNOPSIS -Asserts the agent version is at least the specified minimum. - -.PARAMETER Minimum -Minimum version - must be 2.104.1 or higher. -#> -function Assert-Agent { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [version]$Minimum) - - if (([version]'2.104.1').CompareTo($Minimum) -ge 1) { - Write-Error "Assert-Agent requires the parameter to be 2.104.1 or higher." - return - } - - $agent = Get-TaskVariable -Name 'agent.version' - if (!$agent -or $Minimum.CompareTo([version]$agent) -ge 1) { - Write-Error (Get-LocString -Key 'PSLIB_AgentVersion0Required' -ArgumentList $Minimum) - } -} - -<# -.SYNOPSIS -Asserts that a path exists. Throws if the path does not exist. - -.PARAMETER PassThru -True to return the path. -#> -function Assert-Path { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath, - [Microsoft.PowerShell.Commands.TestPathType]$PathType = [Microsoft.PowerShell.Commands.TestPathType]::Any, - [switch]$PassThru) - - if ($PathType -eq [Microsoft.PowerShell.Commands.TestPathType]::Any) { - Write-Verbose "Asserting path exists: '$LiteralPath'" - } else { - Write-Verbose "Asserting $("$PathType".ToLowerInvariant()) path exists: '$LiteralPath'" - } - - if (Test-Path -LiteralPath $LiteralPath -PathType $PathType) { - if ($PassThru) { - return $LiteralPath - } - - return - } - - $resourceKey = switch ($PathType) { - ([Microsoft.PowerShell.Commands.TestPathType]::Container) { "PSLIB_ContainerPathNotFound0" ; break } - ([Microsoft.PowerShell.Commands.TestPathType]::Leaf) { "PSLIB_LeafPathNotFound0" ; break } - default { "PSLIB_PathNotFound0" } - } - - throw (Get-LocString -Key $resourceKey -ArgumentList $LiteralPath) -} - -<# -.SYNOPSIS -Executes an external program. - -.DESCRIPTION -Executes an external program and waits for the process to exit. - -After calling this command, the exit code of the process can be retrieved from the variable $LASTEXITCODE. - -.PARAMETER Encoding -This parameter not required for most scenarios. Indicates how to interpret the encoding from the external program. An example use case would be if an external program outputs UTF-16 XML and the output needs to be parsed. - -.PARAMETER RequireExitCodeZero -Indicates whether to write an error to the error pipeline if the exit code is not zero. -#> -function Invoke-Tool { # TODO: RENAME TO INVOKE-PROCESS? - [CmdletBinding()] - param( - [ValidatePattern('^[^\r\n]*$')] - [Parameter(Mandatory = $true)] - [string]$FileName, - [ValidatePattern('^[^\r\n]*$')] - [Parameter()] - [string]$Arguments, - [string]$WorkingDirectory, - [System.Text.Encoding]$Encoding, - [switch]$RequireExitCodeZero) - - Trace-EnteringInvocation $MyInvocation - $isPushed = $false - $originalEncoding = $null - try { - if ($Encoding) { - $originalEncoding = [System.Console]::OutputEncoding - [System.Console]::OutputEncoding = $Encoding - } - - if ($WorkingDirectory) { - Push-Location -LiteralPath $WorkingDirectory -ErrorAction Stop - $isPushed = $true - } - - $FileName = $FileName.Replace('"', '').Replace("'", "''") - Write-Host "##[command]""$FileName"" $Arguments" - Invoke-Expression "& '$FileName' --% $Arguments" - Write-Verbose "Exit code: $LASTEXITCODE" - if ($RequireExitCodeZero -and $LASTEXITCODE -ne 0) { - Write-Error (Get-LocString -Key PSLIB_Process0ExitedWithCode1 -ArgumentList ([System.IO.Path]::GetFileName($FileName)), $LASTEXITCODE) - } - } finally { - if ($originalEncoding) { - [System.Console]::OutputEncoding = $originalEncoding - } - - if ($isPushed) { - Pop-Location - } - - Trace-LeavingInvocation $MyInvocation - } -} diff --git a/Tasks/push/ps_modules/VstsTaskSdk/TraceFunctions.ps1 b/Tasks/push/ps_modules/VstsTaskSdk/TraceFunctions.ps1 deleted file mode 100644 index b8e084b..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/TraceFunctions.ps1 +++ /dev/null @@ -1,139 +0,0 @@ -<# -.SYNOPSIS -Writes verbose information about the invocation being entered. - -.DESCRIPTION -Used to trace verbose information when entering a function/script. Writes an entering message followed by a short description of the invocation. Additionally each bound parameter and unbound argument is also traced. - -.PARAMETER Parameter -Wildcard pattern to control which bound parameters are traced. -#> -function Trace-EnteringInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo, - [string[]]$Parameter = '*') - - Write-Verbose "Entering $(Get-InvocationDescription $InvocationInfo)." - $OFS = ", " - if ($InvocationInfo.BoundParameters.Count -and $Parameter.Count) { - if ($Parameter.Count -eq 1 -and $Parameter[0] -eq '*') { - # Trace all parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - } - } else { - # Trace matching parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - foreach ($p in $Parameter) { - if ($key -like $p) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - break - } - } - } - } - } - - # Trace all unbound arguments. - if (@($InvocationInfo.UnboundArguments).Count) { - for ($i = 0 ; $i -lt $InvocationInfo.UnboundArguments.Count ; $i++) { - Write-Verbose " args[$i]: '$($InvocationInfo.UnboundArguments[$i])'" - } - } -} - -<# -.SYNOPSIS -Writes verbose information about the invocation being left. - -.DESCRIPTION -Used to trace verbose information when leaving a function/script. Writes a leaving message followed by a short description of the invocation. -#> -function Trace-LeavingInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo) - - Write-Verbose "Leaving $(Get-InvocationDescription $InvocationInfo)." -} - -<# -.SYNOPSIS -Writes verbose information about paths. - -.DESCRIPTION -Writes verbose information about the paths. The paths are sorted and a the common root is written only once, followed by each relative path. - -.PARAMETER PassThru -Indicates whether to return the sorted paths. -#> -function Trace-Path { - [CmdletBinding()] - param( - [string[]]$Path, - [switch]$PassThru) - - if ($Path.Count -eq 0) { - Write-Verbose "No paths." - if ($PassThru) { - $Path - } - } elseif ($Path.Count -eq 1) { - Write-Verbose "Path: $($Path[0])" - if ($PassThru) { - $Path - } - } else { - # Find the greatest common root. - $sorted = $Path | Sort-Object - $firstPath = $sorted[0].ToCharArray() - $lastPath = $sorted[-1].ToCharArray() - $commonEndIndex = 0 - $j = if ($firstPath.Length -lt $lastPath.Length) { $firstPath.Length } else { $lastPath.Length } - for ($i = 0 ; $i -lt $j ; $i++) { - if ($firstPath[$i] -eq $lastPath[$i]) { - if ($firstPath[$i] -eq '\') { - $commonEndIndex = $i - } - } else { - break - } - } - - if ($commonEndIndex -eq 0) { - # No common root. - Write-Verbose "Paths:" - foreach ($p in $sorted) { - Write-Verbose " $p" - } - } else { - Write-Verbose "Paths: $($Path[0].Substring(0, $commonEndIndex + 1))" - foreach ($p in $sorted) { - Write-Verbose " $($p.Substring($commonEndIndex + 1))" - } - } - - if ($PassThru) { - $sorted - } - } -} - -######################################## -# Private functions. -######################################## -function Get-InvocationDescription { - [CmdletBinding()] - param([System.Management.Automation.InvocationInfo]$InvocationInfo) - - if ($InvocationInfo.MyCommand.Path) { - $InvocationInfo.MyCommand.Path - } elseif ($InvocationInfo.MyCommand.Name) { - $InvocationInfo.MyCommand.Name - } else { - $InvocationInfo.MyCommand.CommandType - } -} diff --git a/Tasks/push/ps_modules/VstsTaskSdk/VstsTaskSdk.dll b/Tasks/push/ps_modules/VstsTaskSdk/VstsTaskSdk.dll deleted file mode 100644 index 54938ab05180ddaf77cf067f2501a1f97ee7e5cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25408 zcmeIa2Urx#@+jULfkmqhP%&pQASxi36%_+2 zidj)qRLqKkIbqJC|C%A{Ip^NgryDMlC=Tgb)?ppFa_* zgD?KL5%6Dw0*IE?-Y<)GNuATFBL$w*iA?2*n3+OBijbYbF+H{2L%K|95{8flQ0QIM^F!gwgx3vTgye}Z zxvSkc0dGI?6aWPJm*)uj%Ro(CG}HVlviga*LJ z%c-k5J<6tW2zm5FiQsmeukhe)BO@9rfIMER2uTstK5*O- zp@Kg2FGIRyijg8h3==K#1PZj)1PGIe078Q?3fcfUNeC&BMM{ur610*^HW~;)GR2%S z(3DOwQpV|!gi1A1fuOl0jrf|$kd2^S3?nFvZYo2j(nM-Ks4UeiN|q`Z1USRgS`itk zLr7Y}2zbjd*FzElyi6uY84`g=F$Rz);PpxhGy!R)7_=hD0z74yA8(aaL_bs@;b4I_ z5N?~0a2Z7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FZHp(A2-`rOF$QP^=qQE&uZkj*RKB7W5c!g? z0_h7Fa_}j-8E?fE5Mv6OoV^RAgq4Z;iP6kh*Od}!VRko2B_4I{(pGl8rg&SSx!qlx z-#KrM7|InfHJ`AO_eUAYF?sl^#S$BqNIJ}W(y+OYtWqR>*+<$(n%M4ZR$_+Esaf{H z-LF;mfQ%IN3Y0$53He+YYQ>eZU+u`D<)c|Fspn^AR|nVK$5^ki+Yn_&WbKc$d_mNg zeC?4#OS(vZ`qJ(l(1DzJ>%sS|AkPgw)t-el)B{!v%PXU|+Pz&4jbY(AL%HEt8Spib zPc<(?tZppIne|$c+|SB32$YYzT>e0{mtgSG^$e`!z1)IGJFu@RSev0mQr?$X4Q!rJP3>&`Zt!=+&?>AJf79Gr=vlfV zg4S?kF+F>fNu}K(Z=}gHBL`*nHQ9&g>ltj`!>A^FaraRJeb@VjRUoeQz@zZ9I|mDk zb7Yo!2RJVGI5#Ow?y=qmZv={jr^{*&IYR2*oz^L5G-brBv_Yz;wu5eD9@@M+Ao<_- zTJ<*aIe)M4x%zcPo;e*jhT|#q9?2=PugJgekDl<9dh6e&6yF`ar4mto>Tbqa^N9R^ J$g$t$@(XnB12_Nx diff --git a/Tasks/push/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 b/Tasks/push/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 deleted file mode 100644 index a1bf2c6..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 +++ /dev/null @@ -1,168 +0,0 @@ -[CmdletBinding()] -param( - [ValidateNotNull()] - [Parameter()] - [hashtable]$ModuleParameters = @{ }) - -if ($host.Name -ne 'ConsoleHost') { - Write-Warning "VstsTaskSdk is designed for use with powershell.exe (ConsoleHost). Output may be different when used with other hosts." -} - -# Private module variables. -[bool]$script:nonInteractive = "$($ModuleParameters['NonInteractive'])" -eq 'true' -Write-Verbose "NonInteractive: $script:nonInteractive" - -# VstsTaskSdk.dll contains the TerminationException and NativeMethods for handle long path -# We used to do inline C# in this powershell module -# However when csc compile the inline C#, it will hit process env block size limit since it's not use unicode to encode env -# To solve the env block size problem, we choose to put all inline C# into an assembly VstsTaskSdk.dll, signing it, package with the PS modules. -Write-Verbose "Loading compiled helper $PSScriptRoot\VstsTaskSdk.dll." -Add-Type -LiteralPath $PSScriptRoot\VstsTaskSdk.dll - -# Import/export functions. -. "$PSScriptRoot\FindFunctions.ps1" -. "$PSScriptRoot\InputFunctions.ps1" -. "$PSScriptRoot\LegacyFindFunctions.ps1" -. "$PSScriptRoot\LocalizationFunctions.ps1" -. "$PSScriptRoot\LoggingCommandFunctions.ps1" -. "$PSScriptRoot\LongPathFunctions.ps1" -. "$PSScriptRoot\ServerOMFunctions.ps1" -. "$PSScriptRoot\ToolFunctions.ps1" -. "$PSScriptRoot\TraceFunctions.ps1" -. "$PSScriptRoot\OutFunctions.ps1" # Load the out functions after all of the other functions are loaded. -Export-ModuleMember -Function @( - # Find functions. - 'Find-Match' - 'New-FindOptions' - 'New-MatchOptions' - 'Select-Match' - # Input functions. - 'Get-Endpoint' - 'Get-SecureFileTicket' - 'Get-SecureFileName' - 'Get-Input' - 'Get-TaskVariable' - 'Get-TaskVariableInfo' - 'Set-TaskVariable' - # Legacy find functions. - 'Find-Files' - # Localization functions. - 'Get-LocString' - 'Import-LocStrings' - # Logging command functions. - 'Write-AddAttachment' - 'Write-AddBuildTag' - 'Write-AssociateArtifact' - 'Write-LogDetail' - 'Write-PrependPath' - 'Write-SetEndpoint' - 'Write-SetProgress' - 'Write-SetResult' - 'Write-SetSecret' - 'Write-SetVariable' - 'Write-TaskDebug' - 'Write-TaskError' - 'Write-TaskVerbose' - 'Write-TaskWarning' - 'Write-UpdateBuildNumber' - 'Write-UpdateReleaseName' - 'Write-UploadArtifact' - 'Write-UploadBuildLog' - 'Write-UploadFile' - 'Write-UploadSummary' - # Out functions. - 'Out-Default' - # Server OM functions. - 'Get-AssemblyReference' - 'Get-TfsClientCredentials' - 'Get-TfsService' - 'Get-VssCredentials' - 'Get-VssHttpClient' - # Tool functions. - 'Assert-Agent' - 'Assert-Path' - 'Invoke-Tool' - # Trace functions. - 'Trace-EnteringInvocation' - 'Trace-LeavingInvocation' - 'Trace-Path' - # Proxy functions - 'Get-WebProxy' - # Client cert functions - 'Get-ClientCertificate' - ) - -# Override Out-Default globally. -$null = New-Item -Force -Path "function:\global:Out-Default" -Value (Get-Command -CommandType Function -Name Out-Default -ListImported) -New-Alias -Name Out-Default -Value "global:Out-Default" -Scope global - -# Perform some initialization in a script block to enable merging the pipelines. -$scriptText = @" -# Load the SDK resource strings. -Import-LocStrings "$PSScriptRoot\lib.json" - -# Load the module that contains ConvertTo-SecureString. -if (!(Get-Module -Name Microsoft.PowerShell.Security)) { - Write-Verbose "Importing the module 'Microsoft.PowerShell.Security'." - Import-Module -Name Microsoft.PowerShell.Security 2>&1 | - ForEach-Object { - if (`$_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose `$_.Exception.Message - } else { - ,`$_ - } - } -} -"@ -. ([scriptblock]::Create($scriptText)) 2>&1 3>&1 4>&1 5>&1 | Out-Default - -# Create Invoke-VstsTaskScript in a special way so it is not bound to the module. -# Otherwise calling the task script block would run within the module context. -# -# An alternative way to solve the problem is to close the script block (i.e. closure). -# However, that introduces a different problem. Closed script blocks are created within -# a dynamic module. Each module gets it's own session state separate from the global -# session state. When running in a regular script context, Import-Module calls import -# the target module into the global session state. When running in a module context, -# Import-Module calls import the target module into the caller module's session state. -# -# The goal of a task may include executing ad-hoc scripts. Therefore, task scripts -# should run in regular script context. The end user specifying an ad-hoc script expects -# the module import rules to be consistent with the default behavior (i.e. imported -# into the global session state). -$null = New-Item -Force -Path "function:\global:Invoke-VstsTaskScript" -Value ([scriptblock]::Create(@' - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [scriptblock]$ScriptBlock) - - try { - $global:ErrorActionPreference = 'Stop' - - # Initialize the environment. - $vstsModule = Get-Module -Name VstsTaskSdk - Write-Verbose "$($vstsModule.Name) $($vstsModule.Version) commit $($vstsModule.PrivateData.PSData.CommitHash)" 4>&1 | Out-Default - & $vstsModule Initialize-Inputs 4>&1 | Out-Default - - # Remove the local variable before calling the user's script. - Remove-Variable -Name vstsModule - - # Call the user's script. - $ScriptBlock | - ForEach-Object { - # Remove the scriptblock variable before calling it. - Remove-Variable -Name ScriptBlock - & $_ 2>&1 3>&1 4>&1 5>&1 | Out-Default - } - } catch [VstsTaskSdk.TerminationException] { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Task script terminated." 4>&1 | Out-Default - } catch { - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Caught exception from task script." 4>&1 | Out-Default - $_ | Out-Default - Write-Host "##vso[task.complete result=Failed]" - } -'@)) diff --git a/Tasks/push/ps_modules/VstsTaskSdk/lib.json b/Tasks/push/ps_modules/VstsTaskSdk/lib.json deleted file mode 100644 index ecdc9d0..0000000 --- a/Tasks/push/ps_modules/VstsTaskSdk/lib.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "messages": { - "PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "PSLIB_FileNotFound0": "File not found: '{0}'", - "PSLIB_Input0": "'{0}' input", - "PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "PSLIB_PathNotFound0": "Path not found: '{0}'", - "PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "PSLIB_Required0": "Required: {0}", - "PSLIB_StringFormatFailed": "String format failed.", - "PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "PSLIB_TaskVariable0": "'{0}' task variable" - } -} diff --git a/Tasks/push/push.ps1 b/Tasks/push/push.ps1 deleted file mode 100644 index 49f1953..0000000 --- a/Tasks/push/push.ps1 +++ /dev/null @@ -1,91 +0,0 @@ -[CmdletBinding()] -param() - -Trace-VstsEnteringInvocation $MyInvocation - -try { - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "Machine") - if(-not (Test-Path $chocoInstallLocation)) { - Write-Output "Environment variable 'ChocolateyInstall' was not found in the system variables. Attempting to find it in the user variables..." - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "User") - } - - $chocoExe = "$chocoInstallLocation\choco.exe" - - if (-not (Test-Path $chocoExe)) { - throw "Chocolatey was not found." - } - - [string]$operation = Get-VstsInput -Name 'operation' -Require - [string]$workingDirectory = Get-VstsInput -Name 'workingDirectory' -Require - [string]$source = Get-VstsInput -Name 'source' -Default 'https://push.chocolatey.org/' - [string]$apikey = Get-VstsInput -Name 'apikey' - [bool]$force = Get-VstsInput -Name 'force' -AsBool -Default $false - [string]$timeout = Get-VstsInput -Name 'timeout' - [bool]$debug = Get-VstsInput -Name 'debug' -AsBool -Default $false - [bool]$verbose = Get-VstsInput -Name 'verbose' -AsBool -Default $false - [bool]$trace = Get-VstsInput -Name 'trace' -AsBool -Default $false - [string]$extraArguments = Get-VstsInput -Name 'extraArguments' - - $chocolateyVersion = & $chocoExe --version - Write-Output "Running Chocolatey Version: $chocolateyVersion" - - $chocolateyArguments = @() - - if($source) { - Write-Output "Adding --source to arguments" - $chocolateyArguments += @("--source", $source) - } - - if($apikey) { - Write-Output "Adding --apikey to arguments" - $chocolateyArguments += @("--apikey", $apikey) - } - - if($force) { - Write-Output "Adding --force to arguments" - $chocolateyArguments += @("--force", "") - } - - if($timeout) { - Write-Output "Adding -t to arguments" - $chocolateyArguments += @("-t", $timeout) - } - - if($debug) { - Write-Output "Adding --debug to arguments" - $chocolateyArguments += @("--debug", "") - } - - if($verbose) { - Write-Output "Adding --verbose to arguments" - $chocolateyArguments += @("--verbose", "") - } - - if($trace) { - Write-Output "Adding --trace to arguments" - $chocolateyArguments += @("--trace", "") - } - - if($extraArguments) { - Write-Output "Adding extra arguments" - $chocolateyArguments += @($extraArguments, "") - } - - Set-Location $workingDirectory - - if($operation -eq "single") { - [string]$nupkgFileName = Get-VstsInput -Name 'nupkgFileName' -Require - & $chocoExe push $nupkgFileName $($chocolateyArguments) - } else { - $nupkgFiles = Get-ChildItem "*.nupkg" - foreach($nupkgFile in $nupkgFiles) { - & $chocoExe push $nupkgFile $($chocolateyArguments) - } - } -} catch { - Write-VstsTaskError $_.Exception.Message - throw -} finally { - Trace-VstsLeavingInvocation $MyInvocation -} diff --git a/Tasks/push/task.json b/Tasks/push/task.json deleted file mode 100644 index 2b4c19c..0000000 --- a/Tasks/push/task.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "id": "40449601-71b9-4f89-8158-d169405a0a0a", - "name": "choco-push", - "friendlyName": "Chocolatey - Push", - "description": "Runs Chocolatey Push with specified parameters", - "author": "gep13", - "helpMarkDown": "", - "category": "Build", - "visibility": [ - "Build", - "Release" - ], - "demands": [], - "version": { - "Major": "0", - "Minor": "1", - "Patch": "0" - }, - "minimumAgentVersion": "1.83.0", - "instanceNameFormat": "Chocolatey Push", - "inputs": [ - { - "name": "operation", - "type": "radio", - "label": "How many nupkg files?", - "required": true, - "defaultValue": "single", - "helpMarkDown": "Choose whether to pus a single nupkg file, or multiple.", - "options": { - "single": "One nupkg file", - "multiple": "Multiple nupkg files" - } - }, - { - "name": "workingDirectory", - "type": "string", - "label": "Working Directory", - "defaultValue": "", - "required": true, - "helpMarkDown": "The location of the nupkg file(s)." - }, - { - "name": "nupkgFileName", - "type": "string", - "label": "Nupkg File Name.", - "defaultValue": "", - "required": true, - "helpMarkDown": "The file name of the Nupkg File that should be pushed.", - "visibleRule": "operation=single" - }, - { - "name": "source", - "type": "string", - "label": "Source", - "defaultValue": "https://push.chocolatey.org/", - "required": false, - "helpMarkDown": "The source to push the nupkg(s) to." - }, - { - "name": "apikey", - "type": "string", - "label": "API Key", - "defaultValue": "", - "required": false, - "helpMarkDown": "The API Key that should be used to push the nupkg(s) to specified source." - }, - { - "name": "force", - "type": "boolean", - "label": "Force.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Force the operation to continue." - }, - { - "name": "timeout", - "type": "string", - "label": "Timeout", - "defaultValue": "", - "required": false, - "helpMarkDown": "The time, in seconds, to allow a package push to occur before timing out." - }, - { - "name": "debug", - "type": "boolean", - "label": "Show debug messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "", - "groupname": "advanced" - }, - { - "name": "verbose", - "type": "boolean", - "label": "Show verbose messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very verbose messaging, avoid using under normal circumstances.", - "groupname": "advanced" - }, - { - "name": "trace", - "type": "boolean", - "label": "Show trace messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very, very verbose trace messaging. Avoid except when needing super low-level .NET Framework debugging.", - "groupname": "advanced" - }, - { - "name": "extraArguments", - "type": "string", - "label": "Extra Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional Chocolatey Arguments that are not catered for above.", - "groupname": "advanced" - } - ], - "execution": { - "PowerShell3": { - "target": "$(currentDirectory)\\push.ps1", - "argumentFormat": "", - "workingDirectory": "$(currentDirectory)" - } - } -} diff --git a/Tasks/source/icon.png b/Tasks/source/icon.png deleted file mode 100755 index ab05af71592b547960e4fcf1f5d527bece1fd5c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2656 zcmY*bc|6o>7yp&5nTW_XQyF7lXG|nABl{9z2o*AxVaQ;NEtRov*Bv(hrKxhFDVoxG4buln4OW*xUDC0l*�JDw&pneYk z1ijO)x9RU=K|Y38`~cu6-+>(hvL6Tmz@aMyD_gRysfoI?x0fQ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kj4 zn?QSY{&XZn56{L3^9+wZhWg|~dqKRP&v2+c?#%qm>s(m%&{}DoYZThnAuekxmRP_v zo1<{TeakXFI}60nz4iiFC)9Tmqf9nC%IO$e-4TUI;0mLh-j zQLr41J|YehYI5OI`_@NoHlzD?aNb91=<9e4Ey;q;%(Y6g~nm{l+;F0(40p<{nF z>wcIBih?#=Uo-gDpTTn~l^|iFdOhERaair#%8cl}Wqppp9%8C)!L_msmh-7sSJ$au zwooOK-<{W5&PJZDhd-M}zxlK4y_LbHeTxE9(XO^rg{Qtw%ODc@`L)mpPD$at^AwMx zZM1Pfjq1Y{)dZcP`G)BvddP=(!1NTPx25UgVTtC6X@<8!WJT!5i=j|k-|wdS%Bc*v zi^*^zqSeu8c#$-AG#d+?&9_GeiqMdbK5QqW%C-P_Z -function Find-Match { - [CmdletBinding()] - param( - [Parameter()] - [string]$DefaultRoot, - [Parameter()] - [string[]]$Pattern, - $FindOptions, - $MatchOptions) - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Apply defaults for parameters and trace. - if (!$DefaultRoot) { - $DefaultRoot = Get-TaskVariable -Name 'System.DefaultWorkingDirectory' -Default (Get-Location).Path - } - - Write-Verbose "DefaultRoot: '$DefaultRoot'" - if (!$FindOptions) { - $FindOptions = New-FindOptions -FollowSpecifiedSymbolicLink -FollowSymbolicLinks - } - - Trace-FindOptions -Options $FindOptions - if (!$MatchOptions) { - $MatchOptions = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $MatchOptions - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Normalize slashes for root dir. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - $results = @{ } - $originalMatchOptions = $MatchOptions - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $MatchOptions = Copy-MatchOptions -Options $originalMatchOptions - - # Skip comments. - if (!$MatchOptions.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $MatchOptions.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$MatchOptions.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$MatchOptions.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $MatchOptions.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $MatchOptions.NoNegate = $true - $MatchOptions.FlipNegate = $false - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Expand braces - required to accurately interpret findPath. - $expanded = $null - $preExpanded = $pat - if ($MatchOptions.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - } - - # Set NoBrace. - $MatchOptions.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - if ($isIncludePattern) { - # Determine the findPath. - $findInfo = Get-FindInfoFromPattern -DefaultRoot $DefaultRoot -Pattern $pat -MatchOptions $MatchOptions - $findPath = $findInfo.FindPath - Write-Verbose "FindPath: '$findPath'" - - if (!$findPath) { - Write-Verbose "Skipping empty path." - continue - } - - # Perform the find. - Write-Verbose "StatOnly: '$($findInfo.StatOnly)'" - [string[]]$findResults = @( ) - if ($findInfo.StatOnly) { - # Simply stat the path - all path segments were used to build the path. - if ((Test-Path -LiteralPath $findPath)) { - $findResults += $findPath - } - } else { - $findResults = Get-FindResult -Path $findPath -Options $FindOptions - } - - Write-Verbose "Found $($findResults.Count) paths." - - # Apply the pattern. - Write-Verbose "Applying include pattern." - if ($findInfo.AdjustedPattern -ne $pat) { - Write-Verbose "AdjustedPattern: '$($findInfo.AdjustedPattern)'" - $pat = $findInfo.AdjustedPattern - } - - $matchResults = [Minimatch.Minimatcher]::Filter( - $findResults, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results[$matchResult.ToUpperInvariant()] = $matchResult - } - - Write-Verbose "$matchCount matches" - } else { - # Check if basename only and MatchBase=true. - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $pat) -and - ($pat -replace '\\', '/').IndexOf('/') -lt 0) { - - # Do not root the pattern. - Write-Verbose "MatchBase and basename only." - } else { - # Root the exclude pattern. - $pat = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - # Apply the pattern. - Write-Verbose 'Applying exclude pattern.' - $matchResults = [Minimatch.Minimatcher]::Filter( - [string[]]$results.Values, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results.Remove($matchResult.ToUpperInvariant()) - } - - Write-Verbose "$matchCount matches" - } - } - } - - $finalResult = @( $results.Values | Sort-Object ) - Write-Verbose "$($finalResult.Count) final results" - return $finalResult - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Creates FindOptions for use with Find-VstsMatch. - -.DESCRIPTION -Creates FindOptions for use with Find-VstsMatch. Contains switches to control whether to follow symlinks. - -.PARAMETER FollowSpecifiedSymbolicLink -Indicates whether to traverse descendants if the specified path is a symbolic link directory. Does not cause nested symbolic link directories to be traversed. - -.PARAMETER FollowSymbolicLinks -Indicates whether to traverse descendants of symbolic link directories. -#> -function New-FindOptions { - [CmdletBinding()] - param( - [switch]$FollowSpecifiedSymbolicLink, - [switch]$FollowSymbolicLinks) - - return New-Object psobject -Property @{ - FollowSpecifiedSymbolicLink = $FollowSpecifiedSymbolicLink.IsPresent - FollowSymbolicLinks = $FollowSymbolicLinks.IsPresent - } -} - -<# -.SYNOPSIS -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. - -.DESCRIPTION -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. Contains switches to control which pattern matching options are applied. -#> -function New-MatchOptions { - [CmdletBinding()] - param( - [switch]$Dot, - [switch]$FlipNegate, - [switch]$MatchBase, - [switch]$NoBrace, - [switch]$NoCase, - [switch]$NoComment, - [switch]$NoExt, - [switch]$NoGlobStar, - [switch]$NoNegate, - [switch]$NoNull) - - return New-Object psobject -Property @{ - Dot = $Dot.IsPresent - FlipNegate = $FlipNegate.IsPresent - MatchBase = $MatchBase.IsPresent - NoBrace = $NoBrace.IsPresent - NoCase = $NoCase.IsPresent - NoComment = $NoComment.IsPresent - NoExt = $NoExt.IsPresent - NoGlobStar = $NoGlobStar.IsPresent - NoNegate = $NoNegate.IsPresent - NoNull = $NoNull.IsPresent - } -} - -<# -.SYNOPSIS -Applies match patterns against a list of files. - -.DESCRIPTION -Applies match patterns to a list of paths. Supports interleaved exclude patterns. - -.PARAMETER ItemPath -Array of paths. - -.PARAMETER Pattern -Patterns to apply. Supports interleaved exclude patterns. - -.PARAMETER PatternRoot -Default root to apply to unrooted patterns. Not applied to basename-only patterns when Options.MatchBase is true. - -.PARAMETER Options -When the Options parameter is not specified, defaults to (New-VstsMatchOptions -Dot -NoBrace -NoCase). -#> -function Select-Match { - [CmdletBinding()] - param( - [Parameter()] - [string[]]$ItemPath, - [Parameter()] - [string[]]$Pattern, - [Parameter()] - [string]$PatternRoot, - $Options) - - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - if (!$Options) { - $Options = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $Options - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Hashtable to keep track of matches. - $map = @{ } - - $originalOptions = $Options - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $Options = Copy-MatchOptions -Options $originalOptions - - # Skip comments. - if (!$Options.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $Options.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$Options.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$Options.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $Options.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $Options.NoNegate = $true - $Options.FlipNegate = $false - - # Expand braces - required to accurately root patterns. - $expanded = $null - $preExpanded = $pat - if ($Options.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $Options)) - } - - # Set NoBrace. - $Options.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - # Root the pattern when all of the following conditions are true: - if ($PatternRoot -and # PatternRoot is supplied - !(Test-Rooted -Path $pat) -and # AND pattern is not rooted - # # AND MatchBase=false or not basename only - (!$Options.MatchBase -or ($pat -replace '\\', '/').IndexOf('/') -ge 0)) { - - # Root the include pattern. - $pat = Get-RootedPattern -DefaultRoot $PatternRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - if ($isIncludePattern) { - # Apply the pattern. - Write-Verbose 'Applying include pattern against original list.' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map[$matchResult] = $true - } - - Write-Verbose "$matchCount matches" - } else { - # Apply the pattern. - Write-Verbose 'Applying exclude pattern against original list' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map.Remove($matchResult) - } - - Write-Verbose "$matchCount matches" - } - } - } - - # return a filtered version of the original list (preserves order and prevents duplication) - $result = $ItemPath | Where-Object { $map[$_] } - Write-Verbose "$($result.Count) final results" - $result - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -################################################################################ -# Private functions. -################################################################################ - -function Copy-MatchOptions { - [CmdletBinding()] - param($Options) - - return New-Object psobject -Property @{ - Dot = $Options.Dot -eq $true - FlipNegate = $Options.FlipNegate -eq $true - MatchBase = $Options.MatchBase -eq $true - NoBrace = $Options.NoBrace -eq $true - NoCase = $Options.NoCase -eq $true - NoComment = $Options.NoComment -eq $true - NoExt = $Options.NoExt -eq $true - NoGlobStar = $Options.NoGlobStar -eq $true - NoNegate = $Options.NoNegate -eq $true - NoNull = $Options.NoNull -eq $true - } -} - -function ConvertTo-MinimatchOptions { - [CmdletBinding()] - param($Options) - - $opt = New-Object Minimatch.Options - $opt.AllowWindowsPaths = $true - $opt.Dot = $Options.Dot -eq $true - $opt.FlipNegate = $Options.FlipNegate -eq $true - $opt.MatchBase = $Options.MatchBase -eq $true - $opt.NoBrace = $Options.NoBrace -eq $true - $opt.NoCase = $Options.NoCase -eq $true - $opt.NoComment = $Options.NoComment -eq $true - $opt.NoExt = $Options.NoExt -eq $true - $opt.NoGlobStar = $Options.NoGlobStar -eq $true - $opt.NoNegate = $Options.NoNegate -eq $true - $opt.NoNull = $Options.NoNull -eq $true - return $opt -} - -function ConvertTo-NormalizedSeparators { - [CmdletBinding()] - param([string]$Path) - - # Convert slashes. - $Path = "$Path".Replace('/', '\') - - # Remove redundant slashes. - $isUnc = $Path -match '^\\\\+[^\\]' - $Path = $Path -replace '\\\\+', '\' - if ($isUnc) { - $Path = '\' + $Path - } - - return $Path -} - -function Get-FindInfoFromPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern, - [Parameter(Mandatory = $true)] - $MatchOptions) - - if (!$MatchOptions.NoBrace) { - throw "Get-FindInfoFromPattern expected MatchOptions.NoBrace to be true." - } - - # For the sake of determining the find path, pretend NoCase=false. - $MatchOptions = Copy-MatchOptions -Options $MatchOptions - $MatchOptions.NoCase = $false - - # Check if basename only and MatchBase=true - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $Pattern) -and - ($Pattern -replace '\\', '/').IndexOf('/') -lt 0) { - - return New-Object psobject -Property @{ - AdjustedPattern = $Pattern - FindPath = $DefaultRoot - StatOnly = $false - } - } - - # The technique applied by this function is to use the information on the Minimatch object determine - # the findPath. Minimatch breaks the pattern into path segments, and exposes information about which - # segments are literal vs patterns. - # - # Note, the technique currently imposes a limitation for drive-relative paths with a glob in the - # first segment, e.g. C:hello*/world. It's feasible to overcome this limitation, but is left unsolved - # for now. - $minimatchObj = New-Object Minimatch.Minimatcher($Pattern, (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # The "set" field is a two-dimensional enumerable of parsed path segment info. The outer enumerable should only - # contain one item, otherwise something went wrong. Brace expansion can result in multiple items in the outer - # enumerable, but that should be turned off by the time this function is reached. - # - # Note, "set" is a private field in the .NET implementation but is documented as a feature in the nodejs - # implementation. The .NET implementation is a port and is by a different author. - $setFieldInfo = $minimatchObj.GetType().GetField('set', 'Instance,NonPublic') - [object[]]$set = $setFieldInfo.GetValue($minimatchObj) - if ($set.Count -ne 1) { - throw "Get-FindInfoFromPattern expected Minimatch.Minimatcher(...).set.Count to be 1. Actual: '$($set.Count)'" - } - - [string[]]$literalSegments = @( ) - [object[]]$parsedSegments = $set[0] - foreach ($parsedSegment in $parsedSegments) { - if ($parsedSegment.GetType().Name -eq 'LiteralItem') { - # The item is a LiteralItem when the original input for the path segment does not contain any - # unescaped glob characters. - $literalSegments += $parsedSegment.Source; - continue - } - - break; - } - - # Join the literal segments back together. Minimatch converts '\' to '/' on Windows, then squashes - # consequetive slashes, and finally splits on slash. This means that UNC format is lost, but can - # be detected from the original pattern. - $joinedSegments = [string]::Join('/', $literalSegments) - if ($joinedSegments -and ($Pattern -replace '\\', '/').StartsWith('//')) { - $joinedSegments = '/' + $joinedSegments # restore UNC format - } - - # Determine the find path. - $findPath = '' - if ((Test-Rooted -Path $Pattern)) { # The pattern is rooted. - $findPath = $joinedSegments - } elseif ($joinedSegments) { # The pattern is not rooted, and literal segements were found. - $findPath = [System.IO.Path]::Combine($DefaultRoot, $joinedSegments) - } else { # The pattern is not rooted, and no literal segements were found. - $findPath = $DefaultRoot - } - - # Clean up the path. - if ($findPath) { - $findPath = [System.IO.Path]::GetDirectoryName(([System.IO.Path]::Combine($findPath, '_'))) # Hack to remove unnecessary trailing slash. - $findPath = ConvertTo-NormalizedSeparators -Path $findPath - } - - return New-Object psobject -Property @{ - AdjustedPattern = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $Pattern - FindPath = $findPath - StatOnly = $literalSegments.Count -eq $parsedSegments.Count - } -} - -function Get-FindResult { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - $Options) - - if (!(Test-Path -LiteralPath $Path)) { - Write-Verbose 'Path not found.' - return - } - - $Path = ConvertTo-NormalizedSeparators -Path $Path - - # Push the first item. - [System.Collections.Stack]$stack = New-Object System.Collections.Stack - $stack.Push((Get-Item -LiteralPath $Path)) - - $count = 0 - while ($stack.Count) { - # Pop the next item and yield the result. - $item = $stack.Pop() - $count++ - $item.FullName - - # Traverse. - if (($item.Attributes -band 0x00000010) -eq 0x00000010) { # Directory - if (($item.Attributes -band 0x00000400) -ne 0x00000400 -or # ReparsePoint - $Options.FollowSymbolicLinks -or - ($count -eq 1 -and $Options.FollowSpecifiedSymbolicLink)) { - - $childItems = @( Get-DirectoryChildItem -Path $Item.FullName -Force ) - [System.Array]::Reverse($childItems) - foreach ($childItem in $childItems) { - $stack.Push($childItem) - } - } - } - } -} - -function Get-RootedPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern) - - if ((Test-Rooted -Path $Pattern)) { - return $Pattern - } - - # Normalize root. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - # Escape special glob characters. - $DefaultRoot = $DefaultRoot -replace '(\[)(?=[^\/]+\])', '[[]' # Escape '[' when ']' follows within the path segment - $DefaultRoot = $DefaultRoot.Replace('?', '[?]') # Escape '?' - $DefaultRoot = $DefaultRoot.Replace('*', '[*]') # Escape '*' - $DefaultRoot = $DefaultRoot -replace '\+\(', '[+](' # Escape '+(' - $DefaultRoot = $DefaultRoot -replace '@\(', '[@](' # Escape '@(' - $DefaultRoot = $DefaultRoot -replace '!\(', '[!](' # Escape '!(' - - if ($DefaultRoot -like '[A-Z]:') { # e.g. C: - return "$DefaultRoot$Pattern" - } - - # Ensure root ends with a separator. - if (!$DefaultRoot.EndsWith('\')) { - $DefaultRoot = "$DefaultRoot\" - } - - return "$DefaultRoot$Pattern" -} - -function Test-Rooted { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - $Path = ConvertTo-NormalizedSeparators -Path $Path - return $Path.StartsWith('\') -or # e.g. \ or \hello or \\hello - $Path -like '[A-Z]:*' # e.g. C: or C:\hello -} - -function Trace-MatchOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "MatchOptions.Dot: '$($Options.Dot)'" - Write-Verbose "MatchOptions.FlipNegate: '$($Options.FlipNegate)'" - Write-Verbose "MatchOptions.MatchBase: '$($Options.MatchBase)'" - Write-Verbose "MatchOptions.NoBrace: '$($Options.NoBrace)'" - Write-Verbose "MatchOptions.NoCase: '$($Options.NoCase)'" - Write-Verbose "MatchOptions.NoComment: '$($Options.NoComment)'" - Write-Verbose "MatchOptions.NoExt: '$($Options.NoExt)'" - Write-Verbose "MatchOptions.NoGlobStar: '$($Options.NoGlobStar)'" - Write-Verbose "MatchOptions.NoNegate: '$($Options.NoNegate)'" - Write-Verbose "MatchOptions.NoNull: '$($Options.NoNull)'" -} - -function Trace-FindOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "FindOptions.FollowSpecifiedSymbolicLink: '$($FindOptions.FollowSpecifiedSymbolicLink)'" - Write-Verbose "FindOptions.FollowSymbolicLinks: '$($FindOptions.FollowSymbolicLinks)'" -} diff --git a/Tasks/source/ps_modules/VstsTaskSdk/InputFunctions.ps1 b/Tasks/source/ps_modules/VstsTaskSdk/InputFunctions.ps1 deleted file mode 100644 index 846492d..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/InputFunctions.ps1 +++ /dev/null @@ -1,493 +0,0 @@ -# Hash table of known variable info. The formatted env var name is the lookup key. -# -# The purpose of this hash table is to keep track of known variables. The hash table -# needs to be maintained for multiple reasons: -# 1) to distinguish between env vars and job vars -# 2) to distinguish between secret vars and public -# 3) to know the real variable name and not just the formatted env var name. -$script:knownVariables = @{ } -$script:vault = @{ } - -<# -.SYNOPSIS -Gets an endpoint. - -.DESCRIPTION -Gets an endpoint object for the specified endpoint name. The endpoint is returned as an object with three properties: Auth, Data, and Url. - -The Data property requires a 1.97 agent or higher. - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-Endpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the URL. - $description = Get-LocString -Key PSLIB_EndpointUrl0 -ArgumentList $Name - $key = "ENDPOINT_URL_$Name" - $url = Get-VaultValue -Description $description -Key $key -Require:$Require - - # Get the auth object. - $description = Get-LocString -Key PSLIB_EndpointAuth0 -ArgumentList $Name - $key = "ENDPOINT_AUTH_$Name" - if ($auth = (Get-VaultValue -Description $description -Key $key -Require:$Require)) { - $auth = ConvertFrom-Json -InputObject $auth - } - - # Get the data. - $description = "'$Name' service endpoint data" - $key = "ENDPOINT_DATA_$Name" - if ($data = (Get-VaultValue -Description $description -Key $key)) { - $data = ConvertFrom-Json -InputObject $data - } - - # Return the endpoint. - if ($url -or $auth -or $data) { - New-Object -TypeName psobject -Property @{ - Url = $url - Auth = $auth - Data = $data - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file ticket. - -.DESCRIPTION -Gets the secure file ticket that can be used to download the secure file contents. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileTicket { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_TICKET_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file name. - -.DESCRIPTION -Gets the name for a secure file. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_NAME_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets an input. - -.DESCRIPTION -Gets the value for the specified input name. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-Input { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - # Get the input from the vault. Splat the bound parameters hashtable. Splatting is required - # in order to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Name - $key = "INPUT_$($Name.Replace(' ', '_').ToUpperInvariant())" - Get-VaultValue @PSBoundParameters -Description $description -Key $key -} - -<# -.SYNOPSIS -Gets a task variable. - -.DESCRIPTION -Gets the value for the specified task variable. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-TaskVariable { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - $description = Get-LocString -Key PSLIB_TaskVariable0 -ArgumentList $Name - $variableKey = Get-VariableKey -Name $Name - if ($script:knownVariables.$variableKey.Secret) { - # Get secret variable. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $vaultKey = "SECRET_$variableKey" - Get-VaultValue @PSBoundParameters -Description $description -Key $vaultKey - } else { - # Get public variable. - $item = $null - $path = "Env:$variableKey" - if ((Test-Path -LiteralPath $path) -and ($item = Get-Item -LiteralPath $path).Value) { - # Intentionally empty. Value was successfully retrieved. - } elseif (!$script:nonInteractive) { - # The value wasn't found and the module is running in interactive dev mode. - # Prompt for the value. - Set-Item -LiteralPath $path -Value (Read-Host -Prompt $description) - if (Test-Path -LiteralPath $path) { - $item = Get-Item -LiteralPath $path - } - } - - # Get the converted value. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - Get-Value @PSBoundParameters -Description $description -Key $variableKey -Value $item.Value - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets all job variables available to the task. Requires 2.104.1 agent or higher. - -.DESCRIPTION -Gets a snapshot of the current state of all job variables available to the task. -Requires a 2.104.1 agent or higher for full functionality. - -Returns an array of objects with the following properties: - [string]Name - [string]Value - [bool]Secret - -Limitations on an agent prior to 2.104.1: - 1) The return value does not include all public variables. Only public variables - that have been added using setVariable are returned. - 2) The name returned for each secret variable is the formatted environment variable - name, not the actual variable name (unless it was set explicitly at runtime using - setVariable). -#> -function Get-TaskVariableInfo { - [CmdletBinding()] - param() - - foreach ($info in $script:knownVariables.Values) { - New-Object -TypeName psobject -Property @{ - Name = $info.Name - Value = Get-TaskVariable -Name $info.Name - Secret = $info.Secret - } - } -} - -<# -.SYNOPSIS -Sets a task variable. - -.DESCRIPTION -Sets a task variable in the current task context as well as in the current job context. This allows the task variable to retrieved by subsequent tasks within the same job. -#> -function Set-TaskVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret) - - # Once a secret always a secret. - $variableKey = Get-VariableKey -Name $Name - [bool]$Secret = $Secret -or $script:knownVariables.$variableKey.Secret - if ($Secret) { - $vaultKey = "SECRET_$variableKey" - if (!$Value) { - # Clear the secret. - Write-Verbose "Set $Name = ''" - $script:vault.Remove($vaultKey) - } else { - # Store the secret in the vault. - Write-Verbose "Set $Name = '********'" - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Set-Item -LiteralPath "Env:$variableKey" -Value '' - } else { - # Set the environment variable. - Write-Verbose "Set $Name = '$Value'" - Set-Item -LiteralPath "Env:$variableKey" -Value $Value - } - - # Store the metadata. - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $Secret - } - - # Persist the variable in the task context. - Write-SetVariable -Name $Name -Value $Value -Secret:$Secret -} - -######################################## -# Private functions. -######################################## -function Get-VaultValue { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - # Attempt to get the vault value. - $value = $null - if ($psCredential = $script:vault[$Key]) { - $value = $psCredential.GetNetworkCredential().Password - } elseif (!$script:nonInteractive) { - # The value wasn't found. Prompt for the value if running in interactive dev mode. - $value = Read-Host -Prompt $Description - if ($value) { - $script:vault[$Key] = New-Object System.Management.Automation.PSCredential( - $Key, - (ConvertTo-SecureString -String $value -AsPlainText -Force)) - } - } - - Get-Value -Value $value @PSBoundParameters -} - -function Get-Value { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [string]$Value, - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - $result = $Value - if ($result) { - if ($Key -like 'ENDPOINT_AUTH_*') { - Write-Verbose "$($Key): '********'" - } else { - Write-Verbose "$($Key): '$result'" - } - } else { - Write-Verbose "$Key (empty)" - - # Write error if required. - if ($Require) { - Write-Error "$(Get-LocString -Key PSLIB_Required0 $Description)" - return - } - - # Fallback to the default if provided. - if ($PSCmdlet.ParameterSetName -eq 'Default') { - $result = $Default - $OFS = ' ' - Write-Verbose " Defaulted to: '$result'" - } else { - $result = '' - } - } - - # Convert to bool if specified. - if ($AsBool) { - if ($result -isnot [bool]) { - $result = "$result" -in '1', 'true' - Write-Verbose " Converted to bool: $result" - } - - return $result - } - - # Convert to int if specified. - if ($AsInt) { - if ($result -isnot [int]) { - try { - $result = [int]"$result" - } catch { - $result = 0 - } - - Write-Verbose " Converted to int: $result" - } - - return $result - } - - return $result -} - -function Initialize-Inputs { - # Store endpoints, inputs, and secret variables in the vault. - foreach ($variable in (Get-ChildItem -Path Env:ENDPOINT_?*, Env:INPUT_?*, Env:SECRET_?*, Env:SECUREFILE_?*)) { - # Record the secret variable metadata. This is required by Get-TaskVariable to - # retrieve the value. In a 2.104.1 agent or higher, this metadata will be overwritten - # when $env:VSTS_SECRET_VARIABLES is processed. - if ($variable.Name -like 'SECRET_?*') { - $variableKey = $variable.Name.Substring('SECRET_'.Length) - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - # This is technically not the variable name (has underscores instead of dots), - # but it's good enough to make Get-TaskVariable work in a pre-2.104.1 agent - # where $env:VSTS_SECRET_VARIABLES is not defined. - Name = $variableKey - Secret = $true - } - } - - # Store the value in the vault. - $vaultKey = $variable.Name - if ($variable.Value) { - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $variable.Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Remove-Item -LiteralPath "Env:$($variable.Name)" - } - - # Record the public variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_PUBLIC_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_PUBLIC_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $false - } - } - - $env:VSTS_PUBLIC_VARIABLES = '' - } - - # Record the secret variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_SECRET_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_SECRET_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $true - } - } - - $env:VSTS_SECRET_VARIABLES = '' - } -} - -function Get-VariableKey { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name) - - if ($Name -ne 'agent.jobstatus') { - $Name = $Name.Replace('.', '_') - } - - $Name.ToUpperInvariant() -} diff --git a/Tasks/source/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 b/Tasks/source/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 deleted file mode 100644 index b4080ae..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 +++ /dev/null @@ -1,320 +0,0 @@ -<# -.SYNOPSIS -Finds files or directories. - -.DESCRIPTION -Finds files or directories using advanced pattern matching. - -.PARAMETER LiteralDirectory -Directory to search. - -.PARAMETER LegacyPattern -Proprietary pattern format. The LiteralDirectory parameter is used to root any unrooted patterns. - -Separate multiple patterns using ";". Escape actual ";" in the path by using ";;". -"?" indicates a wildcard that represents any single character within a path segment. -"*" indicates a wildcard that represents zero or more characters within a path segment. -"**" as the entire path segment indicates a recursive search. -"**" within a path segment indicates a recursive intersegment wildcard. -"+:" (can be omitted) indicates an include pattern. -"-:" indicates an exclude pattern. - -The result is from the command is a union of all the matches from the include patterns, minus the matches from the exclude patterns. - -.PARAMETER IncludeFiles -Indicates whether to include files in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER IncludeDirectories -Indicates whether to include directories in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER Force -Indicates whether to include hidden items. - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is?Match.txt" - -Given: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt -C:\Directory\IsNotMatch.txt - -Returns: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is*Match.txt" - -Given: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt -C:\Directory\NonMatch.txt - -Returns: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**\Match.txt" - -Given: -C:\Directory\Match.txt -C:\Directory\NotAMatch.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -Returns: -C:\Directory\Match.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**" - -Given: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -Returns: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Sub**Match.txt" - -Given: -C:\Directory\IsNotAMatch.txt -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\IsNot.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsNot.txt - -Returns: -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -#> -function Find-Files { - [CmdletBinding()] - param( - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$LiteralDirectory, - [Parameter(Mandatory = $true)] - [string]$LegacyPattern, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - # Note, due to subtle implementation details of Get-PathPrefix/Get-PathIterator, - # this function does not appear to be able to search the root of a drive and other - # cases where Path.GetDirectoryName() returns empty. More details in Get-PathPrefix. - - Trace-EnteringInvocation $MyInvocation - if (!$IncludeFiles -and !$IncludeDirectories) { - $IncludeFiles = $true - } - - $includePatterns = New-Object System.Collections.Generic.List[string] - $excludePatterns = New-Object System.Collections.Generic.List[System.Text.RegularExpressions.Regex] - $LegacyPattern = $LegacyPattern.Replace(';;', "`0") - foreach ($pattern in $LegacyPattern.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries)) { - $pattern = $pattern.Replace("`0", ';') - $isIncludePattern = Test-IsIncludePattern -Pattern ([ref]$pattern) - if ($LiteralDirectory -and !([System.IO.Path]::IsPathRooted($pattern))) { - # Use the root directory provided to make the pattern a rooted path. - $pattern = [System.IO.Path]::Combine($LiteralDirectory, $pattern) - } - - # Validate pattern does not end with a \. - if ($pattern[$pattern.Length - 1] -eq [System.IO.Path]::DirectorySeparatorChar) { - throw (Get-LocString -Key PSLIB_InvalidPattern0 -ArgumentList $pattern) - } - - if ($isIncludePattern) { - $includePatterns.Add($pattern) - } else { - $excludePatterns.Add((Convert-PatternToRegex -Pattern $pattern)) - } - } - - $count = 0 - foreach ($path in (Get-MatchingItems -IncludePatterns $includePatterns -ExcludePatterns $excludePatterns -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force)) { - $count++ - $path - } - - Write-Verbose "Total found: $count" - Trace-LeavingInvocation $MyInvocation -} - -######################################## -# Private functions. -######################################## -function Convert-PatternToRegex { - [CmdletBinding()] - param([string]$Pattern) - - $Pattern = [regex]::Escape($Pattern.Replace('\', '/')). # Normalize separators and regex escape. - Replace('/\*\*/', '((/.+/)|(/))'). # Replace directory globstar. - Replace('\*\*', '.*'). # Replace remaining globstars with a wildcard that can span directory separators. - Replace('\*', '[^/]*'). # Replace asterisks with a wildcard that cannot span directory separators. - # bug: should be '[^/]' instead of '.' - Replace('\?', '.') # Replace single character wildcards. - New-Object regex -ArgumentList "^$Pattern`$", ([System.Text.RegularExpressions.RegexOptions]::IgnoreCase) -} - -function Get-FileNameFilter { - [CmdletBinding()] - param([string]$Pattern) - - $index = $Pattern.LastIndexOf('\') - if ($index -eq -1 -or # Pattern does not contain a backslash. - !($Pattern = $Pattern.Substring($index + 1)) -or # Pattern ends in a backslash. - $Pattern.Contains('**')) # Last segment contains an inter-segment wildcard. - { - return '*' - } - - # bug? is this supposed to do substring? - return $Pattern -} - -function Get-MatchingItems { - [CmdletBinding()] - param( - [System.Collections.Generic.List[string]]$IncludePatterns, - [System.Collections.Generic.List[regex]]$ExcludePatterns, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - Trace-EnteringInvocation $MyInvocation - $allFiles = New-Object System.Collections.Generic.HashSet[string] - foreach ($pattern in $IncludePatterns) { - $pathPrefix = Get-PathPrefix -Pattern $pattern - $fileNameFilter = Get-FileNameFilter -Pattern $pattern - $patternRegex = Convert-PatternToRegex -Pattern $pattern - # Iterate over the directories and files under the pathPrefix. - Get-PathIterator -Path $pathPrefix -Filter $fileNameFilter -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force | - ForEach-Object { - # Normalize separators. - $normalizedPath = $_.Replace('\', '/') - # **/times/** will not match C:/fun/times because there isn't a trailing slash. - # So try both if including directories. - $alternatePath = "$normalizedPath/" # potential bug: it looks like this will result in a false - # positive if the item is a regular file and not a directory - - $isMatch = $false - if ($patternRegex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $patternRegex.IsMatch($alternatePath))) { - $isMatch = $true - - # Test whether the path should be excluded. - foreach ($regex in $ExcludePatterns) { - if ($regex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $regex.IsMatch($alternatePath))) { - $isMatch = $false - break - } - } - } - - if ($isMatch) { - $null = $allFiles.Add($_) - } - } - } - - Trace-Path -Path $allFiles -PassThru - Trace-LeavingInvocation $MyInvocation -} - -function Get-PathIterator { - [CmdletBinding()] - param( - [string]$Path, - [string]$Filter, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - if (!$Path) { - return - } - - # bug: this returns the dir without verifying whether exists - if ($IncludeDirectories) { - $Path - } - - Get-DirectoryChildItem -Path $Path -Filter $Filter -Force:$Force -Recurse | - ForEach-Object { - if ($_.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - if ($IncludeDirectories) { - $_.FullName - } - } elseif ($IncludeFiles) { - $_.FullName - } - } -} - -function Get-PathPrefix { - [CmdletBinding()] - param([string]$Pattern) - - # Note, unable to search root directories is a limitation due to subtleties of this function - # and downstream code in Get-PathIterator that short-circuits when the path prefix is empty. - # This function uses Path.GetDirectoryName() to determine the path prefix, which will yield - # empty in some cases. See the following examples of Path.GetDirectoryName() input => output: - # C:/ => - # C:/hello => C:\ - # C:/hello/ => C:\hello - # C:/hello/world => C:\hello - # C:/hello/world/ => C:\hello\world - # C: => - # C:hello => C: - # C:hello/ => C:hello - # / => - # /hello => \ - # /hello/ => \hello - # //hello => - # //hello/ => - # //hello/world => - # //hello/world/ => \\hello\world - - $index = $Pattern.IndexOfAny([char[]]@('*'[0], '?'[0])) - if ($index -eq -1) { - # If no wildcards are found, return the directory name portion of the path. - # If there is no directory name (file name only in pattern), this will return empty string. - return [System.IO.Path]::GetDirectoryName($Pattern) - } - - [System.IO.Path]::GetDirectoryName($Pattern.Substring(0, $index)) -} - -function Test-IsIncludePattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [ref]$Pattern) - - # Include patterns start with +: or anything except -: - # Exclude patterns start with -: - if ($Pattern.value.StartsWith("+:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $true - } elseif ($Pattern.value.StartsWith("-:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $false - } else { - # No prefix, so leave the string alone. - $true; - } -} diff --git a/Tasks/source/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 b/Tasks/source/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 deleted file mode 100644 index c31790c..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 +++ /dev/null @@ -1,150 +0,0 @@ -$script:resourceStrings = @{ } - -<# -.SYNOPSIS -Gets a localized resource string. - -.DESCRIPTION -Gets a localized resource string and optionally formats the string with arguments. - -If the format fails (due to a bad format string or incorrect expected arguments in the format string), then the format string is returned followed by each of the arguments (delimited by a space). - -If the lookup key is not found, then the lookup key is returned followed by each of the arguments (delimited by a space). - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-LocString { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true, Position = 1)] - [string]$Key, - [Parameter(Position = 2)] - [object[]]$ArgumentList = @( )) - - # Due to the dynamically typed nature of PowerShell, a single null argument passed - # to an array parameter is interpreted as a null array. - if ([object]::ReferenceEquals($null, $ArgumentList)) { - $ArgumentList = @( $null ) - } - - # Lookup the format string. - $format = '' - if (!($format = $script:resourceStrings[$Key])) { - # Warn the key was not found. Prevent recursion if the lookup key is the - # "string resource key not found" lookup key. - $resourceNotFoundKey = 'PSLIB_StringResourceKeyNotFound0' - if ($key -ne $resourceNotFoundKey) { - Write-Warning (Get-LocString -Key $resourceNotFoundKey -ArgumentList $Key) - } - - # Fallback to just the key itself if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $key } - - # Otherwise fallback to the key followed by the arguments. - $OFS = " " - return "$key $ArgumentList" - } - - # Return the string if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $format } - - try { - [string]::Format($format, $ArgumentList) - } catch { - Write-Warning (Get-LocString -Key 'PSLIB_StringFormatFailed') - $OFS = " " - "$format $ArgumentList" - } -} - -<# -.SYNOPSIS -Imports resource strings for use with Get-VstsLocString. - -.DESCRIPTION -Imports resource strings for use with Get-VstsLocString. The imported strings are stored in an internal resource string dictionary. Optionally, if a separate resource file for the current culture exists, then the localized strings from that file then imported (overlaid) into the same internal resource string dictionary. - -Resource strings from the SDK are prefixed with "PSLIB_". This prefix should be avoided for custom resource strings. - -.Parameter LiteralPath -JSON file containing resource strings. - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Imports strings from messages section in the JSON file. If a messages section is not defined, then no strings are imported. Example messages section: -{ - "messages": { - "Hello": "Hello you!", - "Hello0": "Hello {0}!" - } -} - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Overlays strings from an optional separate resource file for the current culture. - -Given the task variable System.Culture is set to 'de-DE'. This variable is set by the agent based on the current culture for the job. -Given the file Task.json contains: -{ - "messages": { - "GoodDay": "Good day!", - } -} -Given the file resources.resjson\de-DE\resources.resjson: -{ - "loc.messages.GoodDay": "Guten Tag!" -} - -The net result from the import command would be one new key-value pair added to the internal dictionary: Key = 'GoodDay', Value = 'Guten Tag!' -#> -function Import-LocStrings { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - # Validate the file exists. - if (!(Test-Path -LiteralPath $LiteralPath -PathType Leaf)) { - Write-Warning (Get-LocString -Key PSLIB_FileNotFound0 -ArgumentList $LiteralPath) - return - } - - # Load the json. - Write-Verbose "Loading resource strings from: $LiteralPath" - $count = 0 - if ($messages = (Get-Content -LiteralPath $LiteralPath -Encoding UTF8 | Out-String | ConvertFrom-Json).messages) { - # Add each resource string to the hashtable. - foreach ($member in (Get-Member -InputObject $messages -MemberType NoteProperty)) { - [string]$key = $member.Name - $script:resourceStrings[$key] = $messages."$key" - $count++ - } - } - - Write-Verbose "Loaded $count strings." - - # Get the culture. - $culture = Get-TaskVariable -Name "System.Culture" -Default "en-US" - - # Load the resjson. - $resjsonPath = "$([System.IO.Path]::GetDirectoryName($LiteralPath))\Strings\resources.resjson\$culture\resources.resjson" - if (Test-Path -LiteralPath $resjsonPath) { - Write-Verbose "Loading resource strings from: $resjsonPath" - $count = 0 - $resjson = Get-Content -LiteralPath $resjsonPath -Encoding UTF8 | Out-String | ConvertFrom-Json - foreach ($member in (Get-Member -Name loc.messages.* -InputObject $resjson -MemberType NoteProperty)) { - if (!($value = $resjson."$($member.Name)")) { - continue - } - - [string]$key = $member.Name.Substring('loc.messages.'.Length) - $script:resourceStrings[$key] = $value - $count++ - } - - Write-Verbose "Loaded $count strings." - } -} diff --git a/Tasks/source/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 b/Tasks/source/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 deleted file mode 100644 index 595a7d8..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 +++ /dev/null @@ -1,601 +0,0 @@ -$script:loggingCommandPrefix = '##vso[' -$script:loggingCommandEscapeMappings = @( # TODO: WHAT ABOUT "="? WHAT ABOUT "%"? - New-Object psobject -Property @{ Token = ';' ; Replacement = '%3B' } - New-Object psobject -Property @{ Token = "`r" ; Replacement = '%0D' } - New-Object psobject -Property @{ Token = "`n" ; Replacement = '%0A' } - New-Object psobject -Property @{ Token = "]" ; Replacement = '%5D' } -) -# TODO: BUG: Escape % ??? -# TODO: Add test to verify don't need to escape "=". - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddAttachment { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Type, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'addattachment' -Data $Path -Properties @{ - 'type' = $Type - 'name' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadSummary { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadsummary' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetEndpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [Parameter(Mandatory = $true)] - [string]$Field, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setendpoint' -Data $Value -Properties @{ - 'id' = $Id - 'field' = $Field - 'key' = $Key - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddBuildTag { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'addbuildtag' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AssociateArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - [string]$Type, - [hashtable]$Properties, - [switch]$AsOutput) - - $p = @{ } - if ($Properties) { - foreach ($key in $Properties.Keys) { - $p[$key] = $Properties[$key] - } - } - - $p['artifactname'] = $Name - $p['artifacttype'] = $Type - Write-LoggingCommand -Area 'artifact' -Event 'associate' -Data $Path -Properties $p -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-LogDetail { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [guid]$Id, - $ParentId, - [string]$Type, - [string]$Name, - $Order, - $StartTime, - $FinishTime, - $Progress, - [ValidateSet('Unknown', 'Initialized', 'InProgress', 'Completed')] - [Parameter()] - $State, - [ValidateSet('Succeeded', 'SucceededWithIssues', 'Failed', 'Cancelled', 'Skipped')] - [Parameter()] - $Result, - [string]$Message, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'logdetail' -Data $Message -Properties @{ - 'id' = $Id - 'parentid' = $ParentId - 'type' = $Type - 'name' = $Name - 'order' = $Order - 'starttime' = $StartTime - 'finishtime' = $FinishTime - 'progress' = $Progress - 'state' = $State - 'result' = $Result - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetProgress { - [CmdletBinding()] - param( - [ValidateRange(0, 100)] - [Parameter(Mandatory = $true)] - [int]$Percent, - [string]$CurrentOperation, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setprogress' -Data $CurrentOperation -Properties @{ - 'value' = $Percent - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetResult { - [CmdletBinding(DefaultParameterSetName = 'AsOutput')] - param( - [ValidateSet("Succeeded", "SucceededWithIssues", "Failed", "Cancelled", "Skipped")] - [Parameter(Mandatory = $true)] - [string]$Result, - [string]$Message, - [Parameter(ParameterSetName = 'AsOutput')] - [switch]$AsOutput, - [Parameter(ParameterSetName = 'DoNotThrow')] - [switch]$DoNotThrow) - - Write-LoggingCommand -Area 'task' -Event 'complete' -Data $Message -Properties @{ - 'result' = $Result - } -AsOutput:$AsOutput - if ($Result -eq 'Failed' -and !$AsOutput -and !$DoNotThrow) { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - throw (New-Object VstsTaskSdk.TerminationException($Message)) - } -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetSecret { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setsecret' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ - 'variable' = $Name - 'issecret' = $Secret - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskDebug { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskError { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type error @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskVerbose { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -AsVerbose -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskWarning { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type warning @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadFile { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadfile' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-PrependPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateBuildNumber { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'updatebuildnumber' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$ContainerFolder, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'artifact' -Event 'upload' -Data $Path -Properties @{ - 'containerfolder' = $ContainerFolder - 'artifactname' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadBuildLog { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'uploadlog' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateReleaseName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'release' -Event 'updatereleasename' -Data $Name -AsOutput:$AsOutput -} - -######################################## -# Private functions. -######################################## -function Format-LoggingCommandData { - [CmdletBinding()] - param([string]$Value, [switch]$Reverse) - - if (!$Value) { - return '' - } - - if (!$Reverse) { - foreach ($mapping in $script:loggingCommandEscapeMappings) { - $Value = $Value.Replace($mapping.Token, $mapping.Replacement) - } - } else { - for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { - $mapping = $script:loggingCommandEscapeMappings[$i] - $Value = $Value.Replace($mapping.Replacement, $mapping.Token) - } - } - - return $Value -} - -function Format-LoggingCommand { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Area, - [Parameter(Mandatory = $true)] - [string]$Event, - [string]$Data, - [hashtable]$Properties) - - # Append the preamble. - [System.Text.StringBuilder]$sb = New-Object -TypeName System.Text.StringBuilder - $null = $sb.Append($script:loggingCommandPrefix).Append($Area).Append('.').Append($Event) - - # Append the properties. - if ($Properties) { - $first = $true - foreach ($key in $Properties.Keys) { - [string]$value = Format-LoggingCommandData $Properties[$key] - if ($value) { - if ($first) { - $null = $sb.Append(' ') - $first = $false - } else { - $null = $sb.Append(';') - } - - $null = $sb.Append("$key=$value") - } - } - } - - # Append the tail and output the value. - $Data = Format-LoggingCommandData $Data - $sb.Append(']').Append($Data).ToString() -} - -function Write-LoggingCommand { - [CmdletBinding(DefaultParameterSetName = 'Parameters')] - param( - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Area, - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Event, - [Parameter(ParameterSetName = 'Parameters')] - [string]$Data, - [Parameter(ParameterSetName = 'Parameters')] - [hashtable]$Properties, - [Parameter(Mandatory = $true, ParameterSetName = 'Object')] - $Command, - [switch]$AsOutput) - - if ($PSCmdlet.ParameterSetName -eq 'Object') { - Write-LoggingCommand -Area $Command.Area -Event $Command.Event -Data $Command.Data -Properties $Command.Properties -AsOutput:$AsOutput - return - } - - $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties - if ($AsOutput) { - $command - } else { - Write-Host $command - } -} - -function Write-LogIssue { - [CmdletBinding()] - param( - [ValidateSet('warning', 'error')] - [Parameter(Mandatory = $true)] - [string]$Type, - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ - 'type' = $Type - 'code' = $ErrCode - 'sourcepath' = $SourcePath - 'linenumber' = $LineNumber - 'columnnumber' = $ColumnNumber - } - if ($AsOutput) { - return $command - } - - if ($Type -eq 'error') { - $foregroundColor = $host.PrivateData.ErrorForegroundColor - $backgroundColor = $host.PrivateData.ErrorBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Red - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.WarningForegroundColor - $backgroundColor = $host.PrivateData.WarningBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Yellow - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} - -function Write-TaskDebug_Internal { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsVerbose, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'debug' -Data $Message - if ($AsOutput) { - return $command - } - - if ($AsVerbose) { - $foregroundColor = $host.PrivateData.VerboseForegroundColor - $backgroundColor = $host.PrivateData.VerboseBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Cyan - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.DebugForegroundColor - $backgroundColor = $host.PrivateData.DebugBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::DarkGray - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host -Object $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} diff --git a/Tasks/source/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 b/Tasks/source/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 deleted file mode 100644 index d536111..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 +++ /dev/null @@ -1,205 +0,0 @@ -######################################## -# Private functions. -######################################## -function ConvertFrom-LongFormPath { - [CmdletBinding()] - param([string]$Path) - - if ($Path) { - if ($Path.StartsWith('\\?\UNC')) { - # E.g. \\?\UNC\server\share -> \\server\share - return $Path.Substring(1, '\?\UNC'.Length) - } elseif ($Path.StartsWith('\\?\')) { - # E.g. \\?\C:\directory -> C:\directory - return $Path.Substring('\\?\'.Length) - } - } - - return $Path -} -function ConvertTo-LongFormPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$longFormPath = Get-FullNormalizedPath -Path $Path - if ($longFormPath -and !$longFormPath.StartsWith('\\?')) { - if ($longFormPath.StartsWith('\\')) { - # E.g. \\server\share -> \\?\UNC\server\share - return "\\?\UNC$($longFormPath.Substring(1))" - } else { - # E.g. C:\directory -> \\?\C:\directory - return "\\?\$longFormPath" - } - } - - return $longFormPath -} - -# TODO: ADD A SWITCH TO EXCLUDE FILES, A SWITCH TO EXCLUDE DIRECTORIES, AND A SWITCH NOT TO FOLLOW REPARSE POINTS. -function Get-DirectoryChildItem { - [CmdletBinding()] - param( - [string]$Path, - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$Filter = "*", - [switch]$Force, - [VstsTaskSdk.FS.FindFlags]$Flags = [VstsTaskSdk.FS.FindFlags]::LargeFetch, - [VstsTaskSdk.FS.FindInfoLevel]$InfoLevel = [VstsTaskSdk.FS.FindInfoLevel]::Basic, - [switch]$Recurse) - - $stackOfDirectoryQueues = New-Object System.Collections.Stack - while ($true) { - $directoryQueue = New-Object System.Collections.Queue - $fileQueue = New-Object System.Collections.Queue - $findData = New-Object VstsTaskSdk.FS.FindData - $longFormPath = (ConvertTo-LongFormPath $Path) - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, $Filter), - $InfoLevel, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - # Output directories immediately. - if ($item.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - $item - # Append to the directory queue if recursive and default filter. - if ($Recurse -and $Filter -eq '*') { - $directoryQueue.Enqueue($item) - } - } else { - # Hold the files until all directories have been output. - $fileQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - - # If recursive and non-default filter, queue child directories. - if ($Recurse -and $Filter -ne '*') { - $findData = New-Object VstsTaskSdk.FS.FindData - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, '*'), - [VstsTaskSdk.FS.FindInfoLevel]::Basic, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Collect directories only. - if ($attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - $directoryQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - } - - # Output the files. - $fileQueue - - # Push the directory queue onto the stack if any directories were found. - if ($directoryQueue.Count) { $stackOfDirectoryQueues.Push($directoryQueue) } - - # Break out of the loop if no more directory queues to process. - if (!$stackOfDirectoryQueues.Count) { break } - - # Get the next path. - $directoryQueue = $stackOfDirectoryQueues.Peek() - $Path = $directoryQueue.Dequeue().FullName - - # Pop the directory queue if it's empty. - if (!$directoryQueue.Count) { $null = $stackOfDirectoryQueues.Pop() } - } -} - -function Get-FullNormalizedPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$outPath = $Path - [uint32]$bufferSize = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, 0, $null, $null) - [int]$lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($bufferSize -gt 0) { - $absolutePath = New-Object System.Text.StringBuilder([int]$bufferSize) - [uint32]$length = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, $bufferSize, $absolutePath, $null) - $lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($length -gt 0) { - $outPath = $absolutePath.ToString() - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - - if ($outPath.EndsWith('\') -and !$outPath.EndsWith(':\')) { - $outPath = $outPath.TrimEnd('\') - } - - $outPath -} \ No newline at end of file diff --git a/Tasks/source/ps_modules/VstsTaskSdk/Minimatch.dll b/Tasks/source/ps_modules/VstsTaskSdk/Minimatch.dll deleted file mode 100644 index 700ddc426e56b08270c9dcbb1ade8ded248f98d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18432 zcmeHvd3amZweLFTNJpa;OY%U-U;wdJ(iE<^0Dr1eX+yVU^ZP<}CerFP{^D;NRAvpy{Upu7qdr-p#QQK0A=EE z*j@RF!K$=fum`{t+x7$Dj;_a3@mYu3X*)Y&L6B{wNj$7;1D=Y{x>+@ezQumU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YsJcSoW3+8v2uRt~2PRkrZsCaP` z%M;!^hY)>E!ekmZ+mS7JOJ0e1gE5&RYTEm`K4ejh?~5E;L%bA3wjduM>CcH7;A0Z2 z39Y*cGcOcTN}LL!0@ai${3@*|MWHUcm42xHg|Sx z`{tfwk3Rjs-`(@)7u#+*@b2&fb<3*0nqD`t;EumPyk`7E?55KHhkzXnS5bT)o=#3d z-F+{9yXNOFH5^~}{vRh_efj-=znQJ>TG@X|0T&zneSN+C-Px<~SNNlRlIX`lH6K&= zS^XHJY=2iHztz#b0<#WW(T^L9EUuHv-1O++0s1PME`6S3JXWHnze|6@uekfVEW3MT zWD8De>Y6p1mBYT2o^FDY>gm-hDgI`N@NExGR&rJ1CG65?^I2{ao?ZKiy45!v%mU6o z{-pd7xp#x)`K^9S*368ckzJK@|eeCHK|wh@#b0Crf~9w6M#pe4dt zz?`bfXOcXA%di!1*2AAZ>IHR3^sUCXQ`(eW-H<5Yn`5?jbXtG5NDp!qZSh!nE9zb< ztrseM(26}cKP~cbpO68?i={JC27M@7HoJ{94MJiBHg6Jt^rDR+*ghhj8AZR?(joL5 zXRI^uV)Ov~6T{i41(qQF;Jm}5U)G~Wa1eUgi?-tx2;$Q%_HJ|9;1T4OOVPlT^5`4c zy-fVO9Xc%ZWemP8R`eKu26_g+E)%~_uQSuTGkx13bviM61?kHHSb7va|F7z)p8hw( X?dtd6e<)43|K{fYzxw~TJn(-2*CUr_ diff --git a/Tasks/source/ps_modules/VstsTaskSdk/OutFunctions.ps1 b/Tasks/source/ps_modules/VstsTaskSdk/OutFunctions.ps1 deleted file mode 100644 index fd898d6..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/OutFunctions.ps1 +++ /dev/null @@ -1,79 +0,0 @@ -# TODO: It would be better if the Out-Default function resolved the underlying Out-Default -# command in the begin block. This would allow for supporting other modules that override -# Out-Default. -$script:outDefaultCmdlet = $ExecutionContext.InvokeCommand.GetCmdlet("Microsoft.PowerShell.Core\Out-Default") - -######################################## -# Public functions. -######################################## -function Out-Default { - [CmdletBinding(ConfirmImpact = "Medium")] - param( - [Parameter(ValueFromPipeline = $true)] - [System.Management.Automation.PSObject]$InputObject) - - begin { - #Write-Host '[Entering Begin Out-Default]' - $__sp = { & $script:outDefaultCmdlet @PSBoundParameters }.GetSteppablePipeline() - $__sp.Begin($pscmdlet) - #Write-Host '[Leaving Begin Out-Default]' - } - - process { - #Write-Host '[Entering Process Out-Default]' - if ($_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose -Message 'Error record:' 4>&1 | Out-Default - Write-Verbose -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) 4>&1 | Out-Default - Write-Verbose -Message 'Script stack trace:' 4>&1 | Out-Default - Write-Verbose -Message "$($_.ScriptStackTrace)" 4>&1 | Out-Default - Write-Verbose -Message 'Exception:' 4>&1 | Out-Default - Write-Verbose -Message $_.Exception.ToString() 4>&1 | Out-Default - Write-TaskError -Message $_.Exception.Message - } elseif ($_ -is [System.Management.Automation.WarningRecord]) { - Write-TaskWarning -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) - } elseif ($_ -is [System.Management.Automation.VerboseRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskVerbose -Message $private:str - } - } elseif ($_ -is [System.Management.Automation.DebugRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskDebug -Message $private:str - } - } else { -# TODO: Consider using out-string here to control the width. As a security precaution it would actually be best to set it to max so wrapping doesn't interfere with secret masking. - $__sp.Process($_) - } - - #Write-Host '[Leaving Process Out-Default]' - } - - end { - #Write-Host '[Entering End Out-Default]' - $__sp.End() - #Write-Host '[Leaving End Out-Default]' - } -} - -######################################## -# Private functions. -######################################## -function Format-DebugMessage { - [CmdletBinding()] - param([psobject]$Object) - - $private:str = Out-String -InputObject $Object -Width 2147483647 - $private:str = Remove-TrailingNewLine $private:str - "$private:str".Replace("`r`n", "`n").Replace("`r", "`n").Split("`n"[0]) -} - -function Remove-TrailingNewLine { - [CmdletBinding()] - param($Str) - if ([object]::ReferenceEquals($Str, $null)) { - return $Str - } elseif ($Str.EndsWith("`r`n")) { - return $Str.Substring(0, $Str.Length - 2) - } else { - return $Str - } -} diff --git a/Tasks/source/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml b/Tasks/source/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml deleted file mode 100644 index 8c20388..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - Microsoft.PowerShell.Commands.PSRepositoryItemInfo - System.Management.Automation.PSCustomObject - System.Object - - - VstsTaskSdk - 0.11.0 - Module - VSTS Task SDK - Microsoft - VSTS - (c) 2016 Microsoft. All rights reserved. -

2018-05-21T03:27:56+01:00
- - - - https://github.com/Microsoft/vsts-task-lib - - - - System.Object[] - System.Array - System.Object - - - PSModule - - - - - System.Collections.Hashtable - System.Object - - - - DscResource - - - - - - - RoleCapability - - - - Cmdlet - - - - Workflow - - - - Command - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - Function - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - - - - - - - - https://www.powershellgallery.com/api/v2 - PSGallery - NuGet - - - System.Management.Automation.PSCustomObject - System.Object - - - (c) 2016 Microsoft. All rights reserved. - VSTS Task SDK - False - True - True - 12749 - 136204 - 71074 - 21/05/2018 03:27:56 +01:00 - 21/05/2018 03:27:56 +01:00 - 09/11/2018 22:20:20 +00:00 - PSModule PSFunction_Find-Match PSCommand_Find-Match PSFunction_New-FindOptions PSCommand_New-FindOptions PSFunction_New-MatchOptions PSCommand_New-MatchOptions PSFunction_Select-Match PSCommand_Select-Match PSFunction_Get-Endpoint PSCommand_Get-Endpoint PSFunction_Get-SecureFileTicket PSCommand_Get-SecureFileTicket PSFunction_Get-SecureFileName PSCommand_Get-SecureFileName PSFunction_Get-Input PSCommand_Get-Input PSFunction_Get-TaskVariable PSCommand_Get-TaskVariable PSFunction_Get-TaskVariableInfo PSCommand_Get-TaskVariableInfo PSFunction_Set-TaskVariable PSCommand_Set-TaskVariable PSFunction_Find-Files PSCommand_Find-Files PSFunction_Get-LocString PSCommand_Get-LocString PSFunction_Import-LocStrings PSCommand_Import-LocStrings PSFunction_Write-AddAttachment PSCommand_Write-AddAttachment PSFunction_Write-AddBuildTag PSCommand_Write-AddBuildTag PSFunction_Write-AssociateArtifact PSCommand_Write-AssociateArtifact PSFunction_Write-LogDetail PSCommand_Write-LogDetail PSFunction_Write-PrependPath PSCommand_Write-PrependPath PSFunction_Write-SetEndpoint PSCommand_Write-SetEndpoint PSFunction_Write-SetProgress PSCommand_Write-SetProgress PSFunction_Write-SetResult PSCommand_Write-SetResult PSFunction_Write-SetSecret PSCommand_Write-SetSecret PSFunction_Write-SetVariable PSCommand_Write-SetVariable PSFunction_Write-TaskDebug PSCommand_Write-TaskDebug PSFunction_Write-TaskError PSCommand_Write-TaskError PSFunction_Write-TaskVerbose PSCommand_Write-TaskVerbose PSFunction_Write-TaskWarning PSCommand_Write-TaskWarning PSFunction_Write-UpdateBuildNumber PSCommand_Write-UpdateBuildNumber PSFunction_Write-UpdateReleaseName PSCommand_Write-UpdateReleaseName PSFunction_Write-UploadArtifact PSCommand_Write-UploadArtifact PSFunction_Write-UploadBuildLog PSCommand_Write-UploadBuildLog PSFunction_Write-UploadFile PSCommand_Write-UploadFile PSFunction_Write-UploadSummary PSCommand_Write-UploadSummary PSFunction_Out-Default PSCommand_Out-Default PSFunction_Get-AssemblyReference PSCommand_Get-AssemblyReference PSFunction_Get-TfsClientCredentials PSCommand_Get-TfsClientCredentials PSFunction_Get-TfsService PSCommand_Get-TfsService PSFunction_Get-VssCredentials PSCommand_Get-VssCredentials PSFunction_Get-VssHttpClient PSCommand_Get-VssHttpClient PSFunction_Assert-Agent PSCommand_Assert-Agent PSFunction_Assert-Path PSCommand_Assert-Path PSFunction_Invoke-Tool PSCommand_Invoke-Tool PSFunction_Trace-EnteringInvocation PSCommand_Trace-EnteringInvocation PSFunction_Trace-LeavingInvocation PSCommand_Trace-LeavingInvocation PSFunction_Trace-Path PSCommand_Trace-Path PSFunction_Get-WebProxy PSCommand_Get-WebProxy PSFunction_Get-ClientCertificate PSCommand_Get-ClientCertificate PSIncludes_Function - False - 2018-11-09T22:20:20Z - 0.11.0 - Microsoft - false - Module - VstsTaskSdk.nuspec|FindFunctions.ps1|InputFunctions.ps1|LegacyFindFunctions.ps1|lib.json|LocalizationFunctions.ps1|LoggingCommandFunctions.ps1|LongPathFunctions.ps1|Minimatch.dll|OutFunctions.ps1|ServerOMFunctions.ps1|ToolFunctions.ps1|TraceFunctions.ps1|VstsTaskSdk.dll|VstsTaskSdk.psd1|VstsTaskSdk.psm1|Strings\resources.resjson\de-de\resources.resjson|Strings\resources.resjson\en-US\resources.resjson|Strings\resources.resjson\es-es\resources.resjson|Strings\resources.resjson\fr-fr\resources.resjson|Strings\resources.resjson\it-IT\resources.resjson|Strings\resources.resjson\ja-jp\resources.resjson|Strings\resources.resjson\ko-KR\resources.resjson|Strings\resources.resjson\ru-RU\resources.resjson|Strings\resources.resjson\zh-CN\resources.resjson|Strings\resources.resjson\zh-TW\resources.resjson - bbed04e2-4e8e-4089-90a2-58b858fed8d8 - 3.0 - Microsoft - - - /Users/gep13/github/gep13/chocolatey-azuredevops/Tasks/install/VstsTaskSdk/0.11.0 - - - diff --git a/Tasks/source/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 b/Tasks/source/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 deleted file mode 100644 index 177820b..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 +++ /dev/null @@ -1,659 +0,0 @@ -<# -.SYNOPSIS -Gets assembly reference information. - -.DESCRIPTION -Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK. - -Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario. - -Walks an assembly's references to determine all of it's dependencies. Also walks the references of the dependencies, and so on until all nested dependencies have been traversed. Dependencies are searched for in the directory of the specified assembly. NET Framework assemblies are omitted. - -See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER LiteralPath -Assembly to walk. - -.EXAMPLE -Get-VstsAssemblyReference -LiteralPath C:\nuget\microsoft.teamfoundationserver.client.14.102.0\lib\net45\Microsoft.TeamFoundation.Build2.WebApi.dll -#> -function Get-AssemblyReference { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - $ErrorActionPreference = 'Stop' - Write-Warning "Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK." - Write-Output '' - Write-Warning "Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario." - $directory = [System.IO.Path]::GetDirectoryName($LiteralPath) - $hashtable = @{ } - $queue = @( [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($LiteralPath).GetName() ) - while ($queue.Count) { - # Add a blank line between assemblies. - Write-Output '' - - # Pop. - $assemblyName = $queue[0] - $queue = @( $queue | Select-Object -Skip 1 ) - - # Attempt to find the assembly in the same directory. - $assembly = $null - $path = "$directory\$($assemblyName.Name).dll" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } else { - $path = "$directory\$($assemblyName.Name).exe" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } - } - - # Make sure the assembly full name matches, not just the file name. - if ($assembly -and $assembly.GetName().FullName -ne $assemblyName.FullName) { - $assembly = $null - } - - # Print the assembly. - if ($assembly) { - Write-Output $assemblyName.FullName - } else { - if ($assemblyName.FullName -eq 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed') { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) *** This is an expected condition when using the HTTP clients from the 15.x VSTS REST SDK. Use Get-VstsVssHttpClient to load the HTTP clients (which applies a binding redirect assembly resolver for Newtonsoft.Json). Otherwise you will need to manage the binding redirect yourself." - } else { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) ***" - } - - continue - } - - # Walk the references. - $refAssemblyNames = @( $assembly.GetReferencedAssemblies() ) - for ($i = 0 ; $i -lt $refAssemblyNames.Count ; $i++) { - $refAssemblyName = $refAssemblyNames[$i] - - # Skip framework assemblies. - $fxPaths = @( - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\$($refAssemblyName.Name).dll" - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\WPF\$($refAssemblyName.Name).dll" - ) - $fxPath = $fxPaths | - Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } | - Where-Object { [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($_).GetName().FullName -eq $refAssemblyName.FullName } - if ($fxPath) { - continue - } - - # Print the reference. - Write-Output " $($refAssemblyName.FullName)" - - # Add new references to the queue. - if (!$hashtable[$refAssemblyName.FullName]) { - $queue += $refAssemblyName - $hashtable[$refAssemblyName.FullName] = $true - } - } - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the TFS extended client SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -Refer to Get-VstsTfsService for a more simple to get a TFS service object. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -$credentials = Get-VstsTfsClientCredentials -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.VersionControl.Client.dll" -$tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection( - (Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require), - $credentials) -$versionControlServer = $tfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer]) -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsClientCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Validate the type can be found. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsClientCredentials' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Construct the credentials. - $credentials = New-Object Microsoft.TeamFoundation.Client.TfsClientCredentials($false) # Do not use default credentials. - $credentials.AllowInteractive = $false - $credentials.Federated = New-Object Microsoft.TeamFoundation.Client.OAuthTokenCredential([string]$endpoint.auth.parameters.AccessToken) - return $credentials - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a TFS extended client service. - -.DESCRIPTION -Gets an instance of an ITfsTeamProjectCollectionObject. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the service to get. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER Uri -URI to use when initializing the service. If not specified, defaults to System.TeamFoundationCollectionUri. - -.PARAMETER TfsClientCredentials -Credentials to use when initializing the service. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -.EXAMPLE -$versionControlServer = Get-VstsTfsService -TypeName Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsService { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $TfsClientCredentials) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Default the credentials. - if (!$TfsClientCredentials) { - $TfsClientCredentials = Get-TfsClientCredentials -OMDirectory $OMDirectory - } - - # Validate the project collection type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsTeamProjectCollection' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Load the project collection object. - $tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection($Uri, $TfsClientCredentials) - - # Validate the requested type can be loaded. - $type = Get-OMType -TypeName $TypeName -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Return the service object. - return $tfsTeamProjectCollection.GetService($type) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the VSTS REST SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project service build/release identity). - -Refer to Get-VstsVssHttpClient for a more simple to get a VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -# This example works using the 14.x .NET SDK. A Newtonsoft.Json 6.0 to 8.0 binding -# redirect may be required when working with the 15.x SDK. Or use Get-VstsVssHttpClient -# to avoid managing the binding redirect. -# -$vssCredentials = Get-VstsVssCredentials -$collectionUrl = New-Object System.Uri((Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require)) -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.Core.WebApi.dll" -$projectHttpClient = New-Object Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient($collectionUrl, $vssCredentials) -$projectHttpClient.GetProjects().Result -#> -function Get-VssCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Check if the VssOAuthAccessTokenCredential type is available. - if ((Get-OMType -TypeName 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory)) { - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential($endpoint.auth.parameters.AccessToken) - } else { - # Validate the fallback type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.Client.VssOAuthCredential($endpoint.auth.parameters.AccessToken) - } - - # Return the credentials. - return New-Object Microsoft.VisualStudio.Services.Common.VssCredentials( - (New-Object Microsoft.VisualStudio.Services.Common.WindowsCredential($false)), # Do not use default credentials. - $federatedCredential, - [Microsoft.VisualStudio.Services.Common.CredentialPromptType]::DoNotPrompt) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VSS HTTP client. - -.DESCRIPTION -Gets an instance of an VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the HTTP client to get. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -# .PARAMETER Uri -# URI to use when initializing the HTTP client. If not specified, defaults to System.TeamFoundationCollectionUri. - -# .PARAMETER VssCredentials -# Credentials to use when initializing the HTTP client. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -# .PARAMETER WebProxy -# WebProxy to use when initializing the HTTP client. If not specified, the default uses the proxy configuration agent current has. - -# .PARAMETER ClientCert -# ClientCert to use when initializing the HTTP client. If not specified, the default uses the client certificate agent current has. - -# .PARAMETER IgnoreSslError -# Skip SSL server certificate validation on all requests made by this HTTP client. If not specified, the default is to validate SSL server certificate. - -.EXAMPLE -$projectHttpClient = Get-VstsVssHttpClient -TypeName Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient -$projectHttpClient.GetProjects().Result -#> -function Get-VssHttpClient { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $VssCredentials, - - $WebProxy = (Get-WebProxy), - - $ClientCert = (Get-ClientCertificate), - - [switch]$IgnoreSslError) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Cast the URI. - [uri]$Uri = New-Object System.Uri($Uri) - - # Default the credentials. - if (!$VssCredentials) { - $VssCredentials = Get-VssCredentials -OMDirectory $OMDirectory - } - - # Validate the type can be loaded. - $null = Get-OMType -TypeName $TypeName -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Update proxy setting for vss http client - [Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler]::DefaultWebProxy = $WebProxy - - # Update client certificate setting for vss http client - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - [Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings]$Settings = [Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings]::Default.Clone() - - if ($ClientCert) { - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance.ClientCertificates.Add($ClientCert) - - $Settings.ClientCertificateManager = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance - } - - # Skip SSL server certificate validation - [bool]$SkipCertValidation = (Get-TaskVariable -Name Agent.SkipCertValidation -AsBool) -or $IgnoreSslError - if ($SkipCertValidation) { - if ($Settings.GetType().GetProperty('ServerCertificateValidationCallback')) { - Write-Verbose "Ignore any SSL server certificate validation errors."; - $Settings.ServerCertificateValidationCallback = [VstsTaskSdk.VstsHttpHandlerSettings]::UnsafeSkipServerCertificateValidation - } - else { - # OMDirectory has older version of Microsoft.VisualStudio.Services.Common.dll - Write-Verbose "The version of 'Microsoft.VisualStudio.Services.Common.dll' does not support skip SSL server certificate validation." - } - } - - # Try to construct the HTTP client. - Write-Verbose "Constructing HTTP client." - try { - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } catch { - # Rethrow if the exception is not due to Newtonsoft.Json DLL not found. - if ($_.Exception.InnerException -isnot [System.IO.FileNotFoundException] -or - $_.Exception.InnerException.FileName -notlike 'Newtonsoft.Json, *') { - - throw - } - - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Test if the Newtonsoft.Json DLL exists in the OM directory. - $newtonsoftDll = [System.IO.Path]::Combine($OMDirectory, "Newtonsoft.Json.dll") - Write-Verbose "Testing file path: '$newtonsoftDll'" - if (!(Test-Path -LiteralPath $newtonsoftDll -PathType Leaf)) { - Write-Verbose 'Not found. Rethrowing exception.' - throw - } - - # Add a binding redirect and try again. Parts of the Dev15 preview SDK have a - # dependency on the 6.0.0.0 Newtonsoft.Json DLL, while other parts reference - # the 8.0.0.0 Newtonsoft.Json DLL. - Write-Verbose "Adding assembly resolver." - $onAssemblyResolve = [System.ResolveEventHandler] { - param($sender, $e) - - if ($e.Name -like 'Newtonsoft.Json, *') { - Write-Verbose "Resolving '$($e.Name)'" - return [System.Reflection.Assembly]::LoadFrom($newtonsoftDll) - } - - Write-Verbose "Unable to resolve assembly name '$($e.Name)'" - return $null - } - [System.AppDomain]::CurrentDomain.add_AssemblyResolve($onAssemblyResolve) - try { - # Try again to construct the HTTP client. - Write-Verbose "Trying again to construct the HTTP client." - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } finally { - # Unregister the assembly resolver. - Write-Verbose "Removing assemlby resolver." - [System.AppDomain]::CurrentDomain.remove_AssemblyResolve($onAssemblyResolve) - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VstsTaskSdk.VstsWebProxy - -.DESCRIPTION -Gets an instance of a VstsTaskSdk.VstsWebProxy that has same proxy configuration as Build/Release agent. - -VstsTaskSdk.VstsWebProxy implement System.Net.IWebProxy interface. - -.EXAMPLE -$webProxy = Get-VstsWebProxy -$webProxy.GetProxy(New-Object System.Uri("https://github.com/Microsoft/vsts-task-lib")) -#> -function Get-WebProxy { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports proxy - Assert-Agent -Minimum '2.105.7' - - $proxyUrl = Get-TaskVariable -Name Agent.ProxyUrl - $proxyUserName = Get-TaskVariable -Name Agent.ProxyUserName - $proxyPassword = Get-TaskVariable -Name Agent.ProxyPassword - $proxyBypassListJson = Get-TaskVariable -Name Agent.ProxyBypassList - [string[]]$ProxyBypassList = ConvertFrom-Json -InputObject $ProxyBypassListJson - - return New-Object -TypeName VstsTaskSdk.VstsWebProxy -ArgumentList @($proxyUrl, $proxyUserName, $proxyPassword, $proxyBypassList) - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a client certificate for current connected TFS instance - -.DESCRIPTION -Gets an instance of a X509Certificate2 that is the client certificate Build/Release agent used. - -.EXAMPLE -$x509cert = Get-ClientCertificate -WebRequestHandler.ClientCertificates.Add(x509cert) -#> -function Get-ClientCertificate { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports client certificate - Assert-Agent -Minimum '2.122.0' - - [string]$clientCert = Get-TaskVariable -Name Agent.ClientCertArchive - [string]$clientCertPassword = Get-TaskVariable -Name Agent.ClientCertPassword - - if ($clientCert -and (Test-Path -LiteralPath $clientCert -PathType Leaf)) { - return New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($clientCert, $clientCertPassword) - } - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -######################################## -# Private functions. -######################################## -function Get-OMType { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [ValidateSet('ExtendedClient', 'WebApi')] - [Parameter(Mandatory = $true)] - [string]$OMKind, - - [string]$OMDirectory, - - [switch]$Require) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Try to load the type. - $errorRecord = $null - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - # Store the error record. - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - - # Build a list of candidate DLL file paths from the namespace. - $dllPaths = @( ) - $namespace = $TypeName - while ($namespace.LastIndexOf('.') -gt 0) { - # Trim the next segment from the namespace. - $namespace = $namespace.SubString(0, $namespace.LastIndexOf('.')) - - # Derive potential DLL file paths based on the namespace and OM kind (i.e. extended client vs web API). - if ($OMKind -eq 'ExtendedClient') { - if ($namespace -like 'Microsoft.TeamFoundation.*') { - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } else { - if ($namespace -like 'Microsoft.TeamFoundation.*' -or - $namespace -like 'Microsoft.VisualStudio.Services' -or - $namespace -like 'Microsoft.VisualStudio.Services.*') { - - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.WebApi.dll") - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } - } - - foreach ($dllPath in $dllPaths) { - # Check whether the DLL exists. - Write-Verbose "Testing leaf path: '$dllPath'" - if (!(Test-Path -PathType Leaf -LiteralPath "$dllPath")) { - Write-Verbose "Not found." - continue - } - - # Load the DLL. - Write-Verbose "Loading assembly: $dllPath" - try { - Add-Type -LiteralPath $dllPath - } catch { - # Write the information to the verbose stream and proceed to attempt to load the requested type. - # - # The requested type may successfully load now. For example, the type used with the 14.0 Web API for the - # federated credential (VssOAuthCredential) resides in Microsoft.VisualStudio.Services.Client.dll. Even - # though loading the DLL results in a ReflectionTypeLoadException when Microsoft.ServiceBus.dll (approx 3.75mb) - # is not present, enough types are loaded to use the VssOAuthCredential federated credential with the Web API - # HTTP clients. - Write-Verbose "$($_.Exception.GetType().FullName): $($_.Exception.Message)" - if ($_.Exception -is [System.Reflection.ReflectionTypeLoadException]) { - for ($i = 0 ; $i -lt $_.Exception.LoaderExceptions.Length ; $i++) { - $loaderException = $_.Exception.LoaderExceptions[$i] - Write-Verbose "LoaderExceptions[$i]: $($loaderException.GetType().FullName): $($loaderException.Message)" - } - } - } - - # Try to load the type. - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - } - - # Check whether to propagate the error. - if ($Require) { - Write-Error $errorRecord - } - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} diff --git a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson b/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson deleted file mode 100644 index 7871c36..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agentversion {0} oder höher ist erforderlich.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Der Containerpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "\"{0}\"-Dienstendpunkt-Anmeldeinformationen", - "loc.messages.PSLIB_EndpointUrl0": "\"{0}\"-Dienstendpunkt-URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Fehler beim Aufzählen von Unterverzeichnissen für den folgenden Pfad: \"{0}\"", - "loc.messages.PSLIB_FileNotFound0": "Die Datei wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Input0": "\"{0}\"-Eingabe", - "loc.messages.PSLIB_InvalidPattern0": "Ungültiges Muster: \"{0}\"", - "loc.messages.PSLIB_LeafPathNotFound0": "Der Blattpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Fehler bei der Normalisierung bzw. Erweiterung des Pfads. Die Pfadlänge wurde vom Kernel32-Subsystem nicht zurückgegeben für: \"{0}\"", - "loc.messages.PSLIB_PathNotFound0": "Der Pfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Der Prozess \"{0}\" wurde mit dem Code \"{1}\" beendet.", - "loc.messages.PSLIB_Required0": "Erforderlich: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Fehler beim Zeichenfolgenformat.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Der Zeichenfolgen-Ressourcenschlüssel wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "\"{0}\"-Taskvariable" -} \ No newline at end of file diff --git a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson b/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson deleted file mode 100644 index 66c17bc..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "File not found: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' input", - "loc.messages.PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Path not found: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "loc.messages.PSLIB_Required0": "Required: {0}", - "loc.messages.PSLIB_StringFormatFailed": "String format failed.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' task variable" -} \ No newline at end of file diff --git a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson b/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson deleted file mode 100644 index f5c9c23..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Se require la versión {0} o posterior del agente.", - "loc.messages.PSLIB_ContainerPathNotFound0": "No se encuentra la ruta de acceso del contenedor: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenciales del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "No se pudieron enumerar los subdirectorios de la ruta de acceso: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Archivo no encontrado: '{0}'", - "loc.messages.PSLIB_Input0": "Entrada '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Patrón no válido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "No se encuentra la ruta de acceso de la hoja: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "No se pudo normalizar o expandir la ruta de acceso. El subsistema Kernel32 no devolvió la longitud de la ruta de acceso para: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "No se encuentra la ruta de acceso: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "El proceso '{0}' finalizó con el código '{1}'.", - "loc.messages.PSLIB_Required0": "Se requiere: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Error de formato de cadena.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "No se encuentra la clave de recurso de la cadena: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tarea '{0}'" -} \ No newline at end of file diff --git a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson b/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson deleted file mode 100644 index 652870c..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "L'agent version {0} (ou une version ultérieure) est obligatoire.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Le chemin du conteneur est introuvable : '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Informations d'identification du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Échec de l'énumération des sous-répertoires pour le chemin : '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Fichier introuvable : {0}.", - "loc.messages.PSLIB_Input0": "Entrée '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Modèle non valide : '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Le chemin feuille est introuvable : '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Échec de la normalisation/l'expansion du chemin. La longueur du chemin n'a pas été retournée par le sous-système Kernel32 pour : '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Chemin introuvable : '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Le processus '{0}' s'est arrêté avec le code '{1}'.", - "loc.messages.PSLIB_Required0": "Obligatoire : {0}", - "loc.messages.PSLIB_StringFormatFailed": "Échec du format de la chaîne.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Clé de la ressource de type chaîne introuvable : '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tâche '{0}'" -} \ No newline at end of file diff --git a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson b/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson deleted file mode 100644 index 6aeb1df..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "È richiesta la versione dell'agente {0} o superiore.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Percorso del contenitore non trovato: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenziali dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "L'enumerazione delle sottodirectory per il percorso '{0}' non è riuscita", - "loc.messages.PSLIB_FileNotFound0": "File non trovato: '{0}'", - "loc.messages.PSLIB_Input0": "Input di '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Criterio non valido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Percorso foglia non trovato: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "La normalizzazione o l'espansione del percorso non è riuscita. Il sottosistema Kernel32 non ha restituito la lunghezza del percorso per '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Percorso non trovato: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Il processo '{0}' è stato terminato ed è stato restituito il codice '{1}'.", - "loc.messages.PSLIB_Required0": "Obbligatorio: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Errore nel formato della stringa.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "La chiave della risorsa stringa non è stata trovata: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variabile dell'attività '{0}'" -} \ No newline at end of file diff --git a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson b/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson deleted file mode 100644 index 6b07ab6..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "バージョン {0} 以降のエージェントが必要です。", - "loc.messages.PSLIB_ContainerPathNotFound0": "コンテナーのパスが見つかりません: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' サービス エンドポイントの資格情報", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' サービス エンドポイントの URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "パス '{0}' のサブディレクトリを列挙できませんでした", - "loc.messages.PSLIB_FileNotFound0": "ファイルが見つかりません: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 入力", - "loc.messages.PSLIB_InvalidPattern0": "使用できないパターンです: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "リーフ パスが見つかりません: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "パスの正規化/展開に失敗しました。Kernel32 サブシステムからパス '{0}' の長さが返されませんでした", - "loc.messages.PSLIB_PathNotFound0": "パスが見つかりません: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "プロセス '{0}' がコード '{1}' で終了しました。", - "loc.messages.PSLIB_Required0": "必要: {0}", - "loc.messages.PSLIB_StringFormatFailed": "文字列のフォーマットに失敗しました。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "文字列のリソース キーが見つかりません: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' タスク変数" -} \ No newline at end of file diff --git a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson b/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson deleted file mode 100644 index e58cbdc..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "에이전트 버전 {0} 이상이 필요합니다.", - "loc.messages.PSLIB_ContainerPathNotFound0": "컨테이너 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 서비스 끝점 자격 증명", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 서비스 끝점 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "경로에 대해 하위 디렉터리를 열거하지 못함: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "{0} 파일을 찾을 수 없습니다.", - "loc.messages.PSLIB_Input0": "'{0}' 입력", - "loc.messages.PSLIB_InvalidPattern0": "잘못된 패턴: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "경로 정규화/확장에 실패했습니다. 다음에 대해 Kernel32 subsystem에서 경로 길이를 반환하지 않음: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "'{1}' 코드로 '{0}' 프로세스가 종료되었습니다.", - "loc.messages.PSLIB_Required0": "필수: {0}", - "loc.messages.PSLIB_StringFormatFailed": "문자열을 포맷하지 못했습니다.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "문자열 리소스 키를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 작업 변수" -} \ No newline at end of file diff --git a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson b/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson deleted file mode 100644 index 38dd69d..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Требуется версия агента {0} или более поздняя.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Путь к контейнеру не найден: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "Учетные данные конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EndpointUrl0": "URL-адрес конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Сбой перечисления подкаталогов для пути: \"{0}\".", - "loc.messages.PSLIB_FileNotFound0": "Файл не найден: \"{0}\".", - "loc.messages.PSLIB_Input0": "Входные данные \"{0}\".", - "loc.messages.PSLIB_InvalidPattern0": "Недопустимый шаблон: \"{0}\".", - "loc.messages.PSLIB_LeafPathNotFound0": "Путь к конечному объекту не найден: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Сбой нормализации и расширения пути. Длина пути не была возвращена подсистемой Kernel32 для: \"{0}\".", - "loc.messages.PSLIB_PathNotFound0": "Путь не найден: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Процесс \"{0}\" завершил работу с кодом \"{1}\".", - "loc.messages.PSLIB_Required0": "Требуется: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Сбой формата строки.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Ключ ресурса строки не найден: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "Переменная задачи \"{0}\"" -} \ No newline at end of file diff --git a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson b/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson deleted file mode 100644 index 1d333de..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理版本 {0} 或更高版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路径:“{0}”", - "loc.messages.PSLIB_EndpointAuth0": "“{0}”服务终结点凭据", - "loc.messages.PSLIB_EndpointUrl0": "“{0}”服务终结点 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "枚举路径的子目录失败:“{0}”", - "loc.messages.PSLIB_FileNotFound0": "找不到文件: {0}。", - "loc.messages.PSLIB_Input0": "“{0}”输入", - "loc.messages.PSLIB_InvalidPattern0": "无效的模式:“{0}”", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到叶路径:“{0}”", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路径规范化/扩展失败。路径长度不是由“{0}”的 Kernel32 子系统返回的", - "loc.messages.PSLIB_PathNotFound0": "找不到路径:“{0}”", - "loc.messages.PSLIB_Process0ExitedWithCode1": "过程“{0}”已退出,代码为“{1}”。", - "loc.messages.PSLIB_Required0": "必需: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字符串格式无效。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字符串资源关键字:“{0}”", - "loc.messages.PSLIB_TaskVariable0": "“{0}”任务变量" -} \ No newline at end of file diff --git a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson b/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson deleted file mode 100644 index 512509b..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理程式版本 {0} 或更新的版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路徑: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 服務端點認證", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 服務端點 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "為路徑列舉子目錄失敗: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "找不到檔案: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 輸入", - "loc.messages.PSLIB_InvalidPattern0": "模式無效: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到分葉路徑: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路徑正規化/展開失敗。Kernel32 子系統未傳回 '{0}' 的路徑長度", - "loc.messages.PSLIB_PathNotFound0": "找不到路徑: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "處理序 '{0}' 以返回碼 '{1}' 結束。", - "loc.messages.PSLIB_Required0": "必要項: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字串格式失敗。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字串資源索引鍵: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 工作變數" -} \ No newline at end of file diff --git a/Tasks/source/ps_modules/VstsTaskSdk/ToolFunctions.ps1 b/Tasks/source/ps_modules/VstsTaskSdk/ToolFunctions.ps1 deleted file mode 100644 index 0e82595..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/ToolFunctions.ps1 +++ /dev/null @@ -1,123 +0,0 @@ -<# -.SYNOPSIS -Asserts the agent version is at least the specified minimum. - -.PARAMETER Minimum -Minimum version - must be 2.104.1 or higher. -#> -function Assert-Agent { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [version]$Minimum) - - if (([version]'2.104.1').CompareTo($Minimum) -ge 1) { - Write-Error "Assert-Agent requires the parameter to be 2.104.1 or higher." - return - } - - $agent = Get-TaskVariable -Name 'agent.version' - if (!$agent -or $Minimum.CompareTo([version]$agent) -ge 1) { - Write-Error (Get-LocString -Key 'PSLIB_AgentVersion0Required' -ArgumentList $Minimum) - } -} - -<# -.SYNOPSIS -Asserts that a path exists. Throws if the path does not exist. - -.PARAMETER PassThru -True to return the path. -#> -function Assert-Path { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath, - [Microsoft.PowerShell.Commands.TestPathType]$PathType = [Microsoft.PowerShell.Commands.TestPathType]::Any, - [switch]$PassThru) - - if ($PathType -eq [Microsoft.PowerShell.Commands.TestPathType]::Any) { - Write-Verbose "Asserting path exists: '$LiteralPath'" - } else { - Write-Verbose "Asserting $("$PathType".ToLowerInvariant()) path exists: '$LiteralPath'" - } - - if (Test-Path -LiteralPath $LiteralPath -PathType $PathType) { - if ($PassThru) { - return $LiteralPath - } - - return - } - - $resourceKey = switch ($PathType) { - ([Microsoft.PowerShell.Commands.TestPathType]::Container) { "PSLIB_ContainerPathNotFound0" ; break } - ([Microsoft.PowerShell.Commands.TestPathType]::Leaf) { "PSLIB_LeafPathNotFound0" ; break } - default { "PSLIB_PathNotFound0" } - } - - throw (Get-LocString -Key $resourceKey -ArgumentList $LiteralPath) -} - -<# -.SYNOPSIS -Executes an external program. - -.DESCRIPTION -Executes an external program and waits for the process to exit. - -After calling this command, the exit code of the process can be retrieved from the variable $LASTEXITCODE. - -.PARAMETER Encoding -This parameter not required for most scenarios. Indicates how to interpret the encoding from the external program. An example use case would be if an external program outputs UTF-16 XML and the output needs to be parsed. - -.PARAMETER RequireExitCodeZero -Indicates whether to write an error to the error pipeline if the exit code is not zero. -#> -function Invoke-Tool { # TODO: RENAME TO INVOKE-PROCESS? - [CmdletBinding()] - param( - [ValidatePattern('^[^\r\n]*$')] - [Parameter(Mandatory = $true)] - [string]$FileName, - [ValidatePattern('^[^\r\n]*$')] - [Parameter()] - [string]$Arguments, - [string]$WorkingDirectory, - [System.Text.Encoding]$Encoding, - [switch]$RequireExitCodeZero) - - Trace-EnteringInvocation $MyInvocation - $isPushed = $false - $originalEncoding = $null - try { - if ($Encoding) { - $originalEncoding = [System.Console]::OutputEncoding - [System.Console]::OutputEncoding = $Encoding - } - - if ($WorkingDirectory) { - Push-Location -LiteralPath $WorkingDirectory -ErrorAction Stop - $isPushed = $true - } - - $FileName = $FileName.Replace('"', '').Replace("'", "''") - Write-Host "##[command]""$FileName"" $Arguments" - Invoke-Expression "& '$FileName' --% $Arguments" - Write-Verbose "Exit code: $LASTEXITCODE" - if ($RequireExitCodeZero -and $LASTEXITCODE -ne 0) { - Write-Error (Get-LocString -Key PSLIB_Process0ExitedWithCode1 -ArgumentList ([System.IO.Path]::GetFileName($FileName)), $LASTEXITCODE) - } - } finally { - if ($originalEncoding) { - [System.Console]::OutputEncoding = $originalEncoding - } - - if ($isPushed) { - Pop-Location - } - - Trace-LeavingInvocation $MyInvocation - } -} diff --git a/Tasks/source/ps_modules/VstsTaskSdk/TraceFunctions.ps1 b/Tasks/source/ps_modules/VstsTaskSdk/TraceFunctions.ps1 deleted file mode 100644 index b8e084b..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/TraceFunctions.ps1 +++ /dev/null @@ -1,139 +0,0 @@ -<# -.SYNOPSIS -Writes verbose information about the invocation being entered. - -.DESCRIPTION -Used to trace verbose information when entering a function/script. Writes an entering message followed by a short description of the invocation. Additionally each bound parameter and unbound argument is also traced. - -.PARAMETER Parameter -Wildcard pattern to control which bound parameters are traced. -#> -function Trace-EnteringInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo, - [string[]]$Parameter = '*') - - Write-Verbose "Entering $(Get-InvocationDescription $InvocationInfo)." - $OFS = ", " - if ($InvocationInfo.BoundParameters.Count -and $Parameter.Count) { - if ($Parameter.Count -eq 1 -and $Parameter[0] -eq '*') { - # Trace all parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - } - } else { - # Trace matching parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - foreach ($p in $Parameter) { - if ($key -like $p) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - break - } - } - } - } - } - - # Trace all unbound arguments. - if (@($InvocationInfo.UnboundArguments).Count) { - for ($i = 0 ; $i -lt $InvocationInfo.UnboundArguments.Count ; $i++) { - Write-Verbose " args[$i]: '$($InvocationInfo.UnboundArguments[$i])'" - } - } -} - -<# -.SYNOPSIS -Writes verbose information about the invocation being left. - -.DESCRIPTION -Used to trace verbose information when leaving a function/script. Writes a leaving message followed by a short description of the invocation. -#> -function Trace-LeavingInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo) - - Write-Verbose "Leaving $(Get-InvocationDescription $InvocationInfo)." -} - -<# -.SYNOPSIS -Writes verbose information about paths. - -.DESCRIPTION -Writes verbose information about the paths. The paths are sorted and a the common root is written only once, followed by each relative path. - -.PARAMETER PassThru -Indicates whether to return the sorted paths. -#> -function Trace-Path { - [CmdletBinding()] - param( - [string[]]$Path, - [switch]$PassThru) - - if ($Path.Count -eq 0) { - Write-Verbose "No paths." - if ($PassThru) { - $Path - } - } elseif ($Path.Count -eq 1) { - Write-Verbose "Path: $($Path[0])" - if ($PassThru) { - $Path - } - } else { - # Find the greatest common root. - $sorted = $Path | Sort-Object - $firstPath = $sorted[0].ToCharArray() - $lastPath = $sorted[-1].ToCharArray() - $commonEndIndex = 0 - $j = if ($firstPath.Length -lt $lastPath.Length) { $firstPath.Length } else { $lastPath.Length } - for ($i = 0 ; $i -lt $j ; $i++) { - if ($firstPath[$i] -eq $lastPath[$i]) { - if ($firstPath[$i] -eq '\') { - $commonEndIndex = $i - } - } else { - break - } - } - - if ($commonEndIndex -eq 0) { - # No common root. - Write-Verbose "Paths:" - foreach ($p in $sorted) { - Write-Verbose " $p" - } - } else { - Write-Verbose "Paths: $($Path[0].Substring(0, $commonEndIndex + 1))" - foreach ($p in $sorted) { - Write-Verbose " $($p.Substring($commonEndIndex + 1))" - } - } - - if ($PassThru) { - $sorted - } - } -} - -######################################## -# Private functions. -######################################## -function Get-InvocationDescription { - [CmdletBinding()] - param([System.Management.Automation.InvocationInfo]$InvocationInfo) - - if ($InvocationInfo.MyCommand.Path) { - $InvocationInfo.MyCommand.Path - } elseif ($InvocationInfo.MyCommand.Name) { - $InvocationInfo.MyCommand.Name - } else { - $InvocationInfo.MyCommand.CommandType - } -} diff --git a/Tasks/source/ps_modules/VstsTaskSdk/VstsTaskSdk.dll b/Tasks/source/ps_modules/VstsTaskSdk/VstsTaskSdk.dll deleted file mode 100644 index 54938ab05180ddaf77cf067f2501a1f97ee7e5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<*aIe)M4x%zcPo;e*jhT|#q9?2=PugJgekDl<9dh6e&6yF`ar4mto>Tbqa^N9R^ J$g$t$@(XnB12_Nx diff --git a/Tasks/source/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 b/Tasks/source/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 deleted file mode 100644 index a1bf2c6..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 +++ /dev/null @@ -1,168 +0,0 @@ -[CmdletBinding()] -param( - [ValidateNotNull()] - [Parameter()] - [hashtable]$ModuleParameters = @{ }) - -if ($host.Name -ne 'ConsoleHost') { - Write-Warning "VstsTaskSdk is designed for use with powershell.exe (ConsoleHost). Output may be different when used with other hosts." -} - -# Private module variables. -[bool]$script:nonInteractive = "$($ModuleParameters['NonInteractive'])" -eq 'true' -Write-Verbose "NonInteractive: $script:nonInteractive" - -# VstsTaskSdk.dll contains the TerminationException and NativeMethods for handle long path -# We used to do inline C# in this powershell module -# However when csc compile the inline C#, it will hit process env block size limit since it's not use unicode to encode env -# To solve the env block size problem, we choose to put all inline C# into an assembly VstsTaskSdk.dll, signing it, package with the PS modules. -Write-Verbose "Loading compiled helper $PSScriptRoot\VstsTaskSdk.dll." -Add-Type -LiteralPath $PSScriptRoot\VstsTaskSdk.dll - -# Import/export functions. -. "$PSScriptRoot\FindFunctions.ps1" -. "$PSScriptRoot\InputFunctions.ps1" -. "$PSScriptRoot\LegacyFindFunctions.ps1" -. "$PSScriptRoot\LocalizationFunctions.ps1" -. "$PSScriptRoot\LoggingCommandFunctions.ps1" -. "$PSScriptRoot\LongPathFunctions.ps1" -. "$PSScriptRoot\ServerOMFunctions.ps1" -. "$PSScriptRoot\ToolFunctions.ps1" -. "$PSScriptRoot\TraceFunctions.ps1" -. "$PSScriptRoot\OutFunctions.ps1" # Load the out functions after all of the other functions are loaded. -Export-ModuleMember -Function @( - # Find functions. - 'Find-Match' - 'New-FindOptions' - 'New-MatchOptions' - 'Select-Match' - # Input functions. - 'Get-Endpoint' - 'Get-SecureFileTicket' - 'Get-SecureFileName' - 'Get-Input' - 'Get-TaskVariable' - 'Get-TaskVariableInfo' - 'Set-TaskVariable' - # Legacy find functions. - 'Find-Files' - # Localization functions. - 'Get-LocString' - 'Import-LocStrings' - # Logging command functions. - 'Write-AddAttachment' - 'Write-AddBuildTag' - 'Write-AssociateArtifact' - 'Write-LogDetail' - 'Write-PrependPath' - 'Write-SetEndpoint' - 'Write-SetProgress' - 'Write-SetResult' - 'Write-SetSecret' - 'Write-SetVariable' - 'Write-TaskDebug' - 'Write-TaskError' - 'Write-TaskVerbose' - 'Write-TaskWarning' - 'Write-UpdateBuildNumber' - 'Write-UpdateReleaseName' - 'Write-UploadArtifact' - 'Write-UploadBuildLog' - 'Write-UploadFile' - 'Write-UploadSummary' - # Out functions. - 'Out-Default' - # Server OM functions. - 'Get-AssemblyReference' - 'Get-TfsClientCredentials' - 'Get-TfsService' - 'Get-VssCredentials' - 'Get-VssHttpClient' - # Tool functions. - 'Assert-Agent' - 'Assert-Path' - 'Invoke-Tool' - # Trace functions. - 'Trace-EnteringInvocation' - 'Trace-LeavingInvocation' - 'Trace-Path' - # Proxy functions - 'Get-WebProxy' - # Client cert functions - 'Get-ClientCertificate' - ) - -# Override Out-Default globally. -$null = New-Item -Force -Path "function:\global:Out-Default" -Value (Get-Command -CommandType Function -Name Out-Default -ListImported) -New-Alias -Name Out-Default -Value "global:Out-Default" -Scope global - -# Perform some initialization in a script block to enable merging the pipelines. -$scriptText = @" -# Load the SDK resource strings. -Import-LocStrings "$PSScriptRoot\lib.json" - -# Load the module that contains ConvertTo-SecureString. -if (!(Get-Module -Name Microsoft.PowerShell.Security)) { - Write-Verbose "Importing the module 'Microsoft.PowerShell.Security'." - Import-Module -Name Microsoft.PowerShell.Security 2>&1 | - ForEach-Object { - if (`$_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose `$_.Exception.Message - } else { - ,`$_ - } - } -} -"@ -. ([scriptblock]::Create($scriptText)) 2>&1 3>&1 4>&1 5>&1 | Out-Default - -# Create Invoke-VstsTaskScript in a special way so it is not bound to the module. -# Otherwise calling the task script block would run within the module context. -# -# An alternative way to solve the problem is to close the script block (i.e. closure). -# However, that introduces a different problem. Closed script blocks are created within -# a dynamic module. Each module gets it's own session state separate from the global -# session state. When running in a regular script context, Import-Module calls import -# the target module into the global session state. When running in a module context, -# Import-Module calls import the target module into the caller module's session state. -# -# The goal of a task may include executing ad-hoc scripts. Therefore, task scripts -# should run in regular script context. The end user specifying an ad-hoc script expects -# the module import rules to be consistent with the default behavior (i.e. imported -# into the global session state). -$null = New-Item -Force -Path "function:\global:Invoke-VstsTaskScript" -Value ([scriptblock]::Create(@' - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [scriptblock]$ScriptBlock) - - try { - $global:ErrorActionPreference = 'Stop' - - # Initialize the environment. - $vstsModule = Get-Module -Name VstsTaskSdk - Write-Verbose "$($vstsModule.Name) $($vstsModule.Version) commit $($vstsModule.PrivateData.PSData.CommitHash)" 4>&1 | Out-Default - & $vstsModule Initialize-Inputs 4>&1 | Out-Default - - # Remove the local variable before calling the user's script. - Remove-Variable -Name vstsModule - - # Call the user's script. - $ScriptBlock | - ForEach-Object { - # Remove the scriptblock variable before calling it. - Remove-Variable -Name ScriptBlock - & $_ 2>&1 3>&1 4>&1 5>&1 | Out-Default - } - } catch [VstsTaskSdk.TerminationException] { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Task script terminated." 4>&1 | Out-Default - } catch { - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Caught exception from task script." 4>&1 | Out-Default - $_ | Out-Default - Write-Host "##vso[task.complete result=Failed]" - } -'@)) diff --git a/Tasks/source/ps_modules/VstsTaskSdk/lib.json b/Tasks/source/ps_modules/VstsTaskSdk/lib.json deleted file mode 100644 index ecdc9d0..0000000 --- a/Tasks/source/ps_modules/VstsTaskSdk/lib.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "messages": { - "PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "PSLIB_FileNotFound0": "File not found: '{0}'", - "PSLIB_Input0": "'{0}' input", - "PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "PSLIB_PathNotFound0": "Path not found: '{0}'", - "PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "PSLIB_Required0": "Required: {0}", - "PSLIB_StringFormatFailed": "String format failed.", - "PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "PSLIB_TaskVariable0": "'{0}' task variable" - } -} diff --git a/Tasks/source/source.ps1 b/Tasks/source/source.ps1 deleted file mode 100644 index 98f9304..0000000 --- a/Tasks/source/source.ps1 +++ /dev/null @@ -1,108 +0,0 @@ -[CmdletBinding()] -param() - -Trace-VstsEnteringInvocation $MyInvocation - -try { - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "Machine") - if(-not (Test-Path $chocoInstallLocation)) { - Write-Output "Environment variable 'ChocolateyInstall' was not found in the system variables. Attempting to find it in the user variables..." - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "User") - } - - $chocoExe = "$chocoInstallLocation\choco.exe" - - if (-not (Test-Path $chocoExe)) { - throw "Chocolatey was not found." - } - - [string]$operation = Get-VstsInput -Name 'operation' -Require - [string]$sourceName = Get-VstsInput -Name 'sourceName' -Require - [string]$priority = Get-VstsInput -Name 'priority' - [string]$user = Get-VstsInput -Name 'user' - [string]$password = Get-VstsInput -Name 'password' - [string]$cert = Get-VstsInput -Name 'cert' - [string]$certpassword = Get-VstsInput -Name 'certpassword' - [bool]$debug = Get-VstsInput -Name 'debug' -AsBool -Default $false - [bool]$verbose = Get-VstsInput -Name 'verbose' -AsBool -Default $false - [bool]$trace = Get-VstsInput -Name 'trace' -AsBool -Default $false - [string]$extraArguments = Get-VstsInput -Name 'extraArguments' - - $chocolateyVersion = & $chocoExe --version - Write-Output "Running Chocolatey Version: $chocolateyVersion" - - $chocolateyArguments = @() - - $chocolateyArguments += @("--name", $sourceName) - - if($priority) { - Write-Output "Adding --priority to arguments" - $chocolateyArguments += @("--priority", $priority) - } - - if($user) { - Write-Output "Adding --user to arguments" - $chocolateyArguments += @("--user", $user) - } - - if($password) { - Write-Output "Adding --password to arguments" - $chocolateyArguments += @("--password", $password) - } - - if($cert) { - Write-Output "Adding --cert to arguments" - $chocolateyArguments += @("--cert", $cert) - } - - if($certpassword) { - Write-Output "Adding --certpassword to arguments" - $chocolateyArguments += @("--certpassword", $certpassword) - } - - if($debug) { - Write-Output "Adding --debug to arguments" - $chocolateyArguments += @("--debug", "") - } - - if($verbose) { - Write-Output "Adding --verbose to arguments" - $chocolateyArguments += @("--verbose", "") - } - - if($trace) { - Write-Output "Adding --trace to arguments" - $chocolateyArguments += @("--trace", "") - } - - if($extraArguments) { - Write-Output "Adding extra arguments" - $chocolateyArguments += @($extraArguments, "") - } - - switch ( $operation ) - { - "add" - { - [string]$source = Get-VstsInput -Name 'source' -Require - & $chocoExe source add --source $source $($chocolateyArguments) - } - "remove" - { - & $chocoExe source remove $($chocolateyArguments) - } - "enable" - { - & $chocoExe source enable $($chocolateyArguments) - } - "disable" - { - & $chocoExe source disable $($chocolateyArguments) - } - } -} catch { - Write-VstsTaskError $_.Exception.Message - throw -} finally { - Trace-VstsLeavingInvocation $MyInvocation -} diff --git a/Tasks/source/task.json b/Tasks/source/task.json deleted file mode 100644 index e78a751..0000000 --- a/Tasks/source/task.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "id": "31733402-f948-4561-a4c9-3a3d43e2854c", - "name": "choco-source", - "friendlyName": "Chocolatey - Source", - "description": "Runs Chocolatey Source with specified parameters", - "author": "gep13", - "helpMarkDown": "", - "category": "Build", - "visibility": [ - "Build", - "Release" - ], - "demands": [], - "version": { - "Major": "0", - "Minor": "1", - "Patch": "0" - }, - "minimumAgentVersion": "1.83.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced options", - "isExpanded": false - } - ], - "instanceNameFormat": "Chocolatey Source", - "inputs": [ - { - "name": "operation", - "type": "radio", - "label": "Source Operation", - "required": true, - "defaultValue": "add", - "helpMarkDown": "Choose whether to add, remove, enable or disable a source.", - "options": { - "add": "Add a source", - "remove": "Remove a source", - "enable": "Enable a source", - "disable": "Disable a source" - } - }, - { - "name": "sourceName", - "type": "string", - "label": "Name", - "defaultValue": "", - "required": true, - "helpMarkDown": "The name to give the Source." - }, - { - "name": "source", - "type": "string", - "label": "Source", - "defaultValue": "", - "required": true, - "helpMarkDown": "The name to give the Source.", - "visibleRule": "operation=add" - }, - { - "name": "priority", - "type": "string", - "label": "Priority", - "defaultValue": "", - "required": false, - "helpMarkDown": "The priority order of this source as compared to other sources, lower is better. Defaults to 0 (no priority). All priorities above 0 will be evaluated first, then zero-based values will be evaluated in config file order." - }, - { - "name": "user", - "type": "string", - "label": "User", - "defaultValue": "", - "required": false, - "helpMarkDown": "Used with authenticated feeds." - }, - { - "name": "password", - "type": "string", - "label": "Password", - "defaultValue": "", - "required": false, - "helpMarkDown": "The user's password to the source. Encrypted in chocolatey.config file." - }, - { - "name": "cert", - "type": "string", - "label": "Client Certificate", - "defaultValue": "", - "required": false, - "helpMarkDown": "PFX pathname for an x509 authenticated feeds." - }, - { - "name": "certpassword", - "type": "string", - "label": "Certificate Password", - "defaultValue": "", - "required": false, - "helpMarkDown": "the client certificate's password to the source." - }, - { - "name": "debug", - "type": "boolean", - "label": "Show debug messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "", - "groupname": "advanced" - }, - { - "name": "verbose", - "type": "boolean", - "label": "Show verbose messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very verbose messaging, avoid using under normal circumstances.", - "groupname": "advanced" - }, - { - "name": "trace", - "type": "boolean", - "label": "Show trace messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very, very verbose trace messaging. Avoid except when needing super low-level .NET Framework debugging.", - "groupname": "advanced" - }, - { - "name": "bypassproxy", - "type": "boolean", - "label": "Bypass Proxy.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Should this source explicitly bypass any explicitly or system configured proxies?", - "groupname": "advanced" - }, - { - "name": "extraArguments", - "type": "string", - "label": "Extra Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional Chocolatey Arguments that are not catered for above.", - "groupname": "advanced" - } - ], - "execution": { - "PowerShell3": { - "target": "$(currentDirectory)\\source.ps1", - "argumentFormat": "", - "workingDirectory": "$(currentDirectory)" - } - } -} diff --git a/Tasks/upgrade/icon.png b/Tasks/upgrade/icon.png deleted file mode 100755 index ab05af71592b547960e4fcf1f5d527bece1fd5c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2656 zcmY*bc|6o>7yp&5nTW_XQyF7lXG|nABl{9z2o*AxVaQ;NEtRov*Bv(hrKxhFDVoxG4buln4OW*xUDC0l*�JDw&pneYk z1ijO)x9RU=K|Y38`~cu6-+>(hvL6Tmz@aMyD_gRysfoI?x0fQ$#oNhMG04kj9}NH+ zLF)UVmn#_u3-Y=_^ivN)!+#;v_v3>!0uK8HA$y|Xwx;GV9dD8=Ohr*y5edhDVKA5m z$px>D)z$x}egA}pyOYU2>Ig(&V4z~)8AWfB8$wAcFl({#nSu%ZdvvL%wT5M?USLS_lI1E z!e!!CZ!DnQx^^6xYv``$x*8e0n?0JCAsf>Qp7;U$7p&xazpS*`uL}azE7*a)DF3yb z^|}*gs<}`RziUQipLJfTsO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wooOK-<{W5&PJZDhd-M}zxlK4y_LbHeTxE9(XO^rg{Qtw%ODc@`L)mpPD$at^AwMx zZM1Pfjq1Y{)dZcP`G)BvddP=(!1NTPx25UgVTtC6X@<8!WJT!5i=j|k-|wdS%Bc*v zi^*^zqSeu8c#$-AG#d+?&9_GeiqMdbK5QqW%C-P_Z -function Find-Match { - [CmdletBinding()] - param( - [Parameter()] - [string]$DefaultRoot, - [Parameter()] - [string[]]$Pattern, - $FindOptions, - $MatchOptions) - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Apply defaults for parameters and trace. - if (!$DefaultRoot) { - $DefaultRoot = Get-TaskVariable -Name 'System.DefaultWorkingDirectory' -Default (Get-Location).Path - } - - Write-Verbose "DefaultRoot: '$DefaultRoot'" - if (!$FindOptions) { - $FindOptions = New-FindOptions -FollowSpecifiedSymbolicLink -FollowSymbolicLinks - } - - Trace-FindOptions -Options $FindOptions - if (!$MatchOptions) { - $MatchOptions = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $MatchOptions - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Normalize slashes for root dir. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - $results = @{ } - $originalMatchOptions = $MatchOptions - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $MatchOptions = Copy-MatchOptions -Options $originalMatchOptions - - # Skip comments. - if (!$MatchOptions.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $MatchOptions.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$MatchOptions.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$MatchOptions.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $MatchOptions.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $MatchOptions.NoNegate = $true - $MatchOptions.FlipNegate = $false - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Expand braces - required to accurately interpret findPath. - $expanded = $null - $preExpanded = $pat - if ($MatchOptions.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - } - - # Set NoBrace. - $MatchOptions.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - if ($isIncludePattern) { - # Determine the findPath. - $findInfo = Get-FindInfoFromPattern -DefaultRoot $DefaultRoot -Pattern $pat -MatchOptions $MatchOptions - $findPath = $findInfo.FindPath - Write-Verbose "FindPath: '$findPath'" - - if (!$findPath) { - Write-Verbose "Skipping empty path." - continue - } - - # Perform the find. - Write-Verbose "StatOnly: '$($findInfo.StatOnly)'" - [string[]]$findResults = @( ) - if ($findInfo.StatOnly) { - # Simply stat the path - all path segments were used to build the path. - if ((Test-Path -LiteralPath $findPath)) { - $findResults += $findPath - } - } else { - $findResults = Get-FindResult -Path $findPath -Options $FindOptions - } - - Write-Verbose "Found $($findResults.Count) paths." - - # Apply the pattern. - Write-Verbose "Applying include pattern." - if ($findInfo.AdjustedPattern -ne $pat) { - Write-Verbose "AdjustedPattern: '$($findInfo.AdjustedPattern)'" - $pat = $findInfo.AdjustedPattern - } - - $matchResults = [Minimatch.Minimatcher]::Filter( - $findResults, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results[$matchResult.ToUpperInvariant()] = $matchResult - } - - Write-Verbose "$matchCount matches" - } else { - # Check if basename only and MatchBase=true. - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $pat) -and - ($pat -replace '\\', '/').IndexOf('/') -lt 0) { - - # Do not root the pattern. - Write-Verbose "MatchBase and basename only." - } else { - # Root the exclude pattern. - $pat = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - # Apply the pattern. - Write-Verbose 'Applying exclude pattern.' - $matchResults = [Minimatch.Minimatcher]::Filter( - [string[]]$results.Values, - $pat, - (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $results.Remove($matchResult.ToUpperInvariant()) - } - - Write-Verbose "$matchCount matches" - } - } - } - - $finalResult = @( $results.Values | Sort-Object ) - Write-Verbose "$($finalResult.Count) final results" - return $finalResult - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Creates FindOptions for use with Find-VstsMatch. - -.DESCRIPTION -Creates FindOptions for use with Find-VstsMatch. Contains switches to control whether to follow symlinks. - -.PARAMETER FollowSpecifiedSymbolicLink -Indicates whether to traverse descendants if the specified path is a symbolic link directory. Does not cause nested symbolic link directories to be traversed. - -.PARAMETER FollowSymbolicLinks -Indicates whether to traverse descendants of symbolic link directories. -#> -function New-FindOptions { - [CmdletBinding()] - param( - [switch]$FollowSpecifiedSymbolicLink, - [switch]$FollowSymbolicLinks) - - return New-Object psobject -Property @{ - FollowSpecifiedSymbolicLink = $FollowSpecifiedSymbolicLink.IsPresent - FollowSymbolicLinks = $FollowSymbolicLinks.IsPresent - } -} - -<# -.SYNOPSIS -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. - -.DESCRIPTION -Creates MatchOptions for use with Find-VstsMatch and Select-VstsMatch. Contains switches to control which pattern matching options are applied. -#> -function New-MatchOptions { - [CmdletBinding()] - param( - [switch]$Dot, - [switch]$FlipNegate, - [switch]$MatchBase, - [switch]$NoBrace, - [switch]$NoCase, - [switch]$NoComment, - [switch]$NoExt, - [switch]$NoGlobStar, - [switch]$NoNegate, - [switch]$NoNull) - - return New-Object psobject -Property @{ - Dot = $Dot.IsPresent - FlipNegate = $FlipNegate.IsPresent - MatchBase = $MatchBase.IsPresent - NoBrace = $NoBrace.IsPresent - NoCase = $NoCase.IsPresent - NoComment = $NoComment.IsPresent - NoExt = $NoExt.IsPresent - NoGlobStar = $NoGlobStar.IsPresent - NoNegate = $NoNegate.IsPresent - NoNull = $NoNull.IsPresent - } -} - -<# -.SYNOPSIS -Applies match patterns against a list of files. - -.DESCRIPTION -Applies match patterns to a list of paths. Supports interleaved exclude patterns. - -.PARAMETER ItemPath -Array of paths. - -.PARAMETER Pattern -Patterns to apply. Supports interleaved exclude patterns. - -.PARAMETER PatternRoot -Default root to apply to unrooted patterns. Not applied to basename-only patterns when Options.MatchBase is true. - -.PARAMETER Options -When the Options parameter is not specified, defaults to (New-VstsMatchOptions -Dot -NoBrace -NoCase). -#> -function Select-Match { - [CmdletBinding()] - param( - [Parameter()] - [string[]]$ItemPath, - [Parameter()] - [string[]]$Pattern, - [Parameter()] - [string]$PatternRoot, - $Options) - - - Trace-EnteringInvocation $MyInvocation -Parameter None - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - if (!$Options) { - $Options = New-MatchOptions -Dot -NoBrace -NoCase - } - - Trace-MatchOptions -Options $Options - Add-Type -LiteralPath $PSScriptRoot\Minimatch.dll - - # Hashtable to keep track of matches. - $map = @{ } - - $originalOptions = $Options - foreach ($pat in $Pattern) { - Write-Verbose "Pattern: '$pat'" - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose 'Skipping empty pattern.' - continue - } - - # Clone match options. - $Options = Copy-MatchOptions -Options $originalOptions - - # Skip comments. - if (!$Options.NoComment -and $pat.StartsWith('#')) { - Write-Verbose 'Skipping comment.' - continue - } - - # Set NoComment. Brace expansion could result in a leading '#'. - $Options.NoComment = $true - - # Determine whether pattern is include or exclude. - $negateCount = 0 - if (!$Options.NoNegate) { - while ($negateCount -lt $pat.Length -and $pat[$negateCount] -eq '!') { - $negateCount++ - } - - $pat = $pat.Substring($negateCount) # trim leading '!' - if ($negateCount) { - Write-Verbose "Trimmed leading '!'. Pattern: '$pat'" - } - } - - $isIncludePattern = $negateCount -eq 0 -or - ($negateCount % 2 -eq 0 -and !$Options.FlipNegate) -or - ($negateCount % 2 -eq 1 -and $Options.FlipNegate) - - # Set NoNegate. Brace expansion could result in a leading '!'. - $Options.NoNegate = $true - $Options.FlipNegate = $false - - # Expand braces - required to accurately root patterns. - $expanded = $null - $preExpanded = $pat - if ($Options.NoBrace) { - $expanded = @( $pat ) - } else { - # Convert slashes on Windows before calling braceExpand(). Unfortunately this means braces cannot - # be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). - Write-Verbose "Expanding braces." - $convertedPattern = $pat -replace '\\', '/' - $expanded = [Minimatch.Minimatcher]::BraceExpand( - $convertedPattern, - (ConvertTo-MinimatchOptions -Options $Options)) - } - - # Set NoBrace. - $Options.NoBrace = $true - - foreach ($pat in $expanded) { - if ($pat -ne $preExpanded) { - Write-Verbose "Pattern: '$pat'" - } - - # Trim and skip empty. - $pat = "$pat".Trim() - if (!$pat) { - Write-Verbose "Skipping empty pattern." - continue - } - - # Root the pattern when all of the following conditions are true: - if ($PatternRoot -and # PatternRoot is supplied - !(Test-Rooted -Path $pat) -and # AND pattern is not rooted - # # AND MatchBase=false or not basename only - (!$Options.MatchBase -or ($pat -replace '\\', '/').IndexOf('/') -ge 0)) { - - # Root the include pattern. - $pat = Get-RootedPattern -DefaultRoot $PatternRoot -Pattern $pat - Write-Verbose "After Get-RootedPattern, pattern: '$pat'" - } - - if ($isIncludePattern) { - # Apply the pattern. - Write-Verbose 'Applying include pattern against original list.' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Union the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map[$matchResult] = $true - } - - Write-Verbose "$matchCount matches" - } else { - # Apply the pattern. - Write-Verbose 'Applying exclude pattern against original list' - $matchResults = [Minimatch.Minimatcher]::Filter( - $ItemPath, - $pat, - (ConvertTo-MinimatchOptions -Options $Options)) - - # Subtract the results. - $matchCount = 0 - foreach ($matchResult in $matchResults) { - $matchCount++ - $map.Remove($matchResult) - } - - Write-Verbose "$matchCount matches" - } - } - } - - # return a filtered version of the original list (preserves order and prevents duplication) - $result = $ItemPath | Where-Object { $map[$_] } - Write-Verbose "$($result.Count) final results" - $result - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -################################################################################ -# Private functions. -################################################################################ - -function Copy-MatchOptions { - [CmdletBinding()] - param($Options) - - return New-Object psobject -Property @{ - Dot = $Options.Dot -eq $true - FlipNegate = $Options.FlipNegate -eq $true - MatchBase = $Options.MatchBase -eq $true - NoBrace = $Options.NoBrace -eq $true - NoCase = $Options.NoCase -eq $true - NoComment = $Options.NoComment -eq $true - NoExt = $Options.NoExt -eq $true - NoGlobStar = $Options.NoGlobStar -eq $true - NoNegate = $Options.NoNegate -eq $true - NoNull = $Options.NoNull -eq $true - } -} - -function ConvertTo-MinimatchOptions { - [CmdletBinding()] - param($Options) - - $opt = New-Object Minimatch.Options - $opt.AllowWindowsPaths = $true - $opt.Dot = $Options.Dot -eq $true - $opt.FlipNegate = $Options.FlipNegate -eq $true - $opt.MatchBase = $Options.MatchBase -eq $true - $opt.NoBrace = $Options.NoBrace -eq $true - $opt.NoCase = $Options.NoCase -eq $true - $opt.NoComment = $Options.NoComment -eq $true - $opt.NoExt = $Options.NoExt -eq $true - $opt.NoGlobStar = $Options.NoGlobStar -eq $true - $opt.NoNegate = $Options.NoNegate -eq $true - $opt.NoNull = $Options.NoNull -eq $true - return $opt -} - -function ConvertTo-NormalizedSeparators { - [CmdletBinding()] - param([string]$Path) - - # Convert slashes. - $Path = "$Path".Replace('/', '\') - - # Remove redundant slashes. - $isUnc = $Path -match '^\\\\+[^\\]' - $Path = $Path -replace '\\\\+', '\' - if ($isUnc) { - $Path = '\' + $Path - } - - return $Path -} - -function Get-FindInfoFromPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern, - [Parameter(Mandatory = $true)] - $MatchOptions) - - if (!$MatchOptions.NoBrace) { - throw "Get-FindInfoFromPattern expected MatchOptions.NoBrace to be true." - } - - # For the sake of determining the find path, pretend NoCase=false. - $MatchOptions = Copy-MatchOptions -Options $MatchOptions - $MatchOptions.NoCase = $false - - # Check if basename only and MatchBase=true - if ($MatchOptions.MatchBase -and - !(Test-Rooted -Path $Pattern) -and - ($Pattern -replace '\\', '/').IndexOf('/') -lt 0) { - - return New-Object psobject -Property @{ - AdjustedPattern = $Pattern - FindPath = $DefaultRoot - StatOnly = $false - } - } - - # The technique applied by this function is to use the information on the Minimatch object determine - # the findPath. Minimatch breaks the pattern into path segments, and exposes information about which - # segments are literal vs patterns. - # - # Note, the technique currently imposes a limitation for drive-relative paths with a glob in the - # first segment, e.g. C:hello*/world. It's feasible to overcome this limitation, but is left unsolved - # for now. - $minimatchObj = New-Object Minimatch.Minimatcher($Pattern, (ConvertTo-MinimatchOptions -Options $MatchOptions)) - - # The "set" field is a two-dimensional enumerable of parsed path segment info. The outer enumerable should only - # contain one item, otherwise something went wrong. Brace expansion can result in multiple items in the outer - # enumerable, but that should be turned off by the time this function is reached. - # - # Note, "set" is a private field in the .NET implementation but is documented as a feature in the nodejs - # implementation. The .NET implementation is a port and is by a different author. - $setFieldInfo = $minimatchObj.GetType().GetField('set', 'Instance,NonPublic') - [object[]]$set = $setFieldInfo.GetValue($minimatchObj) - if ($set.Count -ne 1) { - throw "Get-FindInfoFromPattern expected Minimatch.Minimatcher(...).set.Count to be 1. Actual: '$($set.Count)'" - } - - [string[]]$literalSegments = @( ) - [object[]]$parsedSegments = $set[0] - foreach ($parsedSegment in $parsedSegments) { - if ($parsedSegment.GetType().Name -eq 'LiteralItem') { - # The item is a LiteralItem when the original input for the path segment does not contain any - # unescaped glob characters. - $literalSegments += $parsedSegment.Source; - continue - } - - break; - } - - # Join the literal segments back together. Minimatch converts '\' to '/' on Windows, then squashes - # consequetive slashes, and finally splits on slash. This means that UNC format is lost, but can - # be detected from the original pattern. - $joinedSegments = [string]::Join('/', $literalSegments) - if ($joinedSegments -and ($Pattern -replace '\\', '/').StartsWith('//')) { - $joinedSegments = '/' + $joinedSegments # restore UNC format - } - - # Determine the find path. - $findPath = '' - if ((Test-Rooted -Path $Pattern)) { # The pattern is rooted. - $findPath = $joinedSegments - } elseif ($joinedSegments) { # The pattern is not rooted, and literal segements were found. - $findPath = [System.IO.Path]::Combine($DefaultRoot, $joinedSegments) - } else { # The pattern is not rooted, and no literal segements were found. - $findPath = $DefaultRoot - } - - # Clean up the path. - if ($findPath) { - $findPath = [System.IO.Path]::GetDirectoryName(([System.IO.Path]::Combine($findPath, '_'))) # Hack to remove unnecessary trailing slash. - $findPath = ConvertTo-NormalizedSeparators -Path $findPath - } - - return New-Object psobject -Property @{ - AdjustedPattern = Get-RootedPattern -DefaultRoot $DefaultRoot -Pattern $Pattern - FindPath = $findPath - StatOnly = $literalSegments.Count -eq $parsedSegments.Count - } -} - -function Get-FindResult { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - $Options) - - if (!(Test-Path -LiteralPath $Path)) { - Write-Verbose 'Path not found.' - return - } - - $Path = ConvertTo-NormalizedSeparators -Path $Path - - # Push the first item. - [System.Collections.Stack]$stack = New-Object System.Collections.Stack - $stack.Push((Get-Item -LiteralPath $Path)) - - $count = 0 - while ($stack.Count) { - # Pop the next item and yield the result. - $item = $stack.Pop() - $count++ - $item.FullName - - # Traverse. - if (($item.Attributes -band 0x00000010) -eq 0x00000010) { # Directory - if (($item.Attributes -band 0x00000400) -ne 0x00000400 -or # ReparsePoint - $Options.FollowSymbolicLinks -or - ($count -eq 1 -and $Options.FollowSpecifiedSymbolicLink)) { - - $childItems = @( Get-DirectoryChildItem -Path $Item.FullName -Force ) - [System.Array]::Reverse($childItems) - foreach ($childItem in $childItems) { - $stack.Push($childItem) - } - } - } - } -} - -function Get-RootedPattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$DefaultRoot, - [Parameter(Mandatory = $true)] - [string]$Pattern) - - if ((Test-Rooted -Path $Pattern)) { - return $Pattern - } - - # Normalize root. - $DefaultRoot = ConvertTo-NormalizedSeparators -Path $DefaultRoot - - # Escape special glob characters. - $DefaultRoot = $DefaultRoot -replace '(\[)(?=[^\/]+\])', '[[]' # Escape '[' when ']' follows within the path segment - $DefaultRoot = $DefaultRoot.Replace('?', '[?]') # Escape '?' - $DefaultRoot = $DefaultRoot.Replace('*', '[*]') # Escape '*' - $DefaultRoot = $DefaultRoot -replace '\+\(', '[+](' # Escape '+(' - $DefaultRoot = $DefaultRoot -replace '@\(', '[@](' # Escape '@(' - $DefaultRoot = $DefaultRoot -replace '!\(', '[!](' # Escape '!(' - - if ($DefaultRoot -like '[A-Z]:') { # e.g. C: - return "$DefaultRoot$Pattern" - } - - # Ensure root ends with a separator. - if (!$DefaultRoot.EndsWith('\')) { - $DefaultRoot = "$DefaultRoot\" - } - - return "$DefaultRoot$Pattern" -} - -function Test-Rooted { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - $Path = ConvertTo-NormalizedSeparators -Path $Path - return $Path.StartsWith('\') -or # e.g. \ or \hello or \\hello - $Path -like '[A-Z]:*' # e.g. C: or C:\hello -} - -function Trace-MatchOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "MatchOptions.Dot: '$($Options.Dot)'" - Write-Verbose "MatchOptions.FlipNegate: '$($Options.FlipNegate)'" - Write-Verbose "MatchOptions.MatchBase: '$($Options.MatchBase)'" - Write-Verbose "MatchOptions.NoBrace: '$($Options.NoBrace)'" - Write-Verbose "MatchOptions.NoCase: '$($Options.NoCase)'" - Write-Verbose "MatchOptions.NoComment: '$($Options.NoComment)'" - Write-Verbose "MatchOptions.NoExt: '$($Options.NoExt)'" - Write-Verbose "MatchOptions.NoGlobStar: '$($Options.NoGlobStar)'" - Write-Verbose "MatchOptions.NoNegate: '$($Options.NoNegate)'" - Write-Verbose "MatchOptions.NoNull: '$($Options.NoNull)'" -} - -function Trace-FindOptions { - [CmdletBinding()] - param($Options) - - Write-Verbose "FindOptions.FollowSpecifiedSymbolicLink: '$($FindOptions.FollowSpecifiedSymbolicLink)'" - Write-Verbose "FindOptions.FollowSymbolicLinks: '$($FindOptions.FollowSymbolicLinks)'" -} diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/InputFunctions.ps1 b/Tasks/upgrade/ps_modules/VstsTaskSdk/InputFunctions.ps1 deleted file mode 100644 index 846492d..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/InputFunctions.ps1 +++ /dev/null @@ -1,493 +0,0 @@ -# Hash table of known variable info. The formatted env var name is the lookup key. -# -# The purpose of this hash table is to keep track of known variables. The hash table -# needs to be maintained for multiple reasons: -# 1) to distinguish between env vars and job vars -# 2) to distinguish between secret vars and public -# 3) to know the real variable name and not just the formatted env var name. -$script:knownVariables = @{ } -$script:vault = @{ } - -<# -.SYNOPSIS -Gets an endpoint. - -.DESCRIPTION -Gets an endpoint object for the specified endpoint name. The endpoint is returned as an object with three properties: Auth, Data, and Url. - -The Data property requires a 1.97 agent or higher. - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-Endpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the URL. - $description = Get-LocString -Key PSLIB_EndpointUrl0 -ArgumentList $Name - $key = "ENDPOINT_URL_$Name" - $url = Get-VaultValue -Description $description -Key $key -Require:$Require - - # Get the auth object. - $description = Get-LocString -Key PSLIB_EndpointAuth0 -ArgumentList $Name - $key = "ENDPOINT_AUTH_$Name" - if ($auth = (Get-VaultValue -Description $description -Key $key -Require:$Require)) { - $auth = ConvertFrom-Json -InputObject $auth - } - - # Get the data. - $description = "'$Name' service endpoint data" - $key = "ENDPOINT_DATA_$Name" - if ($data = (Get-VaultValue -Description $description -Key $key)) { - $data = ConvertFrom-Json -InputObject $data - } - - # Return the endpoint. - if ($url -or $auth -or $data) { - New-Object -TypeName psobject -Property @{ - Url = $url - Auth = $auth - Data = $data - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file ticket. - -.DESCRIPTION -Gets the secure file ticket that can be used to download the secure file contents. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileTicket { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_TICKET_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets a secure file name. - -.DESCRIPTION -Gets the name for a secure file. - -.PARAMETER Id -Secure file id. - -.PARAMETER Require -Writes an error to the error pipeline if the ticket is not found. -#> -function Get-SecureFileName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [switch]$Require) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Id - $key = "SECUREFILE_NAME_$Id" - - Get-VaultValue -Description $description -Key $key -Require:$Require - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets an input. - -.DESCRIPTION -Gets the value for the specified input name. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-Input { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - # Get the input from the vault. Splat the bound parameters hashtable. Splatting is required - # in order to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $description = Get-LocString -Key PSLIB_Input0 -ArgumentList $Name - $key = "INPUT_$($Name.Replace(' ', '_').ToUpperInvariant())" - Get-VaultValue @PSBoundParameters -Description $description -Key $key -} - -<# -.SYNOPSIS -Gets a task variable. - -.DESCRIPTION -Gets the value for the specified task variable. - -.PARAMETER AsBool -Returns the value as a bool. Returns true if the value converted to a string is "1" or "true" (case insensitive); otherwise false. - -.PARAMETER AsInt -Returns the value as an int. Returns the value converted to an int. Returns 0 if the conversion fails. - -.PARAMETER Default -Default value to use if the input is null or empty. - -.PARAMETER Require -Writes an error to the error pipeline if the input is null or empty. -#> -function Get-TaskVariable { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(ParameterSetName = 'Default')] - $Default, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [switch]$AsBool, - [switch]$AsInt) - - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - $description = Get-LocString -Key PSLIB_TaskVariable0 -ArgumentList $Name - $variableKey = Get-VariableKey -Name $Name - if ($script:knownVariables.$variableKey.Secret) { - # Get secret variable. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - $vaultKey = "SECRET_$variableKey" - Get-VaultValue @PSBoundParameters -Description $description -Key $vaultKey - } else { - # Get public variable. - $item = $null - $path = "Env:$variableKey" - if ((Test-Path -LiteralPath $path) -and ($item = Get-Item -LiteralPath $path).Value) { - # Intentionally empty. Value was successfully retrieved. - } elseif (!$script:nonInteractive) { - # The value wasn't found and the module is running in interactive dev mode. - # Prompt for the value. - Set-Item -LiteralPath $path -Value (Read-Host -Prompt $description) - if (Test-Path -LiteralPath $path) { - $item = Get-Item -LiteralPath $path - } - } - - # Get the converted value. Splatting is required to concisely invoke the correct parameter set. - $null = $PSBoundParameters.Remove('Name') - Get-Value @PSBoundParameters -Description $description -Key $variableKey -Value $item.Value - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } -} - -<# -.SYNOPSIS -Gets all job variables available to the task. Requires 2.104.1 agent or higher. - -.DESCRIPTION -Gets a snapshot of the current state of all job variables available to the task. -Requires a 2.104.1 agent or higher for full functionality. - -Returns an array of objects with the following properties: - [string]Name - [string]Value - [bool]Secret - -Limitations on an agent prior to 2.104.1: - 1) The return value does not include all public variables. Only public variables - that have been added using setVariable are returned. - 2) The name returned for each secret variable is the formatted environment variable - name, not the actual variable name (unless it was set explicitly at runtime using - setVariable). -#> -function Get-TaskVariableInfo { - [CmdletBinding()] - param() - - foreach ($info in $script:knownVariables.Values) { - New-Object -TypeName psobject -Property @{ - Name = $info.Name - Value = Get-TaskVariable -Name $info.Name - Secret = $info.Secret - } - } -} - -<# -.SYNOPSIS -Sets a task variable. - -.DESCRIPTION -Sets a task variable in the current task context as well as in the current job context. This allows the task variable to retrieved by subsequent tasks within the same job. -#> -function Set-TaskVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret) - - # Once a secret always a secret. - $variableKey = Get-VariableKey -Name $Name - [bool]$Secret = $Secret -or $script:knownVariables.$variableKey.Secret - if ($Secret) { - $vaultKey = "SECRET_$variableKey" - if (!$Value) { - # Clear the secret. - Write-Verbose "Set $Name = ''" - $script:vault.Remove($vaultKey) - } else { - # Store the secret in the vault. - Write-Verbose "Set $Name = '********'" - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Set-Item -LiteralPath "Env:$variableKey" -Value '' - } else { - # Set the environment variable. - Write-Verbose "Set $Name = '$Value'" - Set-Item -LiteralPath "Env:$variableKey" -Value $Value - } - - # Store the metadata. - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $Secret - } - - # Persist the variable in the task context. - Write-SetVariable -Name $Name -Value $Value -Secret:$Secret -} - -######################################## -# Private functions. -######################################## -function Get-VaultValue { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - # Attempt to get the vault value. - $value = $null - if ($psCredential = $script:vault[$Key]) { - $value = $psCredential.GetNetworkCredential().Password - } elseif (!$script:nonInteractive) { - # The value wasn't found. Prompt for the value if running in interactive dev mode. - $value = Read-Host -Prompt $Description - if ($value) { - $script:vault[$Key] = New-Object System.Management.Automation.PSCredential( - $Key, - (ConvertTo-SecureString -String $value -AsPlainText -Force)) - } - } - - Get-Value -Value $value @PSBoundParameters -} - -function Get-Value { - [CmdletBinding(DefaultParameterSetName = 'Require')] - param( - [string]$Value, - [Parameter(Mandatory = $true)] - [string]$Description, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(ParameterSetName = 'Require')] - [switch]$Require, - [Parameter(ParameterSetName = 'Default')] - [object]$Default, - [switch]$AsBool, - [switch]$AsInt) - - $result = $Value - if ($result) { - if ($Key -like 'ENDPOINT_AUTH_*') { - Write-Verbose "$($Key): '********'" - } else { - Write-Verbose "$($Key): '$result'" - } - } else { - Write-Verbose "$Key (empty)" - - # Write error if required. - if ($Require) { - Write-Error "$(Get-LocString -Key PSLIB_Required0 $Description)" - return - } - - # Fallback to the default if provided. - if ($PSCmdlet.ParameterSetName -eq 'Default') { - $result = $Default - $OFS = ' ' - Write-Verbose " Defaulted to: '$result'" - } else { - $result = '' - } - } - - # Convert to bool if specified. - if ($AsBool) { - if ($result -isnot [bool]) { - $result = "$result" -in '1', 'true' - Write-Verbose " Converted to bool: $result" - } - - return $result - } - - # Convert to int if specified. - if ($AsInt) { - if ($result -isnot [int]) { - try { - $result = [int]"$result" - } catch { - $result = 0 - } - - Write-Verbose " Converted to int: $result" - } - - return $result - } - - return $result -} - -function Initialize-Inputs { - # Store endpoints, inputs, and secret variables in the vault. - foreach ($variable in (Get-ChildItem -Path Env:ENDPOINT_?*, Env:INPUT_?*, Env:SECRET_?*, Env:SECUREFILE_?*)) { - # Record the secret variable metadata. This is required by Get-TaskVariable to - # retrieve the value. In a 2.104.1 agent or higher, this metadata will be overwritten - # when $env:VSTS_SECRET_VARIABLES is processed. - if ($variable.Name -like 'SECRET_?*') { - $variableKey = $variable.Name.Substring('SECRET_'.Length) - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - # This is technically not the variable name (has underscores instead of dots), - # but it's good enough to make Get-TaskVariable work in a pre-2.104.1 agent - # where $env:VSTS_SECRET_VARIABLES is not defined. - Name = $variableKey - Secret = $true - } - } - - # Store the value in the vault. - $vaultKey = $variable.Name - if ($variable.Value) { - $script:vault[$vaultKey] = New-Object System.Management.Automation.PSCredential( - $vaultKey, - (ConvertTo-SecureString -String $variable.Value -AsPlainText -Force)) - } - - # Clear the environment variable. - Remove-Item -LiteralPath "Env:$($variable.Name)" - } - - # Record the public variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_PUBLIC_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_PUBLIC_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $false - } - } - - $env:VSTS_PUBLIC_VARIABLES = '' - } - - # Record the secret variable names. Env var added in 2.104.1 agent. - if ($env:VSTS_SECRET_VARIABLES) { - foreach ($name in (ConvertFrom-Json -InputObject $env:VSTS_SECRET_VARIABLES)) { - $variableKey = Get-VariableKey -Name $name - $script:knownVariables[$variableKey] = New-Object -TypeName psobject -Property @{ - Name = $name - Secret = $true - } - } - - $env:VSTS_SECRET_VARIABLES = '' - } -} - -function Get-VariableKey { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name) - - if ($Name -ne 'agent.jobstatus') { - $Name = $Name.Replace('.', '_') - } - - $Name.ToUpperInvariant() -} diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 b/Tasks/upgrade/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 deleted file mode 100644 index b4080ae..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/LegacyFindFunctions.ps1 +++ /dev/null @@ -1,320 +0,0 @@ -<# -.SYNOPSIS -Finds files or directories. - -.DESCRIPTION -Finds files or directories using advanced pattern matching. - -.PARAMETER LiteralDirectory -Directory to search. - -.PARAMETER LegacyPattern -Proprietary pattern format. The LiteralDirectory parameter is used to root any unrooted patterns. - -Separate multiple patterns using ";". Escape actual ";" in the path by using ";;". -"?" indicates a wildcard that represents any single character within a path segment. -"*" indicates a wildcard that represents zero or more characters within a path segment. -"**" as the entire path segment indicates a recursive search. -"**" within a path segment indicates a recursive intersegment wildcard. -"+:" (can be omitted) indicates an include pattern. -"-:" indicates an exclude pattern. - -The result is from the command is a union of all the matches from the include patterns, minus the matches from the exclude patterns. - -.PARAMETER IncludeFiles -Indicates whether to include files in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER IncludeDirectories -Indicates whether to include directories in the results. - -If neither IncludeFiles or IncludeDirectories is set, then IncludeFiles is assumed. - -.PARAMETER Force -Indicates whether to include hidden items. - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is?Match.txt" - -Given: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt -C:\Directory\IsNotMatch.txt - -Returns: -C:\Directory\Is1Match.txt -C:\Directory\Is2Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Is*Match.txt" - -Given: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt -C:\Directory\NonMatch.txt - -Returns: -C:\Directory\IsOneMatch.txt -C:\Directory\IsTwoMatch.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**\Match.txt" - -Given: -C:\Directory\Match.txt -C:\Directory\NotAMatch.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -Returns: -C:\Directory\Match.txt -C:\Directory\SubDir\Match.txt -C:\Directory\SubDir\SubSubDir\Match.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\**" - -Given: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -Returns: -C:\Directory\One.txt -C:\Directory\SubDir\Two.txt -C:\Directory\SubDir\SubSubDir\Three.txt - -.EXAMPLE -Find-VstsFiles -LegacyPattern "C:\Directory\Sub**Match.txt" - -Given: -C:\Directory\IsNotAMatch.txt -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\IsNot.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsNot.txt - -Returns: -C:\Directory\SubDir\IsAMatch.txt -C:\Directory\SubDir\SubSubDir\IsAMatch.txt -#> -function Find-Files { - [CmdletBinding()] - param( - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$LiteralDirectory, - [Parameter(Mandatory = $true)] - [string]$LegacyPattern, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - # Note, due to subtle implementation details of Get-PathPrefix/Get-PathIterator, - # this function does not appear to be able to search the root of a drive and other - # cases where Path.GetDirectoryName() returns empty. More details in Get-PathPrefix. - - Trace-EnteringInvocation $MyInvocation - if (!$IncludeFiles -and !$IncludeDirectories) { - $IncludeFiles = $true - } - - $includePatterns = New-Object System.Collections.Generic.List[string] - $excludePatterns = New-Object System.Collections.Generic.List[System.Text.RegularExpressions.Regex] - $LegacyPattern = $LegacyPattern.Replace(';;', "`0") - foreach ($pattern in $LegacyPattern.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries)) { - $pattern = $pattern.Replace("`0", ';') - $isIncludePattern = Test-IsIncludePattern -Pattern ([ref]$pattern) - if ($LiteralDirectory -and !([System.IO.Path]::IsPathRooted($pattern))) { - # Use the root directory provided to make the pattern a rooted path. - $pattern = [System.IO.Path]::Combine($LiteralDirectory, $pattern) - } - - # Validate pattern does not end with a \. - if ($pattern[$pattern.Length - 1] -eq [System.IO.Path]::DirectorySeparatorChar) { - throw (Get-LocString -Key PSLIB_InvalidPattern0 -ArgumentList $pattern) - } - - if ($isIncludePattern) { - $includePatterns.Add($pattern) - } else { - $excludePatterns.Add((Convert-PatternToRegex -Pattern $pattern)) - } - } - - $count = 0 - foreach ($path in (Get-MatchingItems -IncludePatterns $includePatterns -ExcludePatterns $excludePatterns -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force)) { - $count++ - $path - } - - Write-Verbose "Total found: $count" - Trace-LeavingInvocation $MyInvocation -} - -######################################## -# Private functions. -######################################## -function Convert-PatternToRegex { - [CmdletBinding()] - param([string]$Pattern) - - $Pattern = [regex]::Escape($Pattern.Replace('\', '/')). # Normalize separators and regex escape. - Replace('/\*\*/', '((/.+/)|(/))'). # Replace directory globstar. - Replace('\*\*', '.*'). # Replace remaining globstars with a wildcard that can span directory separators. - Replace('\*', '[^/]*'). # Replace asterisks with a wildcard that cannot span directory separators. - # bug: should be '[^/]' instead of '.' - Replace('\?', '.') # Replace single character wildcards. - New-Object regex -ArgumentList "^$Pattern`$", ([System.Text.RegularExpressions.RegexOptions]::IgnoreCase) -} - -function Get-FileNameFilter { - [CmdletBinding()] - param([string]$Pattern) - - $index = $Pattern.LastIndexOf('\') - if ($index -eq -1 -or # Pattern does not contain a backslash. - !($Pattern = $Pattern.Substring($index + 1)) -or # Pattern ends in a backslash. - $Pattern.Contains('**')) # Last segment contains an inter-segment wildcard. - { - return '*' - } - - # bug? is this supposed to do substring? - return $Pattern -} - -function Get-MatchingItems { - [CmdletBinding()] - param( - [System.Collections.Generic.List[string]]$IncludePatterns, - [System.Collections.Generic.List[regex]]$ExcludePatterns, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - Trace-EnteringInvocation $MyInvocation - $allFiles = New-Object System.Collections.Generic.HashSet[string] - foreach ($pattern in $IncludePatterns) { - $pathPrefix = Get-PathPrefix -Pattern $pattern - $fileNameFilter = Get-FileNameFilter -Pattern $pattern - $patternRegex = Convert-PatternToRegex -Pattern $pattern - # Iterate over the directories and files under the pathPrefix. - Get-PathIterator -Path $pathPrefix -Filter $fileNameFilter -IncludeFiles:$IncludeFiles -IncludeDirectories:$IncludeDirectories -Force:$Force | - ForEach-Object { - # Normalize separators. - $normalizedPath = $_.Replace('\', '/') - # **/times/** will not match C:/fun/times because there isn't a trailing slash. - # So try both if including directories. - $alternatePath = "$normalizedPath/" # potential bug: it looks like this will result in a false - # positive if the item is a regular file and not a directory - - $isMatch = $false - if ($patternRegex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $patternRegex.IsMatch($alternatePath))) { - $isMatch = $true - - # Test whether the path should be excluded. - foreach ($regex in $ExcludePatterns) { - if ($regex.IsMatch($normalizedPath) -or ($IncludeDirectories -and $regex.IsMatch($alternatePath))) { - $isMatch = $false - break - } - } - } - - if ($isMatch) { - $null = $allFiles.Add($_) - } - } - } - - Trace-Path -Path $allFiles -PassThru - Trace-LeavingInvocation $MyInvocation -} - -function Get-PathIterator { - [CmdletBinding()] - param( - [string]$Path, - [string]$Filter, - [switch]$IncludeFiles, - [switch]$IncludeDirectories, - [switch]$Force) - - if (!$Path) { - return - } - - # bug: this returns the dir without verifying whether exists - if ($IncludeDirectories) { - $Path - } - - Get-DirectoryChildItem -Path $Path -Filter $Filter -Force:$Force -Recurse | - ForEach-Object { - if ($_.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - if ($IncludeDirectories) { - $_.FullName - } - } elseif ($IncludeFiles) { - $_.FullName - } - } -} - -function Get-PathPrefix { - [CmdletBinding()] - param([string]$Pattern) - - # Note, unable to search root directories is a limitation due to subtleties of this function - # and downstream code in Get-PathIterator that short-circuits when the path prefix is empty. - # This function uses Path.GetDirectoryName() to determine the path prefix, which will yield - # empty in some cases. See the following examples of Path.GetDirectoryName() input => output: - # C:/ => - # C:/hello => C:\ - # C:/hello/ => C:\hello - # C:/hello/world => C:\hello - # C:/hello/world/ => C:\hello\world - # C: => - # C:hello => C: - # C:hello/ => C:hello - # / => - # /hello => \ - # /hello/ => \hello - # //hello => - # //hello/ => - # //hello/world => - # //hello/world/ => \\hello\world - - $index = $Pattern.IndexOfAny([char[]]@('*'[0], '?'[0])) - if ($index -eq -1) { - # If no wildcards are found, return the directory name portion of the path. - # If there is no directory name (file name only in pattern), this will return empty string. - return [System.IO.Path]::GetDirectoryName($Pattern) - } - - [System.IO.Path]::GetDirectoryName($Pattern.Substring(0, $index)) -} - -function Test-IsIncludePattern { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [ref]$Pattern) - - # Include patterns start with +: or anything except -: - # Exclude patterns start with -: - if ($Pattern.value.StartsWith("+:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $true - } elseif ($Pattern.value.StartsWith("-:")) { - # Remove the prefix. - $Pattern.value = $Pattern.value.Substring(2) - $false - } else { - # No prefix, so leave the string alone. - $true; - } -} diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 b/Tasks/upgrade/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 deleted file mode 100644 index c31790c..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/LocalizationFunctions.ps1 +++ /dev/null @@ -1,150 +0,0 @@ -$script:resourceStrings = @{ } - -<# -.SYNOPSIS -Gets a localized resource string. - -.DESCRIPTION -Gets a localized resource string and optionally formats the string with arguments. - -If the format fails (due to a bad format string or incorrect expected arguments in the format string), then the format string is returned followed by each of the arguments (delimited by a space). - -If the lookup key is not found, then the lookup key is returned followed by each of the arguments (delimited by a space). - -.PARAMETER Require -Writes an error to the error pipeline if the endpoint is not found. -#> -function Get-LocString { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true, Position = 1)] - [string]$Key, - [Parameter(Position = 2)] - [object[]]$ArgumentList = @( )) - - # Due to the dynamically typed nature of PowerShell, a single null argument passed - # to an array parameter is interpreted as a null array. - if ([object]::ReferenceEquals($null, $ArgumentList)) { - $ArgumentList = @( $null ) - } - - # Lookup the format string. - $format = '' - if (!($format = $script:resourceStrings[$Key])) { - # Warn the key was not found. Prevent recursion if the lookup key is the - # "string resource key not found" lookup key. - $resourceNotFoundKey = 'PSLIB_StringResourceKeyNotFound0' - if ($key -ne $resourceNotFoundKey) { - Write-Warning (Get-LocString -Key $resourceNotFoundKey -ArgumentList $Key) - } - - # Fallback to just the key itself if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $key } - - # Otherwise fallback to the key followed by the arguments. - $OFS = " " - return "$key $ArgumentList" - } - - # Return the string if there aren't any arguments to format. - if (!$ArgumentList.Count) { return $format } - - try { - [string]::Format($format, $ArgumentList) - } catch { - Write-Warning (Get-LocString -Key 'PSLIB_StringFormatFailed') - $OFS = " " - "$format $ArgumentList" - } -} - -<# -.SYNOPSIS -Imports resource strings for use with Get-VstsLocString. - -.DESCRIPTION -Imports resource strings for use with Get-VstsLocString. The imported strings are stored in an internal resource string dictionary. Optionally, if a separate resource file for the current culture exists, then the localized strings from that file then imported (overlaid) into the same internal resource string dictionary. - -Resource strings from the SDK are prefixed with "PSLIB_". This prefix should be avoided for custom resource strings. - -.Parameter LiteralPath -JSON file containing resource strings. - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Imports strings from messages section in the JSON file. If a messages section is not defined, then no strings are imported. Example messages section: -{ - "messages": { - "Hello": "Hello you!", - "Hello0": "Hello {0}!" - } -} - -.EXAMPLE -Import-VstsLocStrings -LiteralPath $PSScriptRoot\Task.json - -Overlays strings from an optional separate resource file for the current culture. - -Given the task variable System.Culture is set to 'de-DE'. This variable is set by the agent based on the current culture for the job. -Given the file Task.json contains: -{ - "messages": { - "GoodDay": "Good day!", - } -} -Given the file resources.resjson\de-DE\resources.resjson: -{ - "loc.messages.GoodDay": "Guten Tag!" -} - -The net result from the import command would be one new key-value pair added to the internal dictionary: Key = 'GoodDay', Value = 'Guten Tag!' -#> -function Import-LocStrings { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - # Validate the file exists. - if (!(Test-Path -LiteralPath $LiteralPath -PathType Leaf)) { - Write-Warning (Get-LocString -Key PSLIB_FileNotFound0 -ArgumentList $LiteralPath) - return - } - - # Load the json. - Write-Verbose "Loading resource strings from: $LiteralPath" - $count = 0 - if ($messages = (Get-Content -LiteralPath $LiteralPath -Encoding UTF8 | Out-String | ConvertFrom-Json).messages) { - # Add each resource string to the hashtable. - foreach ($member in (Get-Member -InputObject $messages -MemberType NoteProperty)) { - [string]$key = $member.Name - $script:resourceStrings[$key] = $messages."$key" - $count++ - } - } - - Write-Verbose "Loaded $count strings." - - # Get the culture. - $culture = Get-TaskVariable -Name "System.Culture" -Default "en-US" - - # Load the resjson. - $resjsonPath = "$([System.IO.Path]::GetDirectoryName($LiteralPath))\Strings\resources.resjson\$culture\resources.resjson" - if (Test-Path -LiteralPath $resjsonPath) { - Write-Verbose "Loading resource strings from: $resjsonPath" - $count = 0 - $resjson = Get-Content -LiteralPath $resjsonPath -Encoding UTF8 | Out-String | ConvertFrom-Json - foreach ($member in (Get-Member -Name loc.messages.* -InputObject $resjson -MemberType NoteProperty)) { - if (!($value = $resjson."$($member.Name)")) { - continue - } - - [string]$key = $member.Name.Substring('loc.messages.'.Length) - $script:resourceStrings[$key] = $value - $count++ - } - - Write-Verbose "Loaded $count strings." - } -} diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 b/Tasks/upgrade/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 deleted file mode 100644 index 595a7d8..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/LoggingCommandFunctions.ps1 +++ /dev/null @@ -1,601 +0,0 @@ -$script:loggingCommandPrefix = '##vso[' -$script:loggingCommandEscapeMappings = @( # TODO: WHAT ABOUT "="? WHAT ABOUT "%"? - New-Object psobject -Property @{ Token = ';' ; Replacement = '%3B' } - New-Object psobject -Property @{ Token = "`r" ; Replacement = '%0D' } - New-Object psobject -Property @{ Token = "`n" ; Replacement = '%0A' } - New-Object psobject -Property @{ Token = "]" ; Replacement = '%5D' } -) -# TODO: BUG: Escape % ??? -# TODO: Add test to verify don't need to escape "=". - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddAttachment { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Type, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'addattachment' -Data $Path -Properties @{ - 'type' = $Type - 'name' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadSummary { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadsummary' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetEndpoint { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Id, - [Parameter(Mandatory = $true)] - [string]$Field, - [Parameter(Mandatory = $true)] - [string]$Key, - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setendpoint' -Data $Value -Properties @{ - 'id' = $Id - 'field' = $Field - 'key' = $Key - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AddBuildTag { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'addbuildtag' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-AssociateArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - [string]$Type, - [hashtable]$Properties, - [switch]$AsOutput) - - $p = @{ } - if ($Properties) { - foreach ($key in $Properties.Keys) { - $p[$key] = $Properties[$key] - } - } - - $p['artifactname'] = $Name - $p['artifacttype'] = $Type - Write-LoggingCommand -Area 'artifact' -Event 'associate' -Data $Path -Properties $p -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-LogDetail { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [guid]$Id, - $ParentId, - [string]$Type, - [string]$Name, - $Order, - $StartTime, - $FinishTime, - $Progress, - [ValidateSet('Unknown', 'Initialized', 'InProgress', 'Completed')] - [Parameter()] - $State, - [ValidateSet('Succeeded', 'SucceededWithIssues', 'Failed', 'Cancelled', 'Skipped')] - [Parameter()] - $Result, - [string]$Message, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'logdetail' -Data $Message -Properties @{ - 'id' = $Id - 'parentid' = $ParentId - 'type' = $Type - 'name' = $Name - 'order' = $Order - 'starttime' = $StartTime - 'finishtime' = $FinishTime - 'progress' = $Progress - 'state' = $State - 'result' = $Result - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetProgress { - [CmdletBinding()] - param( - [ValidateRange(0, 100)] - [Parameter(Mandatory = $true)] - [int]$Percent, - [string]$CurrentOperation, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setprogress' -Data $CurrentOperation -Properties @{ - 'value' = $Percent - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetResult { - [CmdletBinding(DefaultParameterSetName = 'AsOutput')] - param( - [ValidateSet("Succeeded", "SucceededWithIssues", "Failed", "Cancelled", "Skipped")] - [Parameter(Mandatory = $true)] - [string]$Result, - [string]$Message, - [Parameter(ParameterSetName = 'AsOutput')] - [switch]$AsOutput, - [Parameter(ParameterSetName = 'DoNotThrow')] - [switch]$DoNotThrow) - - Write-LoggingCommand -Area 'task' -Event 'complete' -Data $Message -Properties @{ - 'result' = $Result - } -AsOutput:$AsOutput - if ($Result -eq 'Failed' -and !$AsOutput -and !$DoNotThrow) { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - throw (New-Object VstsTaskSdk.TerminationException($Message)) - } -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetSecret { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setsecret' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-SetVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ - 'variable' = $Name - 'issecret' = $Secret - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskDebug { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskError { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type error @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskVerbose { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsOutput) - - Write-TaskDebug_Internal @PSBoundParameters -AsVerbose -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-TaskWarning { - [CmdletBinding()] - param( - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - Write-LogIssue -Type warning @PSBoundParameters -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadFile { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'uploadfile' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-PrependPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateBuildNumber { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Value, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'updatebuildnumber' -Data $Value -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadArtifact { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$ContainerFolder, - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'artifact' -Event 'upload' -Data $Path -Properties @{ - 'containerfolder' = $ContainerFolder - 'artifactname' = $Name - } -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UploadBuildLog { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'build' -Event 'uploadlog' -Data $Path -AsOutput:$AsOutput -} - -<# -.SYNOPSIS -See https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md - -.PARAMETER AsOutput -Indicates whether to write the logging command directly to the host or to the output pipeline. -#> -function Write-UpdateReleaseName { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [switch]$AsOutput) - - Write-LoggingCommand -Area 'release' -Event 'updatereleasename' -Data $Name -AsOutput:$AsOutput -} - -######################################## -# Private functions. -######################################## -function Format-LoggingCommandData { - [CmdletBinding()] - param([string]$Value, [switch]$Reverse) - - if (!$Value) { - return '' - } - - if (!$Reverse) { - foreach ($mapping in $script:loggingCommandEscapeMappings) { - $Value = $Value.Replace($mapping.Token, $mapping.Replacement) - } - } else { - for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { - $mapping = $script:loggingCommandEscapeMappings[$i] - $Value = $Value.Replace($mapping.Replacement, $mapping.Token) - } - } - - return $Value -} - -function Format-LoggingCommand { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Area, - [Parameter(Mandatory = $true)] - [string]$Event, - [string]$Data, - [hashtable]$Properties) - - # Append the preamble. - [System.Text.StringBuilder]$sb = New-Object -TypeName System.Text.StringBuilder - $null = $sb.Append($script:loggingCommandPrefix).Append($Area).Append('.').Append($Event) - - # Append the properties. - if ($Properties) { - $first = $true - foreach ($key in $Properties.Keys) { - [string]$value = Format-LoggingCommandData $Properties[$key] - if ($value) { - if ($first) { - $null = $sb.Append(' ') - $first = $false - } else { - $null = $sb.Append(';') - } - - $null = $sb.Append("$key=$value") - } - } - } - - # Append the tail and output the value. - $Data = Format-LoggingCommandData $Data - $sb.Append(']').Append($Data).ToString() -} - -function Write-LoggingCommand { - [CmdletBinding(DefaultParameterSetName = 'Parameters')] - param( - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Area, - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Event, - [Parameter(ParameterSetName = 'Parameters')] - [string]$Data, - [Parameter(ParameterSetName = 'Parameters')] - [hashtable]$Properties, - [Parameter(Mandatory = $true, ParameterSetName = 'Object')] - $Command, - [switch]$AsOutput) - - if ($PSCmdlet.ParameterSetName -eq 'Object') { - Write-LoggingCommand -Area $Command.Area -Event $Command.Event -Data $Command.Data -Properties $Command.Properties -AsOutput:$AsOutput - return - } - - $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties - if ($AsOutput) { - $command - } else { - Write-Host $command - } -} - -function Write-LogIssue { - [CmdletBinding()] - param( - [ValidateSet('warning', 'error')] - [Parameter(Mandatory = $true)] - [string]$Type, - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ - 'type' = $Type - 'code' = $ErrCode - 'sourcepath' = $SourcePath - 'linenumber' = $LineNumber - 'columnnumber' = $ColumnNumber - } - if ($AsOutput) { - return $command - } - - if ($Type -eq 'error') { - $foregroundColor = $host.PrivateData.ErrorForegroundColor - $backgroundColor = $host.PrivateData.ErrorBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Red - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.WarningForegroundColor - $backgroundColor = $host.PrivateData.WarningBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Yellow - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} - -function Write-TaskDebug_Internal { - [CmdletBinding()] - param( - [string]$Message, - [switch]$AsVerbose, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'debug' -Data $Message - if ($AsOutput) { - return $command - } - - if ($AsVerbose) { - $foregroundColor = $host.PrivateData.VerboseForegroundColor - $backgroundColor = $host.PrivateData.VerboseBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Cyan - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.DebugForegroundColor - $backgroundColor = $host.PrivateData.DebugBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::DarkGray - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host -Object $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 b/Tasks/upgrade/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 deleted file mode 100644 index d536111..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/LongPathFunctions.ps1 +++ /dev/null @@ -1,205 +0,0 @@ -######################################## -# Private functions. -######################################## -function ConvertFrom-LongFormPath { - [CmdletBinding()] - param([string]$Path) - - if ($Path) { - if ($Path.StartsWith('\\?\UNC')) { - # E.g. \\?\UNC\server\share -> \\server\share - return $Path.Substring(1, '\?\UNC'.Length) - } elseif ($Path.StartsWith('\\?\')) { - # E.g. \\?\C:\directory -> C:\directory - return $Path.Substring('\\?\'.Length) - } - } - - return $Path -} -function ConvertTo-LongFormPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$longFormPath = Get-FullNormalizedPath -Path $Path - if ($longFormPath -and !$longFormPath.StartsWith('\\?')) { - if ($longFormPath.StartsWith('\\')) { - # E.g. \\server\share -> \\?\UNC\server\share - return "\\?\UNC$($longFormPath.Substring(1))" - } else { - # E.g. C:\directory -> \\?\C:\directory - return "\\?\$longFormPath" - } - } - - return $longFormPath -} - -# TODO: ADD A SWITCH TO EXCLUDE FILES, A SWITCH TO EXCLUDE DIRECTORIES, AND A SWITCH NOT TO FOLLOW REPARSE POINTS. -function Get-DirectoryChildItem { - [CmdletBinding()] - param( - [string]$Path, - [ValidateNotNullOrEmpty()] - [Parameter()] - [string]$Filter = "*", - [switch]$Force, - [VstsTaskSdk.FS.FindFlags]$Flags = [VstsTaskSdk.FS.FindFlags]::LargeFetch, - [VstsTaskSdk.FS.FindInfoLevel]$InfoLevel = [VstsTaskSdk.FS.FindInfoLevel]::Basic, - [switch]$Recurse) - - $stackOfDirectoryQueues = New-Object System.Collections.Stack - while ($true) { - $directoryQueue = New-Object System.Collections.Queue - $fileQueue = New-Object System.Collections.Queue - $findData = New-Object VstsTaskSdk.FS.FindData - $longFormPath = (ConvertTo-LongFormPath $Path) - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, $Filter), - $InfoLevel, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - # Output directories immediately. - if ($item.Attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - $item - # Append to the directory queue if recursive and default filter. - if ($Recurse -and $Filter -eq '*') { - $directoryQueue.Enqueue($item) - } - } else { - # Hold the files until all directories have been output. - $fileQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - - # If recursive and non-default filter, queue child directories. - if ($Recurse -and $Filter -ne '*') { - $findData = New-Object VstsTaskSdk.FS.FindData - $handle = $null - try { - $handle = [VstsTaskSdk.FS.NativeMethods]::FindFirstFileEx( - [System.IO.Path]::Combine($longFormPath, '*'), - [VstsTaskSdk.FS.FindInfoLevel]::Basic, - $findData, - [VstsTaskSdk.FS.FindSearchOps]::NameMatch, - [System.IntPtr]::Zero, - $Flags) - if (!$handle.IsInvalid) { - while ($true) { - if ($findData.fileName -notin '.', '..') { - $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes - # If the item is hidden, check if $Force is specified. - if ($Force -or !$attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Hidden)) { - # Collect directories only. - if ($attributes.HasFlag([VstsTaskSdk.FS.Attributes]::Directory)) { - # Create the item. - $item = New-Object -TypeName psobject -Property @{ - 'Attributes' = $attributes - 'FullName' = (ConvertFrom-LongFormPath -Path ([System.IO.Path]::Combine($Path, $findData.fileName))) - 'Name' = $findData.fileName - } - $directoryQueue.Enqueue($item) - } - } - } - - if (!([VstsTaskSdk.FS.NativeMethods]::FindNextFile($handle, $findData))) { break } - - if ($handle.IsInvalid) { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - Get-LocString -Key PSLIB_EnumeratingSubdirectoriesFailedForPath0 -ArgumentList $Path - )) - } - } - } - } finally { - if ($handle -ne $null) { $handle.Dispose() } - } - } - - # Output the files. - $fileQueue - - # Push the directory queue onto the stack if any directories were found. - if ($directoryQueue.Count) { $stackOfDirectoryQueues.Push($directoryQueue) } - - # Break out of the loop if no more directory queues to process. - if (!$stackOfDirectoryQueues.Count) { break } - - # Get the next path. - $directoryQueue = $stackOfDirectoryQueues.Peek() - $Path = $directoryQueue.Dequeue().FullName - - # Pop the directory queue if it's empty. - if (!$directoryQueue.Count) { $null = $stackOfDirectoryQueues.Pop() } - } -} - -function Get-FullNormalizedPath { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Path) - - [string]$outPath = $Path - [uint32]$bufferSize = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, 0, $null, $null) - [int]$lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($bufferSize -gt 0) { - $absolutePath = New-Object System.Text.StringBuilder([int]$bufferSize) - [uint32]$length = [VstsTaskSdk.FS.NativeMethods]::GetFullPathName($Path, $bufferSize, $absolutePath, $null) - $lastWin32Error = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - if ($length -gt 0) { - $outPath = $absolutePath.ToString() - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - } else { - throw (New-Object -TypeName System.ComponentModel.Win32Exception -ArgumentList @( - $lastWin32Error - Get-LocString -Key PSLIB_PathLengthNotReturnedFor0 -ArgumentList $Path - )) - } - - if ($outPath.EndsWith('\') -and !$outPath.EndsWith(':\')) { - $outPath = $outPath.TrimEnd('\') - } - - $outPath -} \ No newline at end of file diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/Minimatch.dll b/Tasks/upgrade/ps_modules/VstsTaskSdk/Minimatch.dll deleted file mode 100644 index 700ddc426e56b08270c9dcbb1ade8ded248f98d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18432 zcmeHvd3amZweLFTNJpa;OY%U-U;wdJ(iE<^0Dr1eX+yVU^ZP<}CerFP{^D;NRAvpy{Upu7qdr-p#QQK0A=EE z*j@RF!K$=fum`{t+x7$Dj;_a3@mYu3X*)Y&L6B{wNj$7;1D=Y{x>+@ezQumUhi%iz zO@BY1=+-!qPq<}p%U-3n%sDf*P#@P|Wa1p%m=FXEn4%bhfB`=%h9F>|Q;H!781527 z5HJu1N4U|d+S*S|6A90AA zkcdZ#{0VeB+M>~Zr~5WKIT}ZR`3qry$+MxwZUCkMpp6A zlnP^-LRYHRWuXsdbCpqNodtCbjqPxWp&AP6_LosJK9}1uT+)sn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zXnS5bT)o=#3d z-F+{9yXNOFH5^~}{vRh_efj-=znQJ>TG@X|0T&zneSN+C-Px<~SNNlRlIX`lH6K&= zS^XHJY=2iHztz#b0<#WW(T^L9EUuHv-1O++0s1PME`6S3JXWHnze|6@uekfVEW3MT zWD8De>Y6p1mBYT2o^FDY>gm-hDgI`N@NExGR&rJ1CG65?^I2{ao?ZKiy45!v%mU6o z{-pd7xp#x)`K^9S*368ckzJK@|eeCHK|wh@#b0Crf~9w6M#pe4dt zz?`bfXOcXA%di!1*2AAZ>IHR3^sUCXQ`(eW-H<5Yn`5?jbXtG5NDp!qZSh!nE9zb< ztrseM(26}cKP~cbpO68?i={JC27M@7HoJ{94MJiBHg6Jt^rDR+*ghhj8AZR?(joL5 zXRI^uV)Ov~6T{i41(qQF;Jm}5U)G~Wa1eUgi?-tx2;$Q%_HJ|9;1T4OOVPlT^5`4c zy-fVO9Xc%ZWemP8R`eKu26_g+E)%~_uQSuTGkx13bviM61?kHHSb7va|F7z)p8hw( X?dtd6e<)43|K{fYzxw~TJn(-2*CUr_ diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/OutFunctions.ps1 b/Tasks/upgrade/ps_modules/VstsTaskSdk/OutFunctions.ps1 deleted file mode 100644 index fd898d6..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/OutFunctions.ps1 +++ /dev/null @@ -1,79 +0,0 @@ -# TODO: It would be better if the Out-Default function resolved the underlying Out-Default -# command in the begin block. This would allow for supporting other modules that override -# Out-Default. -$script:outDefaultCmdlet = $ExecutionContext.InvokeCommand.GetCmdlet("Microsoft.PowerShell.Core\Out-Default") - -######################################## -# Public functions. -######################################## -function Out-Default { - [CmdletBinding(ConfirmImpact = "Medium")] - param( - [Parameter(ValueFromPipeline = $true)] - [System.Management.Automation.PSObject]$InputObject) - - begin { - #Write-Host '[Entering Begin Out-Default]' - $__sp = { & $script:outDefaultCmdlet @PSBoundParameters }.GetSteppablePipeline() - $__sp.Begin($pscmdlet) - #Write-Host '[Leaving Begin Out-Default]' - } - - process { - #Write-Host '[Entering Process Out-Default]' - if ($_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose -Message 'Error record:' 4>&1 | Out-Default - Write-Verbose -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) 4>&1 | Out-Default - Write-Verbose -Message 'Script stack trace:' 4>&1 | Out-Default - Write-Verbose -Message "$($_.ScriptStackTrace)" 4>&1 | Out-Default - Write-Verbose -Message 'Exception:' 4>&1 | Out-Default - Write-Verbose -Message $_.Exception.ToString() 4>&1 | Out-Default - Write-TaskError -Message $_.Exception.Message - } elseif ($_ -is [System.Management.Automation.WarningRecord]) { - Write-TaskWarning -Message (Remove-TrailingNewLine (Out-String -InputObject $_ -Width 2147483647)) - } elseif ($_ -is [System.Management.Automation.VerboseRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskVerbose -Message $private:str - } - } elseif ($_ -is [System.Management.Automation.DebugRecord] -and !$global:__vstsNoOverrideVerbose) { - foreach ($private:str in (Format-DebugMessage -Object $_)) { - Write-TaskDebug -Message $private:str - } - } else { -# TODO: Consider using out-string here to control the width. As a security precaution it would actually be best to set it to max so wrapping doesn't interfere with secret masking. - $__sp.Process($_) - } - - #Write-Host '[Leaving Process Out-Default]' - } - - end { - #Write-Host '[Entering End Out-Default]' - $__sp.End() - #Write-Host '[Leaving End Out-Default]' - } -} - -######################################## -# Private functions. -######################################## -function Format-DebugMessage { - [CmdletBinding()] - param([psobject]$Object) - - $private:str = Out-String -InputObject $Object -Width 2147483647 - $private:str = Remove-TrailingNewLine $private:str - "$private:str".Replace("`r`n", "`n").Replace("`r", "`n").Split("`n"[0]) -} - -function Remove-TrailingNewLine { - [CmdletBinding()] - param($Str) - if ([object]::ReferenceEquals($Str, $null)) { - return $Str - } elseif ($Str.EndsWith("`r`n")) { - return $Str.Substring(0, $Str.Length - 2) - } else { - return $Str - } -} diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml b/Tasks/upgrade/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml deleted file mode 100644 index 8c20388..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/PSGetModuleInfo.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - Microsoft.PowerShell.Commands.PSRepositoryItemInfo - System.Management.Automation.PSCustomObject - System.Object - - - VstsTaskSdk - 0.11.0 - Module - VSTS Task SDK - Microsoft - VSTS - (c) 2016 Microsoft. All rights reserved. -

2018-05-21T03:27:56+01:00
- - - - https://github.com/Microsoft/vsts-task-lib - - - - System.Object[] - System.Array - System.Object - - - PSModule - - - - - System.Collections.Hashtable - System.Object - - - - DscResource - - - - - - - RoleCapability - - - - Cmdlet - - - - Workflow - - - - Command - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - Function - - - - Find-Match - New-FindOptions - New-MatchOptions - Select-Match - Get-Endpoint - Get-SecureFileTicket - Get-SecureFileName - Get-Input - Get-TaskVariable - Get-TaskVariableInfo - Set-TaskVariable - Find-Files - Get-LocString - Import-LocStrings - Write-AddAttachment - Write-AddBuildTag - Write-AssociateArtifact - Write-LogDetail - Write-PrependPath - Write-SetEndpoint - Write-SetProgress - Write-SetResult - Write-SetSecret - Write-SetVariable - Write-TaskDebug - Write-TaskError - Write-TaskVerbose - Write-TaskWarning - Write-UpdateBuildNumber - Write-UpdateReleaseName - Write-UploadArtifact - Write-UploadBuildLog - Write-UploadFile - Write-UploadSummary - Out-Default - Get-AssemblyReference - Get-TfsClientCredentials - Get-TfsService - Get-VssCredentials - Get-VssHttpClient - Assert-Agent - Assert-Path - Invoke-Tool - Trace-EnteringInvocation - Trace-LeavingInvocation - Trace-Path - Get-WebProxy - Get-ClientCertificate - - - - - - - - - - - - https://www.powershellgallery.com/api/v2 - PSGallery - NuGet - - - System.Management.Automation.PSCustomObject - System.Object - - - (c) 2016 Microsoft. All rights reserved. - VSTS Task SDK - False - True - True - 12749 - 136204 - 71074 - 21/05/2018 03:27:56 +01:00 - 21/05/2018 03:27:56 +01:00 - 09/11/2018 22:20:20 +00:00 - PSModule PSFunction_Find-Match PSCommand_Find-Match PSFunction_New-FindOptions PSCommand_New-FindOptions PSFunction_New-MatchOptions PSCommand_New-MatchOptions PSFunction_Select-Match PSCommand_Select-Match PSFunction_Get-Endpoint PSCommand_Get-Endpoint PSFunction_Get-SecureFileTicket PSCommand_Get-SecureFileTicket PSFunction_Get-SecureFileName PSCommand_Get-SecureFileName PSFunction_Get-Input PSCommand_Get-Input PSFunction_Get-TaskVariable PSCommand_Get-TaskVariable PSFunction_Get-TaskVariableInfo PSCommand_Get-TaskVariableInfo PSFunction_Set-TaskVariable PSCommand_Set-TaskVariable PSFunction_Find-Files PSCommand_Find-Files PSFunction_Get-LocString PSCommand_Get-LocString PSFunction_Import-LocStrings PSCommand_Import-LocStrings PSFunction_Write-AddAttachment PSCommand_Write-AddAttachment PSFunction_Write-AddBuildTag PSCommand_Write-AddBuildTag PSFunction_Write-AssociateArtifact PSCommand_Write-AssociateArtifact PSFunction_Write-LogDetail PSCommand_Write-LogDetail PSFunction_Write-PrependPath PSCommand_Write-PrependPath PSFunction_Write-SetEndpoint PSCommand_Write-SetEndpoint PSFunction_Write-SetProgress PSCommand_Write-SetProgress PSFunction_Write-SetResult PSCommand_Write-SetResult PSFunction_Write-SetSecret PSCommand_Write-SetSecret PSFunction_Write-SetVariable PSCommand_Write-SetVariable PSFunction_Write-TaskDebug PSCommand_Write-TaskDebug PSFunction_Write-TaskError PSCommand_Write-TaskError PSFunction_Write-TaskVerbose PSCommand_Write-TaskVerbose PSFunction_Write-TaskWarning PSCommand_Write-TaskWarning PSFunction_Write-UpdateBuildNumber PSCommand_Write-UpdateBuildNumber PSFunction_Write-UpdateReleaseName PSCommand_Write-UpdateReleaseName PSFunction_Write-UploadArtifact PSCommand_Write-UploadArtifact PSFunction_Write-UploadBuildLog PSCommand_Write-UploadBuildLog PSFunction_Write-UploadFile PSCommand_Write-UploadFile PSFunction_Write-UploadSummary PSCommand_Write-UploadSummary PSFunction_Out-Default PSCommand_Out-Default PSFunction_Get-AssemblyReference PSCommand_Get-AssemblyReference PSFunction_Get-TfsClientCredentials PSCommand_Get-TfsClientCredentials PSFunction_Get-TfsService PSCommand_Get-TfsService PSFunction_Get-VssCredentials PSCommand_Get-VssCredentials PSFunction_Get-VssHttpClient PSCommand_Get-VssHttpClient PSFunction_Assert-Agent PSCommand_Assert-Agent PSFunction_Assert-Path PSCommand_Assert-Path PSFunction_Invoke-Tool PSCommand_Invoke-Tool PSFunction_Trace-EnteringInvocation PSCommand_Trace-EnteringInvocation PSFunction_Trace-LeavingInvocation PSCommand_Trace-LeavingInvocation PSFunction_Trace-Path PSCommand_Trace-Path PSFunction_Get-WebProxy PSCommand_Get-WebProxy PSFunction_Get-ClientCertificate PSCommand_Get-ClientCertificate PSIncludes_Function - False - 2018-11-09T22:20:20Z - 0.11.0 - Microsoft - false - Module - VstsTaskSdk.nuspec|FindFunctions.ps1|InputFunctions.ps1|LegacyFindFunctions.ps1|lib.json|LocalizationFunctions.ps1|LoggingCommandFunctions.ps1|LongPathFunctions.ps1|Minimatch.dll|OutFunctions.ps1|ServerOMFunctions.ps1|ToolFunctions.ps1|TraceFunctions.ps1|VstsTaskSdk.dll|VstsTaskSdk.psd1|VstsTaskSdk.psm1|Strings\resources.resjson\de-de\resources.resjson|Strings\resources.resjson\en-US\resources.resjson|Strings\resources.resjson\es-es\resources.resjson|Strings\resources.resjson\fr-fr\resources.resjson|Strings\resources.resjson\it-IT\resources.resjson|Strings\resources.resjson\ja-jp\resources.resjson|Strings\resources.resjson\ko-KR\resources.resjson|Strings\resources.resjson\ru-RU\resources.resjson|Strings\resources.resjson\zh-CN\resources.resjson|Strings\resources.resjson\zh-TW\resources.resjson - bbed04e2-4e8e-4089-90a2-58b858fed8d8 - 3.0 - Microsoft - - - /Users/gep13/github/gep13/chocolatey-azuredevops/Tasks/install/VstsTaskSdk/0.11.0 - - - diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 b/Tasks/upgrade/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 deleted file mode 100644 index 177820b..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/ServerOMFunctions.ps1 +++ /dev/null @@ -1,659 +0,0 @@ -<# -.SYNOPSIS -Gets assembly reference information. - -.DESCRIPTION -Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK. - -Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario. - -Walks an assembly's references to determine all of it's dependencies. Also walks the references of the dependencies, and so on until all nested dependencies have been traversed. Dependencies are searched for in the directory of the specified assembly. NET Framework assemblies are omitted. - -See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER LiteralPath -Assembly to walk. - -.EXAMPLE -Get-VstsAssemblyReference -LiteralPath C:\nuget\microsoft.teamfoundationserver.client.14.102.0\lib\net45\Microsoft.TeamFoundation.Build2.WebApi.dll -#> -function Get-AssemblyReference { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath) - - $ErrorActionPreference = 'Stop' - Write-Warning "Not supported for use during task execution. This function is only intended to help developers resolve the minimal set of DLLs that need to be bundled when consuming the VSTS REST SDK or TFS Extended Client SDK. The interface and output may change between patch releases of the VSTS Task SDK." - Write-Output '' - Write-Warning "Only a subset of the referenced assemblies may actually be required, depending on the functionality used by your task. It is best to bundle only the DLLs required for your scenario." - $directory = [System.IO.Path]::GetDirectoryName($LiteralPath) - $hashtable = @{ } - $queue = @( [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($LiteralPath).GetName() ) - while ($queue.Count) { - # Add a blank line between assemblies. - Write-Output '' - - # Pop. - $assemblyName = $queue[0] - $queue = @( $queue | Select-Object -Skip 1 ) - - # Attempt to find the assembly in the same directory. - $assembly = $null - $path = "$directory\$($assemblyName.Name).dll" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } else { - $path = "$directory\$($assemblyName.Name).exe" - if ((Test-Path -LiteralPath $path -PathType Leaf)) { - $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($path) - } - } - - # Make sure the assembly full name matches, not just the file name. - if ($assembly -and $assembly.GetName().FullName -ne $assemblyName.FullName) { - $assembly = $null - } - - # Print the assembly. - if ($assembly) { - Write-Output $assemblyName.FullName - } else { - if ($assemblyName.FullName -eq 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed') { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) *** This is an expected condition when using the HTTP clients from the 15.x VSTS REST SDK. Use Get-VstsVssHttpClient to load the HTTP clients (which applies a binding redirect assembly resolver for Newtonsoft.Json). Otherwise you will need to manage the binding redirect yourself." - } else { - Write-Warning "*** NOT FOUND $($assemblyName.FullName) ***" - } - - continue - } - - # Walk the references. - $refAssemblyNames = @( $assembly.GetReferencedAssemblies() ) - for ($i = 0 ; $i -lt $refAssemblyNames.Count ; $i++) { - $refAssemblyName = $refAssemblyNames[$i] - - # Skip framework assemblies. - $fxPaths = @( - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\$($refAssemblyName.Name).dll" - "$env:windir\Microsoft.Net\Framework64\v4.0.30319\WPF\$($refAssemblyName.Name).dll" - ) - $fxPath = $fxPaths | - Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } | - Where-Object { [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($_).GetName().FullName -eq $refAssemblyName.FullName } - if ($fxPath) { - continue - } - - # Print the reference. - Write-Output " $($refAssemblyName.FullName)" - - # Add new references to the queue. - if (!$hashtable[$refAssemblyName.FullName]) { - $queue += $refAssemblyName - $hashtable[$refAssemblyName.FullName] = $true - } - } - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the TFS extended client SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -Refer to Get-VstsTfsService for a more simple to get a TFS service object. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -$credentials = Get-VstsTfsClientCredentials -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.VersionControl.Client.dll" -$tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection( - (Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require), - $credentials) -$versionControlServer = $tfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer]) -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsClientCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Validate the type can be found. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsClientCredentials' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Construct the credentials. - $credentials = New-Object Microsoft.TeamFoundation.Client.TfsClientCredentials($false) # Do not use default credentials. - $credentials.AllowInteractive = $false - $credentials.Federated = New-Object Microsoft.TeamFoundation.Client.OAuthTokenCredential([string]$endpoint.auth.parameters.AccessToken) - return $credentials - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a TFS extended client service. - -.DESCRIPTION -Gets an instance of an ITfsTeamProjectCollectionObject. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the service to get. - -.PARAMETER OMDirectory -Directory where the extended client object model DLLs are located. If the DLLs for the types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the TFS extended client SDK from a task. - -.PARAMETER Uri -URI to use when initializing the service. If not specified, defaults to System.TeamFoundationCollectionUri. - -.PARAMETER TfsClientCredentials -Credentials to use when initializing the service. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -.EXAMPLE -$versionControlServer = Get-VstsTfsService -TypeName Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer -$versionControlServer.GetItems('$/*').Items | Format-List -#> -function Get-TfsService { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $TfsClientCredentials) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Default the credentials. - if (!$TfsClientCredentials) { - $TfsClientCredentials = Get-TfsClientCredentials -OMDirectory $OMDirectory - } - - # Validate the project collection type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.TeamFoundation.Client.TfsTeamProjectCollection' -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Load the project collection object. - $tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection($Uri, $TfsClientCredentials) - - # Validate the requested type can be loaded. - $type = Get-OMType -TypeName $TypeName -OMKind 'ExtendedClient' -OMDirectory $OMDirectory -Require - - # Return the service object. - return $tfsTeamProjectCollection.GetService($type) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a credentials object that can be used with the VSTS REST SDK. - -.DESCRIPTION -The agent job token is used to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project service build/release identity). - -Refer to Get-VstsVssHttpClient for a more simple to get a VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.EXAMPLE -# -# Refer to Get-VstsTfsService for a more simple way to get a TFS service object. -# -# This example works using the 14.x .NET SDK. A Newtonsoft.Json 6.0 to 8.0 binding -# redirect may be required when working with the 15.x SDK. Or use Get-VstsVssHttpClient -# to avoid managing the binding redirect. -# -$vssCredentials = Get-VstsVssCredentials -$collectionUrl = New-Object System.Uri((Get-VstsTaskVariable -Name 'System.TeamFoundationCollectionUri' -Require)) -Add-Type -LiteralPath "$PSScriptRoot\Microsoft.TeamFoundation.Core.WebApi.dll" -$projectHttpClient = New-Object Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient($collectionUrl, $vssCredentials) -$projectHttpClient.GetProjects().Result -#> -function Get-VssCredentials { - [CmdletBinding()] - param([string]$OMDirectory) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Get the endpoint. - $endpoint = Get-Endpoint -Name SystemVssConnection -Require - - # Check if the VssOAuthAccessTokenCredential type is available. - if ((Get-OMType -TypeName 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory)) { - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential($endpoint.auth.parameters.AccessToken) - } else { - # Validate the fallback type can be loaded. - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Create the federated credential. - $federatedCredential = New-Object Microsoft.VisualStudio.Services.Client.VssOAuthCredential($endpoint.auth.parameters.AccessToken) - } - - # Return the credentials. - return New-Object Microsoft.VisualStudio.Services.Common.VssCredentials( - (New-Object Microsoft.VisualStudio.Services.Common.WindowsCredential($false)), # Do not use default credentials. - $federatedCredential, - [Microsoft.VisualStudio.Services.Common.CredentialPromptType]::DoNotPrompt) - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VSS HTTP client. - -.DESCRIPTION -Gets an instance of an VSS HTTP client. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -.PARAMETER TypeName -Namespace-qualified type name of the HTTP client to get. - -.PARAMETER OMDirectory -Directory where the REST client object model DLLs are located. If the DLLs for the credential types are not already loaded, an attempt will be made to automatically load the required DLLs from the object model directory. - -If not specified, defaults to the directory of the entry script for the task. - -*** DO NOT USE Agent.ServerOMDirectory *** See https://github.com/Microsoft/vsts-task-lib/tree/master/powershell/Docs/UsingOM.md for reliable usage when working with the VSTS REST SDK from a task. - -# .PARAMETER Uri -# URI to use when initializing the HTTP client. If not specified, defaults to System.TeamFoundationCollectionUri. - -# .PARAMETER VssCredentials -# Credentials to use when initializing the HTTP client. If not specified, the default uses the agent job token to construct the credentials object. The identity associated with the token depends on the scope selected in the build/release definition (either the project collection build/release service identity, or the project build/release service identity). - -# .PARAMETER WebProxy -# WebProxy to use when initializing the HTTP client. If not specified, the default uses the proxy configuration agent current has. - -# .PARAMETER ClientCert -# ClientCert to use when initializing the HTTP client. If not specified, the default uses the client certificate agent current has. - -# .PARAMETER IgnoreSslError -# Skip SSL server certificate validation on all requests made by this HTTP client. If not specified, the default is to validate SSL server certificate. - -.EXAMPLE -$projectHttpClient = Get-VstsVssHttpClient -TypeName Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient -$projectHttpClient.GetProjects().Result -#> -function Get-VssHttpClient { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [string]$OMDirectory, - - [string]$Uri, - - $VssCredentials, - - $WebProxy = (Get-WebProxy), - - $ClientCert = (Get-ClientCertificate), - - [switch]$IgnoreSslError) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - $originalErrorActionPreference = $ErrorActionPreference - try { - $ErrorActionPreference = 'Stop' - - # Default the URI to the collection URI. - if (!$Uri) { - $Uri = Get-TaskVariable -Name System.TeamFoundationCollectionUri -Require - } - - # Cast the URI. - [uri]$Uri = New-Object System.Uri($Uri) - - # Default the credentials. - if (!$VssCredentials) { - $VssCredentials = Get-VssCredentials -OMDirectory $OMDirectory - } - - # Validate the type can be loaded. - $null = Get-OMType -TypeName $TypeName -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - - # Update proxy setting for vss http client - [Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler]::DefaultWebProxy = $WebProxy - - # Update client certificate setting for vss http client - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - [Microsoft.VisualStudio.Services.Common.VssHttpRequestSettings]$Settings = [Microsoft.VisualStudio.Services.WebApi.VssClientHttpRequestSettings]::Default.Clone() - - if ($ClientCert) { - $null = Get-OMType -TypeName 'Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager' -OMKind 'WebApi' -OMDirectory $OMDirectory -Require - $null = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance.ClientCertificates.Add($ClientCert) - - $Settings.ClientCertificateManager = [Microsoft.VisualStudio.Services.WebApi.VssClientCertificateManager]::Instance - } - - # Skip SSL server certificate validation - [bool]$SkipCertValidation = (Get-TaskVariable -Name Agent.SkipCertValidation -AsBool) -or $IgnoreSslError - if ($SkipCertValidation) { - if ($Settings.GetType().GetProperty('ServerCertificateValidationCallback')) { - Write-Verbose "Ignore any SSL server certificate validation errors."; - $Settings.ServerCertificateValidationCallback = [VstsTaskSdk.VstsHttpHandlerSettings]::UnsafeSkipServerCertificateValidation - } - else { - # OMDirectory has older version of Microsoft.VisualStudio.Services.Common.dll - Write-Verbose "The version of 'Microsoft.VisualStudio.Services.Common.dll' does not support skip SSL server certificate validation." - } - } - - # Try to construct the HTTP client. - Write-Verbose "Constructing HTTP client." - try { - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } catch { - # Rethrow if the exception is not due to Newtonsoft.Json DLL not found. - if ($_.Exception.InnerException -isnot [System.IO.FileNotFoundException] -or - $_.Exception.InnerException.FileName -notlike 'Newtonsoft.Json, *') { - - throw - } - - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Test if the Newtonsoft.Json DLL exists in the OM directory. - $newtonsoftDll = [System.IO.Path]::Combine($OMDirectory, "Newtonsoft.Json.dll") - Write-Verbose "Testing file path: '$newtonsoftDll'" - if (!(Test-Path -LiteralPath $newtonsoftDll -PathType Leaf)) { - Write-Verbose 'Not found. Rethrowing exception.' - throw - } - - # Add a binding redirect and try again. Parts of the Dev15 preview SDK have a - # dependency on the 6.0.0.0 Newtonsoft.Json DLL, while other parts reference - # the 8.0.0.0 Newtonsoft.Json DLL. - Write-Verbose "Adding assembly resolver." - $onAssemblyResolve = [System.ResolveEventHandler] { - param($sender, $e) - - if ($e.Name -like 'Newtonsoft.Json, *') { - Write-Verbose "Resolving '$($e.Name)'" - return [System.Reflection.Assembly]::LoadFrom($newtonsoftDll) - } - - Write-Verbose "Unable to resolve assembly name '$($e.Name)'" - return $null - } - [System.AppDomain]::CurrentDomain.add_AssemblyResolve($onAssemblyResolve) - try { - # Try again to construct the HTTP client. - Write-Verbose "Trying again to construct the HTTP client." - return New-Object $TypeName($Uri, $VssCredentials, $Settings) - } finally { - # Unregister the assembly resolver. - Write-Verbose "Removing assemlby resolver." - [System.AppDomain]::CurrentDomain.remove_AssemblyResolve($onAssemblyResolve) - } - } - } catch { - $ErrorActionPreference = $originalErrorActionPreference - Write-Error $_ - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a VstsTaskSdk.VstsWebProxy - -.DESCRIPTION -Gets an instance of a VstsTaskSdk.VstsWebProxy that has same proxy configuration as Build/Release agent. - -VstsTaskSdk.VstsWebProxy implement System.Net.IWebProxy interface. - -.EXAMPLE -$webProxy = Get-VstsWebProxy -$webProxy.GetProxy(New-Object System.Uri("https://github.com/Microsoft/vsts-task-lib")) -#> -function Get-WebProxy { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports proxy - Assert-Agent -Minimum '2.105.7' - - $proxyUrl = Get-TaskVariable -Name Agent.ProxyUrl - $proxyUserName = Get-TaskVariable -Name Agent.ProxyUserName - $proxyPassword = Get-TaskVariable -Name Agent.ProxyPassword - $proxyBypassListJson = Get-TaskVariable -Name Agent.ProxyBypassList - [string[]]$ProxyBypassList = ConvertFrom-Json -InputObject $ProxyBypassListJson - - return New-Object -TypeName VstsTaskSdk.VstsWebProxy -ArgumentList @($proxyUrl, $proxyUserName, $proxyPassword, $proxyBypassList) - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -<# -.SYNOPSIS -Gets a client certificate for current connected TFS instance - -.DESCRIPTION -Gets an instance of a X509Certificate2 that is the client certificate Build/Release agent used. - -.EXAMPLE -$x509cert = Get-ClientCertificate -WebRequestHandler.ClientCertificates.Add(x509cert) -#> -function Get-ClientCertificate { - [CmdletBinding()] - param() - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Min agent version that supports client certificate - Assert-Agent -Minimum '2.122.0' - - [string]$clientCert = Get-TaskVariable -Name Agent.ClientCertArchive - [string]$clientCertPassword = Get-TaskVariable -Name Agent.ClientCertPassword - - if ($clientCert -and (Test-Path -LiteralPath $clientCert -PathType Leaf)) { - return New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($clientCert, $clientCertPassword) - } - } - finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} - -######################################## -# Private functions. -######################################## -function Get-OMType { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$TypeName, - - [ValidateSet('ExtendedClient', 'WebApi')] - [Parameter(Mandatory = $true)] - [string]$OMKind, - - [string]$OMDirectory, - - [switch]$Require) - - Trace-EnteringInvocation -InvocationInfo $MyInvocation - try { - # Default the OMDirectory to the directory of the entry script for the task. - if (!$OMDirectory) { - $OMDirectory = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - Write-Verbose "Defaulted OM directory to: '$OMDirectory'" - } - - # Try to load the type. - $errorRecord = $null - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - # Store the error record. - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - - # Build a list of candidate DLL file paths from the namespace. - $dllPaths = @( ) - $namespace = $TypeName - while ($namespace.LastIndexOf('.') -gt 0) { - # Trim the next segment from the namespace. - $namespace = $namespace.SubString(0, $namespace.LastIndexOf('.')) - - # Derive potential DLL file paths based on the namespace and OM kind (i.e. extended client vs web API). - if ($OMKind -eq 'ExtendedClient') { - if ($namespace -like 'Microsoft.TeamFoundation.*') { - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } else { - if ($namespace -like 'Microsoft.TeamFoundation.*' -or - $namespace -like 'Microsoft.VisualStudio.Services' -or - $namespace -like 'Microsoft.VisualStudio.Services.*') { - - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.WebApi.dll") - $dllPaths += [System.IO.Path]::Combine($OMDirectory, "$namespace.dll") - } - } - } - - foreach ($dllPath in $dllPaths) { - # Check whether the DLL exists. - Write-Verbose "Testing leaf path: '$dllPath'" - if (!(Test-Path -PathType Leaf -LiteralPath "$dllPath")) { - Write-Verbose "Not found." - continue - } - - # Load the DLL. - Write-Verbose "Loading assembly: $dllPath" - try { - Add-Type -LiteralPath $dllPath - } catch { - # Write the information to the verbose stream and proceed to attempt to load the requested type. - # - # The requested type may successfully load now. For example, the type used with the 14.0 Web API for the - # federated credential (VssOAuthCredential) resides in Microsoft.VisualStudio.Services.Client.dll. Even - # though loading the DLL results in a ReflectionTypeLoadException when Microsoft.ServiceBus.dll (approx 3.75mb) - # is not present, enough types are loaded to use the VssOAuthCredential federated credential with the Web API - # HTTP clients. - Write-Verbose "$($_.Exception.GetType().FullName): $($_.Exception.Message)" - if ($_.Exception -is [System.Reflection.ReflectionTypeLoadException]) { - for ($i = 0 ; $i -lt $_.Exception.LoaderExceptions.Length ; $i++) { - $loaderException = $_.Exception.LoaderExceptions[$i] - Write-Verbose "LoaderExceptions[$i]: $($loaderException.GetType().FullName): $($loaderException.Message)" - } - } - } - - # Try to load the type. - Write-Verbose "Testing whether type can be loaded: '$TypeName'" - $ErrorActionPreference = 'Ignore' - try { - # Failure when attempting to cast a string to a type, transfers control to the - # catch handler even when the error action preference is ignore. The error action - # is set to Ignore so the $Error variable is not polluted. - $type = [type]$TypeName - - # Success. - Write-Verbose "The type was loaded successfully." - return $type - } catch { - $errorRecord = $_ - } - - $ErrorActionPreference = 'Stop' - Write-Verbose "The type was not loaded." - } - - # Check whether to propagate the error. - if ($Require) { - Write-Error $errorRecord - } - } finally { - Trace-LeavingInvocation -InvocationInfo $MyInvocation - } -} diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson b/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson deleted file mode 100644 index 7871c36..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/de-de/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agentversion {0} oder höher ist erforderlich.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Der Containerpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "\"{0}\"-Dienstendpunkt-Anmeldeinformationen", - "loc.messages.PSLIB_EndpointUrl0": "\"{0}\"-Dienstendpunkt-URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Fehler beim Aufzählen von Unterverzeichnissen für den folgenden Pfad: \"{0}\"", - "loc.messages.PSLIB_FileNotFound0": "Die Datei wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Input0": "\"{0}\"-Eingabe", - "loc.messages.PSLIB_InvalidPattern0": "Ungültiges Muster: \"{0}\"", - "loc.messages.PSLIB_LeafPathNotFound0": "Der Blattpfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Fehler bei der Normalisierung bzw. Erweiterung des Pfads. Die Pfadlänge wurde vom Kernel32-Subsystem nicht zurückgegeben für: \"{0}\"", - "loc.messages.PSLIB_PathNotFound0": "Der Pfad wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Der Prozess \"{0}\" wurde mit dem Code \"{1}\" beendet.", - "loc.messages.PSLIB_Required0": "Erforderlich: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Fehler beim Zeichenfolgenformat.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Der Zeichenfolgen-Ressourcenschlüssel wurde nicht gefunden: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "\"{0}\"-Taskvariable" -} \ No newline at end of file diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson b/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson deleted file mode 100644 index 66c17bc..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/en-US/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "File not found: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' input", - "loc.messages.PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Path not found: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "loc.messages.PSLIB_Required0": "Required: {0}", - "loc.messages.PSLIB_StringFormatFailed": "String format failed.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' task variable" -} \ No newline at end of file diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson b/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson deleted file mode 100644 index f5c9c23..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/es-es/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Se require la versión {0} o posterior del agente.", - "loc.messages.PSLIB_ContainerPathNotFound0": "No se encuentra la ruta de acceso del contenedor: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenciales del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL del punto de conexión de servicio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "No se pudieron enumerar los subdirectorios de la ruta de acceso: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Archivo no encontrado: '{0}'", - "loc.messages.PSLIB_Input0": "Entrada '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Patrón no válido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "No se encuentra la ruta de acceso de la hoja: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "No se pudo normalizar o expandir la ruta de acceso. El subsistema Kernel32 no devolvió la longitud de la ruta de acceso para: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "No se encuentra la ruta de acceso: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "El proceso '{0}' finalizó con el código '{1}'.", - "loc.messages.PSLIB_Required0": "Se requiere: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Error de formato de cadena.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "No se encuentra la clave de recurso de la cadena: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tarea '{0}'" -} \ No newline at end of file diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson b/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson deleted file mode 100644 index 652870c..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/fr-fr/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "L'agent version {0} (ou une version ultérieure) est obligatoire.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Le chemin du conteneur est introuvable : '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Informations d'identification du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL du point de terminaison de service '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Échec de l'énumération des sous-répertoires pour le chemin : '{0}'", - "loc.messages.PSLIB_FileNotFound0": "Fichier introuvable : {0}.", - "loc.messages.PSLIB_Input0": "Entrée '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Modèle non valide : '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Le chemin feuille est introuvable : '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Échec de la normalisation/l'expansion du chemin. La longueur du chemin n'a pas été retournée par le sous-système Kernel32 pour : '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Chemin introuvable : '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Le processus '{0}' s'est arrêté avec le code '{1}'.", - "loc.messages.PSLIB_Required0": "Obligatoire : {0}", - "loc.messages.PSLIB_StringFormatFailed": "Échec du format de la chaîne.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Clé de la ressource de type chaîne introuvable : '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variable de tâche '{0}'" -} \ No newline at end of file diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson b/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson deleted file mode 100644 index 6aeb1df..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/it-IT/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "È richiesta la versione dell'agente {0} o superiore.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Percorso del contenitore non trovato: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "Credenziali dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EndpointUrl0": "URL dell'endpoint servizio '{0}'", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "L'enumerazione delle sottodirectory per il percorso '{0}' non è riuscita", - "loc.messages.PSLIB_FileNotFound0": "File non trovato: '{0}'", - "loc.messages.PSLIB_Input0": "Input di '{0}'", - "loc.messages.PSLIB_InvalidPattern0": "Criterio non valido: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Percorso foglia non trovato: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "La normalizzazione o l'espansione del percorso non è riuscita. Il sottosistema Kernel32 non ha restituito la lunghezza del percorso per '{0}'", - "loc.messages.PSLIB_PathNotFound0": "Percorso non trovato: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Il processo '{0}' è stato terminato ed è stato restituito il codice '{1}'.", - "loc.messages.PSLIB_Required0": "Obbligatorio: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Errore nel formato della stringa.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "La chiave della risorsa stringa non è stata trovata: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "Variabile dell'attività '{0}'" -} \ No newline at end of file diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson b/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson deleted file mode 100644 index 6b07ab6..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/ja-jp/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "バージョン {0} 以降のエージェントが必要です。", - "loc.messages.PSLIB_ContainerPathNotFound0": "コンテナーのパスが見つかりません: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' サービス エンドポイントの資格情報", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' サービス エンドポイントの URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "パス '{0}' のサブディレクトリを列挙できませんでした", - "loc.messages.PSLIB_FileNotFound0": "ファイルが見つかりません: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 入力", - "loc.messages.PSLIB_InvalidPattern0": "使用できないパターンです: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "リーフ パスが見つかりません: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "パスの正規化/展開に失敗しました。Kernel32 サブシステムからパス '{0}' の長さが返されませんでした", - "loc.messages.PSLIB_PathNotFound0": "パスが見つかりません: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "プロセス '{0}' がコード '{1}' で終了しました。", - "loc.messages.PSLIB_Required0": "必要: {0}", - "loc.messages.PSLIB_StringFormatFailed": "文字列のフォーマットに失敗しました。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "文字列のリソース キーが見つかりません: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' タスク変数" -} \ No newline at end of file diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson b/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson deleted file mode 100644 index e58cbdc..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/ko-KR/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "에이전트 버전 {0} 이상이 필요합니다.", - "loc.messages.PSLIB_ContainerPathNotFound0": "컨테이너 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 서비스 끝점 자격 증명", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 서비스 끝점 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "경로에 대해 하위 디렉터리를 열거하지 못함: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "{0} 파일을 찾을 수 없습니다.", - "loc.messages.PSLIB_Input0": "'{0}' 입력", - "loc.messages.PSLIB_InvalidPattern0": "잘못된 패턴: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "Leaf 경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "경로 정규화/확장에 실패했습니다. 다음에 대해 Kernel32 subsystem에서 경로 길이를 반환하지 않음: '{0}'", - "loc.messages.PSLIB_PathNotFound0": "경로를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "'{1}' 코드로 '{0}' 프로세스가 종료되었습니다.", - "loc.messages.PSLIB_Required0": "필수: {0}", - "loc.messages.PSLIB_StringFormatFailed": "문자열을 포맷하지 못했습니다.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "문자열 리소스 키를 찾을 수 없음: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 작업 변수" -} \ No newline at end of file diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson b/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson deleted file mode 100644 index 38dd69d..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/ru-RU/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "Требуется версия агента {0} или более поздняя.", - "loc.messages.PSLIB_ContainerPathNotFound0": "Путь к контейнеру не найден: \"{0}\".", - "loc.messages.PSLIB_EndpointAuth0": "Учетные данные конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EndpointUrl0": "URL-адрес конечной точки службы \"{0}\"", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Сбой перечисления подкаталогов для пути: \"{0}\".", - "loc.messages.PSLIB_FileNotFound0": "Файл не найден: \"{0}\".", - "loc.messages.PSLIB_Input0": "Входные данные \"{0}\".", - "loc.messages.PSLIB_InvalidPattern0": "Недопустимый шаблон: \"{0}\".", - "loc.messages.PSLIB_LeafPathNotFound0": "Путь к конечному объекту не найден: \"{0}\".", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "Сбой нормализации и расширения пути. Длина пути не была возвращена подсистемой Kernel32 для: \"{0}\".", - "loc.messages.PSLIB_PathNotFound0": "Путь не найден: \"{0}\".", - "loc.messages.PSLIB_Process0ExitedWithCode1": "Процесс \"{0}\" завершил работу с кодом \"{1}\".", - "loc.messages.PSLIB_Required0": "Требуется: {0}", - "loc.messages.PSLIB_StringFormatFailed": "Сбой формата строки.", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "Ключ ресурса строки не найден: \"{0}\".", - "loc.messages.PSLIB_TaskVariable0": "Переменная задачи \"{0}\"" -} \ No newline at end of file diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson b/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson deleted file mode 100644 index 1d333de..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-CN/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理版本 {0} 或更高版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路径:“{0}”", - "loc.messages.PSLIB_EndpointAuth0": "“{0}”服务终结点凭据", - "loc.messages.PSLIB_EndpointUrl0": "“{0}”服务终结点 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "枚举路径的子目录失败:“{0}”", - "loc.messages.PSLIB_FileNotFound0": "找不到文件: {0}。", - "loc.messages.PSLIB_Input0": "“{0}”输入", - "loc.messages.PSLIB_InvalidPattern0": "无效的模式:“{0}”", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到叶路径:“{0}”", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路径规范化/扩展失败。路径长度不是由“{0}”的 Kernel32 子系统返回的", - "loc.messages.PSLIB_PathNotFound0": "找不到路径:“{0}”", - "loc.messages.PSLIB_Process0ExitedWithCode1": "过程“{0}”已退出,代码为“{1}”。", - "loc.messages.PSLIB_Required0": "必需: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字符串格式无效。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字符串资源关键字:“{0}”", - "loc.messages.PSLIB_TaskVariable0": "“{0}”任务变量" -} \ No newline at end of file diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson b/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson deleted file mode 100644 index 512509b..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/Strings/resources.resjson/zh-TW/resources.resjson +++ /dev/null @@ -1,18 +0,0 @@ -{ - "loc.messages.PSLIB_AgentVersion0Required": "需要代理程式版本 {0} 或更新的版本。", - "loc.messages.PSLIB_ContainerPathNotFound0": "找不到容器路徑: '{0}'", - "loc.messages.PSLIB_EndpointAuth0": "'{0}' 服務端點認證", - "loc.messages.PSLIB_EndpointUrl0": "'{0}' 服務端點 URL", - "loc.messages.PSLIB_EnumeratingSubdirectoriesFailedForPath0": "為路徑列舉子目錄失敗: '{0}'", - "loc.messages.PSLIB_FileNotFound0": "找不到檔案: '{0}'", - "loc.messages.PSLIB_Input0": "'{0}' 輸入", - "loc.messages.PSLIB_InvalidPattern0": "模式無效: '{0}'", - "loc.messages.PSLIB_LeafPathNotFound0": "找不到分葉路徑: '{0}'", - "loc.messages.PSLIB_PathLengthNotReturnedFor0": "路徑正規化/展開失敗。Kernel32 子系統未傳回 '{0}' 的路徑長度", - "loc.messages.PSLIB_PathNotFound0": "找不到路徑: '{0}'", - "loc.messages.PSLIB_Process0ExitedWithCode1": "處理序 '{0}' 以返回碼 '{1}' 結束。", - "loc.messages.PSLIB_Required0": "必要項: {0}", - "loc.messages.PSLIB_StringFormatFailed": "字串格式失敗。", - "loc.messages.PSLIB_StringResourceKeyNotFound0": "找不到字串資源索引鍵: '{0}'", - "loc.messages.PSLIB_TaskVariable0": "'{0}' 工作變數" -} \ No newline at end of file diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/ToolFunctions.ps1 b/Tasks/upgrade/ps_modules/VstsTaskSdk/ToolFunctions.ps1 deleted file mode 100644 index 0e82595..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/ToolFunctions.ps1 +++ /dev/null @@ -1,123 +0,0 @@ -<# -.SYNOPSIS -Asserts the agent version is at least the specified minimum. - -.PARAMETER Minimum -Minimum version - must be 2.104.1 or higher. -#> -function Assert-Agent { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [version]$Minimum) - - if (([version]'2.104.1').CompareTo($Minimum) -ge 1) { - Write-Error "Assert-Agent requires the parameter to be 2.104.1 or higher." - return - } - - $agent = Get-TaskVariable -Name 'agent.version' - if (!$agent -or $Minimum.CompareTo([version]$agent) -ge 1) { - Write-Error (Get-LocString -Key 'PSLIB_AgentVersion0Required' -ArgumentList $Minimum) - } -} - -<# -.SYNOPSIS -Asserts that a path exists. Throws if the path does not exist. - -.PARAMETER PassThru -True to return the path. -#> -function Assert-Path { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$LiteralPath, - [Microsoft.PowerShell.Commands.TestPathType]$PathType = [Microsoft.PowerShell.Commands.TestPathType]::Any, - [switch]$PassThru) - - if ($PathType -eq [Microsoft.PowerShell.Commands.TestPathType]::Any) { - Write-Verbose "Asserting path exists: '$LiteralPath'" - } else { - Write-Verbose "Asserting $("$PathType".ToLowerInvariant()) path exists: '$LiteralPath'" - } - - if (Test-Path -LiteralPath $LiteralPath -PathType $PathType) { - if ($PassThru) { - return $LiteralPath - } - - return - } - - $resourceKey = switch ($PathType) { - ([Microsoft.PowerShell.Commands.TestPathType]::Container) { "PSLIB_ContainerPathNotFound0" ; break } - ([Microsoft.PowerShell.Commands.TestPathType]::Leaf) { "PSLIB_LeafPathNotFound0" ; break } - default { "PSLIB_PathNotFound0" } - } - - throw (Get-LocString -Key $resourceKey -ArgumentList $LiteralPath) -} - -<# -.SYNOPSIS -Executes an external program. - -.DESCRIPTION -Executes an external program and waits for the process to exit. - -After calling this command, the exit code of the process can be retrieved from the variable $LASTEXITCODE. - -.PARAMETER Encoding -This parameter not required for most scenarios. Indicates how to interpret the encoding from the external program. An example use case would be if an external program outputs UTF-16 XML and the output needs to be parsed. - -.PARAMETER RequireExitCodeZero -Indicates whether to write an error to the error pipeline if the exit code is not zero. -#> -function Invoke-Tool { # TODO: RENAME TO INVOKE-PROCESS? - [CmdletBinding()] - param( - [ValidatePattern('^[^\r\n]*$')] - [Parameter(Mandatory = $true)] - [string]$FileName, - [ValidatePattern('^[^\r\n]*$')] - [Parameter()] - [string]$Arguments, - [string]$WorkingDirectory, - [System.Text.Encoding]$Encoding, - [switch]$RequireExitCodeZero) - - Trace-EnteringInvocation $MyInvocation - $isPushed = $false - $originalEncoding = $null - try { - if ($Encoding) { - $originalEncoding = [System.Console]::OutputEncoding - [System.Console]::OutputEncoding = $Encoding - } - - if ($WorkingDirectory) { - Push-Location -LiteralPath $WorkingDirectory -ErrorAction Stop - $isPushed = $true - } - - $FileName = $FileName.Replace('"', '').Replace("'", "''") - Write-Host "##[command]""$FileName"" $Arguments" - Invoke-Expression "& '$FileName' --% $Arguments" - Write-Verbose "Exit code: $LASTEXITCODE" - if ($RequireExitCodeZero -and $LASTEXITCODE -ne 0) { - Write-Error (Get-LocString -Key PSLIB_Process0ExitedWithCode1 -ArgumentList ([System.IO.Path]::GetFileName($FileName)), $LASTEXITCODE) - } - } finally { - if ($originalEncoding) { - [System.Console]::OutputEncoding = $originalEncoding - } - - if ($isPushed) { - Pop-Location - } - - Trace-LeavingInvocation $MyInvocation - } -} diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/TraceFunctions.ps1 b/Tasks/upgrade/ps_modules/VstsTaskSdk/TraceFunctions.ps1 deleted file mode 100644 index b8e084b..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/TraceFunctions.ps1 +++ /dev/null @@ -1,139 +0,0 @@ -<# -.SYNOPSIS -Writes verbose information about the invocation being entered. - -.DESCRIPTION -Used to trace verbose information when entering a function/script. Writes an entering message followed by a short description of the invocation. Additionally each bound parameter and unbound argument is also traced. - -.PARAMETER Parameter -Wildcard pattern to control which bound parameters are traced. -#> -function Trace-EnteringInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo, - [string[]]$Parameter = '*') - - Write-Verbose "Entering $(Get-InvocationDescription $InvocationInfo)." - $OFS = ", " - if ($InvocationInfo.BoundParameters.Count -and $Parameter.Count) { - if ($Parameter.Count -eq 1 -and $Parameter[0] -eq '*') { - # Trace all parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - } - } else { - # Trace matching parameters. - foreach ($key in $InvocationInfo.BoundParameters.Keys) { - foreach ($p in $Parameter) { - if ($key -like $p) { - Write-Verbose " $($key): '$($InvocationInfo.BoundParameters[$key])'" - break - } - } - } - } - } - - # Trace all unbound arguments. - if (@($InvocationInfo.UnboundArguments).Count) { - for ($i = 0 ; $i -lt $InvocationInfo.UnboundArguments.Count ; $i++) { - Write-Verbose " args[$i]: '$($InvocationInfo.UnboundArguments[$i])'" - } - } -} - -<# -.SYNOPSIS -Writes verbose information about the invocation being left. - -.DESCRIPTION -Used to trace verbose information when leaving a function/script. Writes a leaving message followed by a short description of the invocation. -#> -function Trace-LeavingInvocation { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.Management.Automation.InvocationInfo]$InvocationInfo) - - Write-Verbose "Leaving $(Get-InvocationDescription $InvocationInfo)." -} - -<# -.SYNOPSIS -Writes verbose information about paths. - -.DESCRIPTION -Writes verbose information about the paths. The paths are sorted and a the common root is written only once, followed by each relative path. - -.PARAMETER PassThru -Indicates whether to return the sorted paths. -#> -function Trace-Path { - [CmdletBinding()] - param( - [string[]]$Path, - [switch]$PassThru) - - if ($Path.Count -eq 0) { - Write-Verbose "No paths." - if ($PassThru) { - $Path - } - } elseif ($Path.Count -eq 1) { - Write-Verbose "Path: $($Path[0])" - if ($PassThru) { - $Path - } - } else { - # Find the greatest common root. - $sorted = $Path | Sort-Object - $firstPath = $sorted[0].ToCharArray() - $lastPath = $sorted[-1].ToCharArray() - $commonEndIndex = 0 - $j = if ($firstPath.Length -lt $lastPath.Length) { $firstPath.Length } else { $lastPath.Length } - for ($i = 0 ; $i -lt $j ; $i++) { - if ($firstPath[$i] -eq $lastPath[$i]) { - if ($firstPath[$i] -eq '\') { - $commonEndIndex = $i - } - } else { - break - } - } - - if ($commonEndIndex -eq 0) { - # No common root. - Write-Verbose "Paths:" - foreach ($p in $sorted) { - Write-Verbose " $p" - } - } else { - Write-Verbose "Paths: $($Path[0].Substring(0, $commonEndIndex + 1))" - foreach ($p in $sorted) { - Write-Verbose " $($p.Substring($commonEndIndex + 1))" - } - } - - if ($PassThru) { - $sorted - } - } -} - -######################################## -# Private functions. -######################################## -function Get-InvocationDescription { - [CmdletBinding()] - param([System.Management.Automation.InvocationInfo]$InvocationInfo) - - if ($InvocationInfo.MyCommand.Path) { - $InvocationInfo.MyCommand.Path - } elseif ($InvocationInfo.MyCommand.Name) { - $InvocationInfo.MyCommand.Name - } else { - $InvocationInfo.MyCommand.CommandType - } -} diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/VstsTaskSdk.dll b/Tasks/upgrade/ps_modules/VstsTaskSdk/VstsTaskSdk.dll deleted file mode 100644 index 54938ab05180ddaf77cf067f2501a1f97ee7e5cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25408 z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ar4mto>Tbqa^N9R^ J$g$t$@(XnB12_Nx diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 b/Tasks/upgrade/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 deleted file mode 100644 index a1bf2c6..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/VstsTaskSdk.psm1 +++ /dev/null @@ -1,168 +0,0 @@ -[CmdletBinding()] -param( - [ValidateNotNull()] - [Parameter()] - [hashtable]$ModuleParameters = @{ }) - -if ($host.Name -ne 'ConsoleHost') { - Write-Warning "VstsTaskSdk is designed for use with powershell.exe (ConsoleHost). Output may be different when used with other hosts." -} - -# Private module variables. -[bool]$script:nonInteractive = "$($ModuleParameters['NonInteractive'])" -eq 'true' -Write-Verbose "NonInteractive: $script:nonInteractive" - -# VstsTaskSdk.dll contains the TerminationException and NativeMethods for handle long path -# We used to do inline C# in this powershell module -# However when csc compile the inline C#, it will hit process env block size limit since it's not use unicode to encode env -# To solve the env block size problem, we choose to put all inline C# into an assembly VstsTaskSdk.dll, signing it, package with the PS modules. -Write-Verbose "Loading compiled helper $PSScriptRoot\VstsTaskSdk.dll." -Add-Type -LiteralPath $PSScriptRoot\VstsTaskSdk.dll - -# Import/export functions. -. "$PSScriptRoot\FindFunctions.ps1" -. "$PSScriptRoot\InputFunctions.ps1" -. "$PSScriptRoot\LegacyFindFunctions.ps1" -. "$PSScriptRoot\LocalizationFunctions.ps1" -. "$PSScriptRoot\LoggingCommandFunctions.ps1" -. "$PSScriptRoot\LongPathFunctions.ps1" -. "$PSScriptRoot\ServerOMFunctions.ps1" -. "$PSScriptRoot\ToolFunctions.ps1" -. "$PSScriptRoot\TraceFunctions.ps1" -. "$PSScriptRoot\OutFunctions.ps1" # Load the out functions after all of the other functions are loaded. -Export-ModuleMember -Function @( - # Find functions. - 'Find-Match' - 'New-FindOptions' - 'New-MatchOptions' - 'Select-Match' - # Input functions. - 'Get-Endpoint' - 'Get-SecureFileTicket' - 'Get-SecureFileName' - 'Get-Input' - 'Get-TaskVariable' - 'Get-TaskVariableInfo' - 'Set-TaskVariable' - # Legacy find functions. - 'Find-Files' - # Localization functions. - 'Get-LocString' - 'Import-LocStrings' - # Logging command functions. - 'Write-AddAttachment' - 'Write-AddBuildTag' - 'Write-AssociateArtifact' - 'Write-LogDetail' - 'Write-PrependPath' - 'Write-SetEndpoint' - 'Write-SetProgress' - 'Write-SetResult' - 'Write-SetSecret' - 'Write-SetVariable' - 'Write-TaskDebug' - 'Write-TaskError' - 'Write-TaskVerbose' - 'Write-TaskWarning' - 'Write-UpdateBuildNumber' - 'Write-UpdateReleaseName' - 'Write-UploadArtifact' - 'Write-UploadBuildLog' - 'Write-UploadFile' - 'Write-UploadSummary' - # Out functions. - 'Out-Default' - # Server OM functions. - 'Get-AssemblyReference' - 'Get-TfsClientCredentials' - 'Get-TfsService' - 'Get-VssCredentials' - 'Get-VssHttpClient' - # Tool functions. - 'Assert-Agent' - 'Assert-Path' - 'Invoke-Tool' - # Trace functions. - 'Trace-EnteringInvocation' - 'Trace-LeavingInvocation' - 'Trace-Path' - # Proxy functions - 'Get-WebProxy' - # Client cert functions - 'Get-ClientCertificate' - ) - -# Override Out-Default globally. -$null = New-Item -Force -Path "function:\global:Out-Default" -Value (Get-Command -CommandType Function -Name Out-Default -ListImported) -New-Alias -Name Out-Default -Value "global:Out-Default" -Scope global - -# Perform some initialization in a script block to enable merging the pipelines. -$scriptText = @" -# Load the SDK resource strings. -Import-LocStrings "$PSScriptRoot\lib.json" - -# Load the module that contains ConvertTo-SecureString. -if (!(Get-Module -Name Microsoft.PowerShell.Security)) { - Write-Verbose "Importing the module 'Microsoft.PowerShell.Security'." - Import-Module -Name Microsoft.PowerShell.Security 2>&1 | - ForEach-Object { - if (`$_ -is [System.Management.Automation.ErrorRecord]) { - Write-Verbose `$_.Exception.Message - } else { - ,`$_ - } - } -} -"@ -. ([scriptblock]::Create($scriptText)) 2>&1 3>&1 4>&1 5>&1 | Out-Default - -# Create Invoke-VstsTaskScript in a special way so it is not bound to the module. -# Otherwise calling the task script block would run within the module context. -# -# An alternative way to solve the problem is to close the script block (i.e. closure). -# However, that introduces a different problem. Closed script blocks are created within -# a dynamic module. Each module gets it's own session state separate from the global -# session state. When running in a regular script context, Import-Module calls import -# the target module into the global session state. When running in a module context, -# Import-Module calls import the target module into the caller module's session state. -# -# The goal of a task may include executing ad-hoc scripts. Therefore, task scripts -# should run in regular script context. The end user specifying an ad-hoc script expects -# the module import rules to be consistent with the default behavior (i.e. imported -# into the global session state). -$null = New-Item -Force -Path "function:\global:Invoke-VstsTaskScript" -Value ([scriptblock]::Create(@' - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [scriptblock]$ScriptBlock) - - try { - $global:ErrorActionPreference = 'Stop' - - # Initialize the environment. - $vstsModule = Get-Module -Name VstsTaskSdk - Write-Verbose "$($vstsModule.Name) $($vstsModule.Version) commit $($vstsModule.PrivateData.PSData.CommitHash)" 4>&1 | Out-Default - & $vstsModule Initialize-Inputs 4>&1 | Out-Default - - # Remove the local variable before calling the user's script. - Remove-Variable -Name vstsModule - - # Call the user's script. - $ScriptBlock | - ForEach-Object { - # Remove the scriptblock variable before calling it. - Remove-Variable -Name ScriptBlock - & $_ 2>&1 3>&1 4>&1 5>&1 | Out-Default - } - } catch [VstsTaskSdk.TerminationException] { - # Special internal exception type to control the flow. Not currently intended - # for public usage and subject to change. - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Task script terminated." 4>&1 | Out-Default - } catch { - $global:__vstsNoOverrideVerbose = '' - Write-Verbose "Caught exception from task script." 4>&1 | Out-Default - $_ | Out-Default - Write-Host "##vso[task.complete result=Failed]" - } -'@)) diff --git a/Tasks/upgrade/ps_modules/VstsTaskSdk/lib.json b/Tasks/upgrade/ps_modules/VstsTaskSdk/lib.json deleted file mode 100644 index ecdc9d0..0000000 --- a/Tasks/upgrade/ps_modules/VstsTaskSdk/lib.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "messages": { - "PSLIB_AgentVersion0Required": "Agent version {0} or higher is required.", - "PSLIB_ContainerPathNotFound0": "Container path not found: '{0}'", - "PSLIB_EndpointAuth0": "'{0}' service endpoint credentials", - "PSLIB_EndpointUrl0": "'{0}' service endpoint URL", - "PSLIB_EnumeratingSubdirectoriesFailedForPath0": "Enumerating subdirectories failed for path: '{0}'", - "PSLIB_FileNotFound0": "File not found: '{0}'", - "PSLIB_Input0": "'{0}' input", - "PSLIB_InvalidPattern0": "Invalid pattern: '{0}'", - "PSLIB_LeafPathNotFound0": "Leaf path not found: '{0}'", - "PSLIB_PathLengthNotReturnedFor0": "Path normalization/expansion failed. The path length was not returned by the Kernel32 subsystem for: '{0}'", - "PSLIB_PathNotFound0": "Path not found: '{0}'", - "PSLIB_Process0ExitedWithCode1": "Process '{0}' exited with code '{1}'.", - "PSLIB_Required0": "Required: {0}", - "PSLIB_StringFormatFailed": "String format failed.", - "PSLIB_StringResourceKeyNotFound0": "String resource key not found: '{0}'", - "PSLIB_TaskVariable0": "'{0}' task variable" - } -} diff --git a/Tasks/upgrade/task.json b/Tasks/upgrade/task.json deleted file mode 100644 index 2377029..0000000 --- a/Tasks/upgrade/task.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "id": "d9331f3c-0bb3-4987-8eee-e2296f172818", - "name": "choco-upgrade", - "friendlyName": "Chocolatey - Upgrade", - "description": "Runs Chocolatey Upgrade with specified parameters", - "author": "gep13", - "helpMarkDown": "", - "category": "Build", - "visibility": [ - "Build", - "Release" - ], - "demands": [], - "version": { - "Major": "0", - "Minor": "1", - "Patch": "0" - }, - "minimumAgentVersion": "1.83.0", - "groups": [ - { - "name": "advanced", - "displayName": "Advanced options", - "isExpanded": false - } - ], - "instanceNameFormat": "Chocolatey Upgrade", - "inputs": [ - { - "name": "packageId", - "type": "string", - "label": "The id of the package(s) that are to be installed.", - "defaultValue": "", - "required": true, - "helpMarkDown": "For example, windirstat." - }, - { - "name": "packageVersion", - "type": "string", - "label": "The version of the package that is to be installed.", - "defaultValue": "", - "required": false, - "helpMarkDown": "For example, 1.2.3." - }, - { - "name": "pre", - "type": "boolean", - "label": "Prerelease.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Include Prereleases?" - }, - { - "name": "source", - "type": "string", - "label": "The source to find the package(s) to install.", - "defaultValue": "", - "required": false, - "helpMarkDown": "Special sources include: ruby, webpi, cygwin, windowsfeatures, and python. To specify more than one source, pass it with a semi-colon separating the values (e.g. \"'source1;source2'\"). Defaults to default feeds." - }, - { - "name": "except", - "type": "string", - "label": "Except.", - "defaultValue": "", - "required": false, - "helpMarkDown": "A comma-separated list of package names that should not be upgraded when upgrading 'all'.", - "groupname": "advanced" - }, - { - "name": "installargs", - "type": "string", - "label": "Install Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Install Arguments to pass to the native installer in the package.", - "groupname": "advanced" - }, - { - "name": "params", - "type": "string", - "label": "Package Parameters", - "defaultValue": "", - "required": false, - "helpMarkDown": "Parameters to pass to the package.", - "groupname": "advanced" - }, - { - "name": "force", - "type": "boolean", - "label": "Force the behavior.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Do not use force during normal operation - it subverts some of the smart behavior for commands.", - "groupname": "advanced" - }, - { - "name": "x86", - "type": "boolean", - "label": "Force X86.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Force x86 (32bit) installation on 64 bit systems.", - "groupname": "advanced" - }, - { - "name": "override", - "type": "boolean", - "label": "Override Arguments", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Should install arguments be used exclusively without appending to current package passed arguments?", - "groupname": "advanced" - }, - { - "name": "debug", - "type": "boolean", - "label": "Show debug messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "", - "groupname": "advanced" - }, - { - "name": "verbose", - "type": "boolean", - "label": "Show verbose messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very verbose messaging, avoid using under normal circumstances.", - "groupname": "advanced" - }, - { - "name": "trace", - "type": "boolean", - "label": "Show trace messaging.", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Very, very verbose trace messaging. Avoid except when needing super low-level .NET Framework debugging.", - "groupname": "advanced" - }, - { - "name": "extraArguments", - "type": "string", - "label": "Extra Arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional Chocolatey Arguments that are not catered for above.", - "groupname": "advanced" - } - ], - "execution": { - "PowerShell3": { - "target": "$(currentDirectory)\\upgrade.ps1", - "argumentFormat": "", - "workingDirectory": "$(currentDirectory)" - } - } -} diff --git a/Tasks/upgrade/upgrade.ps1 b/Tasks/upgrade/upgrade.ps1 deleted file mode 100644 index 684aaed..0000000 --- a/Tasks/upgrade/upgrade.ps1 +++ /dev/null @@ -1,119 +0,0 @@ -[CmdletBinding()] -param() - -Trace-VstsEnteringInvocation $MyInvocation - -try { - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "Machine") - if(-not (Test-Path $chocoInstallLocation)) { - Write-Output "Environment variable 'ChocolateyInstall' was not found in the system variables. Attempting to find it in the user variables..." - $chocoInstallLocation = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "User") - } - - $chocoExe = "$chocoInstallLocation\choco.exe" - - if (-not (Test-Path $chocoExe)) { - throw "Chocolatey was not found." - } - - [string]$packageId = Get-VstsInput -Name 'packageId' -Require - [string]$packageVersion = Get-VstsInput -Name 'packageVersion' - [bool]$pre = Get-VstsInput -Name 'pre' -AsBool -Default $false - [string]$source = Get-VstsInput -Name 'source' - [string]$except = Get-VstsInput -Name 'except' - [bool]$force = Get-VstsInput -Name 'force' -AsBool -Default $false - [bool]$x86 = Get-VstsInput -Name 'x86' -AsBool -Default $false - [string]$installArgs = Get-VstsInput -Name 'installargs' - [bool]$override = Get-VstsInput -Name 'override' -AsBool -Default $false - [string]$params = Get-VstsInput -Name 'params' - [string]$extraArguments = Get-VstsInput -Name 'extraArguments' - [bool]$debug = Get-VstsInput -Name 'debug' -AsBool -Default $false - [bool]$verbose = Get-VstsInput -Name 'verbose' -AsBool -Default $false - [bool]$trace = Get-VstsInput -Name 'trace' -AsBool -Default $false - - $chocolateyVersion = & $chocoExe --version - Write-Output "Running Chocolatey Version: $chocolateyVersion" - - $chocolateyArguments = @() - if([System.Version]::Parse($chocolateyVersion) -ge [System.Version]::Parse("0.9.8.33")) { - Write-Output "Adding -y to arguments" - $chocolateyArguments += @("-y", "") - } - - if([System.Version]::Parse($chocolateyVersion) -ge [System.Version]::Parse("0.10.4")) { - Write-Output "Adding --no-progress to arguments" - $chocolateyArguments += @("--no-progress", "") - } - - if($packageVersion) { - Write-Output "Adding --version to arguments" - $chocolateyArguments += @("--version", $packageVersion) - } - - if($pre) { - Write-Output "Adding --pre to arguments" - $chocolateyArguments += @("--pre", "") - } - - if($source) { - Write-Output "Adding --source to arguments" - $chocolateyArguments += @("--version", $source) - } - - if($except) { - Write-Output "Adding --except to arguments" - $chocolateyArguments += @("--except", $except) - } - - if($force) { - Write-Output "Adding --force to arguments" - $chocolateyArguments += @("--force", "") - } - - if($x86) { - Write-Output "Adding --x86 to arguments" - $chocolateyArguments += @("--x86", "") - } - - if($installArgs) { - Write-Output "Adding --install-arguments to arguments" - $chocolateyArguments += @("--install-arguments", $installArgs) - } - - if($override) { - Write-Output "Adding --override-arguments to arguments" - $chocolateyArguments += @("--override-arguments", "") - } - - if($params) { - Write-Output "Adding --package-parameters to arguments" - $chocolateyArguments += @("--package-parameters", $params) - } - - if($extraArguments) { - Write-Output "Adding extra arguments" - $chocolateyArguments += @($extraArguments, "") - } - - if($debug) { - Write-Output "Adding --debug to arguments" - $chocolateyArguments += @("--debug", "") - } - - if($verbose) { - Write-Output "Adding --verbose to arguments" - $chocolateyArguments += @("--verbose", "") - } - - if($trace) { - Write-Output "Adding --trace to arguments" - $chocolateyArguments += @("--trace", "") - } - - & $chocoExe upgrade $packageId $($chocolateyArguments) -} catch { - Write-VstsTaskError $_.Exception.Message - throw -} finally { - Trace-VstsLeavingInvocation $MyInvocation -} diff --git a/build.cake b/build.cake index 2234372..7443242 100644 --- a/build.cake +++ b/build.cake @@ -87,7 +87,7 @@ Task("Update-Json-Versions") { "version", parameters.Version.SemVersion } }); - var taskJson = "Tasks/pack/task.json"; + var taskJson = "Tasks/chocolatey/task.json"; Information("Updating {0} version -> {1}", taskJson, parameters.Version.SemVersion); TransformConfig(taskJson, taskJson, new TransformationCollection { diff --git a/vss-extension.json b/vss-extension.json index 3b62b76..ecaf340 100644 --- a/vss-extension.json +++ b/vss-extension.json @@ -44,123 +44,19 @@ }, "contributions": [ { - "id": "chocolatey-azuredevops-apikey", + "id": "chocolatey-azuredevops", "targets": [ "ms.vss-distributed-task.tasks" ], "type": "ms.vss-distributed-task.task", "properties": { - "name": "Tasks/apikey" - } - }, - { - "id": "chocolatey-azuredevops-config", - "targets": [ - "ms.vss-distributed-task.tasks" - ], - "type": "ms.vss-distributed-task.task", - "properties": { - "name": "Tasks/config" - } - }, - { - "id": "chocolatey-azuredevops-custom", - "targets": [ - "ms.vss-distributed-task.tasks" - ], - "type": "ms.vss-distributed-task.task", - "properties": { - "name": "Tasks/custom" - } - }, - { - "id": "chocolatey-azuredevops-feature", - "targets": [ - "ms.vss-distributed-task.tasks" - ], - "type": "ms.vss-distributed-task.task", - "properties": { - "name": "Tasks/feature" - } - }, - { - "id": "chocolatey-azuredevops-install", - "targets": [ - "ms.vss-distributed-task.tasks" - ], - "type": "ms.vss-distributed-task.task", - "properties": { - "name": "Tasks/install" - } - }, - { - "id": "chocolatey-azuredevops-pack", - "targets": [ - "ms.vss-distributed-task.tasks" - ], - "type": "ms.vss-distributed-task.task", - "properties": { - "name": "Tasks/pack" - } - }, - { - "id": "chocolatey-azuredevops-push", - "targets": [ - "ms.vss-distributed-task.tasks" - ], - "type": "ms.vss-distributed-task.task", - "properties": { - "name": "Tasks/push" - } - }, - { - "id": "chocolatey-azuredevops-source", - "targets": [ - "ms.vss-distributed-task.tasks" - ], - "type": "ms.vss-distributed-task.task", - "properties": { - "name": "Tasks/source" - } - }, - { - "id": "chocolatey-azuredevops-upgrade", - "targets": [ - "ms.vss-distributed-task.tasks" - ], - "type": "ms.vss-distributed-task.task", - "properties": { - "name": "Tasks/upgrade" + "name": "Tasks/chocolatey" } } ], "files": [ { - "path": "Tasks/apikey" - }, - { - "path": "Tasks/config" - }, - { - "path": "Tasks/custom" - }, - { - "path": "Tasks/feature" - }, - { - "path": "Tasks/install" - }, - { - "path": "Tasks/pack" - }, - { - "path": "Tasks/push" - }, - { - "path": "Tasks/source" - }, - { - "path": "Tasks/upgrade" + "path": "Tasks/chocolatey" } ] -} +} \ No newline at end of file