Skip to content

Commit cf17345

Browse files
authored
Merge branch 'intersystems-community:master' into permit-docker-republish
2 parents 359dd1a + 052591b commit cf17345

File tree

5 files changed

+89
-15
lines changed

5 files changed

+89
-15
lines changed

.github/workflows/trigger-deploy.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ on:
1414
jobs:
1515
trigger-zpm-deployment:
1616
name: Trigger zpm-registry-deployment via REST API
17-
runs-on: ubuntu-latest
18-
17+
runs-on: ubuntu-22.04
1918
steps:
2019
- name: REST POST call
2120
run: |-

README.md

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# intersystems zpm-registry
2-
[![Quality Gate Status](https://community.objectscriptquality.com/api/project_badges/measure?project=intersystems_iris_community%2Fzpm-registry&metric=alert_status)](https://community.objectscriptquality.com/dashboard?id=intersystems_iris_community%2Fzpm-registry)
2+
[![Quality Gate Status](https://community.objectscriptquality.com/api/project_badges/measure?project=intersystems_iris_community%2Fzpm-registry&metric=alert_status)](https://community.objectscriptquality.com/dashboard?id=intersystems_iris_community%2Fzpm-registry)
33

44
ZPM Registry is a a server part of ObjectScript Package Manager.
55

@@ -13,26 +13,59 @@ You can use ZPM Registry project to build your own private registry to have the
1313
ZPM Registry works only on IRIS and IRIS For Health, community and Enterprise versions.
1414

1515
# Installation
16-
## Usual Installation
17-
Import classes from cls and run Installer from Root
16+
17+
## ZPM Installation
18+
`install zpm-registry`
1819

1920
## Docker Installation
2021
Build docker container
2122

22-
## ZPM Installation
23-
`install zpm-registry`
23+
## Usual Installation
24+
Import classes from cls and run Installer from Root
2425

2526
# Usage
2627
ZPM Registry exposes REST API, which perfoms listing, publising and deployment services. You can examine the REST in the source class [Registry.cls](https://github.com/intersystems-community/zpm-registry/blob/master/src/cls/ZPM/Registry.cls) or via Swagger
2728

28-
Note, when you publish the repo via API you need to provide the GIthub URL of the repo, which will contain module.xml.
29+
Note, when you publish the repo via API you need to provide the Github URL of the repo, which will contain module.xml.
2930
And published package will remember the repository and will not allow to publish/update package with the same name but with another repository.
3031

3132

3233
## Working With Your Registry From ZPM Client
3334
You can setup ZPM client to work with your registry with the following command:
3435
```
35-
ZPM:USER>repo -n registry -r -url https://registry.yourdomain.com
36+
zpm:USER>repo -n registry -r -url https://registry.yourdomain.com
37+
```
38+
39+
## Settings
40+
To configure the registry, utilize the zpm-registry.yaml file located within the IRIS installation folder. Retrieve the IRIS directory in which the file should reside using the following command: `write ##class(%SYSTEM.Util).InstallDirectory()`.
41+
42+
43+
## Proxy-Registry
44+
Starting from version 1.1.2, zpm-registry includes the Proxy feature.
45+
This allows the IPM client to use only your private registry and install packages from your private registry, all the while retaining the capability to install packages from an external registry (Uplink).
46+
47+
External registries that your local registry can access are called Uplinks. You can define one or more external registries. You can also list which packages from the Uplink registry should be available.
48+
49+
These settings are set in the `zpm-registry.yaml` file.
50+
51+
Settings file example:
52+
```
53+
uplinks:
54+
pm:
55+
url: https://pm.community.intersystems.com/
56+
allow_packages: dsw,zpm*,?u*
57+
```
58+
59+
For more information, see https://community.intersystems.com/post/new-zpm-registry-feature-%E2%80%93-proxy-registry
60+
61+
62+
## Delete packages
63+
Starting from version 0.7, IPM introduces support for the "unpublish" command, which facilitates the removal of a package that was previously published.
64+
In order for this command to be executed, it is necessary to explicitly allow the removal of packages on the side of the registry. To do this, add the line "delete-enabled: true" to the settings file `zpm-registry.yaml`
65+
66+
Settings file example:
67+
```
68+
delete-enabled: true
3669
```
3770

3871

module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Name>zpm-registry</Name>
66
<ExternalName>ZPM Registry</ExternalName>
77
<Description>Registry server for ZPM</Description>
8-
<Version>1.2.5</Version>
8+
<Version>1.2.7</Version>
99
<Packaging>module</Packaging>
1010
<Dependencies>
1111
<ModuleReference>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/// To execute your code immediately after the event occurs,
2+
/// you need to create a subclass of this class and override the Process() method in it.
3+
Class ZPM.Analytics.AbstractEventProcessor [ Abstract ]
4+
{
5+
6+
Parameter SubClasses As CONFIGVALUE;
7+
8+
/// Override this method to run your code when event occurs
9+
ClassMethod Process(event as ZPM.Analytics.Event) As %Status [ Abstract ]
10+
{
11+
Return $$$OK
12+
}
13+
14+
/// Do not change or override this method
15+
ClassMethod getSubClasses() As %String [ CodeMode = objectgenerator ]
16+
{
17+
Set list = ""
18+
19+
Set rs = ##class(%Dictionary.ClassDefinitionQuery).SubclassOfFunc("ZPM.Analytics.AbstractEventProcessor")
20+
While (rs.%Next()) {
21+
Set list = list _ $listbuild( rs.%GetData(1) )
22+
}
23+
24+
Do $system.OBJ.UpdateConfigParam("ZPM.Analytics.AbstractEventProcessor","SubClasses",$listtostring(list,","))
25+
Do %code.WriteLine(" return $PARAMETER(""ZPM.Analytics.AbstractEventProcessor"",""SubClasses"") ")
26+
Return $$$OK
27+
}
28+
29+
}

src/cls/ZPM/Analytics/Event.cls

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Class ZPM.Analytics.Event Extends (%Persistent, %JSON.Adaptor)
33

44
Parameter DSTIME = "AUTO";
55

6-
/// Server date and time, saving the data
6+
/// Server date and time, saving the data
77
Property TS As %PosixTime(%JSONINCLUDE = "none") [ SqlComputeCode = {set {*}=##class(%Library.PosixTime).CurrentTimeStamp()}, SqlComputed, SqlComputeOnChange = %%INSERT ];
88

99
/// Event type: download, install, uninstall
@@ -40,6 +40,22 @@ Property Region As %String(%JSONINCLUDE = "none");
4040

4141
Property City As %String(%JSONINCLUDE = "none");
4242

43+
ClassMethod ExecuteEventProcessors(event As ZPM.Analytics.Event) As %Status
44+
{
45+
Set subclasses = $PARAMETER("ZPM.Analytics.AbstractEventProcessor","SubClasses")
46+
Set list = $ListFromString(subclasses,",")
47+
For i=1:1:$listlength(list){
48+
Try {
49+
$$$ThrowOnError($Classmethod($listget(list,i), "Process", event))
50+
} Catch ex {
51+
If (ex.Name '= "<CLASS DOES NOT EXIST>") {
52+
Throw ex
53+
}
54+
}
55+
}
56+
return $$$OK
57+
}
58+
4359
ClassMethod SaveEvent(action As %String, ip As %String = "", json As %DynamicObject) As %Status
4460
{
4561
Try {
@@ -48,10 +64,7 @@ ClassMethod SaveEvent(action As %String, ip As %String = "", json As %DynamicObj
4864
Set event.IP = ip
4965
Do event.%JSONImport(json)
5066
$$$ThrowOnError(event.%Save())
51-
If ##class(%Dictionary.CompiledClass).%ExistsId("ZPM.Analytics.IP") {
52-
Do ##class(ZPM.Analytics.IP).SetGeo(event, ip)
53-
}
54-
$$$ThrowOnError(event.%Save())
67+
$$$ThrowOnError(..ExecuteEventProcessors(event))
5568
Return $$$OK
5669
} Catch ex {
5770
Do ex.Log()

0 commit comments

Comments
 (0)