Question
Ron Sweeney · Oct 5

Share ZPM technique?

Anybody willing to share a method form the ZPM cli (or othewise) where zpm will "Install package if not already installed?"  I would want this to count for updates too I think as I would want to control that too.

The use case is in a CI-CD pipeline, where the pipeline can be used to provision start to state, but for somethings only do once.  An example would be I have a package that provisions a fhir package or search parameter in my own way, but doesnt do it again when somebody merges operational code and the pipeline fires again, it would not attempt to load the fhir package again.

Product version: IRIS 2022.1
1
0 96
Discussion (6)3
Log in or sign up to continue

@Ron Sweeney this seems like a good use case to define your own package with dependencies for the things you want to "install if not already installed" - installing your package will install those dependencies only if they haven't been installed. (And if the versions update, they'll be updated.)

Alternatively, you could do something like:
 

if '##class(%ZPM.PackageManager.Developer.Module).NameExists(packagename) { zpm "install "_packagename }

@Eduard Lebedyuk if you say zpm "install packagename" and you already have the latest version installed, it'll just reinstall the same package (rather than doing nothing, which is what Ron wants).