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';
|
||||
import { AppDeploymentRecord, AppDeploymentRemovalRecord, AuctionData } from './types';
|
||||
import { getConfig, getRepoDetails, sleep } from './utils';
|
||||
import { Auction } from '@cerc-io/registry-sdk/dist/proto/cerc/auction/v1/auction';
|
||||
|
||||
const log = debug('snowball:registry');
|
||||
|
||||
@ -428,8 +427,8 @@ export class Registry {
|
||||
const auctions = await this.registry.getAuctionsByIds(validAuctionIds);
|
||||
|
||||
const completedAuctions = auctions
|
||||
.filter((auction: Auction) => auction.status === 'completed')
|
||||
.map((auction: Auction) => auction.id);
|
||||
.filter((auction: { id: string, status: string }) => auction.status === 'completed')
|
||||
.map((auction: { id: string, status: string }) => auction.id);
|
||||
|
||||
return completedAuctions;
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ export class Service {
|
||||
|
||||
if (completedAuctionIds) {
|
||||
const projectsToBedeployed = projects.filter((project) =>
|
||||
completedAuctionIds.includes(project.auctionId!)
|
||||
completedAuctionIds.includes(project.auctionId!) && project.deployerLrns !== null
|
||||
);
|
||||
|
||||
for (const project of projectsToBedeployed) {
|
||||
@ -878,6 +878,7 @@ export class Service {
|
||||
await this.updateProject(project.id, { auctionId: applicationDeploymentAuctionId })
|
||||
} else {
|
||||
await this.createDeployment(user.id, octokit, deploymentData, lrn!);
|
||||
await this.updateProject(project.id, { deployerLrns: [lrn!] })
|
||||
}
|
||||
|
||||
await this.createRepoHook(octokit, project);
|
||||
@ -948,9 +949,7 @@ export class Service {
|
||||
});
|
||||
|
||||
const deployers = project.deployerLrns;
|
||||
if (!deployers) {
|
||||
return;
|
||||
}
|
||||
if (!deployers) return;
|
||||
|
||||
for (const deployer of deployers) {
|
||||
// Create deployment with branch and latest commit in GitHub data
|
||||
@ -970,7 +969,6 @@ export class Service {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async updateProject(
|
||||
|
@ -72,26 +72,6 @@ export interface AddProjectFromTemplateInput {
|
||||
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 {
|
||||
maxPrice: string,
|
||||
numProviders: number,
|
||||
|
Loading…
Reference in New Issue
Block a user