Update code to handle re-deployments on pushing

This commit is contained in:
IshaVenikar 2024-10-16 17:19:53 +05:30
parent a9f50a02f0
commit 9f6aa43586
3 changed files with 5 additions and 28 deletions

View File

@ -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;
}

View File

@ -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(

View File

@ -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,