Skip to content
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

Merged
merged 3 commits into from
Oct 14, 2024
Merged

Conversation

adityachoudhari26
Copy link
Contributor

No description provided.

envs: Array<{ id: string; policyId?: string | null }>,
) =>
envs.map((e) => ({
id: `${e.policyId ?? "trigger"}-releaseSequencing-${e.id}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id: `${e.id}-releaseSequencing-${e.id}`,
id: `${e.id}-release-sequencing-${e.id}`,

Comment on lines +62 to +71
{isWaitingOnActive && (
<>
<Waiting /> Another release is in progress
</>
)}
{!isWaitingOnActive && !allJobs.isLoading && (
<>
<Passing /> All other releases finished
</>
)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we using fragments

Comment on lines 36 to 52
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"}
`;
Copy link
Member

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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id: env.id + "-releaseSequencing",
id: env.id + "-release-sequencing",

schema.releaseJobTrigger.id,
releaseJobTriggers.map((t) => t.id),
)}
and ${schema.environmentPolicy.releaseSequencing} = ${"cancel"}
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@adityachoudhari26 adityachoudhari26 merged commit 9cc03ba into main Oct 14, 2024
10 checks passed
@adityachoudhari26 adityachoudhari26 deleted the release-sequencing-cleanup branch October 14, 2024 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants