How to use the azure-pipelines-task-lib/task.getBoolInput function in azure-pipelines-task-lib

To help you get started, we’ve selected a few azure-pipelines-task-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jfrog / artifactory-vsts-extension / tasks / ArtifactoryToolsInstaller / toolsInstaller.js View on Github external
function RunTaskCbk(cliPath) {
    let installMavenExtractor = tl.getBoolInput("installMavenExtractor");
    if (!installMavenExtractor) {
        tl.setResult(tl.TaskResult.Succeeded, "Tools installed successfully.");
        return;
    }
    console.log("Installing Maven Extractor...");

    // Get inputs and variables
    let artifactoryService = tl.getInput("artifactoryService");
    let buildName = tl.getVariable('Build.DefinitionName');
    let buildNumber = tl.getVariable('Build.BuildNumber');
    let workDir = tl.getVariable('System.DefaultWorkingDirectory');
    if (!workDir) {
        tl.setResult(tl.TaskResult.Failed, "Failed getting default working directory.");
        return;
    }
github microsoft / google-play-vsts-extension / Tasks / google-play-release-bundle / GooglePlay.ts View on Github external
console.log(tl.loc('FoundMainBundle', bundleFile));
        tl.debug(`Found the main bundle file: ${bundleFile}.`);

        const versionCodeFilterType: string = tl.getInput('versionCodeFilterType', false) || 'all';
        let versionCodeFilter: string | string[] = null;
        if (versionCodeFilterType === 'list') {
            versionCodeFilter = getVersionCodeListInput();
        } else if (versionCodeFilterType === 'expression') {
            versionCodeFilter = tl.getInput('replaceExpression', true);
        }

        const track: string = tl.getInput('track', true);
        const userFractionSupplied: boolean = tl.getBoolInput('rolloutToUserFraction');
        const userFraction: number = Number(userFractionSupplied ? tl.getInput('userFraction', false) : 1.0);

        const shouldAttachMetadata: boolean = tl.getBoolInput('shouldAttachMetadata', false);

        let changelogFile: string = null;
        let languageCode: string = null;
        let metadataRootPath: string = null;

        if (shouldAttachMetadata) {
            metadataRootPath = tl.getPathInput('metadataRootPath', true, true);
        } else {
            changelogFile = tl.getInput('changelogFile', false);
            languageCode = tl.getInput('languageCode', false) || 'en-US';
        }

        const globalParams: googleutil.GlobalParams = { auth: null, params: {} };
        let bundleVersionCode: number;

        // The submission process is composed
github aloisdeniel / vsts-flutter-tasks / tasks / build / index.js View on Github external
var flutterPath = task.getVariable(FLUTTER_TOOL_PATH_ENV_VAR) || process.env[FLUTTER_TOOL_PATH_ENV_VAR] || task.getInput('flutterDirectory', false);
        flutterPath = path.join(flutterPath, "flutter");
        if (!flutterPath) {
            throw new Error(`The '${FLUTTER_TOOL_PATH_ENV_VAR}' environment variable must be set before using this task (you can use 'flutterinstall' task).`);
        }
        // 2. Get target
        let target = task.getInput('target', true);
        // 3. Move current working directory to project
        let projectDirectory = task.getPathInput('projectDirectory', false, false);
        if (projectDirectory) {
            task.debug(`Moving to ${projectDirectory}`);
            task.cd(projectDirectory);
        }
        task.debug(`Project's directory : ${task.cwd()}`);
        // 4. Get common input
        let debugMode = task.getBoolInput('debugMode', false);
        let buildName = task.getInput('buildName', false);
        let buildNumber = task.getInput('buildNumber', false);
        let buildFlavour = task.getInput('buildFlavour', false);
        let entryPoint = task.getInput('entryPoint', false);
        // 5. Builds
        if (target === "all" || target === "ios") {
            let targetPlatform = task.getInput('iosTargetPlatform', false);
            let codesign = task.getBoolInput('iosCodesign', false);
            yield buildIpa(flutterPath, targetPlatform == "simulator", codesign, buildName, buildNumber, debugMode, buildFlavour, entryPoint);
        }
        if (target === "all" || target === "apk") {
            let targetPlatform = task.getInput('apkTargetPlatform', false);
            yield buildApk(flutterPath, targetPlatform, buildName, buildNumber, debugMode, buildFlavour, entryPoint);
        }
        if (target === "all" || target === "aab") {
            yield buildAab(flutterPath, buildName, buildNumber, debugMode, buildFlavour, entryPoint);
github jfrog / artifactory-vsts-extension / tasks / ArtifactoryGenericUpload / uploadArtifacts.js View on Github external
function RunTaskCbk(cliPath) {
    let workDir = tl.getVariable('System.DefaultWorkingDirectory');
    if (!workDir) {
        tl.setResult(tl.TaskResult.Failed, "Failed getting default working directory.");
        return;
    }
    let specPath = path.join(workDir, "uploadSpec" + Date.now() + ".json");

    // Get input parameters
    let artifactoryService = tl.getInput("artifactoryService", false);
    let artifactoryUrl = tl.getEndpointUrl(artifactoryService, false);
    let specSource = tl.getInput("specSource", false);
    let collectBuildInfo = tl.getBoolInput("collectBuildInfo");

    // Create upload FileSpec.
    try {
        utils.writeSpecContentToSpecPath(specSource, specPath);
    } catch (ex) {
        tl.setResult(tl.TaskResult.Failed, ex);
        return;
    }

    let cliCommand = utils.cliJoin(cliPath, cliUploadCommand, "--url=" + utils.quote(artifactoryUrl), "--spec=" + utils.quote(specPath));
    cliCommand = utils.addArtifactoryCredentials(cliCommand, artifactoryService);
    cliCommand = utils.addBoolParam(cliCommand, "failNoOp", "fail-no-op");

    // Add build info collection
    if (collectBuildInfo) {
        let buildName = tl.getInput('buildName', true);
github marceloavf / github-tools-vsts / Src / GithubReleasePublish / githubReleasePublish.js View on Github external
const githubTag = tl.getInput('githubTag')
const githubReleaseTitle = tl.getInput('githubReleaseTitle')
const githubReleaseNotes = tl.getInput('githubReleaseNotes')
const githubApiUrl = tl.getInput('githubApiUrl')
const githubTargetCommitsh = tl.getInput('githubTargetCommitsh')

/** Booleans */
const manuallySetRepository = tl.getBoolInput('manuallySetRepository')
const githubReleaseDraft = tl.getBoolInput('githubReleaseDraft')
const githubReleasePrerelease = tl.getBoolInput('githubReleasePrerelease')
const githubReuseRelease = tl.getBoolInput('githubReuseRelease')
const githubReuseDraftOnly = tl.getBoolInput('githubReuseDraftOnly')
const githubSkipDuplicatedAssets = tl.getBoolInput('githubSkipDuplicatedAssets')
const githubIgnoreAssets = tl.getBoolInput('githubIgnoreAssets')
const githubEditRelease = tl.getBoolInput('githubEditRelease')
const githubDeleteEmptyTag = tl.getBoolInput('githubDeleteEmptyTag')

/** Paths */
const manifestJson = tl.getPathInput('manifestJson')
let githubReleaseAssets = tl.getDelimitedInput('githubReleaseAsset', '\n', !githubIgnoreAssets)

/** Check for options in manifest if they don't exists on input */
const manifestOptions = readManifest(manifestJson)

/**
 * Get specific token, either OAuth or Personal Access Token
 * WARNING: AccessToken first letter change depending on scheme
 */
if (githubEndpointObject.scheme === 'PersonalAccessToken') {
  githubEndpointToken = githubEndpointObject.parameters.accessToken
} else {
  // scheme: 'OAuth'
github microsoft / azure-devops-extension-tasks / BuildTasks / PublishExtension / PublishExtension.ts View on Github external
const vsixFile = matchingVsixFile[0];
            tl.checkPath(vsixFile, "vsixPath");

            vsixOutput = tl.getVariable("System.DefaultWorkingDirectory");

            const publisher = tl.getInput("publisherId", false);

            const extensionId = tl.getInput("extensionId", false);
            const extensionTag = tl.getInput("extensionTag", false);

            const extensionName = tl.getInput("extensionName", false);
            const extensionVisibility = tl.getInput("extensionVisibility", false) || "";
            const extensionPricing = tl.getInput("extensionPricing", false);
            const extensionVersion = common.getExtensionVersion();
            const updateTasksId = tl.getBoolInput("updateTasksId", false);
            const updateTasksVersion = tl.getBoolInput("updateTasksVersion", false);

            if (publisher
                || extensionId
                || extensionTag
                || extensionName
                || (extensionPricing && extensionPricing !== "default")
                || (extensionVisibility && extensionVisibility !== "default")
                || extensionVersion
                || updateTasksId ) {

                tl.debug("Start editing of VSIX");
                const ve = new vsixeditor.VSIXEditor(vsixFile, vsixOutput);
                ve.startEdit();

                if (publisher) { ve.editPublisher(publisher); }
github geeklearningio / gl-vsts-tasks-file-patch / Tasks / YamlPatch / yamlPatch.ts View on Github external
import * as tl from "azure-pipelines-task-lib/task";

import patchProcess = require("./common/patchProcess");
import yamlPatcher = require("./yamlPatcher");
import { Operation } from "fast-json-patch";

var targetPath = tl.getPathInput("YamlWorkingDir");
var patchContent = tl.getInput("YamlPatchContent");

var patterns: any = tl.getInput("YamlTargetFilters");
var outputPatchedFile = tl.getBoolInput("OutputPatchFile");
var failIfNoPatchApplied = tl.getBoolInput("FailIfNoPatchApplied");
var treatErrors = tl.getInput("TreatErrors");
var syntax = tl.getInput("SyntaxType");

try {
  var patches: Operation[] =
    syntax == "slick"
      ? patchProcess.expandVariablesAndParseSlickPatch(patchContent)
      : patchProcess.expandVariablesAndParseJson(patchContent);

  patchProcess.apply(
    new yamlPatcher.YamlPatcher(patches),
    targetPath,
    patterns,
    outputPatchedFile,
    failIfNoPatchApplied,
github jfrog / artifactory-vsts-extension / artifactory-tasks-utils / utils.js View on Github external
function addBoolParam(cliCommand, inputParam, cliParam) {
    let val = tl.getBoolInput(inputParam, false);
    cliCommand = cliJoin(cliCommand, "--" + cliParam + "=" + val);
    return cliCommand;
}
github microsoft / azure-pipelines-tasks / Tasks / NuGetCommandV2 / nugetcommandmain.ts View on Github external
"NUGET_EXE_TOOL_PATH_ENV_VAR": tl.getVariable(nuGetGetter.NUGET_EXE_TOOL_PATH_ENV_VAR),
                "NUGET_EXE_CUSTOM_LOCATION": tl.getVariable(NUGET_EXE_CUSTOM_LOCATION),
                "searchPatternPack": tl.getPathInput("searchPatternPack"),
                "configurationToPack": tl.getInput("configurationToPack"),
                "versioningScheme": tl.getInput("versioningScheme"),
                "includeReferencedProjects": tl.getBoolInput("includeReferencedProjects"),
                "versionEnvVar": tl.getInput("versioningScheme") === "byEnvVar" ?
                    tl.getVariable(tl.getInput("versionEnvVar")) : null,
                "requestedMajorVersion": tl.getInput("requestedMajorVersion"),
                "requestedMinorVersion": tl.getInput("requestedMinorVersion"),
                "requestedPatchVersion": tl.getInput("requestedPatchVersion"),
                "packTimezone": tl.getInput("packTimezone"),
                "buildProperties": tl.getInput("buildProperties"),
                "basePath": tl.getInput("basePath"),
                "verbosityPack": tl.getInput("verbosityPack"),
                "includeSymbols": tl.getBoolInput("includeSymbols"),
                "NuGet.UseLegacyFindFiles": tl.getVariable("NuGet.UseLegacyFindFiles"),
                "NuGetTasks.IsHostedTestEnvironment": tl.getVariable("NuGetTasks.IsHostedTestEnvironment"),
                "System.TeamFoundationCollectionUri": tl.getVariable("System.TeamFoundationCollectionUri"),
                "NuGet.OverwritePackagingCollectionUrl": tl.getVariable("NuGet.OverwritePackagingCollectionUrl"),
                "externalendpoint": externalendpoint,
                "externalendpoints": externalendpoints,
                "allowpackageconflicts": tl.getInput("allowpackageconflicts"),
                "includenugetorg": tl.getInput("includenugetorg"),
                "nocache": tl.getInput("nocache"),
                "disableparallelprocessing": tl.getInput("disableParallelProcessing"),
                "nugetconfigpath": tl.getInput("nugetconfigpath"),
                "nugetfeedtype": nugetfeedtype,
                "searchpatternpush": tl.getInput("searchpatternpush"),
                "selectorconfig": tl.getInput("selectorconfig"),
                "solution": tl.getInput("solution"),
                "verbositypush": tl.getInput("verbositypush"),
github aws / aws-vsts-tools / Tasks / AWSShellScript / TaskParameters.ts View on Github external
export function buildTaskParameters(): TaskParameters {
    const parameters: TaskParameters = {
        awsConnectionParameters: buildConnectionParameters(),
        arguments: getInputOrEmpty('arguments'),
        scriptType: getInputRequired('scriptType'),
        filePath: '',
        inlineScript: '',
        disableAutoCwd: getBoolInput('disableAutoCwd', false),
        workingDirectory: '',
        failOnStandardError: getBoolInput('failOnStandardError', false)
    }

    if (parameters.scriptType === fileScriptType) {
        parameters.filePath = getPathInput('filePath', true, true)
    } else {
        parameters.inlineScript = getInputRequired('inlineScript')
    }

    if (parameters.disableAutoCwd) {
        parameters.workingDirectory = getPathInput('workingDirectory', true, false)
    }

    return parameters
}