Skip to content

Commit

Permalink
Merge pull request #666 from intersystems/v0.10.x-update-to-date
Browse files Browse the repository at this point in the history
V0.10.x update to date
  • Loading branch information
isc-tleavitt authored Dec 19, 2024
2 parents 4630bd9 + 33859a6 commit 0fb097d
Show file tree
Hide file tree
Showing 60 changed files with 1,675 additions and 217 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ jobs:
zpm ${{ steps.image.outputs.flags }})
sleep 5; docker exec $CONTAINER /usr/irissys/dev/Cloud/ICM/waitISC.sh
docker cp . $CONTAINER:/home/irisowner/zpm/
echo `docker exec -i --user root $CONTAINER chmod -R 777 /home/irisowner/zpm/`
echo `docker exec -i --workdir /home/irisowner/zpm/ $CONTAINER ls -rtl`
docker exec -i $CONTAINER iris session iris -UUSER << EOF
zpm "list":1
Expand Down Expand Up @@ -201,8 +202,12 @@ jobs:
zpm "repo -list"
zpm "search":1
zpm "install sslclient":1
write "Before migration",!
zpm "list"
zpm "install zpm -v":1
zpm "load -dev /tmp/test-package/":1
write "After migration",!
zpm "list"
zpm "test ipm-migration-v0.7-to-v0.9 -only -verbose":1
halt
EOF
Expand Down Expand Up @@ -291,7 +296,7 @@ jobs:
CONTAINER=$(docker run -d --rm -v $(pwd):/home/irisowner/zpm/ containers.intersystems.com/intersystems/${{ needs.prepare.outputs.main }} --check-caps false)
sleep 5; docker exec $CONTAINER /usr/irissys/dev/Cloud/ICM/waitISC.sh
docker exec -i $CONTAINER iris session iris -UUSER << EOF
set sc=##class(%SYSTEM.OBJ).Load("/home/irisowner/zpm/Installer.cls","ck")
set sc=##class(%SYSTEM.OBJ).Load("/home/irisowner/zpm/preload/cls/IPM/Installer.cls","ck")
set sc=##class(IPM.Installer).setup("/home/irisowner/zpm/",3)
zpm "repo -r -name registry -url ""https://pm.community.intersystems.com/"" -username ${{ secrets.REGISTRY_USERNAME }} -password ${{ secrets.REGISTRY_PASSWORD }}":1
zpm "publish zpm -v":1
Expand Down
18 changes: 5 additions & 13 deletions .github/workflows/packages-summary.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
name: Summarize package test results
on:
workflow_call:
inputs:
runId:
type: number
required: true
description: "Id of the workflow run to summarize"
workflow_dispatch:
inputs:
runId:
type: number
required: true
description: "Id of the workflow run to summarize"
workflow_run:
workflows: ["Test major packages"]
types:
- completed

jobs:
summarize:
Expand All @@ -21,7 +13,7 @@ jobs:
steps:
- name: Donwload log zip
run: |
curl -L -o logs.zip "${{ env.BASE_URL }}/${{ inputs.runId }}/logs" -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}'
curl -L -o logs.zip "${{ env.BASE_URL }}/${{ github.event.workflow_run.id }}/logs" -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}'
- name: Unzip logs
run: |
unzip logs.zip -d /tmp/logs/
Expand Down
29 changes: 12 additions & 17 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:
required: true
type: number
default: 1
timeoutSeconds:
description: "Timeout in seconds for each test"
required: true
type: number
default: 120

