forked from Azure/powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4,344 changed files
with
1,429,579 additions
and
710 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class Constants { | ||
} | ||
exports.default = Constants; | ||
Constants.prefix = "az_"; | ||
Constants.moduleName = "Az"; | ||
Constants.versionPattern = /[0-9]\.[0-9]\.[0-9]/; | ||
Constants.Success = "Success"; | ||
Constants.Error = "Error"; | ||
Constants.AzVersion = "AzVersion"; | ||
Constants.versionExists = "versionExists"; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class Constants { | ||
} | ||
exports.default = Constants; | ||
Constants.prefix = "az_"; | ||
Constants.moduleName = "Az"; | ||
Constants.versionPattern = /[0-9]\.[0-9]\.[0-9]/; | ||
Constants.Success = "Success"; | ||
Constants.Error = "Error"; | ||
Constants.AzVersion = "AzVersion"; | ||
Constants.versionExists = "versionExists"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,56 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const core = __importStar(require("@actions/core")); | ||
const Utils_1 = __importDefault(require("./Utilities/Utils")); | ||
const Constants_1 = __importDefault(require("./Constants")); | ||
class InitializeAzure { | ||
static importAzModule(azPSVersion) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
Utils_1.default.setPSModulePath(); | ||
if (azPSVersion === "latest") { | ||
azPSVersion = yield Utils_1.default.getLatestModule(Constants_1.default.moduleName); | ||
} | ||
else { | ||
yield Utils_1.default.checkModuleVersion(Constants_1.default.moduleName, azPSVersion); | ||
} | ||
core.debug(`Az Module version used: ${azPSVersion}`); | ||
Utils_1.default.setPSModulePath(`${Constants_1.default.prefix}${azPSVersion}`); | ||
}); | ||
} | ||
} | ||
exports.default = InitializeAzure; | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const core = __importStar(require("@actions/core")); | ||
const Utils_1 = __importDefault(require("./Utilities/Utils")); | ||
const Constants_1 = __importDefault(require("./Constants")); | ||
class InitializeAzure { | ||
static importAzModule(azPSVersion) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
Utils_1.default.setPSModulePath(); | ||
if (azPSVersion === "latest") { | ||
azPSVersion = yield Utils_1.default.getLatestModule(Constants_1.default.moduleName); | ||
} | ||
else { | ||
yield Utils_1.default.checkModuleVersion(Constants_1.default.moduleName, azPSVersion); | ||
} | ||
core.debug(`Az Module version used: ${azPSVersion}`); | ||
Utils_1.default.setPSModulePath(`${Constants_1.default.prefix}${azPSVersion}`); | ||
}); | ||
} | ||
} | ||
exports.default = InitializeAzure; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,86 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const core = __importStar(require("@actions/core")); | ||
const FileUtils_1 = __importDefault(require("./Utilities/FileUtils")); | ||
const PowerShellToolRunner_1 = __importDefault(require("./Utilities/PowerShellToolRunner")); | ||
const ScriptBuilder_1 = __importDefault(require("./Utilities/ScriptBuilder")); | ||
class ScriptRunner { | ||
constructor(inlineScript, errorActionPreference, failOnStandardErr) { | ||
this.inlineScript = inlineScript; | ||
this.errorActionPreference = errorActionPreference; | ||
this.failOnStandardErr = failOnStandardErr; | ||
} | ||
executeFile() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const error = []; | ||
const options = { | ||
listeners: { | ||
stderr: (data) => { | ||
if (error.length < 10) { | ||
// Truncate to at most 1000 bytes | ||
if (data.length > 1000) { | ||
error.push(`${data.toString('utf8', 0, 1000)}<truncated>`); | ||
} | ||
else { | ||
error.push(data.toString('utf8')); | ||
} | ||
} | ||
else if (error.length === 10) { | ||
error.push('Additional writes to stderr truncated'); | ||
} | ||
} | ||
} | ||
}; | ||
const scriptToExecute = new ScriptBuilder_1.default().getInlineScriptFile(this.inlineScript, this.errorActionPreference); | ||
ScriptRunner.filePath = yield FileUtils_1.default.createScriptFile(scriptToExecute); | ||
core.debug(`script file to run: ${ScriptRunner.filePath}`); | ||
yield PowerShellToolRunner_1.default.init(); | ||
const exitCode = yield PowerShellToolRunner_1.default.executePowerShellScriptBlock(ScriptRunner.filePath, options); | ||
if (exitCode !== 0) { | ||
core.setOutput(`Azure PowerShell exited with code:`, exitCode.toString()); | ||
if (this.failOnStandardErr) { | ||
error.forEach((err) => { | ||
core.error(err); | ||
}); | ||
throw new Error(`Standard error stream contains one or more lines`); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
exports.default = ScriptRunner; | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const core = __importStar(require("@actions/core")); | ||
const FileUtils_1 = __importDefault(require("./Utilities/FileUtils")); | ||
const PowerShellToolRunner_1 = __importDefault(require("./Utilities/PowerShellToolRunner")); | ||
const ScriptBuilder_1 = __importDefault(require("./Utilities/ScriptBuilder")); | ||
class ScriptRunner { | ||
constructor(inlineScript, errorActionPreference, failOnStandardErr) { | ||
this.inlineScript = inlineScript; | ||
this.errorActionPreference = errorActionPreference; | ||
this.failOnStandardErr = failOnStandardErr; | ||
} | ||
executeFile() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const error = []; | ||
const options = { | ||
listeners: { | ||
stderr: (data) => { | ||
if (error.length < 10) { | ||
// Truncate to at most 1000 bytes | ||
if (data.length > 1000) { | ||
error.push(`${data.toString('utf8', 0, 1000)}<truncated>`); | ||
} | ||
else { | ||
error.push(data.toString('utf8')); | ||
} | ||
} | ||
else if (error.length === 10) { | ||
error.push('Additional writes to stderr truncated'); | ||
} | ||
} | ||
} | ||
}; | ||
const scriptToExecute = new ScriptBuilder_1.default().getInlineScriptFile(this.inlineScript, this.errorActionPreference); | ||
ScriptRunner.filePath = yield FileUtils_1.default.createScriptFile(scriptToExecute); | ||
core.debug(`script file to run: ${ScriptRunner.filePath}`); | ||
yield PowerShellToolRunner_1.default.init(); | ||
const exitCode = yield PowerShellToolRunner_1.default.executePowerShellScriptBlock(ScriptRunner.filePath, options); | ||
if (exitCode !== 0) { | ||
core.setOutput(`Azure PowerShell exited with code:`, exitCode.toString()); | ||
if (this.failOnStandardErr) { | ||
error.forEach((err) => { | ||
core.error(err); | ||
}); | ||
throw new Error(`Standard error stream contains one or more lines`); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
exports.default = ScriptRunner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,60 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const core_1 = require("@actions/core"); | ||
const exec_1 = require("@actions/exec"); | ||
const io_1 = require("@actions/io"); | ||
const PowerShellToolRunner_1 = __importDefault(require("./PowerShellToolRunner")); | ||
class ArchiveTools { | ||
constructor(use7Zip = false) { | ||
this.use7Zip = use7Zip; | ||
} | ||
unzip(zipPath, destination) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (this.use7Zip) { | ||
yield this.unzipUsing7Zip(zipPath, destination); | ||
} | ||
else { | ||
yield this.unzipUsingPowerShell(zipPath, destination); | ||
} | ||
}); | ||
} | ||
unzipUsing7Zip(zipPath, destination) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
core_1.debug(`Using 7zip to extract ${zipPath} to ${destination}`); | ||
const path7Zip = yield io_1.which("7z.exe", true); | ||
const exitCode = yield exec_1.exec(`${path7Zip} x -o${destination} ${zipPath}`); | ||
if (exitCode != 0) { | ||
throw new Error(`Extraction using 7zip failed from ${zipPath} to ${destination}`); | ||
} | ||
}); | ||
} | ||
unzipUsingPowerShell(zipPath, destination) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
core_1.debug(`Using powershell Expand-Archive cmdlet to extract ${zipPath} to ${destination}`); | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ArchiveTools = void 0; | ||
const core_1 = require("@actions/core"); | ||
const exec_1 = require("@actions/exec"); | ||
const io_1 = require("@actions/io"); | ||
const PowerShellToolRunner_1 = __importDefault(require("./PowerShellToolRunner")); | ||
class ArchiveTools { | ||
constructor(use7Zip = false) { | ||
this.use7Zip = use7Zip; | ||
} | ||
unzip(zipPath, destination) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (this.use7Zip) { | ||
yield this.unzipUsing7Zip(zipPath, destination); | ||
} | ||
else { | ||
yield this.unzipUsingPowerShell(zipPath, destination); | ||
} | ||
}); | ||
} | ||
unzipUsing7Zip(zipPath, destination) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
(0, core_1.debug)(`Using 7zip to extract ${zipPath} to ${destination}`); | ||
const path7Zip = yield (0, io_1.which)("7z.exe", true); | ||
const exitCode = yield (0, exec_1.exec)(`${path7Zip} x -o${destination} ${zipPath}`); | ||
if (exitCode != 0) { | ||
throw new Error(`Extraction using 7zip failed from ${zipPath} to ${destination}`); | ||
} | ||
}); | ||
} | ||
unzipUsingPowerShell(zipPath, destination) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
(0, core_1.debug)(`Using powershell Expand-Archive cmdlet to extract ${zipPath} to ${destination}`); | ||
const script = ` | ||
$prevProgressPref = $ProgressPreference | ||
$ProgressPreference = 'SilentlyContinue' | ||
Expand-Archive -Path ${zipPath} -DestinationPath ${destination} | ||
$ProgressPreference = $prevProgressPref`; | ||
yield PowerShellToolRunner_1.default.init(); | ||
const exitCode = yield PowerShellToolRunner_1.default.executePowerShellScriptBlock(script); | ||
if (exitCode != 0) { | ||
throw new Error(`Extraction using Expand-Archive cmdlet failed from ${zipPath} to ${destination}`); | ||
} | ||
}); | ||
} | ||
} | ||
exports.ArchiveTools = ArchiveTools; | ||
$ProgressPreference = $prevProgressPref`; | ||
yield PowerShellToolRunner_1.default.init(); | ||
const exitCode = yield PowerShellToolRunner_1.default.executePowerShellScriptBlock(script); | ||
if (exitCode != 0) { | ||
throw new Error(`Extraction using Expand-Archive cmdlet failed from ${zipPath} to ${destination}`); | ||
} | ||
}); | ||
} | ||
} | ||
exports.ArchiveTools = ArchiveTools; |
Oops, something went wrong.