Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "azure-devops-node-api in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'azure-devops-node-api' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

build_name: getBuildName('x', '@rotorz/unity3d-localized-strings', '1.0.3'),
          // 'system.debug': true,
          // 'agent.diagnostic': true,
        }
      )
  }, config.azureDevops.project);
  for (let i = 0; i < config.azureDevops.retries; i++) {
    await sleep(config.azureDevops.retryIntervalStep * (i + 1));
    build = await buildApi.getBuild(config.azureDevops.project, build.id);
    let statusName = BuildStatusEnum.getKeyOrThrow(build.status);
    let resultName = typeof build.result === 'undefined'
      ? 'undefined'
      : BuildResultEnum.getKeyOrThrow(build.result);
    console.log(`status: ${statusName}, result: ${resultName}`);
    switch (build.status) {
      case BuildStatus.Completed:
      case BuildStatus.Cancelling:
      case BuildStatus.Postponed:
        return build;
      case BuildStatus.None:
      case BuildStatus.InProgress:
      case BuildStatus.NotStarted:
        break;
      default:
        throw new Error(`Unknown build status ${build.status}`);
    }
  }
};
const project = cm.getProject();
        console.log("project", project);

        // get the latest successful build.
        cm.heading(`Get latest successful build for ${project} project`);
        const builds: bi.Build[] = await vstsBuild.getBuilds(
                        project,
                        null,                       // definitions: number[]
                        null,                       // queues: number[]
                        null,                       // buildNumber
                        null, //new Date(2016, 1, 1),       // minFinishTime
                        null,                       // maxFinishTime
                        null,                       // requestedFor: string
                        bi.BuildReason.All,         // reason
                        bi.BuildStatus.Completed,
                        bi.BuildResult.Succeeded,
                        null,                       // tagFilters: string[]
                        null,                       // properties: string[]
                        //bi.DefinitionType.Build,
                        1                           // top: number
                        );

        if (builds.length > 0) {
            const latestBuild: bi.Build = builds[0];
            console.log(`build ${latestBuild.id}`);

            // Retrieve the list of artifacts for the latest build.
            cm.heading(`Artifacts for build ${latestBuild.id}, ${project} project`);
            const artifacts: bi.BuildArtifact[] = await vstsBuild.getArtifacts(project, latestBuild.id);

            let downloadableArtifact;
            for (const artifact of artifacts) {
definitionId = String(definitions[0].id);
                console.log(tl.loc("DefinitionNameMatchFound", definitionIdSpecified, definitionId));
            }

            if (!definitionId) {
                reject(tl.loc("UnresolvedDefinitionId"));
                return;
            }
        }

        // verify that buildId belongs to the definition selected
        if (definitionId) {
            var build: Build;
            if (buildVersionToDownload != "specific" && !triggeringBuildFound) {
                var resultFilter = BuildResult.Succeeded;
                if (allowPartiallySucceededBuilds) {
                    resultFilter |= BuildResult.PartiallySucceeded;
                }
                var branchNameFilter = (buildVersionToDownload == "latest") ? null : branchName;

                // get latest successful build filtered by branch
                var buildsForThisDefinition = await executeWithRetries("getBuildId", () => buildApi.getBuilds(projectId, [parseInt(definitionId)], null, null, null, null, null, null, BuildStatus.Completed, resultFilter, tagFilters, null, null, null, null, null, BuildQueryOrder.FinishTimeDescending, branchNameFilter), retryLimit).catch((reason) => {
                    reject(reason);
                    return;
                });

                if (!buildsForThisDefinition || buildsForThisDefinition.length == 0) {
                    if (buildVersionToDownload == "latestFromBranch") reject(tl.loc("LatestBuildFromBranchNotFound", branchNameFilter));
                    else reject(tl.loc("LatestBuildNotFound"));
                    return;
                }
cm.banner("Build Artifact Samples");
        const project = cm.getProject();
        console.log("project", project);

        // get the latest successful build.
        cm.heading(`Get latest successful build for ${project} project`);
        const builds: bi.Build[] = await vstsBuild.getBuilds(
                        project,
                        null,                       // definitions: number[]
                        null,                       // queues: number[]
                        null,                       // buildNumber
                        null, //new Date(2016, 1, 1),       // minFinishTime
                        null,                       // maxFinishTime
                        null,                       // requestedFor: string
                        bi.BuildReason.All,         // reason
                        bi.BuildStatus.Completed,
                        bi.BuildResult.Succeeded,
                        null,                       // tagFilters: string[]
                        null,                       // properties: string[]
                        //bi.DefinitionType.Build,
                        1                           // top: number
                        );

        if (builds.length > 0) {
            const latestBuild: bi.Build = builds[0];
            console.log(`build ${latestBuild.id}`);

            // Retrieve the list of artifacts for the latest build.
            cm.heading(`Artifacts for build ${latestBuild.id}, ${project} project`);
            const artifacts: bi.BuildArtifact[] = await vstsBuild.getArtifacts(project, latestBuild.id);

            let downloadableArtifact;
// 'system.debug': true,
          // 'agent.diagnostic': true,
        }
      )
  }, config.azureDevops.project);
  for (let i = 0; i < config.azureDevops.retries; i++) {
    await sleep(config.azureDevops.retryIntervalStep * (i + 1));
    build = await buildApi.getBuild(config.azureDevops.project, build.id);
    let statusName = BuildStatusEnum.getKeyOrThrow(build.status);
    let resultName = typeof build.result === 'undefined'
      ? 'undefined'
      : BuildResultEnum.getKeyOrThrow(build.result);
    console.log(`status: ${statusName}, result: ${resultName}`);
    switch (build.status) {
      case BuildStatus.Completed:
      case BuildStatus.Cancelling:
      case BuildStatus.Postponed:
        return build;
      case BuildStatus.None:
      case BuildStatus.InProgress:
      case BuildStatus.NotStarted:
        break;
      default:
        throw new Error(`Unknown build status ${build.status}`);
    }
  }
};
cm.banner("Build Artifact Samples");
        const project = cm.getProject();
        console.log("project", project);

        // get the latest successful build.
        cm.heading(`Get latest successful build for ${project} project`);
        const builds: bi.Build[] = await vstsBuild.getBuilds(
                        project,
                        null,                       // definitions: number[]
                        null,                       // queues: number[]
                        null,                       // buildNumber
                        null, //new Date(2016, 1, 1),       // minFinishTime
                        null,                       // maxFinishTime
                        null,                       // requestedFor: string
                        bi.BuildReason.All,         // reason
                        bi.BuildStatus.Completed,
                        bi.BuildResult.Succeeded,
                        null,                       // tagFilters: string[]
                        null,                       // properties: string[]
                        //bi.DefinitionType.Build,
                        1                           // top: number
                        );

        if (builds.length > 0) {
            const latestBuild: bi.Build = builds[0];
            console.log(`build ${latestBuild.id}`);

            // Retrieve the list of artifacts for the latest build.
            cm.heading(`Artifacts for build ${latestBuild.id}, ${project} project`);
            const artifacts: bi.BuildArtifact[] = await vstsBuild.getArtifacts(project, latestBuild.id);
console.log(tl.loc("DefinitionNameMatchFound", definitionIdSpecified, definitionId));
            }

            if (!definitionId) {
                reject(tl.loc("UnresolvedDefinitionId"));
                return;
            }
        }

        // verify that buildId belongs to the definition selected
        if (definitionId) {
            var build: Build;
            if (buildVersionToDownload != "specific" && !triggeringBuildFound) {
                var resultFilter = BuildResult.Succeeded;
                if (allowPartiallySucceededBuilds) {
                    resultFilter |= BuildResult.PartiallySucceeded;
                }
                var branchNameFilter = (buildVersionToDownload == "latest") ? null : branchName;

                // get latest successful build filtered by branch
                var buildsForThisDefinition = await executeWithRetries("getBuildId", () => buildApi.getBuilds(projectId, [parseInt(definitionId)], null, null, null, null, null, null, BuildStatus.Completed, resultFilter, tagFilters, null, null, null, null, null, BuildQueryOrder.FinishTimeDescending, branchNameFilter), retryLimit).catch((reason) => {
                    reject(reason);
                    return;
                });

                if (!buildsForThisDefinition || buildsForThisDefinition.length == 0) {
                    if (buildVersionToDownload == "latestFromBranch") reject(tl.loc("LatestBuildFromBranchNotFound", branchNameFilter));
                    else reject(tl.loc("LatestBuildNotFound"));
                    return;
                }

                build = buildsForThisDefinition[0];
const buildAzurePipelines = async function () {
  let authHandler = azureDevops.getPersonalAccessTokenHandler(config.azureDevops.token);
  let conn = new azureDevops.WebApi(config.azureDevops.endpoint, authHandler);
  var buildApi = await conn.getBuildApi();
  let build = await buildApi.queueBuild({
    definition: {
      id: config.azureDevops.definitionId,
    },
    parameters:
      JSON.stringify(
        {
          repo_url: 'https://github.com/rotorz/unity3d-localized-strings.git',
          repo_branch: 'v1.0.3',
          package_name: '@rotorz/unity3d-localized-strings',
          package_ver: '1.0.3',
          build_name: getBuildName('x', '@rotorz/unity3d-localized-strings', '1.0.3'),
          // 'system.debug': true,
          // 'agent.diagnostic': true,
        }
const buildAzurePipelines = async function () {
  let authHandler = azureDevops.getPersonalAccessTokenHandler(config.azureDevops.token);
  let conn = new azureDevops.WebApi(config.azureDevops.endpoint, authHandler);
  var buildApi = await conn.getBuildApi();
  let build = await buildApi.queueBuild({
    definition: {
      id: config.azureDevops.definitionId,
    },
    parameters:
      JSON.stringify(
        {
          repo_url: 'https://github.com/rotorz/unity3d-localized-strings.git',
          repo_branch: 'v1.0.3',
          package_name: '@rotorz/unity3d-localized-strings',
          package_ver: '1.0.3',
          build_name: getBuildName('x', '@rotorz/unity3d-localized-strings', '1.0.3'),
          // 'system.debug': true,
          // 'agent.diagnostic': true,
const INTEGRATION_DIR = path.join(__dirname, '..', '_layout', 'integrations');
const GIT = 'git';

var opt = require('node-getopt').create([
    ['',  'dryrun',               'Dry run only, do not actually commit new release'],
    ['h', 'help',                 'Display this help'],
  ])
  .setHelp(
    'Usage: node createAdoPrs.js [OPTION] \n' +
    '\n' +
    '[[OPTIONS]]\n'
  )
  .bindHelp()     // bind option 'help' to default action
  .parseSystem(); // parse command line

const authHandler = azdev.getPersonalAccessTokenHandler(process.env.PAT);
const connection = new azdev.WebApi('https://dev.azure.com/mseng', authHandler);

function createIntegrationFiles(newRelease, callback)
{
    fs.mkdirSync(INTEGRATION_DIR, { recursive: true });
    fs.readdirSync(INTEGRATION_DIR).forEach( function(entry) {
        if (entry.startsWith('PublishVSTSAgent-'))
        {
            // node 12 has recursive support in rmdirSync
            // but since most of us are still on node 10
            // remove the files manually first
            var dirToDelete = path.join(INTEGRATION_DIR, entry);
            fs.readdirSync(dirToDelete).forEach( function(file) {
                fs.unlinkSync(path.join(dirToDelete, file));
            });
            fs.rmdirSync(dirToDelete, { recursive: true });

Is your System Free of Underlying Vulnerabilities?
Find Out Now