How to use the azure-pipelines-task-lib.debug 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 microsoft / azure-pipelines-tasks / Tasks / TwineAuthenticateV1 / twineauthenticatemain.ts View on Github external
async function main(): Promise {
    tl.setResourcePath(path.join(__dirname, "task.json"));
    try {
        // Local feeds
        const internalFeed = await auth.getInternalAuthInfoArray("artifactFeed");
        // external service endpoints
        const externalEndpoints = await auth.getExternalAuthInfoArray("pythonUploadServiceConnection");
        // combination of both internal and external
        const newEndpointsToAdd = internalFeed.concat(externalEndpoints);

        let pypircPath = utils.getPypircPath();

        // create new file. We do not merge existing files and always create a fresh file
        fs.writeFileSync(pypircPath, formPypircFormatFromData(newEndpointsToAdd));
        tl.setVariable("PYPIRC_PATH", pypircPath, false);
        tl.debug(tl.loc("VariableSetForPypirc", pypircPath));

        // Configuring the pypirc file
        console.log(tl.loc("Info_SuccessAddingAuth", internalFeed.length, externalEndpoints.length));
    }
    catch (error) {
        tl.error(error);
        tl.setResult(tl.TaskResult.Failed, tl.loc("FailedToAddAuthentication"));
        return;
    } finally{
        _logTwineAuthStartupVariables();
    }
}
 // Telemetry
github microsoft / azure-pipelines-tasks / Tasks / TwineAuthenticateV0 / twineauthenticatemain.ts View on Github external
fileContent[entry.packageSource.feedName] = new Repository(
                    entry.packageSource.feedUri,
                    entry.username,
                    entry.password);
                fileContent["distutils"]["index-servers"] += " " + entry.packageSource.feedName;
            }

            let encodedStr = ini.encode(fileContent);
            fs.writeFileSync(pypircPath, encodedStr);
        }
        else {
            // create new
            fs.writeFileSync(pypircPath, formPypircFormatFromData(newEndpointsToAdd));
            tl.setVariable("PYPIRC_PATH", pypircPath, false);
            tl.debug(tl.loc("VariableSetForPypirc", pypircPath));
        }

        // Configuring the pypirc file
        console.log(tl.loc("Info_SuccessAddingAuth", internalFeeds.length, externalEndpoints.length));
    }
    catch (error) {
        tl.error(error);
        tl.setResult(tl.TaskResult.Failed, tl.loc("FailedToAddAuthentication"));
        return;
    } finally{
        _logTwineAuthStartupVariables();
    }
}
 // Telemetry
github microsoft / code-push-vsts-extension / Tasks / codepush-release-cordova / codepush-release-cordova.js View on Github external
});

    for (var flag in optionFlags) {
        // If the value is falsey, the option flag doesn't have to be specified.
        if (optionFlags[flag]) {
            var flagValue = "" + optionFlags[flag];

            command = command + " --" + flag;
            // For boolean flags, the presence of the flag is enough to indicate its value.
            if (flagValue != "true" && flagValue != "false") {
                command = command + " \"" + flagValue + "\"";
            }
        }
    }

    tl.debug("Finished Building Command: " + command);
    return command;
}
github microsoft / azure-pipelines-tasks / Tasks / PipAuthenticateV1 / pipauthenticatemain.ts View on Github external
const onlyAddExtraIndex = tl.getBoolInput("onlyAddExtraIndex");

        // Local feeds
        if (feedList)
        {
            tl.debug(tl.loc("Info_AddingInternalFeeds", feedList.length));
            const serviceUri = tl.getEndpointUrl("SYSTEMVSSCONNECTION", false);
            const localAccessToken = pkgLocationUtils.getSystemAccessToken();
            try {
                // This call is to get the packaging URI(abc.pkgs.vs.com) which is same for all protocols.
                packagingLocation = await pkgLocationUtils.getNuGetUriFromBaseServiceUri(
                    serviceUri,
                    localAccessToken);
            } catch (error) {
                tl.debug(tl.loc("FailedToGetPackagingUri"));
                tl.debug(JSON.stringify(error));
                packagingLocation = serviceUri;
            }

            for (const feedName of feedList) {
                const feed = getProjectAndFeedIdFromInput(feedName);
                const feedUri = await pkgLocationUtils.getFeedRegistryUrl(
                    packagingLocation,
                    pkgLocationUtils.RegistryType.PyPiSimple,
                    feed.feedId,
                    feed.projectId,
                    localAccessToken);
                const pipUri = utils.formPipCompatibleUri("build", localAccessToken, feedUri);
                internalAndExternalEndpoints.push(pipUri);
            }
        }
