Skip to content

feat(agent): Add shutdown lifecycle states and shutdown_script support #6139

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

Merged
merged 21 commits into from
Mar 6, 2023

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Feb 9, 2023

This PR adds support for agent shutdown lifecycle states and shutdown_script.

It (currently) relies on terraform provider abilities to gracefully shut down. For instance with the docker provider it can be controlled via:

resource "docker_container" "workspace" {
  destroy_grace_seconds = 30
  stop_timeout          = 30
  stop_signal           = "SIGINT"
}

The agent can handle common signals like SIGHUP, SIGINT, SIGTERM. If need be, more signals could be handled.

Builds upon #5171
Fixes #4677

Note:

  • In hindsight, I should probably have called the lifecycle states stopping, stop_timeout, stop_error, stopped, yay or nay to make this change?

@mafredri
Copy link
Member Author

mafredri commented Feb 13, 2023

TODOs (a1222d0) have been removed in favor of #6180 (primarily #6177).

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

Nice!

LGTM, but I didn't analyze it too deeply as the PR is massive.

@mafredri mafredri force-pushed the mafredri/feat-shutdown-script branch from 2ac1a38 to 2ca1810 Compare February 20, 2023 13:35
@kylecarbs kylecarbs removed their request for review February 26, 2023 18:05
@github-actions
Copy link

github-actions bot commented Mar 6, 2023

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Mar 6, 2023
@mtojek
Copy link
Member

mtojek commented Mar 6, 2023

Hey @mafredri! Is it something that you will continue to work soon?

@mafredri
Copy link
Member Author

mafredri commented Mar 6, 2023

Hey @mafredri! Is it something that you will continue to work soon?

Yup, I'll get this rebased and (try to) merge it today. 👍🏻

@mafredri mafredri force-pushed the mafredri/feat-shutdown-script branch from 2ca1810 to 22ad8b9 Compare March 6, 2023 12:04
@mafredri mafredri removed the stale This issue is like stale bread. label Mar 6, 2023
@mafredri mafredri changed the title feat(agent): Add shutdown lifecycle states and shutdown_script support feat(agent): Add shutdown lifecycle states and shutdown_script support Mar 6, 2023
@mafredri mafredri merged commit 22e3ff9 into main Mar 6, 2023
@mafredri mafredri deleted the mafredri/feat-shutdown-script branch March 6, 2023 19:34
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.

Run script before workspace stop
2 participants