archi-modelrepository-plugin
archi-modelrepository-plugin copied to clipboard
Add support to Save repository model
I have added support to enable the saving of a model to a local repository format.
There is now an extra command line option you can specify: --modelrepository.saveModel "cloneFolder"
"cloneFolder" would typically be the same location you would use with the loadModel counterpart, but it does not have to be. As it is used the active model, it can also enable scenarios where you would load a normal .archimate file, but then save it in the Grafico format.
The save model will not be pushed as part of this commandline option, that is up to the user to decide and enables CI type of scenarios where the clone and the push would be executed by the CI pipeline.
Comment from @jbsarrodie at https://github.com/archimatetool/archi-modelrepository-plugin/pull/228#issuecomment-2612056350
Hi,
Thank you for this PR. I have some remarks though...
I don't think exporting to grafico is the right use-case (coArchi doesn't support it). Instead, I think we should have a "commit" option which exports the model to grafico and commits it, and a "publish" option which triggers the pull/merge/push.
The main reason is that nobody should use git commands to merge a model. As explained in several occasions, doing it outside coArchi leads to model corruption. So an option to save as grafico would encourage such misuse.
Of course, because of potential conflicts (even though in such automated context, doing the publish really soon after the clone of the model should really mower the risk), the "publish" action should take an attribute to decide what to do (choose "mine", "theirs" or "cancel").
For my own part I'm not going to be doing any more on coArchi 1. My efforts now will be on coArchi 2.
I don't think exporting to grafico is the right use-case (coArchi doesn't support it). Instead, I think we should have a "commit" option which exports the model to grafico and commits it, and a "publish" option which triggers the pull/merge/push. The main reason is that nobody should use git commands to merge a model. As explained in several occasions, doing it outside coArchi leads to model corruption. So an option to save as grafico would encourage such misuse. Of course, because of potential conflicts (even though in such automated context, doing the publish really soon after the clone of the model should really mower the risk), the "publish" action should take an attribute to decide what to do (choose "mine", "theirs" or "cancel").
I agree that things could go wrong when somebody commits in between and a merge is needed. For me, I do not see that as a problem since:
- I have a protected master branch where nobody can commit directly
- I am doing this in CI automation, and when there would be a merge conflict when trying to push, I would simply fail the pipeline and not push. Since the pipeline can be restarted, it would then do the same action on the latest master branch version, and the issue would not occur anymore.
- The CI Automation will run daily at night, further reducing merge conflict risk :-)