-
Notifications
You must be signed in to change notification settings - Fork 27
Adding zpm "ci" command to install from a lock file #1080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
26c1f47
dedd323
6a759be
90daa5e
15eed15
d5bdbc1
7ad4aa2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -794,6 +794,25 @@ generate /my/path -export 00000,PacketName2,IgnorePacket2^00000,PacketName3,Igno | |
| <example description="Display the current history retention setting.">config get HistoryRetain</example> | ||
| </command> | ||
|
|
||
| <command name="ci"> | ||
| <summary>Installs a module from a lock file</summary> | ||
| <description> | ||
| Installs a module from its lock file. Will first install all listed repositories followed by dependency modules and then the base module. | ||
| </description> | ||
|
|
||
| <!-- Examples --> | ||
| <example description="Reads from the module-lock.json defined for mymodule and installs the repositories, module, and dependencies"> | ||
| ci mymodule 3.0.0 | ||
| </example> | ||
|
|
||
| <!-- Parameters --> | ||
| <parameter name="module" required="true" description="Name of module on which to perform update actions" /> | ||
| <parameter name="version" description="Version (or version expression) of module to install; defaults to the latest available if unspecified." /> | ||
|
|
||
| <!-- Modifiers --> | ||
| <modifier name="verbose" aliases="v" dataAlias="Verbose" dataValue="1" description="Produces verbose output from the command." /> | ||
| </command> | ||
|
|
||
| </commands> | ||
| } | ||
|
|
||
|
|
@@ -1080,8 +1099,10 @@ ClassMethod ShellInternal( | |
| do ..ModuleVersion(.tCommandInfo) | ||
| } elseif (tCommandInfo = "information") { | ||
| do ..Information(.tCommandInfo) | ||
| } elseif (tCommandInfo = "history") { | ||
| do ..History(.tCommandInfo) | ||
| } elseif (tCommandInfo = "history") { | ||
| do ..History(.tCommandInfo) | ||
| } elseif (tCommandInfo = "ci") { | ||
| do ..CleanInstall(.tCommandInfo) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit confusing to me to have "ci" stand for "CleanInstall", since 1) CI=continuous integration, and 2) it doesn't mention the lock file like "LockFileInstall" would for example. But taking a step back, what's the benefit of having a new command versus using a flag on |
||
| } | ||
| } catch pException { | ||
| if (pException.Code = $$$ERCTRLC) { | ||
|
|
@@ -2491,12 +2512,11 @@ ClassMethod Install( | |
| $$$ThrowStatus($$$ERROR($$$GeneralError, "Deployed package '" _ tModuleName _ "' " _ tResult.VersionString _ " not supported on this platform " _ platformVersion _ ".")) | ||
| } | ||
| } | ||
| $$$ThrowOnError(log.SetSource(tResult.ServerName)) | ||
| $$$ThrowOnError(log.SetVersion(tResult.Version)) | ||
| $$$ThrowOnError(log.SetSource(tResult.ServerName)) | ||
| $$$ThrowOnError(log.SetVersion(tResult.Version)) | ||
| $$$ThrowOnError(##class(%IPM.Utils.Module).LoadQualifiedReference(tResult, .tParams, , log)) | ||
| } | ||
| } else { | ||
| set tPrefix = "" | ||
| if (tModuleName '= "") { | ||
| if (tVersion '= "") { | ||
| $$$ThrowStatus($$$ERROR($$$GeneralError, tModuleName_" "_tVersion_" not found in any repository.")) | ||
|
|
@@ -2510,10 +2530,32 @@ ClassMethod Install( | |
| } | ||
| } | ||
| } catch ex { | ||
| $$$ThrowOnError(log.Finalize(ex.AsStatus(), devMode)) | ||
| throw ex | ||
| } | ||
| $$$ThrowOnError(log.Finalize($$$OK, devMode)) | ||
| $$$ThrowOnError(log.Finalize(ex.AsStatus(), devMode)) | ||
| throw ex | ||
| } | ||
| $$$ThrowOnError(log.Finalize($$$OK, devMode)) | ||
| } | ||
|
|
||
| ClassMethod CleanInstall(ByRef commandInfo) [ Internal ] | ||
| { | ||
| set moduleName = $get(commandInfo("parameters","module")) | ||
| set version = $get(commandInfo("parameters","version")) | ||
| set verbose = $get(commandInfo("data","Verbose")) | ||
| set log = ##class(%IPM.General.HistoryTemp).CleanInstallInit(moduleName) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also add a test to check that the history log is being populated correctly (see Test.PM.Integration.History) |
||
|
|
||
| // TODO: Add "path"? (see Update() for more info of calling install v load) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When is this todo being done or removed? |
||
|
|
||
| if verbose { | ||
| write !, "Going to run a clean install on "_moduleName | ||
| } | ||
|
|
||
| // Indicating to commandInfo that this is a clean install command, not an install or load command. commandInfo will be passed to either Install() or Load() to continue performing the update. | ||
| set commandInfo("data","cmd") = "ci" | ||
| set commandInfo("data","CleanInstall") = 1 | ||
| set log = ##class(%IPM.General.HistoryTemp).UpdateInit(moduleName) | ||
|
|
||
| // Forward execution to install | ||
| do ..Install(.commandInfo, log) | ||
| } | ||
|
|
||
| ClassMethod Reinstall(ByRef pCommandInfo) [ Internal ] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.