-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Clean up release sequencing #137
Conversation
envs: Array<{ id: string; policyId?: string | null }>, | ||
) => | ||
envs.map((e) => ({ | ||
id: `${e.policyId ?? "trigger"}-releaseSequencing-${e.id}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id: `${e.policyId ?? "trigger"}-releaseSequencing-${e.id}`, | |
id: `${e.policyId ?? "trigger"}-release-sequencing-${e.id}`, |
envs: Array<{ id: string; policyId?: string | null }>, | ||
) => | ||
envs.map((e) => ({ | ||
id: `${e.id}-releaseSequencing-${e.id}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id: `${e.id}-releaseSequencing-${e.id}`, | |
id: `${e.id}-release-sequencing-${e.id}`, |
{isWaitingOnActive && ( | ||
<> | ||
<Waiting /> Another release is in progress | ||
</> | ||
)} | ||
{!isWaitingOnActive && !allJobs.isLoading && ( | ||
<> | ||
<Passing /> All other releases finished | ||
</> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we using fragments
const jobsToCancelQuery = sql` | ||
select distinct triggers.jobIdToCancel | ||
from ${schema.releaseJobTrigger} | ||
inner join ${schema.release} on ${schema.releaseJobTrigger.releaseId} = ${schema.release.id} | ||
inner join ${schema.deployment} on ${schema.release.deploymentId} = ${schema.deployment.id} | ||
inner join ${schema.environment} on ${schema.releaseJobTrigger.environmentId} = ${schema.environment.id} | ||
inner join ${schema.environmentPolicy} on ${schema.environment.policyId} = ${schema.environmentPolicy.id} | ||
inner join (${triggersSubquery}) as triggers on | ||
${schema.deployment.id} = triggers.cancelDeploymentId | ||
and ${schema.releaseJobTrigger.environmentId} = triggers.cancelEnvironmentId | ||
and ${schema.release.id} != triggers.cancelReleaseId | ||
where ${inArray( | ||
schema.releaseJobTrigger.id, | ||
releaseJobTriggers.map((t) => t.id), | ||
)} | ||
and ${schema.environmentPolicy.releaseSequencing} = ${"cancel"} | ||
`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you do this in drizzle, there is no way you cannot
...envs.map((env) => { | ||
const policy = policies.find((p) => p.id === env.policyId); | ||
return { | ||
id: env.id + "-releaseSequencing", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id: env.id + "-releaseSequencing", | |
id: env.id + "-release-sequencing", |
schema.releaseJobTrigger.id, | ||
releaseJobTriggers.map((t) => t.id), | ||
)} | ||
and ${schema.environmentPolicy.releaseSequencing} = ${"cancel"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use the enum value directly?
.execute(jobsToCancelQuery) | ||
.then((r) => r.rows.map((r) => String(r.jobidtocancel))); | ||
|
||
console.log("jobsToCancel", jobsToCancel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
No description provided.