-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Git commit + push on workspace shutdown to backup unsaved workspace project changes #22308
Comments
Looks good to me. I couple of comments:
|
If we want to restore from a backup branch when possible, we should probably choose a deterministic name for the branch (e.g. For determining the remote to check, we already determine which remote to clone from, so we could check if that branch exists and clone that instead of what's selected in the devworkspace, though this might cause confusion ("I've been pushing to branch X but now branch Y is checked out") From a first pass, it looks like the configurable options we'd need to consider would be
In addition, we could consider whether we want to allow configuration at a workspace level or a per-project level (or both). Attributes would be a good candidate for this since they allow structured data rather than just strings. Implementation wise, we could potentially do everything required within DWO/project-clone itself, though if we implement it as a preStop hook we might have to consider collisions with preStop events, if we ever decide to implement those. Currently DWO will provision a preStop event handler when async storage is used, but this might be extended. |
A project that may be interesting for this https://github.com/tkellogg/dura |
@l0rd @amisevsk Thank you both for the thoughtful input.
Ideally, I'd like to support configuring this at the workspace and project level. If we only support this on a per-project basis, then users who want to use this feature for all workspaces will have to copy/paste the attribute for all projects. If we only support it on a workspace basis, then users don't have the granularity to only use it for the project they are actively working on.
I'm considering trying to implement support for multiple
This seems really cool & relevant to this feature. I think I should spend some time experimenting with dura to make sure it'll work nicely for our use case. My concern is ensuring the main workspace container image has the dura binary installed. However, the same concern exists for git: users could use a workspace container image that doesn't have git installed - so this concern might be outside our control. |
Issues go stale after Mark the issue as fresh with If this issue is safe to close now please do so. Moderators: Add |
/remove-lifecycle stale |
@AObuchow |
@tolusha I'm actually (slowly) still working on this issue, though it's low priority since no one has actively requested for it. |
Issues go stale after Mark the issue as fresh with If this issue is safe to close now please do so. Moderators: Add |
Is your enhancement related to a problem? Please describe
Using ephemeral storage can often provide faster workspace startup time (as storage does not have to be provisioned). However, there is the inherent disadvantage that any code changes to the project that the user is working on will not be persisted upon workspace shutdown. The user needs to commit and push their changes with git in order to retrieve them later on.
Describe the solution you'd like
It'd be nice to have a
spec.devEnvironments.gitBackup: <bool>
configuration option in the Che Cluster CR, that when enabled, will automatically commit all changes to the project in use, and push them to a unique branch, e.g.che-backup-<checked-out-branch-name>-YYYY-MM-DD-HH-MM-SS
.This could be implemented as a pre-stop event for workspace pods at the DevWorkspace Operator level.
There are some considerations that need to be made for this feature. Some that come to mind:
origin
andfork
. Since these remote names may be different on a per-devfile-basis, setting the default remote to "backup" to may be tricky. We may need something at the devfile or devworkspace level to specify which remote should be used for backups.preStop
events (though these are currently unsupported by DWO/Che)Describe alternatives you've considered
As
preStop
events are not currently supported by DWO, there's no way to manually configure a git commit and push on workspace shutdown from a devfile. Users using ephemeral storage must remember to always manually commit and push their workspaces changes before their workspace shuts down.Additional context
No response
The text was updated successfully, but these errors were encountered: