How to use the azure-devops-node-api/interfaces/BuildInterfaces.BuildReason function in azure-devops-node-api

To help you get started, we’ve selected a few azure-devops-node-api 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-devops-node-api / samples / buildArtifact.ts View on Github external
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);