jobs:
matrix-setup:
Expand Down Expand Up @@ -54,12 +59,11 @@ jobs:
docker exec $CONTAINER /usr/irissys/dev/Cloud/ICM/waitISC.sh
docker exec -i $CONTAINER iris session IRIS << EOF
zpm "list":1
zn "%SYS"
zpm "test zpm -v -only":1:1
EOF
docker container stop $CONTAINER
- name: Upload Image
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: zpmimage
path: /tmp/zpmimage.tar
Expand All @@ -78,7 +82,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download Artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: zpmimage
path: /tmp
Expand Down Expand Up @@ -114,9 +118,10 @@ jobs:
echo "::group::Test package $package"
set +e
docker exec -i $CONTAINER iris session IRIS <<- EOF
zpm "install $package":1
zpm "$package test -only ${{ env.test-flags }}":1:1
timeout ${{ inputs.timeoutSeconds }}s docker exec -i $CONTAINER iris session IRIS <<- EOF
zpm "install $package":1
zpm "$package test -only ${{ env.test-flags }}":1:1
halt
EOF
if [ $? -ne 0 ]; then
Expand All @@ -134,14 +139,4 @@ jobs:
echo "::endgroup::"
done
IFS=' '
summarize:
needs:
- run-tests
runs-on: ubuntu-latest
steps:
- name: Call package-summary workflow
uses: ./.github/workflows/packages-summary.yml
with:
runId: ${{ github.run_id }}
IFS=' '
10 changes: 3 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Deprecated
-

## [Unreleased - 0.9.0+snapshot]
## [0.9.0] - 2024-12-16

### Added
- #364 Added ability to restrict the installation to IRIS or IRIS for Health platform to the SystemRequirements attribute
Expand All @@ -53,6 +53,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- HSIEO-11006: Fix conditions for marking code as deployed
- HSIEO-10884: Bug Fix - FileCopy to check for $ variables in path
- HSIEO-11006: Fix conditions for marking code as deployed
- HSIEO-9269, HSIEO-9402: % percent perforce directories are no longer necessary
- HSIEO-9269, HSIEO-9404: Repo check should happen in the order to repo creation, not by repo name
- HSIEO-9269, HSIEO-9411: Make sure can load and export xml Package-type resource
Expand Down Expand Up @@ -89,11 +91,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- #606: Don't put garbage folders in tar archive
- #652: Don't create extra needless mappings (could cause deadlock with parallel installation of dependencies)

### Security
-

### Removed
-

