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(containers): run ready actions when the deployment is ready #731

Conversation

noaccOS
Copy link
Collaborator

@noaccOS noaccOS commented Nov 20, 2024

drafted because it depends on #724 and 724 is not ready, but 2795152 is ready for review

@noaccOS noaccOS requested a review from lusergit November 20, 2024 18:01
Copy link
Collaborator

@lusergit lusergit left a comment

Choose a reason for hiding this comment

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

lgtm

@noaccOS noaccOS force-pushed the feat/run-ready-action branch from 2795152 to f81c876 Compare November 25, 2024 16:01
@noaccOS noaccOS marked this pull request as ready for review November 25, 2024 16:01
@noaccOS noaccOS force-pushed the feat/run-ready-action branch from f81c876 to bccdbc0 Compare November 25, 2024 16:09
Copy link
Collaborator

@lusergit lusergit left a comment

Choose a reason for hiding this comment

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

Overall approval, just a small comment on run_ready_actions.ex

Comment on lines 35 to 40
Enum.reduce_while(deployment.ready_actions, {:ok, deployment}, fn action, _acc ->
case Containers.run_ready_action(action) do
{:ok, _ready_action} -> {:cont, {:ok, deployment}}
{:error, reason} -> {:halt, {:error, reason}}
end
end)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe here we don't actually want to halt if one ready action fails, I think it would be better to just run the ready action and let them crash if something happens

Suggested change
Enum.reduce_while(deployment.ready_actions, {:ok, deployment}, fn action, _acc ->
case Containers.run_ready_action(action) do
{:ok, _ready_action} -> {:cont, {:ok, deployment}}
{:error, reason} -> {:halt, {:error, reason}}
end
end)
_ready_actions = Enum.map(deployment.ready_actions, &Containers.run_ready_action/1))
{:ok, deployment}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hard to say now because we don't have any information on what we want to do with multiple ready actions for the same deployment.
It's a problem we will encounter once the situation arises

@noaccOS noaccOS force-pushed the feat/run-ready-action branch from bccdbc0 to 6c12827 Compare November 25, 2024 16:23
@lusergit lusergit merged commit 50c3ce5 into edgehog-device-manager:feature/application-management Nov 25, 2024
8 checks passed
@noaccOS noaccOS deleted the feat/run-ready-action branch November 25, 2024 16:27
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