Removed depreciated V0 and V1 tasks #695 (#1064)

This commit is contained in:
Bernie White 2024-09-06 20:48:06 +10:00 коммит произвёл GitHub
Родитель 63257f1997
Коммит dc43fcf37d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
20 изменённых файлов: 191 добавлений и 1593 удалений

2
.github/workflows/build.yaml поставляемый
Просмотреть файл

@ -30,7 +30,7 @@ jobs:
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 22
- name: Install dependencies
shell: pwsh

Просмотреть файл

@ -18,6 +18,8 @@ See [upgrade notes][1] for helpful information when upgrading from previous vers
What's changed since v2.9.0:
- Engineering:
- **Breaking changes**: Removed depreciated V0 and V1 tasks by @BernieWhite.
[#695](https://github.com/microsoft/PSRule-pipelines/issues/695)
- Bump VstsTaskSdk to v0.20.0.
[#961](https://github.com/microsoft/PSRule-pipelines/pull/961)
- Bump azure-pipelines-task-lib to v4.17.0.

Просмотреть файл

@ -4,51 +4,7 @@
// Build script for extension
import * as esbuild from 'esbuild'
await esbuild.build({
entryPoints: ['./tasks/ps-rule-assertV0/powershell.ts'],
bundle: true,
outfile: 'out/dist/ps-rule-assert/ps-rule-assertV0/powershell.js',
platform: 'node',
format: 'cjs',
minify: true,
target: 'node6',
external: ['shelljs'],
})
await esbuild.build({
entryPoints: ['./tasks/ps-rule-installV0/powershell.ts'],
bundle: true,
outfile: 'out/dist/ps-rule-install/ps-rule-installV0/powershell.js',
platform: 'node',
format: 'cjs',
minify: true,
target: 'node6',
external: ['shelljs'],
})
await esbuild.build({
entryPoints: ['./tasks/ps-rule-assertV1/powershell.ts'],
bundle: true,
outfile: 'out/dist/ps-rule-assert/ps-rule-assertV1/powershell.js',
platform: 'node',
format: 'cjs',
minify: true,
target: 'node10',
external: ['shelljs'],
})
await esbuild.build({
entryPoints: ['./tasks/ps-rule-installV1/powershell.ts'],
bundle: true,
outfile: 'out/dist/ps-rule-install/ps-rule-installV1/powershell.js',
platform: 'node',
format: 'cjs',
minify: false,
target: 'node10',
external: ['shelljs'],
})
import {taskExtrasPlugin} from './plugins/extras.js'
await esbuild.build({
entryPoints: ['./tasks/ps-rule-assertV2/powershell.ts'],
@ -59,6 +15,9 @@ await esbuild.build({
minify: true,
target: 'node10',
external: ['shelljs'],
plugins: [taskExtrasPlugin],
sourceRoot: './tasks/ps-rule-assertV2',
outbase: 'out/dist/ps-rule-assert/ps-rule-assertV2',
})
await esbuild.build({
@ -70,4 +29,7 @@ await esbuild.build({
minify: true,
target: 'node10',
external: ['shelljs'],
plugins: [taskExtrasPlugin],
sourceRoot: './tasks/ps-rule-installV2',
outbase: 'out/dist/ps-rule-install/ps-rule-installV2',
})

Просмотреть файл

@ -70,46 +70,6 @@ module.exports = (env) => {
path: "out/dist/ps-rule-install",
packagePath: "/ps-rule-install"
},
{
path: "out/dist/ps_modules/PSRule/1.11.1",
packagePath: "/ps-rule-assert/ps-rule-assertV0/ps_modules/PSRule/1.11.1"
},
{
path: "out/dist/ps_modules/VstsTaskSdk/0.20.0",
packagePath: "/ps-rule-assert/ps-rule-assertV0/ps_modules/VstsTaskSdk"
},
{
path: "out/dist/ps_modules/PowerShellGet",
packagePath: "/ps-rule-install/ps-rule-installV0/ps_modules/PowerShellGet"
},
{
path: "out/dist/ps_modules/PackageManagement",
packagePath: "/ps-rule-install/ps-rule-installV0/ps_modules/PackageManagement"
},
{
path: "out/dist/ps_modules/VstsTaskSdk/0.20.0",
packagePath: "/ps-rule-install/ps-rule-installV0/ps_modules/VstsTaskSdk"
},
{
path: "out/dist/ps_modules/PSRule/1.11.1",
packagePath: "/ps-rule-assert/ps-rule-assertV1/ps_modules/PSRule/1.11.1"
},
{
path: "out/dist/ps_modules/VstsTaskSdk/0.20.0",
packagePath: "/ps-rule-assert/ps-rule-assertV1/ps_modules/VstsTaskSdk"
},
{
path: "out/dist/ps_modules/PowerShellGet",
packagePath: "/ps-rule-install/ps-rule-installV1/ps_modules/PowerShellGet"
},
{
path: "out/dist/ps_modules/PackageManagement",
packagePath: "/ps-rule-install/ps-rule-installV1/ps_modules/PackageManagement"
},
{
path: "out/dist/ps_modules/VstsTaskSdk/0.20.0",
packagePath: "/ps-rule-install/ps-rule-installV1/ps_modules/VstsTaskSdk"
},
{
path: "out/dist/modules.json",
packagePath: "/ps-rule-assert/ps-rule-assertV2/modules.json"

181
package-lock.json сгенерированный
Просмотреть файл

@ -10,9 +10,8 @@
"azure-pipelines-task-lib": "^4.17.0"
},
"devDependencies": {
"@types/mocha": "^10.0.6",
"@types/node": "^18.19.42",
"@types/q": "^1.5.8",
"@types/mocha": "^10.0.7",
"@types/node": "^20.16.5",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"@typescript-eslint/parser": "^8.4.0",
"esbuild": "^0.23.1",
@ -39,6 +38,7 @@
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"aix"
@ -55,6 +55,7 @@
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
@ -71,6 +72,7 @@
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
@ -87,6 +89,7 @@
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
@ -103,6 +106,7 @@
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
@ -119,6 +123,7 @@
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
@ -135,6 +140,7 @@
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
@ -151,6 +157,7 @@
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
@ -167,6 +174,7 @@
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
@ -183,6 +191,7 @@
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
@ -199,6 +208,7 @@
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
@ -215,6 +225,7 @@
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
@ -231,6 +242,7 @@
"mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
@ -247,6 +259,7 @@
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
@ -263,6 +276,7 @@
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
@ -279,6 +293,7 @@
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
@ -295,6 +310,7 @@
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
@ -311,6 +327,7 @@
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
@ -327,6 +344,7 @@
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
@ -343,6 +361,7 @@
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
@ -359,6 +378,7 @@
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"sunos"
@ -375,6 +395,7 @@
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
@ -391,6 +412,7 @@
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
@ -407,6 +429,7 @@
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
@ -436,6 +459,7 @@
"resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz",
"integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^12.0.0 || ^14.0.0 || >=16.0.0"
}
@ -445,6 +469,7 @@
"resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.18.0.tgz",
"integrity": "sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@eslint/object-schema": "^2.1.4",
"debug": "^4.3.1",
@ -459,6 +484,7 @@
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -469,6 +495,7 @@
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^1.1.7"
},
@ -481,6 +508,7 @@
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz",
"integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
@ -504,6 +532,7 @@
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -514,6 +543,7 @@
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^1.1.7"
},
@ -526,6 +556,7 @@
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.9.1.tgz",
"integrity": "sha512-xIDQRsfg5hNBqHz04H1R3scSVwmI+KUbqjsQKHKQ1DAUSaUjYPReZZmS/5PNiKu1fUvzDd6H7DEDKACSEhu+TQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
@ -535,6 +566,7 @@
"resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz",
"integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
@ -558,6 +590,7 @@
"resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.0.tgz",
"integrity": "sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": ">=18.18"
},
@ -612,26 +645,21 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "18.19.42",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.42.tgz",
"integrity": "sha512-d2ZFc/3lnK2YCYhos8iaNIYu9Vfhr92nHiyJHRltXWjXUBjEE+A4I58Tdbnw4VhggSW+2j5y5gTrLs4biNnubg==",
"version": "20.16.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.5.tgz",
"integrity": "sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~5.26.4"
"undici-types": "~6.19.2"
}
},
"node_modules/@types/q": {
"version": "1.5.8",
"resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.8.tgz",
"integrity": "sha512-hroOstUScF6zhIi+5+x0dzqrHA1EJi+Irri6b1fxolMTqqHIV/Cg77EtnQcZqZCu8hR3mX2BzIxN4/GzI68Kfw==",
"dev": true,
"license": "MIT"
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.4.0.tgz",
"integrity": "sha512-rg8LGdv7ri3oAlenMACk9e+AR4wUV0yrrG+XKsGKOK0EVgeEDqurkXMPILG2836fW4ibokTB5v4b6Z9+GYQDEw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.4.0",
@ -665,6 +693,7 @@
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.4.0.tgz",
"integrity": "sha512-NHgWmKSgJk5K9N16GIhQ4jSobBoJwrmURaLErad0qlLjrpP5bECYg+wxVTGlGZmJbU03jj/dfnb6V9bw+5icsA==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"@typescript-eslint/scope-manager": "8.4.0",
"@typescript-eslint/types": "8.4.0",
@ -693,6 +722,7 @@
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.4.0.tgz",
"integrity": "sha512-n2jFxLeY0JmKfUqy3P70rs6vdoPjHK8P/w+zJcV3fk0b0BwRXC/zxRTEnAsgYT7MwdQDt/ZEbtdzdVC+hcpF0A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.4.0",
"@typescript-eslint/visitor-keys": "8.4.0"
@ -710,6 +740,7 @@
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.4.0.tgz",
"integrity": "sha512-pu2PAmNrl9KX6TtirVOrbLPLwDmASpZhK/XU7WvoKoCUkdtq9zF7qQ7gna0GBZFN0hci0vHaSusiL2WpsQk37A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/typescript-estree": "8.4.0",
"@typescript-eslint/utils": "8.4.0",
@ -734,6 +765,7 @@
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.4.0.tgz",
"integrity": "sha512-T1RB3KQdskh9t3v/qv7niK6P8yvn7ja1mS7QK7XfRVL6wtZ8/mFs/FHf4fKvTA0rKnqnYxl/uHFNbnEt0phgbw==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
@ -747,6 +779,7 @@
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.4.0.tgz",
"integrity": "sha512-kJ2OIP4dQw5gdI4uXsaxUZHRwWAGpREJ9Zq6D5L0BweyOrWsL6Sz0YcAZGWhvKnH7fm1J5YFE1JrQL0c9dd53A==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"@typescript-eslint/types": "8.4.0",
"@typescript-eslint/visitor-keys": "8.4.0",
@ -775,6 +808,7 @@
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.4.0.tgz",
"integrity": "sha512-swULW8n1IKLjRAgciCkTCafyTHHfwVQFt8DovmaF69sKbOxTSFMmIZaSHjqO9i/RV0wIblaawhzvtva8Nmm7lQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.4.0",
@ -797,6 +831,7 @@
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.4.0.tgz",
"integrity": "sha512-zTQD6WLNTre1hj5wp09nBIDiOc2U5r/qmzo7wxPn4ZgAjHql09EofqhF9WF+fZHzL5aCyaIpPcT2hyxl73kr9A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.4.0",
"eslint-visitor-keys": "^3.4.3"
@ -814,6 +849,7 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz",
"integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==",
"dev": true,
"license": "MIT",
"bin": {
"acorn": "bin/acorn"
},
@ -826,14 +862,15 @@
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
"integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
"node_modules/adm-zip": {
"version": "0.5.14",
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.14.tgz",
"integrity": "sha512-DnyqqifT4Jrcvb8USYjp6FHtBpEIz1mnXu6pTRHZ0RL69LbQYiO+0lDFg5+OKA7U29oWSs3a/i8fhn8ZcceIWg==",
"version": "0.5.16",
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.16.tgz",
"integrity": "sha512-TGw5yVi4saajsSEgz25grObGHEUaDrniwvA2qwSC060KfqGPdglhvPMA2lPIoxs3PQIItj2iag35fONcQqgUaQ==",
"license": "MIT",
"engines": {
"node": ">=12.0"
@ -856,6 +893,7 @@
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dev": true,
"license": "MIT",
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
@ -964,7 +1002,8 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
"dev": true,
"license": "Python-2.0"
},
"node_modules/array-buffer-byte-length": {
"version": "1.0.1",
@ -1069,6 +1108,7 @@
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-4.17.0.tgz",
"integrity": "sha512-WSopDnRAQAnxqKf7SEVHQS88NjCUNDQAc3qE6xqQWEwo8UeaK3UISxHXrVlaW0frjrgMhs3m+RhZPDlyIGYmhA==",
"license": "MIT",
"dependencies": {
"adm-zip": "^0.5.10",
"minimatch": "3.0.5",
@ -1256,6 +1296,7 @@
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
}
@ -1469,12 +1510,12 @@
}
},
"node_modules/debug": {
"version": "4.3.5",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz",
"integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==",
"version": "4.3.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
"license": "MIT",
"dependencies": {
"ms": "2.1.2"
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
@ -1681,6 +1722,7 @@
"integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"bin": {
"esbuild": "bin/esbuild"
},
@ -1732,6 +1774,7 @@
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.9.1.tgz",
"integrity": "sha512-dHvhrbfr4xFQ9/dq+jcVneZMyRYLjggWjk6RVsIiHsP8Rz6yZ8LvZ//iU4TrZF+SXWG+JkNF2OyiZRvzgRDqMg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.11.0",
@ -1791,6 +1834,7 @@
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.2.tgz",
"integrity": "sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"esrecurse": "^4.3.0",
"estraverse": "^5.2.0"
@ -1831,6 +1875,7 @@
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz",
"integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
@ -1856,6 +1901,7 @@
"resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz",
"integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"acorn": "^8.12.0",
"acorn-jsx": "^5.3.2",
@ -1873,6 +1919,7 @@
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz",
"integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
@ -1881,9 +1928,9 @@
}
},
"node_modules/esquery": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
"integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==",
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz",
"integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
@ -1898,6 +1945,7 @@
"resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
"integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"estraverse": "^5.2.0"
},
@ -1920,6 +1968,7 @@
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=0.10.0"
}
@ -2004,7 +2053,8 @@
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true
"dev": true,
"license": "MIT"
},
"node_modules/fast-glob": {
"version": "3.3.2",
@ -2040,7 +2090,8 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
"dev": true
"dev": true,
"license": "MIT"
},
"node_modules/fast-levenshtein": {
"version": "2.0.6",
@ -2064,6 +2115,7 @@
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
"integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"flat-cache": "^4.0.0"
},
@ -2106,6 +2158,7 @@
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz",
"integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==",
"dev": true,
"license": "MIT",
"dependencies": {
"flatted": "^3.2.9",
"keyv": "^4.5.4"
@ -2118,12 +2171,13 @@
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz",
"integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==",
"dev": true
"dev": true,
"license": "ISC"
},
"node_modules/follow-redirects": {
"version": "1.15.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
"version": "1.15.8",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.8.tgz",
"integrity": "sha512-xgrmBhBToVKay1q2Tao5LI26B83UhrB/vM1avwVSDzt8rx3rO6AizBAaF46EgksTVr+rFTQaqZZ9MVBfUe4nig==",
"funding": [
{
"type": "individual",
@ -2323,6 +2377,7 @@
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
},
@ -2496,9 +2551,9 @@
"license": "BSD-3-Clause"
},
"node_modules/ignore": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz",
"integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==",
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
"integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
"dev": true,
"license": "MIT",
"engines": {
@ -2517,6 +2572,7 @@
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
"integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
"dev": true,
"license": "MIT",
"dependencies": {
"parent-module": "^1.0.0",
"resolve-from": "^4.0.0"
@ -2640,9 +2696,9 @@
}
},
"node_modules/is-core-module": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz",
"integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==",
"version": "2.15.1",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz",
"integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==",
"license": "MIT",
"dependencies": {
"hasown": "^2.0.2"
@ -2895,6 +2951,7 @@
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
@ -2906,7 +2963,8 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
"integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
"dev": true
"dev": true,
"license": "MIT"
},
"node_modules/json-in-place": {
"version": "1.0.1",
@ -2929,7 +2987,8 @@
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true
"dev": true,
"license": "MIT"
},
"node_modules/json-stable-stringify-without-jsonify": {
"version": "1.0.1",
@ -2956,6 +3015,7 @@
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
"integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
"dev": true,
"license": "MIT",
"dependencies": {
"json-buffer": "3.0.1"
}
@ -3066,6 +3126,7 @@
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
"dev": true,
"license": "MIT",
"dependencies": {
"braces": "^3.0.3",
"picomatch": "^2.3.1"
@ -3096,9 +3157,9 @@
}
},
"node_modules/minimatch": {
"version": "9.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz",
"integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==",
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"license": "ISC",
"dependencies": {
@ -3135,9 +3196,9 @@
}
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/mute-stream": {
@ -3376,6 +3437,7 @@
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
"integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
"dev": true,
"license": "MIT",
"dependencies": {
"callsites": "^3.0.0"
},
@ -3494,6 +3556,7 @@
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
}
@ -3510,9 +3573,9 @@
}
},
"node_modules/qs": {
"version": "6.12.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.12.1.tgz",
"integrity": "sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ==",
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
"integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
@ -3634,6 +3697,7 @@
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=4"
}
@ -3751,9 +3815,9 @@
"license": "ISC"
},
"node_modules/semver": {
"version": "7.6.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz",
"integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==",
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
"dev": true,
"license": "ISC",
"bin": {
@ -3970,6 +4034,7 @@
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
"integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
},
@ -4316,6 +4381,7 @@
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@ -4341,16 +4407,16 @@
}
},
"node_modules/underscore": {
"version": "1.13.6",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz",
"integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==",
"version": "1.13.7",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz",
"integrity": "sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==",
"dev": true,
"license": "MIT"
},
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
"dev": true,
"license": "MIT"
},
@ -4359,6 +4425,7 @@
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"punycode": "^2.1.0"
}

