Update code to handle re-deployments on pushing
This commit is contained in:
parent
a9f50a02f0
commit
9f6aa43586
@ -16,7 +16,6 @@ import {
|
|||||||
} from './entity/Deployment';
|
} from './entity/Deployment';
|
||||||
import { AppDeploymentRecord, AppDeploymentRemovalRecord, AuctionData } from './types';
|
import { AppDeploymentRecord, AppDeploymentRemovalRecord, AuctionData } from './types';
|
||||||
import { getConfig, getRepoDetails, sleep } from './utils';
|
import { getConfig, getRepoDetails, sleep } from './utils';
|
||||||
import { Auction } from '@cerc-io/registry-sdk/dist/proto/cerc/auction/v1/auction';
|
|
||||||
|
|
||||||
const log = debug('snowball:registry');
|
const log = debug('snowball:registry');
|
||||||
|
|
||||||
@ -428,8 +427,8 @@ export class Registry {
|
|||||||
const auctions = await this.registry.getAuctionsByIds(validAuctionIds);
|
const auctions = await this.registry.getAuctionsByIds(validAuctionIds);
|
||||||
|
|
||||||
const completedAuctions = auctions
|
const completedAuctions = auctions
|
||||||
.filter((auction: Auction) => auction.status === 'completed')
|
.filter((auction: { id: string, status: string }) => auction.status === 'completed')
|
||||||
.map((auction: Auction) => auction.id);
|
.map((auction: { id: string, status: string }) => auction.id);
|
||||||
|
|
||||||
return completedAuctions;
|
return completedAuctions;
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ export class Service {
|
|||||||
|
|
||||||
if (completedAuctionIds) {
|
if (completedAuctionIds) {
|
||||||
const projectsToBedeployed = projects.filter((project) =>
|
const projectsToBedeployed = projects.filter((project) =>
|
||||||
completedAuctionIds.includes(project.auctionId!)
|
completedAuctionIds.includes(project.auctionId!) && project.deployerLrns !== null
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const project of projectsToBedeployed) {
|
for (const project of projectsToBedeployed) {
|
||||||
@ -878,6 +878,7 @@ export class Service {
|
|||||||
await this.updateProject(project.id, { auctionId: applicationDeploymentAuctionId })
|
await this.updateProject(project.id, { auctionId: applicationDeploymentAuctionId })
|
||||||
} else {
|
} else {
|
||||||
await this.createDeployment(user.id, octokit, deploymentData, lrn!);
|
await this.createDeployment(user.id, octokit, deploymentData, lrn!);
|
||||||
|
await this.updateProject(project.id, { deployerLrns: [lrn!] })
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.createRepoHook(octokit, project);
|
await this.createRepoHook(octokit, project);
|
||||||
@ -948,9 +949,7 @@ export class Service {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const deployers = project.deployerLrns;
|
const deployers = project.deployerLrns;
|
||||||
if (!deployers) {
|
if (!deployers) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const deployer of deployers) {
|
for (const deployer of deployers) {
|
||||||
// Create deployment with branch and latest commit in GitHub data
|
// Create deployment with branch and latest commit in GitHub data
|
||||||
@ -970,7 +969,6 @@ export class Service {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateProject(
|
async updateProject(
|
||||||
|
@ -72,26 +72,6 @@ export interface AddProjectFromTemplateInput {
|
|||||||
isPrivate: boolean;
|
isPrivate: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Auction {
|
|
||||||
id: string;
|
|
||||||
kind: string;
|
|
||||||
status: string;
|
|
||||||
ownerAddress: string;
|
|
||||||
createTime: Date;
|
|
||||||
commitsEndTime: Date;
|
|
||||||
revealsEndTime: Date;
|
|
||||||
commitFee: string;
|
|
||||||
revealFee: string;
|
|
||||||
minimumBid?: string;
|
|
||||||
winnerAddresses: string[];
|
|
||||||
winnerBids?: string[];
|
|
||||||
winnerPrice?: string;
|
|
||||||
maxPrice?: string;
|
|
||||||
numProviders: number;
|
|
||||||
fundsReleased: boolean;
|
|
||||||
bids: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AuctionData {
|
export interface AuctionData {
|
||||||
maxPrice: string,
|
maxPrice: string,
|
||||||
numProviders: number,
|
numProviders: number,
|
||||||
|
Loading…
Reference in New Issue
Block a user