### Deprecated
- #593 CSPApplication is deprecated in favor of WebApplication. User will be warned when installing a package containing CSPApplication.
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
iris:
build: .
Expand Down Expand Up @@ -38,6 +37,9 @@ services:
volumes:
- ./:/home/irisowner/zpm/
- ./tests/sandbox/:/home/irisowner/sandbox/
command:
- -a
- iris session iris -U%SYS '##class(Security.Users).UnExpireUserPasswords("*")'
oras:
image: ghcr.io/project-zot/zot-linux-amd64:latest
ports:
Expand Down
1 change: 1 addition & 0 deletions module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<UnitTest Name="/tests/integration_tests/" Package="Test.PM.Integration" Phase="verify"/>
<Resource Name="/doc/README.txt"/>
<Invoke Class="IPM.Installer" Method="Map" Phase="Reload" When="Before" />
<Invoke Class="IPM.Installer" Method="MapIfLegacy" Phase="Compile" When="After" />
<Invoke Class="%IPM.Main" Method="UpdateLanguageExtensions" />
<Invoke Class="%IPM.Utils.Migration" Method="RunAll">
<Arg>${verbose}</Arg>
Expand Down
11 changes: 11 additions & 0 deletions preload/cls/IPM/Installer.cls
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ ClassMethod ZPMInit(pRegistry As %String = "", pAnalyticsTrackingID As %String =
$$$QuitOnError(##class(%IPM.Repo.UniversalSettings).SetAnalyticsAvailable(1, 0))
$$$QuitOnError(##class(%IPM.Repo.UniversalSettings).SetAnalyticsTrackingId(pAnalyticsTrackingID, 0))
$$$QuitOnError(##class(%IPM.Repo.UniversalSettings).SetValue("ColorScheme","", 0))
$$$QuitOnError(##class(%IPM.Repo.UniversalSettings).SetValue("PipCaller", "", 0))
$$$QuitOnError(##class(%IPM.Repo.UniversalSettings).SetValue("UseStandalonePip", "", 0))
$$$QuitOnError(##class(%IPM.Repo.UniversalSettings).SetValue("SemVerPostRelease", 0, 0))
Quit $$$OK
}

Expand All @@ -115,6 +118,14 @@ ClassMethod ZPMCompile()
Quit ##class(%IPM.Main).Shell("ZPM compile")
}

ClassMethod MapIfLegacy()
{
If ##class(%IPM.Utils.Migration).HasLegacyZPMPackage() {
Quit ##class(%IPM.Main).Shell("enable -globally -map")
}
Quit $$$OK
}

ClassMethod EndCompile(qstruct) As %Status
{
#; Behave as simple installer
Expand Down
7 changes: 4 additions & 3 deletions scripts/setup-registry.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/env iriscli

zpm "install zpm-registry"
/bin/env iriscli << EOF
zpm "install zpm-registry"
halt
EOF
15 changes: 15 additions & 0 deletions src/cls/IPM/DataType/RegExString.cls
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,19 @@ ClassMethod IsValid(%val As %CacheString) As %Status [ ServerOnly = 0 ]
return $$$OK
}

ClassMethod FromWildCard(wildcard As %String) As %String
{
Set regex = ""
For i=1:1:$Length(wildcard) {
Set char = $Extract(wildcard, i)
If char = "*" {
Set regex = regex_".*"
} Else {
Set regex = regex_char
}
}
// Is there a way to return an instance of this class instead of %String?
Quit "^(?i)"_regex_"$"
}

}
92 changes: 59 additions & 33 deletions src/cls/IPM/General/SemanticVersion.cls
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ Property Patch As %Integer(MINVAL = 0) [ Required ];

Property Prerelease As %IPM.DataType.RegExString(MAXLEN = 100, REGEX = "([0-9A-Za-z-])+(\.([0-9A-Za-z-])+)*");

/// This is an alias for Prerelease. It is used for code readability when SemVerPostRelease is enabled.
Property Postrelease As %IPM.DataType.RegExString(MAXLEN = 100, REGEX = "([0-9A-Za-z-])+(\.([0-9A-Za-z-])+)*") [ Calculated, SqlComputeCode = { Set {*} = {Prerelease} }, SqlComputed, Transient ];

Property Build As %IPM.DataType.RegExString(MAXLEN = 100, REGEX = "([0-9A-Za-z-])+(\.([0-9A-Za-z-])+)*");

Method PostreleaseGet() As %IPM.DataType.RegExString
{
Quit ..Prerelease
}

Method ToString() As %String [ CodeMode = expression ]
{
..Major
Expand Down Expand Up @@ -116,6 +124,25 @@ Method Follows(pVersion As %IPM.General.SemanticVersion) As %Boolean
((..Major = pVersion.Major) && (..Minor > pVersion.Minor)) ||
((..Major = pVersion.Major) && (..Minor = pVersion.Minor) && (..Patch > pVersion.Patch))

// Handle post-releases if enabled. With this, post-releases are considered as higher version numbers.
If ##class(%IPM.Repo.UniversalSettings).GetValue("SemVerPostRelease") {
If tFollows {
Return 1
}
If (..Major < pVersion.Major) || (..Minor < pVersion.Minor) || (..Patch < pVersion.Patch) {
Return 0
}
// If it reaches here, major, minor, and patch are equal. We need to check post-releases.
If (..Postrelease = "") {
Return 0
} ElseIf (pVersion.Postrelease = "") {
Return 1
}
// If it reaches here, major, minor, and patch are equal. Both post-releases are non-empty. Compare them.
Return ..CompareDotSeparatedStrings(..Postrelease, pVersion.Postrelease)

}

// Handle prereleases - messy!!
Set tEquals = (..Major = pVersion.Major) && (..Minor = pVersion.Minor) && (..Patch = pVersion.Patch)
If (..Prerelease '= "") || (pVersion.Prerelease '= "") {
Expand All @@ -135,46 +162,45 @@ Method Follows(pVersion As %IPM.General.SemanticVersion) As %Boolean
// We are comparing equal versions where the earlier has a prerelease.
Quit 1
} Else{
// Both have a prerelease, and they're different.
// Compare dot-separated parts of the prerelease.
Set tFollows = 1
Set tThisParts = $ListFromString(..Prerelease,".")
Set tOtherParts = $ListFromString(pVersion.Prerelease,".")

Set tOtherHasData = 1
Set tThisPointer = 0
Set tOtherPointer = 0
While $ListNext(tThisParts,tThisPointer,tThisPart) {
Set tOtherHasData = $ListNext(tOtherParts,tOtherPointer,tOtherPart)
If 'tOtherHasData {
// The prerelease version has more parts for this one.
Return 1
}
If (tOtherPart = tThisPart) {
// Keep looking through dot-separated parts.
Continue
}

// "Collates after" operator works nicely here.
// e.g., the following are true: "beta" ]] 11, 11 ]] 2, 2 ]] 1
If (tThisPart ]] tOtherPart) {
Return 1
} Else {
Return 0
}
}
If tFollows && tOtherHasData && $ListNext(tOtherParts,tOtherPointer,tOtherPart) {
// If there are still dot-separated parts left in the prerelease of the version we are comparing to,
// it has more than this version, and therefore this version does not follow it.
Quit 0
}
Quit ..CompareDotSeparatedStrings(..Prerelease, pVersion.Prerelease)
}
} ElseIf tEquals {
Quit (pVersion.IsSnapshot() && '..IsSnapshot())
}
Quit tFollows
}