github microsoft / code-push-vsts-extension / Tasks / codepush-release-cordova / codepush-release-cordova.js View on Github external
function performDeployTask(accessKey, appName, appStoreVersion, platform, deploymentName, description, rollout, isMandatory, isDisabled, shouldBuild) {
    var cwd = tl.getVariable("BUILD_SOURCEDIRECTORY", false) || tl.getVariable("BUILD_SOURCESDIRECTORY", false);
    tl.debug("Swapping to working directory: " + cwd);
    process.chdir(cwd);

    if (process.cwd() != cwd) {
        tl.debug("Working directories do not match: ");
        tl.debug("cwd: " + process.cwd());
        tl.debug("expected cwd: " + cwd);
        tl.debug("task will likely fail");
    }

    // If function arguments are provided (e.g. during test), use those, else, get user inputs provided by VSTS.
    var authType = tl.getInput("authType", false);
    if (authType === "AccessKey") {
        accessKey = tl.getInput("accessKey", true);
    } else if (authType === "ServiceEndpointCodePush" || authType === "ServiceEndpointHockeyApp") {
        var serviceAccount = tl.getEndpointAuthorization(tl.getInput(authType, true));
        accessKey = serviceAccount.parameters.password;
    }

    appName = appName || tl.getInput("appName", true);
    deploymentName = deploymentName || tl.getInput("deploymentName", false);
github microsoft / google-play-vsts-extension / Tasks / google-play-release-bundle / googleutil.ts View on Github external
deobfuscationFileType: 'proguard',
        packageName: packageName,
        apkVersionCode: apkVersionCode,
        media: {
            body: fs.createReadStream(mappingFilePath),
            mimeType: ''
        }
    };

    try {
        tl.debug('Request Parameters: ' + JSON.stringify(requestParameters));
        const res = (await edits.deobfuscationfiles.upload(requestParameters)).data;
        tl.debug('returned: ' + JSON.stringify(res));
        return res;
    } catch (e) {
        tl.debug(`Failed to upload deobfuscation file ${mappingFilePath}`);
        tl.debug(e);
        throw new Error(tl.loc('CannotUploadDeobfuscationFile', mappingFilePath, e));
    }
}
github microsoft / google-play-vsts-extension / Tasks / google-play-release-bundle / googleutil.ts View on Github external
export async function updateTrack(edits: pub3.Resource$Edits, packageName: string, track: string, versionCode: string | string[], userFraction: number, releaseNotes?: pub3.Schema$LocalizedText[]): Promise {
    tl.debug('Updating track');
    const release: pub3.Schema$TrackRelease = {
        versionCodes: (Array.isArray(versionCode) ? versionCode : [versionCode])
    };

    if (releaseNotes && releaseNotes.length > 0) {
        tl.debug('Attaching release notes to the update');
        release.releaseNotes = releaseNotes;
    }

    if (userFraction < 1.0) {
        release.userFraction = userFraction;
        release.status = 'inProgress';
    } else {
        tl.debug('User fraction is more than 100% marking rollout "completed"');
        release.status = 'completed';
    }

    const requestParameters: pub3.Params$Resource$Edits$Tracks$Update = {
        packageName: packageName,
        track: track,
        requestBody: {
            track,
github microsoft / azure-devops-extension-tasks / BuildTasks / PublishVSExtension / Utils.ts View on Github external
export function getVsixPublisherExe(): string {
    if (cacheVsixPublisherExe === "") {
        const vswhereTool = tl.tool(path.join(__dirname, "tools", "vswhere.exe"));
        vswhereTool.line("-version [15.0,17.0) -latest -requires Microsoft.VisualStudio.Component.VSSDK -find VSSDK\\VisualStudioIntegration\\Tools\\Bin\\VsixPublisher.exe");
        const vswhereResult = vswhereTool.execSync({ silent: true } as tr.IExecSyncOptions);
        const vsixPublisherExe = vswhereResult.stdout.trim();
        if (vswhereResult.code === 0 && vsixPublisherExe && tl.exist(vsixPublisherExe))
        {
            tl.debug('VsixPublisher.exe installed path: ' + vsixPublisherExe);
            cacheVsixPublisherExe = vsixPublisherExe;
        }
        else
        {
            throw new Error("Could not locate vsixpublisher.exe. Ensure the Visual Studio SDK is installed on the agent.");
        }
    }
    return cacheVsixPublisherExe;
 }