Просмотреть файл

@ -1,4 +1,5 @@
{
"type": "module",
"name": "psrule-pipelines",
"displayName": "PSRule",
"description": "An extension for using PSRule within Azure Pipelines.",
@ -18,19 +19,18 @@
"azure-pipelines-task-lib": "^4.17.0"
},
"devDependencies": {
"@types/mocha": "^10.0.6",
"@types/node": "^18.19.42",
"@types/q": "^1.5.8",
"@types/mocha": "^10.0.7",
"@types/node": "^20.16.5",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"@typescript-eslint/parser": "^8.4.0",
"esbuild": "^0.23.1",
"eslint": "^9.9.1",
"typescript": "^5.5.4",
"tfx-cli": "^0.17.0"
"tfx-cli": "^0.17.0",
"typescript": "^5.5.4"
},
"scripts": {
"compile": "tsc -p ./",
"package": "tfx extension create --json --no-color --root out/dist --manifest-js extension.config.js --output-path out/extension",
"package": "tfx extension create --json --no-color --root out/dist --manifest-js extension.config.cjs --output-path out/extension --env",
"build": "node build.mjs"
}
}

Просмотреть файл

@ -104,21 +104,13 @@ task Dependencies NuGet, {
Install-Dependencies -Path $PWD/modules.json;
}
task SaveDependencies NuGet, PSRule, {
Import-Module $PWD/scripts/dependencies.psm1;
Save-Dependencies -Path $PWD/modules.json -OutputPath out/dist/ps_modules;
}
# Synopsis: Install PSRule older version of PSRule for V1
task PSRule NuGet, {
task SaveDependencies NuGet, {
if (!(Test-Path -Path out/dist/ps_modules)) {
$Null = New-Item -Path out/dist/ps_modules -ItemType Directory -Force;
}
if ($Null -eq (Get-InstalledModule -Name PSRule -RequiredVersion 1.11.1 -ErrorAction SilentlyContinue)) {
Install-Module -Name PSRule -Repository PSGallery -Scope CurrentUser -RequiredVersion 1.11.1 -Force;
}
Save-Module -Name PSRule -Repository PSGallery -Path out/dist/ps_modules -RequiredVersion 1.11.1;
Import-Module -Name PSRule -Verbose:$False;
Import-Module $PWD/scripts/dependencies.psm1;
Save-Dependencies -Path $PWD/modules.json -OutputPath out/dist/ps_modules;
}
# Synopsis: Remove temp files.
@ -158,8 +150,8 @@ task CopyExtension {
task BuildExtension CopyExtension, VersionExtension, SaveDependencies, {
Write-Host '> Building extension' -ForegroundColor Green;
exec { & npm run build }
exec { & npm run -S "package" -- --env version=$Build }
exec { & npm run -S "package" -- --env version=$Build official=true }
exec { & npm run -S "package" -- version=$Build }
exec { & npm run -S "package" -- version=$Build official=true }
}
task VersionExtension {

45
plugins/extras.js Normal file
Просмотреть файл

@ -0,0 +1,45 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import * as fs from 'fs';
import * as path from 'path';
let options = {}
// Copy files that end with .ps1 or .json
function filter(src, dest) {
return src.endsWith('.ps1') || src.endsWith('.json')
}
export const taskExtrasPlugin = {
name: 'task-extras',
setup(build) {
const options = build.initialOptions
build.onEnd((result) => {
// Find all files that end with .ps1 or .json
const files = fs.readdirSync(options.sourceRoot).filter(filter);
// Copy each file to the output directory
files.forEach((file) => {
const src = path.join(options.sourceRoot, file);
const dest = path.join(options.outbase, file);
// Ensure the destination directory exists
const destinationDir = path.dirname(dest);
if (!fs.existsSync(destinationDir)) {
fs.mkdirSync(destinationDir, { recursive: true });
}
// Copy the file
fs.cpSync(src, dest, {
dereference: options.dereference || true,
errorOnExist: options.errorOnExist || false,
force: options.force || true,
preserveTimestamps: options.preserveTimestamps || true,
recursive: options.recursive || true,
});
});
});
},
}

Просмотреть файл

@ -1,224 +0,0 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# ps-rule-assert
#
# See details at: https://github.com/microsoft/PSRule-pipelines
[CmdletBinding()]
param (
# The root path for analysis
[Parameter(Mandatory = $False)]
[String]$Path = (Get-VstsInput -Name 'path'),
# The type of input
[Parameter(Mandatory = $False)]
[ValidateSet('repository', 'inputPath')]
[String]$InputType = (Get-VstsInput -Name 'inputType'),
# The path to input files
[Parameter(Mandatory = $False)]
[String]$InputPath = (Get-VstsInput -Name 'inputPath'),
# The path to find rules
[Parameter(Mandatory = $False)]
[String]$Source = (Get-VstsInput -Name 'source'),
# Rule modules to use
[Parameter(Mandatory = $False)]
[String]$Modules = (Get-VstsInput -Name 'modules'),
# The name of a baseline to use
[Parameter(Mandatory = $False)]
[String]$Baseline = (Get-VstsInput -Name 'baseline'),
# The conventions to use
[Parameter(Mandatory = $False)]
[String]$Conventions = (Get-VstsInput -Name 'conventions'),
# The output format
[Parameter(Mandatory = $False)]
[ValidateSet('None', 'Yaml', 'Json', 'Markdown', 'NUnit3', 'Csv')]
[String]$OutputFormat = (Get-VstsInput -Name 'outputFormat'),
# The path to store formatted output
[Parameter(Mandatory = $False)]
[String]$OutputPath = (Get-VstsInput -Name 'outputPath')
)
Write-Host "`#`#vso[task.logissue type=warning]You are using an old version of this task that uses a deprecated version of Node. Please upgrade to the latest version by using 'ps-rule-assert@2'. See https://aka.ms/ps-rule-pipelines/upgrade for details.";
if ($Env:SYSTEM_DEBUG -eq 'true') {
$VerbosePreference = 'Continue';
}
if ([String]::IsNullOrEmpty($Path)) {
$Path = $Env:BUILD_SOURCESDIRECTORY;
}
if ([String]::IsNullOrEmpty($Path)) {
$Path = $PWD;
}
if ($Null -eq $InputPath) {
$InputPath = $Path;
}
if ([String]::IsNullOrEmpty($Source)) {
$Source = Join-Path -Path $Path -ChildPath '.ps-rule/';
}
# Set conventions
if (![String]::IsNullOrEmpty($Conventions)) {
$Conventions = @($Conventions.Split(',', [System.StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object {
$_.Trim();
});
}
else {
$Conventions = @();
}
if (!(Test-Path -Path $Source)) {
Write-Host "[info] Source '$Source' does not exist.";
Write-Host '';
}
function WriteDebug {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $True)]
[String]$Message
)
process {
if ($Env:SYSTEM_DEBUG -eq 'true') {
Write-Host "[debug] $Message";
}
}
}
# Import localized strings
Import-VstsLocStrings -LiteralPath $PSScriptRoot/task.json;
# Setup paths for importing modules
$modulesPath = Join-Path -Path $PSScriptRoot -ChildPath 'ps_modules' -Resolve;
if ((Get-Variable -Name IsMacOS -ErrorAction Ignore) -or (Get-Variable -Name IsLinux -ErrorAction Ignore)) {
$moduleSearchPaths = $Env:PSModulePath.Split(':', [System.StringSplitOptions]::RemoveEmptyEntries);
if ($modulesPath -notin $moduleSearchPaths) {
$Env:PSModulePath += [String]::Concat($Env:PSModulePath, ':', $modulesPath);
}
}
else {
$moduleSearchPaths = $Env:PSModulePath.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries);
if ($modulesPath -notin $moduleSearchPaths) {
$Env:PSModulePath += [String]::Concat($Env:PSModulePath, ';', $modulesPath);
}
}
$moduleNames = @()
if (![String]::IsNullOrEmpty($Modules)) {
$moduleNames = $Modules.Split(',', [System.StringSplitOptions]::RemoveEmptyEntries);
}
$moduleParams = @{
Scope = 'CurrentUser'
Force = $True
}
# Install each module if not already installed
foreach ($m in $moduleNames) {
$m = $m.Trim();
Write-Host "> Checking module: $m";
try {
if ($Null -eq (Get-InstalledModule -Name $m -ErrorAction Ignore)) {
Write-Host ' - Installing module';
$Null = Install-Module -Name $m @moduleParams -AllowClobber -ErrorAction Stop;
}
else {
Write-Host ' - Already installed';
}
# Check
if ($Null -eq (Get-InstalledModule -Name $m)) {
Write-Host ' - Failed to install';
}
else {
Write-Host " - Using version: $((Get-InstalledModule -Name $m).Version)";
}
}
catch {
Write-Host "`#`#vso[task.logissue type=error]$(Get-VstsLocString -Key 'DependencyFailed')";
Write-Host "`#`#vso[task.complete result=Failed;]FAILED";
$Host.SetShouldExit(1);
}
}
try {
$Null = Import-Module PSRule -ErrorAction Stop;
$version = (Get-InstalledModule PSRule).Version;
}
catch {
Write-Host "`#`#vso[task.logissue type=error]$(Get-VstsLocString -Key 'ImportFailed')";
Write-Host "`#`#vso[task.complete result=Failed;]FAILED";
$Host.SetShouldExit(1);
}
Write-Host '';
Write-Host "[info] Using Version: $version";
Write-Host "[info] Using PWD: $PWD";
Write-Host "[info] Using Path: $Path";
Write-Host "[info] Using Source: $Source";
Write-Host "[info] Using Baseline: $Baseline";
Write-Host "[info] Using Conventions: $Conventions";
Write-Host "[info] Using InputType: $InputType";
Write-Host "[info] Using InputPath: $InputPath";
Write-Host "[info] Using OutputFormat: $OutputFormat";
Write-Host "[info] Using OutputPath: $OutputPath";
try {
Push-Location -Path $Path;
$invokeParams = @{
Path = $Source
Style = 'AzurePipelines'
ErrorAction = 'Stop'
}
WriteDebug "Preparing command-line:";
WriteDebug ([String]::Concat('-Path ''', $Source, ''''));
if (![String]::IsNullOrEmpty($Baseline)) {
$invokeParams['Baseline'] = $Baseline;
WriteDebug ([String]::Concat('-Baseline ''', $Baseline, ''''));
}
if ($Conventions.Length -gt 0) {
$invokeParams['Convention'] = $Conventions;
WriteDebug ([String]::Concat('-Convention ', [String]::Join(', ', $Conventions)));
}
if (![String]::IsNullOrEmpty($Modules)) {
$moduleNames = $Modules.Split(',', [System.StringSplitOptions]::RemoveEmptyEntries);
$invokeParams['Module'] = $moduleNames;
WriteDebug ([String]::Concat('-Module ', [String]::Join(', ', $moduleNames)));
}
if (![String]::IsNullOrEmpty($OutputFormat) -and ![String]::IsNullOrEmpty($OutputPath) -and $OutputFormat -ne 'None') {
$invokeParams['OutputFormat'] = $OutputFormat;
$invokeParams['OutputPath'] = $OutputPath;
WriteDebug ([String]::Concat('-OutputFormat ', $OutputFormat, ' -OutputPath ''', $OutputPath, ''''));
}
# Repository
if ($InputType -eq 'repository') {
WriteDebug 'Running ''Assert-PSRule'' with repository as input.';
Write-Host '';
Write-Host '---';
Assert-PSRule @invokeParams -InputPath $InputPath -Format File;
}
# Repository
elseif ($InputType -eq 'inputPath') {
WriteDebug 'Running ''Assert-PSRule'' with input from path.';
Write-Host '';
Write-Host '---';
Assert-PSRule @invokeParams -InputPath $InputPath;
}
}
catch {
Write-Host "`#`#vso[task.logissue type=error]$(Get-VstsLocString -Key 'AssertFailed')";
Write-Host "`#`#vso[task.complete result=Failed;]FAILED";
$Host.SetShouldExit(1);
}
finally {
Pop-Location;
}
Write-Host '---';

Просмотреть файл

@ -1,88 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
import * as task from 'azure-pipelines-task-lib/task';
import * as runner from 'azure-pipelines-task-lib/toolrunner';
async function run() {
try {
// Get task
task.setResourcePath(path.join(__dirname, 'task.json'));
// Get inputs
let input_path: string = task.getPathInput('path', /*required*/ true, /*check*/ true);
let input_inputType: string = task.getInput('inputType', /*required*/ true);
let input_inputPath: string = task.getInput('inputPath', /*required*/ true);
let input_source: string = task.getPathInput('source', /*required*/ false, /*check*/ false);
let input_modules: string = task.getInput('modules', /*required*/ false);
let input_baseline: string = task.getInput('baseline', /*required*/ false);
let input_conventions: string = task.getInput('conventions', /*required*/ false);
let input_outputFormat: string = task.getPathInput('outputFormat', /*required*/ false, /*check*/ false) || 'None';
let input_outputPath: string = task.getPathInput('outputPath', /*required*/ false, /*check*/ false);
// Write bootstrap commands to a temporary script file
let contents: string[] = [];
// Import SDK
contents.push(`$rootPath = '${__dirname}';`);
contents.push(`$sdkPath = Join-Path -Path $rootPath -ChildPath 'ps_modules/VstsTaskSdk';`);
contents.push(`Import-Module $sdkPath -ArgumentList @{ NonInteractive = 'true' }`);
// Prepare parameters
contents.push(`$scriptParams = @{ Path = '${input_path}'; InputType = '${input_inputType}'; InputPath = '${input_inputPath}' };`);
if (input_source !== undefined) {
contents.push(`$scriptParams['Source'] = '${input_source}'`);
}
if (input_modules !== undefined) {
contents.push(`$scriptParams['Modules'] = '${input_modules}'`);
}
if (input_baseline !== undefined) {
contents.push(`$scriptParams['Baseline'] = '${input_baseline}'`);
}
if (input_conventions !== undefined) {
contents.push(`$scriptParams['Conventions'] = '${input_conventions}'`);
}
if (input_outputFormat !== undefined) {
contents.push(`$scriptParams['OutputFormat'] = '${input_outputFormat}'`);
}
if (input_outputPath !== undefined) {
contents.push(`$scriptParams['OutputPath'] = '${input_outputPath}'`);
}
// Add PowerShell entry point
contents.push(` . $rootPath\\powershell.ps1 @scriptParams`.trim());
// Write the script to disk.
task.assertAgent('2.115.0');
const tempDirectory = task.getVariable('agent.tempDirectory');
task.checkPath(tempDirectory, `${tempDirectory} (agent.tempDirectory)`);
const filePath = path.join(tempDirectory, 'run_ps_rule_assert.ps1');
fs.writeFileSync(filePath, '\ufeff' + contents.join(os.EOL), { encoding: 'utf8' });
// Run the script.
const powershell = task.tool(task.which('pwsh') || task.which('powershell') || task.which('pwsh', true))
.arg('-NoLogo')
.arg('-NoProfile')
.arg('-NonInteractive')
.arg('-Command')
.arg(`. '${filePath.replace(/'/g, "''")}'`);
const options = <runner.IExecOptions>{
cwd: input_path,
failOnStdErr: false,
errStream: process.stdout,
outStream: process.stdout,
ignoreReturnCode: true
};
// Run PowerShell
const exitCode: number = await powershell.exec(options);
}
catch (err) {
task.setResult(task.TaskResult.Failed, err.message || 'run() failed');
}
}
run();

Просмотреть файл

@ -1,141 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/azure-pipelines-task-lib/master/tasks.schema.json",
"id": "8804fc31-b62f-4d49-b2a1-c80dc0879dae",
"name": "ps-rule-assert",
"friendlyName": "PSRule analysis",
"description": "Run analysis with PSRule.",
"helpUrl": "https://github.com/Microsoft/PSRule-pipelines/blob/main/docs/tasks.md#ps-rule-assert",
"helpMarkDown": "[Learn more about this task](https://github.com/Microsoft/PSRule-pipelines/blob/main/docs/tasks.md#ps-rule-assert)",
"category": "Utility",
"visibility": [
"Build",
"Release"
],
"runsOn": [
"Agent",
"DeploymentGroup"
],
"author": "Bernie White",
"version": {
"Major": 0,
"Minor": 100,
"Patch": 0
},
"preview": true,
"deprecated": true,
"releaseNotes": "[See change log](https://github.com/Microsoft/PSRule-pipelines/blob/main/CHANGELOG.md)",
"groups": [
{
"name": "advanced",
"displayName": "Advanced",
"isExpanded": false
}
],
"minimumAgentVersion": "2.115.0",
"inputs": [
{
"name": "path",
"type": "filePath",
"label": "Working directory",
"groupName": "advanced",
"defaultValue": "",
"required": false,
"helpMarkDown": "The working directory PSRule is run from."
},
{
"name": "inputType",
"type": "pickList",
"label": "Input type",
"options": {
"repository": "Repository",
"inputPath": "Input Path"
},
"defaultValue": "repository",
"required": true,
"helpMarkDown": "Determines the type of input to use for PSRule."
},
{
"name": "inputPath",
"type": "filePath",
"label": "Input file(s)",
"defaultValue": "",
"required": true,
"helpMarkDown": "The path PSRule will look for files to validate."
},
{
"name": "source",
"type": "filePath",
"label": "Source path",
"defaultValue": ".ps-rule/",
"required": false,
"helpMarkDown": "An path containing rules to use for analysis."
},
{
"name": "modules",
"type": "string",
"label": "Modules",
"required": false,
"defaultValue": "",
"helpMarkDown": "A comma separated list of modules to use for analysis."
},
{
"name": "baseline",
"type": "string",
"label": "Baseline",
"required": false,
"defaultValue": "",
"helpMarkDown": "The name of a PSRule baseline to use."
},
{
"name": "conventions",
"type": "string",
"label": "Conventions",
"required": false,
"defaultValue": "",
"helpMarkDown": "A comma separated list of conventions to use."
},
{
"name": "outputFormat",
"type": "pickList",
"label": "Output format",
"options": {
"None": "None",
"Yaml": "Yaml",
"Json": "Json",
"Markdown": "Markdown",
"NUnit3": "NUnit3",
"Csv": "Csv"
},
"required": true,
"defaultValue": "None",
"helpMarkDown": "The format to use when writing results to disk. When set to `None` results are not written to disk."
},
{
"name": "outputPath",
"type": "filePath",
"label": "Output path",
"defaultValue": "",
"required": true,
"helpMarkDown": "The file path to write results to.",
"visibleRule": "outputFormat != None"
}
],
"instanceNameFormat": "Run PSRule analysis",
"execution": {
"PowerShell3": {
"target": "powershell.ps1",
"platforms": [
"windows"
]
},
"Node": {
"target": "powershell.js",
"argumentFormat": ""
}
},
"messages": {
"AssertFailed": "One or more assertions failed.",
"DependencyFailed": "An error occurred installing a dependency module.",
"ImportFailed": "An error occurred importing module 'PSRule'."
}
}

Просмотреть файл

@ -1,224 +0,0 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# ps-rule-assert
#
# See details at: https://github.com/microsoft/PSRule-pipelines
[CmdletBinding()]
param (
# The root path for analysis
[Parameter(Mandatory = $False)]
[String]$Path = (Get-VstsInput -Name 'path'),
# The type of input
[Parameter(Mandatory = $False)]
[ValidateSet('repository', 'inputPath')]
[String]$InputType = (Get-VstsInput -Name 'inputType'),
# The path to input files
[Parameter(Mandatory = $False)]
[String]$InputPath = (Get-VstsInput -Name 'inputPath'),
# The path to find rules
[Parameter(Mandatory = $False)]
[String]$Source = (Get-VstsInput -Name 'source'),
# Rule modules to use
[Parameter(Mandatory = $False)]
[String]$Modules = (Get-VstsInput -Name 'modules'),
# The name of a baseline to use
[Parameter(Mandatory = $False)]
[String]$Baseline = (Get-VstsInput -Name 'baseline'),
# The conventions to use
[Parameter(Mandatory = $False)]
[String]$Conventions = (Get-VstsInput -Name 'conventions'),
# The output format
[Parameter(Mandatory = $False)]
[ValidateSet('None', 'Yaml', 'Json', 'Markdown', 'NUnit3', 'Csv')]
[String]$OutputFormat = (Get-VstsInput -Name 'outputFormat'),
# The path to store formatted output
[Parameter(Mandatory = $False)]
[String]$OutputPath = (Get-VstsInput -Name 'outputPath')
)
Write-Host "`#`#vso[task.logissue type=warning]This version of the task is deprecated. Please upgrade to the latest version by using 'ps-rule-assert@2'. See https://aka.ms/ps-rule-pipelines/upgrade for details.";
if ($Env:SYSTEM_DEBUG -eq 'true') {
$VerbosePreference = 'Continue';
}
if ([String]::IsNullOrEmpty($Path)) {
$Path = $Env:BUILD_SOURCESDIRECTORY;
}
if ([String]::IsNullOrEmpty($Path)) {
$Path = $PWD;
}
if ($Null -eq $InputPath) {
$InputPath = $Path;
}
if ([String]::IsNullOrEmpty($Source)) {
$Source = Join-Path -Path $Path -ChildPath '.ps-rule/';
}
# Set conventions
if (![String]::IsNullOrEmpty($Conventions)) {
$Conventions = @($Conventions.Split(',', [System.StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object {
$_.Trim();
});
}
else {
$Conventions = @();
}
if (!(Test-Path -Path $Source)) {
Write-Host "[info] Source '$Source' does not exist.";
Write-Host '';
}
function WriteDebug {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $True)]
[String]$Message
)
process {
if ($Env:SYSTEM_DEBUG -eq 'true') {
Write-Host "[debug] $Message";
}
}
}
# Import localized strings
Import-VstsLocStrings -LiteralPath $PSScriptRoot/task.json;
# Setup paths for importing modules
$modulesPath = Join-Path -Path $PSScriptRoot -ChildPath 'ps_modules' -Resolve;
if ((Get-Variable -Name IsMacOS -ErrorAction Ignore) -or (Get-Variable -Name IsLinux -ErrorAction Ignore)) {
$moduleSearchPaths = $Env:PSModulePath.Split(':', [System.StringSplitOptions]::RemoveEmptyEntries);
if ($modulesPath -notin $moduleSearchPaths) {
$Env:PSModulePath += [String]::Concat($Env:PSModulePath, ':', $modulesPath);
}
}
else {
$moduleSearchPaths = $Env:PSModulePath.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries);
if ($modulesPath -notin $moduleSearchPaths) {
$Env:PSModulePath += [String]::Concat($Env:PSModulePath, ';', $modulesPath);
}
}
$moduleNames = @()
if (![String]::IsNullOrEmpty($Modules)) {
$moduleNames = $Modules.Split(',', [System.StringSplitOptions]::RemoveEmptyEntries);
}
$moduleParams = @{
Scope = 'CurrentUser'
Force = $True
}
# Install each module if not already installed
foreach ($m in $moduleNames) {
$m = $m.Trim();
Write-Host "> Checking module: $m";
try {
if ($Null -eq (Get-InstalledModule -Name $m -ErrorAction Ignore)) {
Write-Host ' - Installing module';
$Null = Install-Module -Name $m @moduleParams -AllowClobber -ErrorAction Stop;
}
else {
Write-Host ' - Already installed';
}
# Check
if ($Null -eq (Get-InstalledModule -Name $m)) {
Write-Host ' - Failed to install';
}
else {
Write-Host " - Using version: $((Get-InstalledModule -Name $m).Version)";
}
}
catch {
Write-Host "`#`#vso[task.logissue type=error]$(Get-VstsLocString -Key 'DependencyFailed')";
Write-Host "`#`#vso[task.complete result=Failed;]FAILED";
$Host.SetShouldExit(1);
}
}
try {
$Null = Import-Module PSRule -ErrorAction Stop;
$version = (Get-InstalledModule PSRule).Version;
}
catch {
Write-Host "`#`#vso[task.logissue type=error]$(Get-VstsLocString -Key 'ImportFailed')";
Write-Host "`#`#vso[task.complete result=Failed;]FAILED";
$Host.SetShouldExit(1);
}
Write-Host '';
Write-Host "[info] Using Version: $version";
Write-Host "[info] Using PWD: $PWD";
Write-Host "[info] Using Path: $Path";
Write-Host "[info] Using Source: $Source";
Write-Host "[info] Using Baseline: $Baseline";
Write-Host "[info] Using Conventions: $Conventions";
Write-Host "[info] Using InputType: $InputType";
Write-Host "[info] Using InputPath: $InputPath";
Write-Host "[info] Using OutputFormat: $OutputFormat";
Write-Host "[info] Using OutputPath: $OutputPath";
try {
Push-Location -Path $Path;
$invokeParams = @{
Path = $Source
Style = 'AzurePipelines'
ErrorAction = 'Stop'
}
WriteDebug "Preparing command-line:";
WriteDebug ([String]::Concat('-Path ''', $Source, ''''));
if (![String]::IsNullOrEmpty($Baseline)) {
$invokeParams['Baseline'] = $Baseline;
WriteDebug ([String]::Concat('-Baseline ''', $Baseline, ''''));
}
if ($Conventions.Length -gt 0) {
$invokeParams['Convention'] = $Conventions;
WriteDebug ([String]::Concat('-Convention ', [String]::Join(', ', $Conventions)));
}
if (![String]::IsNullOrEmpty($Modules)) {
$moduleNames = $Modules.Split(',', [System.StringSplitOptions]::RemoveEmptyEntries);
$invokeParams['Module'] = $moduleNames;
WriteDebug ([String]::Concat('-Module ', [String]::Join(', ', $moduleNames)));
}
if (![String]::IsNullOrEmpty($OutputFormat) -and ![String]::IsNullOrEmpty($OutputPath) -and $OutputFormat -ne 'None') {
$invokeParams['OutputFormat'] = $OutputFormat;
$invokeParams['OutputPath'] = $OutputPath;
WriteDebug ([String]::Concat('-OutputFormat ', $OutputFormat, ' -OutputPath ''', $OutputPath, ''''));
}
# Repository
if ($InputType -eq 'repository') {
WriteDebug 'Running ''Assert-PSRule'' with repository as input.';
Write-Host '';
Write-Host '---';
Assert-PSRule @invokeParams -InputPath $InputPath -Format File;
}
# Repository
elseif ($InputType -eq 'inputPath') {
WriteDebug 'Running ''Assert-PSRule'' with input from path.';
Write-Host '';
Write-Host '---';
Assert-PSRule @invokeParams -InputPath $InputPath;
}
}
catch {
Write-Host "`#`#vso[task.logissue type=error]$(Get-VstsLocString -Key 'AssertFailed')";
Write-Host "`#`#vso[task.complete result=Failed;]FAILED";
$Host.SetShouldExit(1);
}
finally {
Pop-Location;
}
Write-Host '---';

Просмотреть файл

@ -1,88 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
import * as task from 'azure-pipelines-task-lib/task';
import * as runner from 'azure-pipelines-task-lib/toolrunner';
async function run() {
try {
// Get task
task.setResourcePath(path.join(__dirname, 'task.json'));
// Get inputs
let input_path: string = task.getPathInput('path', /*required*/ true, /*check*/ true);
let input_inputType: string = task.getInput('inputType', /*required*/ true);
let input_inputPath: string = task.getInput('inputPath', /*required*/ true);
let input_source: string = task.getPathInput('source', /*required*/ false, /*check*/ false);
let input_modules: string = task.getInput('modules', /*required*/ false);
let input_baseline: string = task.getInput('baseline', /*required*/ false);
let input_conventions: string = task.getInput('conventions', /*required*/ false);
let input_outputFormat: string = task.getPathInput('outputFormat', /*required*/ false, /*check*/ false) || 'None';
let input_outputPath: string = task.getPathInput('outputPath', /*required*/ false, /*check*/ false);
// Write bootstrap commands to a temporary script file
let contents: string[] = [];
// Import SDK
contents.push(`$rootPath = '${__dirname}';`);
contents.push(`$sdkPath = Join-Path -Path $rootPath -ChildPath 'ps_modules/VstsTaskSdk';`);
contents.push(`Import-Module $sdkPath -ArgumentList @{ NonInteractive = 'true' }`);
// Prepare parameters
contents.push(`$scriptParams = @{ Path = '${input_path}'; InputType = '${input_inputType}'; InputPath = '${input_inputPath}' };`);
if (input_source !== undefined) {
contents.push(`$scriptParams['Source'] = '${input_source}'`);
}
if (input_modules !== undefined) {
contents.push(`$scriptParams['Modules'] = '${input_modules}'`);
}
if (input_baseline !== undefined) {
contents.push(`$scriptParams['Baseline'] = '${input_baseline}'`);
}
if (input_conventions !== undefined) {
contents.push(`$scriptParams['Conventions'] = '${input_conventions}'`);
}
if (input_outputFormat !== undefined) {
contents.push(`$scriptParams['OutputFormat'] = '${input_outputFormat}'`);
}
if (input_outputPath !== undefined) {
contents.push(`$scriptParams['OutputPath'] = '${input_outputPath}'`);
}
// Add PowerShell entry point
contents.push(` . $rootPath\\powershell.ps1 @scriptParams`.trim());
// Write the script to disk.
task.assertAgent('2.144.0');
const tempDirectory = task.getVariable('agent.tempDirectory');
task.checkPath(tempDirectory, `${tempDirectory} (agent.tempDirectory)`);
const filePath = path.join(tempDirectory, 'run_ps_rule_assert.ps1');
fs.writeFileSync(filePath, '\ufeff' + contents.join(os.EOL), { encoding: 'utf8' });
// Run the script.
const powershell = task.tool(task.which('pwsh') || task.which('powershell') || task.which('pwsh', true))
.arg('-NoLogo')
.arg('-NoProfile')
.arg('-NonInteractive')
.arg('-Command')
.arg(`. '${filePath.replace(/'/g, "''")}'`);
const options = <runner.IExecOptions>{
cwd: input_path,
failOnStdErr: false,
errStream: process.stdout,
outStream: process.stdout,
ignoreReturnCode: true
};
// Run PowerShell
const exitCode: number = await powershell.exec(options);
}
catch (err) {
task.setResult(task.TaskResult.Failed, err.message || 'run() failed');
}
}
run();

Просмотреть файл

@ -1,139 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/azure-pipelines-task-lib/master/tasks.schema.json",
"id": "8804fc31-b62f-4d49-b2a1-c80dc0879dae",
"name": "ps-rule-assert",
"friendlyName": "PSRule analysis",
"description": "Run analysis with PSRule.",
"helpUrl": "https://github.com/Microsoft/PSRule-pipelines/blob/main/docs/tasks.md#ps-rule-assert",
"helpMarkDown": "[Learn more about this task](https://github.com/Microsoft/PSRule-pipelines/blob/main/docs/tasks.md#ps-rule-assert)",
"category": "Utility",
"visibility": [
"Build",
"Release"
],
"runsOn": [
"Agent",
"DeploymentGroup"
],
"author": "Bernie White",
"version": {
"Major": 1,
"Minor": 100,
"Patch": 0
},
"releaseNotes": "[See change log](https://github.com/Microsoft/PSRule-pipelines/blob/main/CHANGELOG.md)",
"groups": [
{
"name": "advanced",
"displayName": "Advanced",
"isExpanded": false
}
],
"minimumAgentVersion": "2.144.0",
"inputs": [
{
"name": "path",
"type": "filePath",
"label": "Working directory",
"groupName": "advanced",
"defaultValue": "",
"required": false,
"helpMarkDown": "The working directory PSRule is run from."
},
{
"name": "inputType",
"type": "pickList",
"label": "Input type",
"options": {
"repository": "Repository",
"inputPath": "Input Path"
},
"defaultValue": "repository",
"required": true,
"helpMarkDown": "Determines the type of input to use for PSRule."
},
{
"name": "inputPath",
"type": "filePath",
"label": "Input file(s)",
"defaultValue": "",
"required": true,
"helpMarkDown": "The path PSRule will look for files to validate."
},
{
"name": "source",
"type": "filePath",
"label": "Source path",
"defaultValue": ".ps-rule/",
"required": false,
"helpMarkDown": "An path containing rules to use for analysis."
},
{
"name": "modules",
"type": "string",
"label": "Modules",
"required": false,
"defaultValue": "",
"helpMarkDown": "A comma separated list of modules to use for analysis."
},
{
"name": "baseline",
"type": "string",
"label": "Baseline",
"required": false,
"defaultValue": "",
"helpMarkDown": "The name of a PSRule baseline to use."
},
{
"name": "conventions",
"type": "string",
"label": "Conventions",
"required": false,
"defaultValue": "",
"helpMarkDown": "A comma separated list of conventions to use."
},
{
"name": "outputFormat",
"type": "pickList",
"label": "Output format",
"options": {
"None": "None",
"Yaml": "Yaml",
"Json": "Json",
"Markdown": "Markdown",
"NUnit3": "NUnit3",
"Csv": "Csv"
},
"required": true,
"defaultValue": "None",
"helpMarkDown": "The format to use when writing results to disk. When set to `None` results are not written to disk."
},
{
"name": "outputPath",
"type": "filePath",
"label": "Output path",
"defaultValue": "",
"required": true,
"helpMarkDown": "The file path to write results to.",
"visibleRule": "outputFormat != None"
}
],
"instanceNameFormat": "Run PSRule analysis",
"execution": {
"PowerShell3": {
"target": "powershell.ps1",
"platforms": [
"windows"
]
},
"Node10": {
"target": "powershell.js",
"argumentFormat": ""
}
},
"messages": {
"AssertFailed": "One or more assertions failed.",
"DependencyFailed": "An error occurred installing a dependency module.",
"ImportFailed": "An error occurred importing module 'PSRule'."
}
}

Просмотреть файл

@ -1,103 +0,0 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# ps-rule-install
#
# See details at: https://github.com/microsoft/PSRule-pipelines
[CmdletBinding()]
param (
# The name of the module to install
[Parameter(Mandatory = $False)]
[String]$Module = (Get-VstsInput -Name 'module'),
# Determine if the PSRule module is updated to the latest version
[Parameter(Mandatory = $False)]
[System.Boolean]$Latest = (Get-VstsInput -Name 'latest' -AsBool),
# Determine if pre-release modules are installed
[Parameter(Mandatory = $False)]
[System.Boolean]$PreRelease = (Get-VstsInput -Name 'prerelease' -AsBool)
)
Write-Host "`#`#vso[task.logissue type=warning]You are using an old version of this task that uses a deprecated version of Node. Please upgrade to the latest version by using 'ps-rule-install@2'. See https://aka.ms/ps-rule-pipelines/upgrade for details.";
if ($Env:SYSTEM_DEBUG -eq 'true') {
$VerbosePreference = 'Continue';
}
$ProgressPreference = 'SilentlyContinue';
Write-Host '';
Write-Host "[info] Using PreRelease: $PreRelease";
function WriteDebug {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $True)]
[String]$Message
)
process {
if ($Env:SYSTEM_DEBUG -eq 'true') {
Write-Host "[debug] $Message";
}
}
}
$moduleNames = @($Module)
if ('PSRule' -notin $moduleNames) {
$moduleNames += 'PSRule';
}
# Setup paths for importing modules
$modulesPath = Join-Path -Path $PSScriptRoot -ChildPath 'ps_modules' -Resolve;
if ((Get-Variable -Name IsMacOS -ErrorAction Ignore) -or (Get-Variable -Name IsLinux -ErrorAction Ignore)) {
$moduleSearchPaths = $Env:PSModulePath.Split(':', [System.StringSplitOptions]::RemoveEmptyEntries);
if ($modulesPath -notin $moduleSearchPaths) {
$Env:PSModulePath += [String]::Concat($Env:PSModulePath, ':', $modulesPath);
}
}
else {
$moduleSearchPaths = $Env:PSModulePath.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries);
if ($modulesPath -notin $moduleSearchPaths) {
$Env:PSModulePath += [String]::Concat($Env:PSModulePath, ';', $modulesPath);
}
}
Write-Host '[info] Checking PowerShellGet';
Import-Module -Name PowerShellGet -MinimumVersion 2.2.3;
$exitResult = 0;
$moduleParams = @{
Scope = 'CurrentUser'
Force = $True
}
if ($PreRelease) {
$moduleParams['AllowPrerelease'] = $True;
}
# Install each module if not already installed
foreach ($m in $moduleNames) {
Write-Host "[info] Checking module: $m";
if ($Null -eq (Get-InstalledModule -Name $m -ErrorAction Ignore)) {
Write-Host "[info] Installing module: $m";
$Null = Install-Module -Name $m @moduleParams -AllowClobber;
}
elseif ($Latest) {
Write-Host "[info] Updating module: $m";
$Null = Update-Module -Name $m @moduleParams;
}
else {
WriteDebug "Module '$m' already installed";
}
# Check
if ($Null -eq (Get-InstalledModule -Name $m)) {
$exitResult = 1;
Write-Host "[error] Failed to install module: $m";
}
else {
Write-Host "[info] Using module: $m - v$((Get-InstalledModule -Name $m).Version)";
}
}
$Host.SetShouldExit($exitResult);

Просмотреть файл

@ -1,83 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
import * as task from 'azure-pipelines-task-lib/task';
import * as runner from 'azure-pipelines-task-lib/toolrunner';
async function run() {
try {
// Get task
task.setResourcePath(path.join(__dirname, 'task.json'));
// Get inputs
let input_module: string = task.getInput('module', /*required*/ true);
let input_latest: boolean = task.getBoolInput('latest', /*required*/ true);
let input_prerelease: boolean = task.getBoolInput('prerelease', /*required*/ true);
// Write bootstrap commands to a temporary script file
let contents: string[] = [];
// Import SDK
contents.push(`$rootPath = '${__dirname}';`);
contents.push(`$sdkPath = Join-Path -Path $rootPath -ChildPath 'ps_modules/VstsTaskSdk';`);
contents.push(`Import-Module $sdkPath -ArgumentList @{ NonInteractive = 'true' }`);
// Prepare parameters
contents.push(`$scriptParams = @{ };`);
if (input_module !== undefined) {
contents.push(`$scriptParams['Module'] = '${input_module}'`);
}
if (input_latest) {
contents.push(`$scriptParams['Latest'] = $True;`);
}
else {
contents.push(`$scriptParams['Latest'] = $False;`);
}
if (input_prerelease) {
contents.push(`$scriptParams['PreRelease'] = $True;`);
}
else {
contents.push(`$scriptParams['PreRelease'] = $False;`);
}
// Add PowerShell entry point
contents.push(` . $rootPath\\powershell.ps1 @scriptParams`.trim());
// Write the script to disk.
task.assertAgent('2.115.0');
const tempDirectory = task.getVariable('agent.tempDirectory');
task.checkPath(tempDirectory, `${tempDirectory} (agent.tempDirectory)`);
const filePath = path.join(tempDirectory, 'run_ps_rule_install.ps1');
fs.writeFileSync(filePath, '\ufeff' + contents.join(os.EOL), { encoding: 'utf8' });
// Run the script.
const powershell = task.tool(task.which('pwsh') || task.which('powershell') || task.which('pwsh', true))
.arg('-NoLogo')
.arg('-NoProfile')
.arg('-NonInteractive')
.arg('-Command')
.arg(`. '${filePath.replace(/'/g, "''")}'`);
const options = <runner.IExecOptions>{
failOnStdErr: false,
errStream: process.stdout,
outStream: process.stdout,
ignoreReturnCode: true
};
// Run PowerShell
const exitCode: number = await powershell.exec(options);
// Fail on exit code.
if (exitCode !== 0) {
task.setResult(task.TaskResult.Failed, task.loc('JS_ExitCode', exitCode));
}
}
catch (err) {
task.setResult(task.TaskResult.Failed, err.message || 'run() failed');
}
}
run();

Просмотреть файл

@ -1,78 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/azure-pipelines-task-lib/master/tasks.schema.json",
"id": "0848dd65-bc06-4882-ae15-e2609d7fab0d",
"name": "ps-rule-install",
"friendlyName": "Install PSRule module",
"description": "Install a PowerShell module containing rules.",
"helpUrl": "https://github.com/Microsoft/PSRule-pipelines/blob/main/docs/tasks.md#ps-rule-install",
"helpMarkDown": "[Learn more about this task](https://github.com/Microsoft/PSRule-pipelines/blob/main/docs/tasks.md#ps-rule-install)",
"category": "Utility",
"visibility": [
"Build",
"Release"
],
"runsOn": [
"Agent",
"DeploymentGroup"
],
"author": "Bernie White",
"version": {
"Major": 0,
"Minor": 100,
"Patch": 0
},
"preview": true,
"deprecated": true,
"releaseNotes": "[See change log](https://github.com/Microsoft/PSRule-pipelines/blob/main/CHANGELOG.md)",
"groups": [
{
"name": "advanced",
"displayName": "Advanced",
"isExpanded": false
}
],
"minimumAgentVersion": "2.115.0",
"inputs": [
{
"name": "module",
"type": "string",
"label": "Module",
"required": true,
"helpMarkDown": "The name of a PSRule module to install from the PowerShell Gallery."
},
{
"name": "latest",
"type": "boolean",
"label": "Install latest",
"defaultValue": false,
"required": true,
"helpMarkDown": "Determines if the module is automatically updated to the latest version.",
"groupName": "advanced"
},
{
"name": "prerelease",
"type": "boolean",
"label": "Allow pre-releases",
"defaultValue": false,
"required": true,
"helpMarkDown": "Determines if pre-release module versions are installed.",
"groupName": "advanced"
}
],
"instanceNameFormat": "Install $(module)",
"execution": {
"PowerShell3": {
"target": "powershell.ps1",
"platforms": [
"windows"
]
},
"Node": {
"target": "powershell.js",
"argumentFormat": ""
}
},
"messages": {
"JS_ExitCode": "Extension error:"
}
}

Просмотреть файл

@ -1,103 +0,0 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# ps-rule-install
#
# See details at: https://github.com/microsoft/PSRule-pipelines
[CmdletBinding()]
param (
# The name of the module to install
[Parameter(Mandatory = $False)]
[String]$Module = (Get-VstsInput -Name 'module'),
# Determine if the PSRule module is updated to the latest version
[Parameter(Mandatory = $False)]
[System.Boolean]$Latest = (Get-VstsInput -Name 'latest' -AsBool),
# Determine if pre-release modules are installed
[Parameter(Mandatory = $False)]
[System.Boolean]$PreRelease = (Get-VstsInput -Name 'prerelease' -AsBool)
)
Write-Host "`#`#vso[task.logissue type=warning]This version of the task is deprecated. Please upgrade to the latest version by using 'ps-rule-install@2'. See https://aka.ms/ps-rule-pipelines/upgrade for details.";
if ($Env:SYSTEM_DEBUG -eq 'true') {
$VerbosePreference = 'Continue';
}
$ProgressPreference = 'SilentlyContinue';
Write-Host '';
Write-Host "[info] Using PreRelease: $PreRelease";
function WriteDebug {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $True)]
[String]$Message
)
process {
if ($Env:SYSTEM_DEBUG -eq 'true') {
Write-Host "[debug] $Message";
}
}
}
$moduleNames = @($Module)
if ('PSRule' -notin $moduleNames) {
$moduleNames += 'PSRule';
}
# Setup paths for importing modules
$modulesPath = Join-Path -Path $PSScriptRoot -ChildPath 'ps_modules' -Resolve;
if ((Get-Variable -Name IsMacOS -ErrorAction Ignore) -or (Get-Variable -Name IsLinux -ErrorAction Ignore)) {
$moduleSearchPaths = $Env:PSModulePath.Split(':', [System.StringSplitOptions]::RemoveEmptyEntries);
if ($modulesPath -notin $moduleSearchPaths) {
$Env:PSModulePath += [String]::Concat($Env:PSModulePath, ':', $modulesPath);
}
}
else {
$moduleSearchPaths = $Env:PSModulePath.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries);
if ($modulesPath -notin $moduleSearchPaths) {
$Env:PSModulePath += [String]::Concat($Env:PSModulePath, ';', $modulesPath);
}
}
Write-Host '[info] Checking PowerShellGet';
Import-Module -Name PowerShellGet -MinimumVersion 2.2.3;
$exitResult = 0;
$moduleParams = @{
Scope = 'CurrentUser'
Force = $True
}
if ($PreRelease) {
$moduleParams['AllowPrerelease'] = $True;
}
# Install each module if not already installed
foreach ($m in $moduleNames) {
Write-Host "[info] Checking module: $m";
if ($Null -eq (Get-InstalledModule -Name $m -ErrorAction Ignore)) {
Write-Host "[info] Installing module: $m";
$Null = Install-Module -Name $m @moduleParams -AllowClobber;
}
elseif ($Latest) {
Write-Host "[info] Updating module: $m";
$Null = Update-Module -Name $m @moduleParams;
}
else {
WriteDebug "Module '$m' already installed";
}
# Check
if ($Null -eq (Get-InstalledModule -Name $m)) {
$exitResult = 1;
Write-Host "[error] Failed to install module: $m";
}
else {
Write-Host "[info] Using module: $m - v$((Get-InstalledModule -Name $m).Version)";
}
}
$Host.SetShouldExit($exitResult);

Просмотреть файл

@ -1,83 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
import * as task from 'azure-pipelines-task-lib/task';
import * as runner from 'azure-pipelines-task-lib/toolrunner';
async function run() {
try {
// Get task
task.setResourcePath(path.join(__dirname, 'task.json'));
// Get inputs
let input_module: string = task.getInput('module', /*required*/ true);
let input_latest: boolean = task.getBoolInput('latest', /*required*/ true);
let input_prerelease: boolean = task.getBoolInput('prerelease', /*required*/ true);
// Write bootstrap commands to a temporary script file
let contents: string[] = [];
// Import SDK
contents.push(`$rootPath = '${__dirname}';`);
contents.push(`$sdkPath = Join-Path -Path $rootPath -ChildPath 'ps_modules/VstsTaskSdk';`);
contents.push(`Import-Module $sdkPath -ArgumentList @{ NonInteractive = 'true' }`);
// Prepare parameters
contents.push(`$scriptParams = @{ };`);
if (input_module !== undefined) {
contents.push(`$scriptParams['Module'] = '${input_module}'`);
}
if (input_latest) {
contents.push(`$scriptParams['Latest'] = $True;`);
}
else {
contents.push(`$scriptParams['Latest'] = $False;`);
}
if (input_prerelease) {
contents.push(`$scriptParams['PreRelease'] = $True;`);
}
else {
contents.push(`$scriptParams['PreRelease'] = $False;`);
}
// Add PowerShell entry point
contents.push(` . $rootPath\\powershell.ps1 @scriptParams`.trim());
// Write the script to disk.
task.assertAgent('2.144.0');
const tempDirectory = task.getVariable('agent.tempDirectory');
task.checkPath(tempDirectory, `${tempDirectory} (agent.tempDirectory)`);
const filePath = path.join(tempDirectory, 'run_ps_rule_install.ps1');
fs.writeFileSync(filePath, '\ufeff' + contents.join(os.EOL), { encoding: 'utf8' });
// Run the script.
const powershell = task.tool(task.which('pwsh') || task.which('powershell') || task.which('pwsh', true))
.arg('-NoLogo')
.arg('-NoProfile')
.arg('-NonInteractive')
.arg('-Command')
.arg(`. '${filePath.replace(/'/g, "''")}'`);
const options = <runner.IExecOptions>{
failOnStdErr: false,
errStream: process.stdout,
outStream: process.stdout,
ignoreReturnCode: true
};
// Run PowerShell
const exitCode: number = await powershell.exec(options);
// Fail on exit code.
if (exitCode !== 0) {
task.setResult(task.TaskResult.Failed, task.loc('JS_ExitCode', exitCode));
}
}
catch (err) {
task.setResult(task.TaskResult.Failed, err.message || 'run() failed');
}
}
run();

Просмотреть файл

@ -1,76 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/azure-pipelines-task-lib/master/tasks.schema.json",
"id": "0848dd65-bc06-4882-ae15-e2609d7fab0d",
"name": "ps-rule-install",
"friendlyName": "Install PSRule module",
"description": "Install a PowerShell module containing rules.",
"helpUrl": "https://github.com/Microsoft/PSRule-pipelines/blob/main/docs/tasks.md#ps-rule-install",
"helpMarkDown": "[Learn more about this task](https://github.com/Microsoft/PSRule-pipelines/blob/main/docs/tasks.md#ps-rule-install)",
"category": "Utility",
"visibility": [
"Build",
"Release"
],
"runsOn": [
"Agent",
"DeploymentGroup"
],
"author": "Bernie White",
"version": {
"Major": 1,
"Minor": 100,
"Patch": 0
},
"releaseNotes": "[See change log](https://github.com/Microsoft/PSRule-pipelines/blob/main/CHANGELOG.md)",
"groups": [
{
"name": "advanced",
"displayName": "Advanced",
"isExpanded": false
}
],
"minimumAgentVersion": "2.144.0",
"inputs": [
{
"name": "module",
"type": "string",
"label": "Module",
"required": true,
"helpMarkDown": "The name of a PSRule module to install from the PowerShell Gallery."
},
{
"name": "latest",
"type": "boolean",
"label": "Install latest",
"defaultValue": false,
"required": true,
"helpMarkDown": "Determines if the module is automatically updated to the latest version.",
"groupName": "advanced"
},
{
"name": "prerelease",
"type": "boolean",
"label": "Allow pre-releases",
"defaultValue": false,
"required": true,
"helpMarkDown": "Determines if pre-release module versions are installed.",
"groupName": "advanced"
}
],
"instanceNameFormat": "Install $(module)",
"execution": {
"PowerShell3": {
"target": "powershell.ps1",
"platforms": [
"windows"
]
},
"Node10": {
"target": "powershell.js",
"argumentFormat": ""
}
},
"messages": {
"JS_ExitCode": "Extension error:"
}
}