How to use RepositoryBuilds method in argos

Best JavaScript code snippet using argos

manage.ts

Source:manage.ts Github

copy

Full Screen

1import { ipcRenderer as ipc } from 'electron'2import { Action, Module, Mutation, VuexModule } from 'vuex-module-decorators'3import { Events } from '../../../common/events'4import { AccountType } from '../../../common/models/AccountType'5import { fetchOutcomeOfMostRecentBuild } from '../../../common/utils'6import { bitbucketApi } from '../../api/BitbucketApi'7import { circleCiApi } from '../../api/CircleCiApi'8import { githubApi } from '../../api/GithubApi'9import { IRootState } from '../index'10import { Outcome } from '../models/build'11import { Repository } from '../models/repository'12import { RepositoryBuilds } from '../models/repository-builds'13import { sendBuildFailedNotification } from '../side-effects'14export interface IManageState {15 buildInfo: RepositoryBuilds[]16 projects: Repository[]17 projectSearchIds: string[]18 projectSearching: boolean19 pollingSeconds: number20 globalBuildStatus: Outcome21 individualBuildStatus: Array<{repository: Repository, outCome: Outcome}>22}23@Module({namespaced: true, name: 'manage'})24export class Manage extends VuexModule implements IManageState {25 buildInfo: RepositoryBuilds[] = []26 projects: Repository[] = []27 projectSearchIds: string[] = []28 projectSearching = false29 pollingSeconds = 3030 globalBuildStatus: Outcome = 'UNKNOWN'31 individualBuildStatus: Array<{repository: Repository, outCome: Outcome}> = []32 timeoutId: NodeJS.Timeout | undefined33 @Mutation34 setPollingSeconds(seconds: number) {35 if (!seconds || seconds < 10) {36 this.pollingSeconds = 1037 } else {38 this.pollingSeconds = seconds39 }40 }41 @Mutation42 setProjectToSelected(id: string) {43 const repository = this.projects.find(p => p.id === id)44 if (!repository) {45 return46 }47 const modified: Repository = {...repository, selected: true}48 this.projects = [...this.projects.filter(p => p.id !== repository.id), modified]49 }50 @Mutation51 setProjectToUnselected(id: string) {52 const repository = this.projects.find(p => p.id === id)53 if (!repository) {54 return55 }56 const modified: Repository = {...repository, selected: false}57 this.projects = [...this.projects.filter(u => u.id !== repository.id), modified]58 }59 @Mutation60 updateBuildInfo(buildInfo: RepositoryBuilds[]) {61 this.buildInfo = buildInfo62 }63 @Mutation64 updateGlobalBuildStatus(buildInfo: RepositoryBuilds[]) {65 const allOutcomes: Outcome[] = buildInfo.map(r => fetchOutcomeOfMostRecentBuild(r.builds))66 if (allOutcomes.some(o => o === 'FAILED')) {67 if (this.globalBuildStatus === 'FAILED') {68 return; // if globalBuildStatus was already in failed, return.69 }70 ipc.send(Events.BUILD_STATUS_CHANGED, {outcome: 'FAILED'})71 this.globalBuildStatus = 'FAILED'72 } else if (allOutcomes.some(o => o === 'ONGOING')) {73 if (this.globalBuildStatus === 'ONGOING') {74 return;75 }76 ipc.send(Events.BUILD_STATUS_CHANGED, {outcome: 'ONGOING'})77 this.globalBuildStatus = 'ONGOING'78 } else if (allOutcomes.some(o => o === 'SUCCESSFUL')) {79 if (this.globalBuildStatus === 'SUCCESSFUL') {80 return;81 }82 ipc.send(Events.BUILD_STATUS_CHANGED, {outcome: 'SUCCESSFUL'})83 this.globalBuildStatus = 'SUCCESSFUL'84 }85 }86 @Mutation87 updateIndividualBuildStatus(payload: {buildInfo: RepositoryBuilds[], notificationsEnabled: boolean}) {88 const newOutcomes: {repository: Repository, outCome: Outcome}[] = payload.buildInfo.map(r => ({89 repository: r.repository,90 outCome: fetchOutcomeOfMostRecentBuild(r.builds)91 }))92 if (payload.notificationsEnabled) {93 newOutcomes.forEach(n => {94 const existingOutcome = this.individualBuildStatus.find(i => i.repository.id === n.repository.id)95 if (existingOutcome) {96 if (existingOutcome.outCome === 'FAILED') {97 return98 } else if (n.outCome === 'FAILED') {99 sendBuildFailedNotification(n.repository)100 }101 } else {102 if (n.outCome === 'FAILED') {103 sendBuildFailedNotification(n.repository)104 }105 }106 })107 }108 this.individualBuildStatus = newOutcomes109 }110 @Mutation111 updateProjectInfo(repositories: Repository[]) {112 repositories.forEach(r => {113 const localProject = this.projects.find(p => p.id === r.id)114 if (localProject) {115 const project: Repository = {...r, selected: localProject.selected}116 this.projects = [...this.projects.filter(p => p.id !== r.id), project]117 } else {118 this.projects.push(r)119 }120 })121 }122 @Mutation123 addSearchIds(ids: string[]) {124 this.projectSearchIds = [...this.projectSearchIds.filter(id => !ids.includes(id)), ...ids]125 this.projectSearching = true126 }127 @Mutation128 clearSearchIds() {129 this.projectSearchIds = []130 }131 @Mutation132 setSearchFilter(filter: boolean) {133 this.projectSearching = filter134 }135 @Action({rawError: true})136 public async searchProjects(payload: {search: string, accountTypes: AccountType[]}) {137 const {search, accountTypes} = payload138 const projectInfo: Repository[] = []139 try {140 if (!search) {141 this.context.commit('setSearchFilter', false)142 return143 }144 let promiseBitbucket: Promise<Repository[]> | undefined145 let promiseCircle: Promise<Repository[]> | undefined146 let promiseGithub: Promise<Repository[]> | undefined147 if (accountTypes.includes("bitbucket-cloud")) {148 promiseBitbucket = bitbucketApi.requestProjectInfo(search)149 }150 if (accountTypes.includes("circleci")) {151 promiseCircle = circleCiApi.requestProjectInfo(search)152 }153 if (accountTypes.includes("github")) {154 promiseGithub = githubApi.requestProjectInfo(search)155 }156 if (promiseBitbucket){157 try {158 const projects = await promiseBitbucket;159 projectInfo.push(...projects)160 } catch (e) {161 await this.context.dispatch('app/setError', e, {root: true})162 }163 }164 if (promiseCircle) {165 try {166 const projects = await promiseCircle;167 projectInfo.push(...projects)168 } catch (e) {169 await this.context.dispatch('app/setError', e, {root: true})170 }171 }172 if (promiseGithub) {173 try {174 const projects = await promiseGithub;175 projectInfo.push(...projects)176 } catch (e) {177 await this.context.dispatch('app/setError', e, {root: true})178 }179 }180 this.context.commit('updateProjectInfo', projectInfo)181 this.context.commit('clearSearchIds')182 this.context.commit('addSearchIds', projectInfo.map(p => p.id))183 } catch (e) {184 await this.context.dispatch('app/setError', e, {root: true})185 }186 }187 @Action({rawError: true})188 public async fetchMyBuildData() {189 const promises: Promise<RepositoryBuilds>[] =190 this.projects191 .filter(p => p.selected)192 .map(f => {193 if (f.accountType === 'bitbucket-cloud') {194 return bitbucketApi.requestBuildInfo(f.fullname)195 .then(b => ({repository: f, builds: b} as RepositoryBuilds))196 } else if (f.accountType === 'circleci') {197 return circleCiApi.requestBuildInfo(f.fullname)198 .then(b => ({repository: f, builds: b} as RepositoryBuilds))199 } else if (f.accountType === 'github') {200 return githubApi.requestBuildInfo(f.fullname)201 .then(b => ({repository: f, builds: b} as RepositoryBuilds))202 } else {203 // backwards-compatible: return bitbucket pipelines (if any)204 return bitbucketApi.requestBuildInfo(f.fullname)205 .then(b => ({repository: f, builds: b} as RepositoryBuilds))206 }207 })208 try {209 const respositoryBuilds = await Promise.all(promises)210 this.context.commit('updateBuildInfo', respositoryBuilds)211 this.context.commit('updateGlobalBuildStatus', respositoryBuilds)212 const notificationsEnabled = (this.context.rootState as IRootState).app.notificationsEnabled213 this.context.commit('updateIndividualBuildStatus', {buildInfo: respositoryBuilds, notificationsEnabled: notificationsEnabled})214 } catch (e) {215 await this.context.dispatch('app/setError', e, {root: true})216 }217 }218 @Action({rawError: true})219 public async listenToMyBuildInfo() {220 if (this.timeoutId) {221 clearTimeout(this.timeoutId)222 }223 this.timeoutId = setInterval(() => {224 this.context.dispatch('fetchMyBuildData')225 }, this.pollingSeconds * 1000)226 await this.context.dispatch('fetchMyBuildData')227 }...

Full Screen

Full Screen

repositoryBuildTests.js

Source:repositoryBuildTests.js Github

copy

Full Screen

1/* eslint-env mocha */2const expect = require("chai").expect;3const repositoryBuilds = require("../lib/repositoryBuilds");4const mockClient = require("./mockClient");5describe("Repository builds", function() {6 beforeEach(() => {7 mockClient.reset();8 repositoryBuilds.setClient(mockClient);9 });10 it("should be able to add a build", async function() {11 await repositoryBuilds.updateRepositoryBuild("some-org", "some-repo", {12 id: "some-build"13 });14 expect(15 mockClient.getCache()["stampede-some-org-some-repo-repositoryBuilds"]16 ).to.include("some-build");17 });18 it("should be able to remove a build", async function() {19 await repositoryBuilds.updateRepositoryBuild("some-org", "some-repo", {20 id: "some-build"21 });22 await repositoryBuilds.removeRepositoryBuild(23 "some-org",24 "some-repo",25 "some-build"26 );27 expect(28 mockClient.getCache()["stampede-some-org-some-repo-repositoryBuilds"]29 ).to.not.include("some-build");30 });31 it("should be able to retrieve a single build", async function() {32 await repositoryBuilds.updateRepositoryBuild("some-org", "some-repo", {33 id: "some-build"34 });35 const info = await repositoryBuilds.fetchRepositoryBuild(36 "some-org",37 "some-repo",38 "some-build"39 );40 expect(info.id).to.equal("some-build");41 });42 it("should be able to update a build", async function() {43 await repositoryBuilds.updateRepositoryBuild("some-org", "some-repo", {44 id: "some-build"45 });46 const info = await repositoryBuilds.fetchRepositoryBuild(47 "some-org",48 "some-repo",49 "some-build"50 );51 expect(info.lastUpdated).to.be.undefined;52 await repositoryBuilds.updateRepositoryBuild("some-org", "some-repo", {53 id: "some-build",54 lastUpdated: "now"55 });56 const updatedinfo = await repositoryBuilds.fetchRepositoryBuild(57 "some-org",58 "some-repo",59 "some-build"60 );61 expect(updatedinfo.lastUpdated).to.equal("now");62 });63 // it("should be able to store system queues", async function() {64 // await systemQueues.storeSystemQueues(["some-queue", "some-other-queue"]);65 // expect(mockClient.getCache()["stampede-config-queues"]).to.include(66 // "some-queue"67 // );68 // });69 // it("should be able to fetch system queues", async function() {70 // await systemQueues.storeSystemQueues(["some-queue", "some-other-queue"]);71 // const queues = await systemQueues.fetchSystemQueues();72 // expect(queues).to.include("some-queue");73 // expect(queues).to.include("some-other-queue");74 // });75 // it("should be able to add a system queue", async function() {76 // await systemQueues.storeSystemQueues(["some-queue", "some-other-queue"]);77 // await systemQueues.addSystemQueue("some-third-queue");78 // const queues = await systemQueues.fetchSystemQueues();79 // expect(queues).to.include("some-queue");80 // expect(queues).to.include("some-other-queue");81 // expect(queues).to.include("some-third-queue");82 // });83 // it("should be able to remove a system queue", async function() {84 // await systemQueues.storeSystemQueues(["some-queue", "some-other-queue"]);85 // await systemQueues.removeSystemQueue("some-queue");86 // const queues = await systemQueues.fetchSystemQueues();87 // expect(queues).to.not.include("some-queue");88 // expect(queues).to.include("some-other-queue");89 // });...

Full Screen

Full Screen

repository-builds.service.ts

Source:repository-builds.service.ts Github

copy

Full Screen

...25 variables: { scmId: scmdId, repository: repositoryName },26 })27 .pipe(map((result: ApolloQueryResult<{ repositoryBuilds: Array<RepositoryBuild> }>) => result.data.repositoryBuilds))28 }29 getRepositoryBuilds(repository: string) {30 return this.apollo.query({31 query: gql`32 query getRepositoryBuilds($repository: String){33 repositoryBuilds(repository: $repository){34 buildStatus35 commit36 endTime37 repository38 scmId39 startTime40 tag41 timestamp42 buildId43 }44 }`,45 variables: { repository: repository },46 })...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var argosyPatterns = require('argosy-patterns')3var argosyService = require('argosy-service')4var argosyPipeline = require('argosy-pipeline')5var argosyRepository = require('argosy-repository')6var argosyRepositoryBuilds = require('argosy-repository-builds')7var argosyRepositorySearch = require('argosy-repository-search')8var argosyPatterns = require('argosy-patterns')9var service = argosy()10 .pipe(argosyPatterns({11 builds: argosyRepositoryBuilds({12 search: argosyRepositorySearch({13 query: argosyRepository({14 get: function (id, cb) {15 cb(null, { id: id, name: 'test' })16 }17 })18 })19 })20 }))21 .pipe(argosyService({22 }))23 .listen({ port: 8000 })24service.request({25 builds: {26 search: {27 query: {28 }29 }30 }31}, function (err, response) {32 console.log(response)33})34### `argosyRepositoryBuilds([options])`

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var argosyPatterns = require('argosy-patterns')3var argosyService = argosy()4var argosyPatternsService = argosyPatterns(argosyService)5var argosyService = argosy()6var argosyPatternsService = argosyPatterns(argosyService)7argosyService.accept({role: 'test', cmd: 'test'}, function (msg, respond) {8 respond(null, {message: 'This is a test'})9})10argosyService.listen(8001)11var argosyService = argosy()12var argosyPatternsService = argosyPatterns(argosyService)13argosyService.accept({role: 'test', cmd: 'test'}, function (msg, respond) {14 respond(null, {message: 'This is a test'})15})16argosyService.listen(8001)17var argosyService = argosy()18var argosyPatternsService = argosyPatterns(argosyService)19argosyService.accept({role: 'test', cmd: 'test'}, function (msg, respond) {20 respond(null, {message: 'This is a test'})21})22argosyService.listen(8001)23var argosyService = argosy()24var argosyPatternsService = argosyPatterns(argosyService)25argosyService.accept({role: 'test', cmd: 'test'}, function (msg, respond) {26 respond(null, {message: 'This is a test'})27})28argosyService.listen(8001)29var argosyService = argosy()30var argosyPatternsService = argosyPatterns(argosyService)31argosyService.accept({role: 'test', cmd: 'test'}, function (msg, respond) {32 respond(null, {message: 'This is a test'})33})34argosyService.listen(8001)35var argosyService = argosy()36var argosyPatternsService = argosyPatterns(argosyService)

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var repository = require('argosy-repository')3var pattern = require('argosy-pattern')4var h = require('highland')5var _ = require('lodash')6var svc = argosy()7svc.pipe(repository()).pipe(svc)8var builds = svc.accept({role: 'repository', cmd: 'RepositoryBuilds'})9var stream = h(builds({repo: '

Full Screen

Using AI Code Generation

copy

Full Screen

1var repoApi = require('argos-repo-api');2repoApi.RepositoryBuilds('argos-repo', 'master', function (err, data) {3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var repoApi = require('argos-repo-api');10repoApi.RepositoryCommits('argos-repo', 'master', function (err, data) {11 if (err) {12 console.log(err);13 } else {14 console.log(data);15 }16});17var repoApi = require('argos-repo-api');18repoApi.RepositoryContributors('argos-repo', function (err, data) {19 if (err) {20 console.log(err);21 } else {22 console.log(data);23 }24});25var repoApi = require('argos-repo-api');26repoApi.RepositoryDeployments('argos-repo', 'master', function (err, data) {27 if (err) {28 console.log(err);29 } else {30 console.log(data);31 }32});33var repoApi = require('argos-repo-api');34repoApi.RepositoryDownloads('argos-repo', function (err, data) {35 if (err) {36 console.log(err);

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosRepo = require('argos-repo');2var options = {3};4argosRepo.RepositoryBuilds(options, function (err, data) {5 if (err) {6 console.log(err);7 }8 else {9 console.log(data);10 }11});

Full Screen

Using AI Code Generation

copy

Full Screen

1const api = require('argos-ci-api');2const myApi = new api();3myApi.RepositoryBuilds('argos-ci', 'argos', 3)4 .then((builds) => {5 console.log(builds);6 });7### RepositoryBuildsBySha(repository, sha, limit)8const api = require('argos-ci-api');9const myApi = new api();10myApi.RepositoryBuildsBySha('argos-ci', 'f2d7c7a1a8c2d0a2e2a9e9e0b8a0a7e1b1d7c7a1', 3)11 .then((builds) => {12 console.log(builds);13 });14### RepositoryBuildsByBranch(repository, branch, limit)15const api = require('argos-ci-api');16const myApi = new api();17myApi.RepositoryBuildsByBranch('argos-ci', 'master', 3)18 .then((builds) => {19 console.log(builds);20 });21### RepositoryBuildsByTag(repository, tag, limit)22const api = require('argos-ci-api');23const myApi = new api();24myApi.RepositoryBuildsByTag('argos-ci', 'v0.4.0', 3)25 .then((builds) => {26 console.log(builds);27 });28### RepositoryBuildsByPullRequest(repository, pullRequest, limit)29const api = require('argos-ci-api');30const myApi = new api();31myApi.RepositoryBuildsByPullRequest('argos-ci', '2', 3)32 .then((build

Full Screen

Using AI Code Generation

copy

Full Screen

1var sdk = require('argos-sdk');2var RepositoryBuilds = sdk.RepositoryBuilds;3var options = {4};5var builds = new RepositoryBuilds(options);6builds.fetch().then(function (results) {7 console.log(results);8});9var sdk = require('argos-sdk');10var Build = sdk.Build;11var options = {12};13var build = new Build(options);14build.fetch().then(function (results) {15 console.log(results);16});17See [CONTRIBUTING.md](

Full Screen

Using AI Code Generation

copy

Full Screen

1var repoService = require('argos-repo-service');2var repoBuilds = repoService.RepositoryBuilds();3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var repoService = require('argos-repo-service');10var repoBuilds = repoService.RepositoryBuilds();11 if (err) {12 console.log(err);13 } else {14 console.log(data);15 }16});17## RepositoryBuilds.getBuilds(url, repository, callback)18## RepositoryBuilds.getBuild(url, repository, build, callback)19## RepositoryBuilds.getBuildsForBranch(url, repository, branch, callback)20## RepositoryBuilds.getBuildsForTag(url, repository, tag, callback)

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosyService = require('argosy-service')2var argosy = require('argosy')3var service = argosyService({4})5var client = argosy({6 request: function (pattern, cb) {7 cb(null, pattern)8 }9})10client.pipe(service).pipe(client)11client({12}, function (error, builds) {13 if (error) {14 console.error(error)15 } else {16 console.log(builds)17 }18})

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run argos automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful