File persistence system for files outside the repository #31
Labels
enhancement
New feature or request
passed-dev-qa
Optional state. Use this when QAing other peoples fixes in another branch.ready to be merged to main
Problem this feature will solve
Any file not written to
/workspace
or deeper is not persisted between subsequent startups of a workspace.Because of this, on every subsequent startup of the workspace:
~/.gitconfig
has to be re-customized/var/log/worspace-init.log
gets blasted away.Background
See bug #30
Proposed Solution
Its hacky but until Gitpod supports file persistence outside of the `/workspace' directory let's do this:
/workspace/my-project
would have a ancillary folder called/workspace/my-project--store
.mark-as-inited
helper function to be called once frombash/init-complete.sh
as the very last line of code. Themark-as-inited
function will set anis_inited.lock
file (in the ancillary folder) that will serve as a flag for the workspace to know when it has already been started at least once already.is-inited
helper function to use as a hook (that checks for the presence ofis_inited.lock
) for determining if the workspace has been started before or not.persist_file
helper function that will copy the file passed in to it, to the ancillary project folder mentioned in bullet point 1. That folder will be created on-the-fly if it does not already exist.restore_persistent_files
helper function that will copy all file 'persisted' by thepersist_file
function from the ancillary project folder to their original locations.bash/before-tasks.sh
, right before themark_as_inited
function call. Set any persistent file you want by passing them to thepersist_file
function.before-tasks.sh
as the very last code block, check if the workspace has been run for the first time and if it has, restore all persistent files by callingrestore_persistent_files
. The code will look like this:Constraints and Assumptions
Alternatives or Workarounds
Unsure.
Additional context
Don't use this system too much because there is a bunch of boilerplate code that goes with it and eventually it will be a depricated system when Gitpod adds a file persistence feature.
The text was updated successfully, but these errors were encountered: