my127 / workspace

Development environment tooling
MIT License
16 stars 13 forks source link

Workspace should auto-download a new harness version if it has changed in workspace.yml #76

Open jameshalsall opened 3 years ago

jameshalsall commented 3 years ago

Currently, if you pull some changes from your repository that include a harness version bump, you have to manually remove the .my127ws harness directory and redownload it with ws harness download (or run ws install).

It would be nice to have workspace check some kind of metafile in the .my127ws directory that contains harness info, like the version number, and compare it to the current version defined in workspace.yml. If it differs, then it should automatically download the new version of the harness.

Workspace could generate this metafile in the .my127ws directory after a harness download.

jameshalsall commented 3 years ago

As discussed with @dcole-inviqa directly, we should have workspace do something like the following

  1. Check the metafile each time workspace commands are invoked
  2. If the harness version in the metafile matches project workspace.yml then do as normal; otherwise
  3. Prompt the user, with something like "Looks like your downloaded harness version does not match the one defined in workspace.yml, would you like to download the correct version now?"
  4. Fire an event that harnesses can hook into for before-harness-auto-download
  5. Do the harness re-download
  6. Fire another event that harnesses can hook into for after-harness-auto-download

In step 4 and 6, harnesses will be able to cleanly shut down any running environment, and bring it back up as safe as possible without completely destroying it, which would lead to poor DX.

Also, it might be worth making this feature opt-in per harness, as without those event hooks it might cause problems for developers.