本文整理汇总了TypeScript中vsts-task-lib/task.getBoolInput函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getBoolInput函数的具体用法?TypeScript getBoolInput怎么用?TypeScript getBoolInput使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getBoolInput函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: run
async function run() {
try {
// Configure localization
tl.setResourcePath(path.join(__dirname, 'task.json'));
// Get files to be signed
const filesPattern: string = tl.getInput('files', true);
// Signing the APK?
const apksign: boolean = tl.getBoolInput('apksign');
// Zipaligning the APK?
const zipalign: boolean = tl.getBoolInput('zipalign');
// Resolve files for the specified value or pattern
const filesToSign: string[] = tl.findMatch(null, filesPattern);
// Fail if no matching files were found
if (!filesToSign || filesToSign.length === 0) {
throw new Error(tl.loc('NoMatchingFiles', filesPattern));
}
for (const file of filesToSign) {
if (zipalign) {
await zipaligning(file);
}
if (apksign) {
await apksigning(file);
}
}
} catch (err) {
tl.setResult(tl.TaskResult.Failed, err);
}
}
示例2: run
async function run() {
let packageType = tl.getInput('packageType', true).toLowerCase();
let versionSpec = tl.getInput('version', true);
let installationPath = tl.getInput('installationPath', false);
if (!installationPath) {
installationPath = path.join(tl.getVariable('Agent.ToolsDirectory'), "dotnet");
}
let includePreviewVersions: boolean = tl.getBoolInput('includePreviewVersions', false) || false;
console.log(tl.loc("ToolToInstall", packageType, versionSpec));
var versionSpecParts = new VersionParts(versionSpec);
let versionFetcher = new DotNetCoreVersionFetcher();
let versionInfo: VersionInfo = await versionFetcher.getVersionInfo(versionSpecParts.versionSpec, packageType, includePreviewVersions);
if (!versionInfo) {
throw tl.loc("MatchingVersionNotFound", versionSpecParts.versionSpec);
}
let dotNetCoreInstaller = new VersionInstaller(packageType, installationPath);
if (!dotNetCoreInstaller.isVersionInstalled(versionInfo.getVersion())) {
await dotNetCoreInstaller.downloadAndInstall(versionInfo, versionFetcher.getDownloadUrl(versionInfo));
}
toolLib.prependPath(installationPath);
// By default disable Multi Level Lookup unless user wants it enabled.
let performMultiLevelLookup = tl.getBoolInput("performMultiLevelLookup", false);
tl.setVariable("DOTNET_MULTILEVEL_LOOKUP", !performMultiLevelLookup ? "0" : "1");
// Add dot net tools path to "PATH" environment variables, so that tools can be used directly.
addDotNetCoreToolPath();
// Set DOTNET_ROOT for dotnet core Apphost to find runtime since it is installed to a non well-known location.
tl.setVariable('DOTNET_ROOT', installationPath);
}
示例3: run
export function run(connection: ContainerConnection): any {
var command = connection.createCommand();
command.arg("build");
var dockerfilepath = tl.getInput("dockerFile", true);
let dockerFile = fileUtils.findDockerFile(dockerfilepath);
if(!tl.exist(dockerFile)) {
throw new Error(tl.loc('ContainerDockerFileNotFound', dockerfilepath));
}
command.arg(["-f", dockerFile]);
tl.getDelimitedInput("buildArguments", "\n").forEach(buildArgument => {
command.arg(["--build-arg", buildArgument]);
});
var imageName = utils.getImageName();
var qualifyImageName = tl.getBoolInput("qualifyImageName");
if (qualifyImageName) {
imageName = connection.getQualifiedImageNameIfRequired(imageName);
}
command.arg(["-t", tl.getBoolInput("enforceDockerNamingConvention") ? imageUtils.generateValidImageName(imageName) : imageName]);
var baseImageName = imageUtils.imageNameWithoutTag(imageName);
tl.getDelimitedInput("additionalImageTags", "\n").forEach(tag => {
command.arg(["-t", baseImageName + ":" + tag]);
});
var includeSourceTags = tl.getBoolInput("includeSourceTags");
if (includeSourceTags) {
sourceUtils.getSourceTags().forEach(tag => {
command.arg(["-t", baseImageName + ":" + tag]);
});
}
var includeLatestTag = tl.getBoolInput("includeLatestTag");
if (baseImageName !== imageName && includeLatestTag) {
command.arg(["-t", baseImageName]);
}
var memory = tl.getInput("memory");
if (memory) {
command.arg(["-m", memory]);
}
var context: string;
var defaultContext = tl.getBoolInput("defaultContext");
if (defaultContext) {
context = path.dirname(dockerFile);
} else {
context = tl.getPathInput("context");
}
command.arg(context);
return connection.execCommand(command);
}
示例4: run
async function run() {
try {
const environmentVariables = utils.getVstsEnvironmentVariables();
const vstsConnection = utils.createVstsConnection(environmentVariables);
const octoConnection = utils.getDefaultOctopusConnectionDetailsOrThrow();
const space = tasks.getInput("Space");
const project = await utils.resolveProjectName(octoConnection, tasks.getInput("ProjectName", true))
.then(x => x.value);
const releaseNumber = tasks.getInput("ReleaseNumber");
const channel = tasks.getInput("Channel");
const changesetCommentReleaseNotes = tasks.getBoolInput("ChangesetCommentReleaseNotes");
const workItemReleaseNotes = tasks.getBoolInput("WorkItemReleaseNotes");
const customReleaseNotes = tasks.getInput("CustomReleaseNotes");
const deployToEnvironments = utils.getOptionalCsvInput("DeployToEnvironment");
const deployForTenants = utils.getOptionalCsvInput("DeployForTenants");
const deployForTenantTags = utils.getOptionalCsvInput("DeployForTenantTags");
const deploymentProgress = tasks.getBoolInput("DeploymentProgress")
const additionalArguments = tasks.getInput("AdditionalArguments");
const octo = await utils.getOrInstallOctoCommandRunner("create-release");
let linkedReleaseNotes = "";
if(workItemReleaseNotes || changesetCommentReleaseNotes){
linkedReleaseNotes = await utils.getLinkedReleaseNotes(vstsConnection, changesetCommentReleaseNotes, workItemReleaseNotes);
}
const realseNotesFile = utils.createReleaseNotesFile(() => {
return utils.generateReleaseNotesContent(environmentVariables, linkedReleaseNotes, customReleaseNotes);
}, environmentVariables.defaultWorkingDirectory);
const configure = [
argumentIfSet(argumentEnquote, "space", space),
argumentEnquote("project", project),
argumentIfSet(argumentEnquote, "releaseNumber", releaseNumber),
argumentIfSet(argumentEnquote, "channel", channel),
connectionArguments(octoConnection),
flag("enableServiceMessages", true),
multiArgument(argumentEnquote, "deployTo", deployToEnvironments),
flag("progress", deployToEnvironments.length > 0 && deploymentProgress),
multiArgument(argumentEnquote, "tenant", deployForTenants),
multiArgument(argumentEnquote, "tenanttag", deployForTenantTags),
argumentEnquote("releaseNotesFile", realseNotesFile),
includeArguments(additionalArguments)
];
const code:Number = await octo.map(x => x.launchOcto(configure))
.getOrElseL((x) => { throw new Error(x); });
tasks.setResult(tasks.TaskResult.Succeeded, "Create octopus release succeeded with code " + code);
}catch(err){
tasks.error(err);
tasks.setResult(tasks.TaskResult.Failed, "Failed to deploy release " + err.message);
}
}
示例5: getImageMappings
export function getImageMappings(connection: ContainerConnection, imageNames: string[]): ImageMapping[] {
let qualifyImageName = tl.getBoolInput("qualifyImageName");
let imageInfos: ImageInfo[] = imageNames.map(imageName => {
let qualifiedImageName = qualifyImageName ? connection.qualifyImageName(imageName) : imageName;
return {
sourceImageName: imageName,
qualifiedImageName: qualifiedImageName,
baseImageName: imageUtils.imageNameWithoutTag(qualifiedImageName),
taggedImages: []
};
});
let additionalImageTags = tl.getDelimitedInput("additionalImageTags", "\n");
let includeSourceTags = tl.getBoolInput("includeSourceTags");
let includeLatestTag = tl.getBoolInput("includeLatestTag");
let sourceTags: string[] = [];
if (includeSourceTags) {
sourceTags = sourceUtils.getSourceTags();
}
let commonTags: string[] = additionalImageTags.concat(sourceTags);
// For each of the image names, generate a mapping from the source image name to the target image. The same source image name
// may be listed more than once if there are multiple tags. The target image names will be tagged based on the task configuration.
for (let i = 0; i < imageInfos.length; i++) {
let imageInfo = imageInfos[i];
let imageSpecificTags: string[] = [];
if (imageInfo.baseImageName === imageInfo.qualifiedImageName) {
imageSpecificTags.push("latest");
} else {
imageInfo.taggedImages.push(imageInfo.qualifiedImageName);
if (includeLatestTag) {
imageSpecificTags.push("latest");
}
}
commonTags.concat(imageSpecificTags).forEach(tag => {
imageInfo.taggedImages.push(imageInfo.baseImageName + ":" + tag);
});
}
// Flatten the image infos into a mapping between the source images and each of their tagged target images
let sourceToTargetMapping: ImageMapping[] = [];
imageInfos.forEach(imageInfo => {
imageInfo.taggedImages.forEach(taggedImage => {
sourceToTargetMapping.push({
sourceImageName: imageInfo.sourceImageName,
targetImageName: taggedImage
});
});
});
return sourceToTargetMapping;
}
示例6: getKubectl
private async getKubectl() : Promise<string> {
let versionOrLocation = tl.getInput("versionOrLocation");
if( versionOrLocation === "location") {
let pathToKubectl = tl.getPathInput("specifyLocation", true, true);
fs.chmodSync(pathToKubectl, "777");
return pathToKubectl;
}
else if(versionOrLocation === "version") {
var defaultVersionSpec = "1.7.0";
let versionSpec = tl.getInput("versionSpec");
let checkLatest: boolean = tl.getBoolInput('checkLatest', false);
var version = await utils.getKubectlVersion(versionSpec, checkLatest);
if (versionSpec != defaultVersionSpec || checkLatest)
{
tl.debug(tl.loc("DownloadingClient"));
var version = await utils.getKubectlVersion(versionSpec, checkLatest);
return await utils.downloadKubectl(version);
}
// Reached here => default version
// Now to handle back-compat, return the version installed on the machine
if(this.kubectlPath && fs.existsSync(this.kubectlPath))
{
return this.kubectlPath;
}
// Download the default version
tl.debug(tl.loc("DownloadingClient"));
var version = await utils.getKubectlVersion(versionSpec, checkLatest);
return await utils.downloadKubectl(version);
}
}
示例7: isDtaEngineRequired
function isDtaEngineRequired(): boolean {
const batchType = tl.getInput('distributionBatchType');
if (batchType && batchType === 'basedOnTestCases') {
const batchSize = tl.getInput('batchingBasedOnAgentsOption');
if (batchSize && batchSize === 'customBatchSize') {
return true;
}
} else if (batchType && batchType === 'basedOnExecutionTime') {
return true;
} else if (batchType && batchType === 'basedOnAssembly') {
return true;
}
const testType = tl.getInput('testSelector');
tl.debug('Value of Test Selector :' + testType);
if (testType.toLowerCase() === 'testplan' || testType.toLowerCase() === 'testrun') {
return true;
}
const parallelExecution = tl.getVariable('System.ParallelExecutionType');
tl.debug('Value of ParallelExecutionType :' + parallelExecution);
if (parallelExecution && parallelExecution.toLowerCase() === 'multimachine') {
const dontDistribute = tl.getBoolInput('dontDistribute');
if (dontDistribute) {
return false;
}
return true;
}
return false;
}
示例8: while
return connection.getCombinedConfig(imageDigestComposeFile).then(output => {
var removeBuildOptions = tl.getBoolInput("removeBuildOptions");
if (removeBuildOptions) {
var doc = yaml.safeLoad(output);
for (var serviceName in doc.services || {}) {
delete doc.services[serviceName].build;
}
output = yaml.safeDump(doc, {lineWidth: -1} as any);
}
var baseResolveDir = tl.getPathInput("baseResolveDirectory");
if (baseResolveDir) {
// This just searches the output string and replaces all
// occurrences of the base resolve directory. This isn't
// precisely accurate but is a good enough solution.
var replaced = output;
do {
output = replaced;
replaced = output.replace(baseResolveDir, ".");
} while (replaced !== output);
}
var outputDockerComposeFile = tl.getPathInput("outputDockerComposeFile", true);
fs.writeFileSync(outputDockerComposeFile, output);
});
示例9: run
export function run(connection: ContainerConnection): any {
let command = tl.getInput("command", true);
var commandArguments = tl.getInput("arguments", false);
let imageNames;
let useMultiImageMode = tl.getBoolInput("pushMultipleImages");
if (useMultiImageMode) {
imageNames = utils.getImageNames();
} else {
imageNames = [utils.getImageName()];
}
let imageMappings = utils.getImageMappings(connection, imageNames, []);
let imageDigestFile: string = null;
if (tl.filePathSupplied("imageDigestFile")) {
imageDigestFile = tl.getPathInput("imageDigestFile");
}
let firstImageMapping = imageMappings.shift();
let pushedSourceImages = [firstImageMapping.sourceImageName];
let promise = dockerPush(connection, firstImageMapping.targetImageName, imageDigestFile, useMultiImageMode, commandArguments);
imageMappings.forEach(imageMapping => {
// If we've already pushed a tagged version of this source image, then we don't want to write the digest info to the file since it will be duplicate.
if (pushedSourceImages.indexOf(imageMapping.sourceImageName) >= 0) {
promise = promise.then(() => dockerPush(connection, imageMapping.targetImageName, commandArguments = commandArguments));
} else {
pushedSourceImages.push(imageMapping.sourceImageName);
promise = promise.then(() => dockerPush(connection, imageMapping.targetImageName, imageDigestFile, useMultiImageMode, commandArguments));
}
});
return promise;
}