Store deployer lrn for each deployment
This commit is contained in:
parent
a9e69afe08
commit
22fb9323d7
@ -127,6 +127,9 @@ export class Deployment {
|
|||||||
@Column('simple-json', { nullable: true })
|
@Column('simple-json', { nullable: true })
|
||||||
applicationDeploymentRemovalRecordData!: AppDeploymentRemovalRecordAttributes | null;
|
applicationDeploymentRemovalRecordData!: AppDeploymentRemovalRecordAttributes | null;
|
||||||
|
|
||||||
|
@Column('varchar')
|
||||||
|
deployerLrn!: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
enum: Environment
|
enum: Environment
|
||||||
})
|
})
|
||||||
|
@ -50,7 +50,7 @@ export class Project {
|
|||||||
auctionId?: string | null;
|
auctionId?: string | null;
|
||||||
|
|
||||||
@Column({ type: 'simple-array', nullable: true })
|
@Column({ type: 'simple-array', nullable: true })
|
||||||
deployerLrn?: string[] | null;
|
deployerLrn!: string[] | null;
|
||||||
|
|
||||||
// TODO: Compute template & framework in import repository
|
// TODO: Compute template & framework in import repository
|
||||||
@Column('varchar', { nullable: true })
|
@Column('varchar', { nullable: true })
|
||||||
|
@ -553,7 +553,7 @@ export class Service {
|
|||||||
domain: prodBranchDomains[0],
|
domain: prodBranchDomains[0],
|
||||||
commitHash: oldDeployment.commitHash,
|
commitHash: oldDeployment.commitHash,
|
||||||
commitMessage: oldDeployment.commitMessage,
|
commitMessage: oldDeployment.commitMessage,
|
||||||
});
|
}, oldDeployment.deployerLrn);
|
||||||
|
|
||||||
return newDeployment;
|
return newDeployment;
|
||||||
}
|
}
|
||||||
@ -562,7 +562,7 @@ export class Service {
|
|||||||
userId: string,
|
userId: string,
|
||||||
octokit: Octokit,
|
octokit: Octokit,
|
||||||
data: DeepPartial<Deployment>,
|
data: DeepPartial<Deployment>,
|
||||||
lrn?: string
|
lrn: string
|
||||||
): Promise<Deployment> {
|
): Promise<Deployment> {
|
||||||
assert(data.project?.repository, 'Project repository not found');
|
assert(data.project?.repository, 'Project repository not found');
|
||||||
log(
|
log(
|
||||||
@ -629,6 +629,7 @@ export class Service {
|
|||||||
createdBy: Object.assign(new User(), {
|
createdBy: Object.assign(new User(), {
|
||||||
id: userId,
|
id: userId,
|
||||||
}),
|
}),
|
||||||
|
deployerLrn: lrn,
|
||||||
});
|
});
|
||||||
|
|
||||||
log(
|
log(
|
||||||
@ -887,7 +888,7 @@ export class Service {
|
|||||||
const { applicationDeploymentAuctionId } = await this.registry.createApplicationDeploymentAuction(repo, octokit, auctionData!, deploymentData);
|
const { applicationDeploymentAuctionId } = await this.registry.createApplicationDeploymentAuction(repo, octokit, auctionData!, deploymentData);
|
||||||
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.createRepoHook(octokit, project);
|
await this.createRepoHook(octokit, project);
|
||||||
@ -959,8 +960,15 @@ export class Service {
|
|||||||
branch,
|
branch,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const deployers = project.deployerLrn;
|
||||||
|
if (!deployers) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
await this.createDeployment(project.ownerId, octokit, {
|
await this.createDeployment(project.ownerId, octokit,
|
||||||
|
{
|
||||||
project,
|
project,
|
||||||
branch,
|
branch,
|
||||||
environment:
|
environment:
|
||||||
@ -970,10 +978,14 @@ export class Service {
|
|||||||
domain,
|
domain,
|
||||||
commitHash: headCommit.id,
|
commitHash: headCommit.id,
|
||||||
commitMessage: headCommit.message,
|
commitMessage: headCommit.message,
|
||||||
});
|
},
|
||||||
|
deployer
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
async updateProject(
|
async updateProject(
|
||||||
projectId: string,
|
projectId: string,
|
||||||
data: DeepPartial<Project>,
|
data: DeepPartial<Project>,
|
||||||
@ -1028,7 +1040,7 @@ export class Service {
|
|||||||
domain: oldDeployment.domain,
|
domain: oldDeployment.domain,
|
||||||
commitHash: oldDeployment.commitHash,
|
commitHash: oldDeployment.commitHash,
|
||||||
commitMessage: oldDeployment.commitMessage,
|
commitMessage: oldDeployment.commitMessage,
|
||||||
});
|
}, oldDeployment.deployerLrn);
|
||||||
|
|
||||||
return newDeployment;
|
return newDeployment;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ const Configure = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{isLoading ? 'Deploying' : 'Deploy'}
|
{isLoading ? 'Deploying repo' : 'Deploy repo'}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user