/// Compare two dot-separated strings (usually prerelease or postrelease identifiers).
Method CompareDotSeparatedStrings(pThis As %String, pOther As %String) As %Boolean
{
Set tThisParts = $ListFromString(pThis,".")
Set tOtherParts = $ListFromString(pOther,".")

Set tOtherHasData = 1
Set tThisPointer = 0
Set tOtherPointer = 0
While $ListNext(tThisParts,tThisPointer,tThisPart) {
Set tOtherHasData = $ListNext(tOtherParts,tOtherPointer,tOtherPart)
If 'tOtherHasData {
// The prerelease version has more parts for this one.
Return 1
}
If (tOtherPart = tThisPart) {
// Keep looking through dot-separated parts.
Continue
}

// "Collates after" operator works nicely here.
// e.g., the following are true: "beta" ]] 11, 11 ]] 2, 2 ]] 1
If (tThisPart ]] tOtherPart) {
Return 1
} Else {
Return 0
}
}
Return 0
}

Method Satisfies(pExpression As %IPM.General.SemanticVersionExpression) As %Boolean
{
Quit pExpression.IsSatisfiedBy($this)
Expand Down
5 changes: 3 additions & 2 deletions src/cls/IPM/General/SemanticVersionExpression/Comparator.cls
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ Method Evaluate(pVersion As %IPM.General.SemanticVersion) As %Boolean
Set tEquals = tEquals && (val1 = val2)
}
}
If ($Extract(..Operator,1) = "=") {
// Means direct equality and not <= or >= so compare pre-release as well
If (+##class(%IPM.Repo.UniversalSettings).GetValue("SemVerPostRelease") = 0) || ($Extract(..Operator,1) = "=") {
// If SemVerPostRelease is disabled, then we should not consider post-release versions as equal to the base version
// ..Operator = "=" means direct equality and not <= or >= so compare pre-release as well
Set tEquals = tEquals && (pVersion.Prerelease = ..Prerelease)
}
If tEquals || (..Operator = "=") {
Expand Down
Loading

0 comments on commit 0fb097d

Please sign in to comment.