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

feat: add ability to control semantics for Freight being made available to a Stage #3257

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aidan-canva
Copy link

Closes #3207

Adds concept of 'availability strategy' to a Freight Request to allow users to control the semantics used to determine if (verified) Freight is made available to a stage.

Default behavior is to make a Freight available if 'any' of the upstream Stages have verified it. This is backwards compatible with the current state of behavior. Users can explicitly configure UpstreamAny (default behavior) or UpstreamAll (enums) as possible values. UpstreamAll will only make Freight available if all of the configure upstream Stages have verified it. An enum was chosen over a boolean as it is possible other option could be implemented in the future (ie, promote when a majority of upstream have verified the Freight).

This condition is applied on-top of existing Freight Request controls, such as the recently added minimum bake time control. For that reason, perhaps its better suited to sit closer to FreightSources where the RequiredSoakTime is configured.

@aidan-canva aidan-canva requested a review from a team as a code owner January 13, 2025 10:18
Copy link

netlify bot commented Jan 13, 2025

Deploy Preview for docs-kargo-io ready!

Name Link
🔨 Latest commit bfa3654
🔍 Latest deploy log https://app.netlify.com/sites/docs-kargo-io/deploys/6784e9388e635f00086037c4
😎 Deploy Preview https://deploy-preview-3257.docs.kargo.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

…n all upstream Stages

Signed-off-by: Aidan Rowe <aidan@canva.com>
@aidan-canva aidan-canva force-pushed the feat-freight-availability-all-semantic branch from c6645f0 to bfa3654 Compare January 13, 2025 10:21
@aidan-canva
Copy link
Author

FYI @krancour

@krancour
Copy link
Member

@aidan-canva sorry for the delay. At a glance, this looks fantastic. I'll dig deeper on Monday and maybe have @hiddeco look as well.

Copy link
Contributor

@hiddeco hiddeco left a comment

Choose a reason for hiding this comment

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

For that reason, perhaps its better suited to sit closer to FreightSources where the RequiredSoakTime is configured.

After reviewing your code, I think this is a good observation, and I would feel more comfortable with it sitting at the same level as RequiredSoakTime. This would make the setting count for the list item (just like the soak time requirement), which I feel is better.

Other than this and my question/suggestion below, this looks like a straight forward implementation and a job well done. 🌷

VerifiedIn: req.Sources.Stages,
ApprovedFor: s.Name,
VerifiedIn: req.Sources.Stages,
RequireAllVerifiedIn: req.AvailabilityStrategy == FreightAvailabilityStrategyAllUpstream,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a specific reason you made the RequireAllVerifiedIn a boolean instead of just passing on the strategy?

Comment on lines +134 to +137
const (
FreightAvailabilityStrategyAllUpstream FreightAvailabilityStrategy = "AllUpstream"
FreightAvailabilityStrategyAnyUpstream FreightAvailabilityStrategy = "AnyUpstream"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Wonder if brevity might be an improvement here, but open to discussion.

Suggested change
const (
FreightAvailabilityStrategyAllUpstream FreightAvailabilityStrategy = "AllUpstream"
FreightAvailabilityStrategyAnyUpstream FreightAvailabilityStrategy = "AnyUpstream"
)
const (
FreightAvailabilityStrategyAll FreightAvailabilityStrategy = "All"
FreightAvailabilityStrategyOneOf FreightAvailabilityStrategy = "OneOf"
)

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.

feat: opt-in to "all" semantics when determining freight's availability to a given stage
3 participants