Store deployer lrn for each deployment
This commit is contained in:
parent
1dc8dcabb1
commit
f445d0b956
@ -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,19 +960,30 @@ export class Service {
|
|||||||
branch,
|
branch,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create deployment with branch and latest commit in GitHub data
|
const deployers = project.deployerLrn;
|
||||||
await this.createDeployment(project.ownerId, octokit, {
|
if (!deployers) {
|
||||||
project,
|
return;
|
||||||
branch,
|
}
|
||||||
environment:
|
|
||||||
project.prodBranch === branch
|
for (const deployer of deployers) {
|
||||||
? Environment.Production
|
// Create deployment with branch and latest commit in GitHub data
|
||||||
: Environment.Preview,
|
await this.createDeployment(project.ownerId, octokit,
|
||||||
domain,
|
{
|
||||||
commitHash: headCommit.id,
|
project,
|
||||||
commitMessage: headCommit.message,
|
branch,
|
||||||
});
|
environment:
|
||||||
|
project.prodBranch === branch
|
||||||
|
? Environment.Production
|
||||||
|
: Environment.Preview,
|
||||||
|
domain,
|
||||||
|
commitHash: headCommit.id,
|
||||||
|
commitMessage: headCommit.message,
|
||||||
|
},
|
||||||
|
deployer
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateProject(
|
async updateProject(
|
||||||
@ -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