single-spa / import-map-deployer

A manifest deployment service for sofe/import maps
Apache License 2.0
191 stars 63 forks source link

[Feature] support before and after hook, after call import map deployer #150

Closed vctqs1 closed 1 year ago

vctqs1 commented 1 year ago

In my purpose, after cal imd i'd like to call to another service to update version. and make sure that it also put in lock to handle race-conditional

The behavior look like this

  1. use curl call to imd
  2. open lock
  3. beforeHook
  4. update import-map.json file
  5. afterHook. that maybe integrate to send noti to slack or another service
  6. close lock
  7. exec next call

Could the team help to review this, I'd be happy to open PR and contribute if possible

nhumrich commented 1 year ago

Is there a particular reason why these things would have to happen while the manifest is locked vs just doing them out-of-band in your CI/script?

vctqs1 commented 1 year ago

Is there a particular reason why these things would have to happen while the manifest is locked vs just doing them out-of-band in your CI/script?

I'd like to store each version of manifest with our service and database. that act looks like a dashboard for deployment. For EX: if we'd like to rollback or check the version causing a bug at cross-team feature, the specific version of team A. you will easy to know the version at that time of other teams also

If it exec out of manifest lock it hard to control transactions and race-condition. for EX: next in the above scenario. in case this is out of the band in CI/scripts. it can't be correct to order of versioning manifest.

so in db right now the order looks like

vctqs1 commented 1 year ago

ah nvm I thnk we can use writeManifest https://github.com/single-spa/import-map-deployer/blob/ad02a26b2c7b6bb82425ea39ec4b4a53e5d09f3a/src/modify.js#L69