Skip to content

Commit

Permalink
Merge branch 'v0.10.x' into v0.10.x-fix-bootstrap-pydeps
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-shuliu authored Feb 12, 2025
2 parents d485b1c + 701100a commit 00eac84
Show file tree
Hide file tree
Showing 24 changed files with 635 additions and 27 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ jobs:
tag_name: v${{ needs.prepare.outputs.version }}
release_name: v${{ needs.prepare.outputs.version }}
prerelease: ${{ github.event_name != 'release' }}
- name: Upload Beta Release Asset
- name: Upload Beta Release Asset (versioned)
uses: actions/upload-release-asset@v1
if: github.event_name == 'push'
env:
Expand All @@ -282,6 +282,16 @@ jobs:
asset_path: zpm-${{ needs.prepare.outputs.version }}.xml
asset_name: zpm-${{ needs.prepare.outputs.version }}.xml
asset_content_type: text/xml
- name: Upload Beta Release Asset (versionless)
uses: actions/upload-release-asset@v1
if: github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: zpm-${{ needs.prepare.outputs.version }}.xml
asset_name: zpm.xml
asset_content_type: text/xml
- name: Publish release
if: github.event_name == 'release'
env:
Expand All @@ -299,7 +309,7 @@ jobs:
halt
EOF
docker stop $CONTAINER
- name: Upload Public Release Asset
- name: Upload Public Release Asset (versioned)
uses: actions/upload-release-asset@v1
if: github.event_name == 'release'
env:
Expand All @@ -309,6 +319,16 @@ jobs:
asset_path: zpm-${{ needs.prepare.outputs.version }}.xml
asset_name: zpm-${{ needs.prepare.outputs.version }}.xml
asset_content_type: text/xml
- name: Upload Public Release Asset (versionless)
uses: actions/upload-release-asset@v1
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: zpm-${{ needs.prepare.outputs.version }}.xml
asset_name: zpm.xml
asset_content_type: text/xml
- name: Bump Release number
if: github.event_name == 'release'
env:
Expand Down
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- #469 Added ability to include an `IPMVersion` in `SystemRequirement` of module.xml
- #530 Added a `CustomPhase` attribute to `<Invoke>` that doesn't require a corresponding %method in lifecycle class.
- #582 Added functionality to optionally see time of last update and server version of each package
- #609 Added support for `-export-deps` when running the "Package" phase of lifecycle
- #609,#729 Added support for `-export-deps` when running the "Package" phase (and, consequently, the "Publish" phase) of lifecycle
- #541 Added support for ORAS repository
- #704 Added support for passing in env files via `-env /path/to/env1.json;/path/to/env2.json` syntax
- #702 Added a new lifecycle phase `Initialize` which is used for preload
- #702 Added a `<CPF/>` resource, which can be used for CPF merge before/after a specified lifecycle phase or in a custom lifecycle phase.
- #716 Added support to publish under external name by passing `-use-external-name` or `-use-ext`.
- #704 Added support for passing in env files via `-env /path/to/env1.json;/path/to/env2.json` syntax
- #710 Added support for `module-version` command which updates the version of a module
- #716,#733 Added support to publish under external name by passing `-use-external-name` or `-use-ext`. Fail early if external name is illegal / empty.
- #720 Added support to export package with Python dependencies exported as a wheel file.
- #720 Support offline installation of oras using fixed version of pure python wheels and an adaptor for rpds.

### Changed
- #702 Preload now happens as part of the new `Initialize` lifecycle phase. `zpm "<module> reload -only"` will no longer auto compile resources in `/preload` directory.
- #726 When running `zpm "load ..."` on a nonexistent path, it now returns an error instead of silently failing with a $$$OK status.

### Fixed
- #474: When loading a .tgz/.tar.gz package, automatically locate the top-most module.xml in case there is nested directory structure (e.g., GitHub releases)
- #635: When calling the "package" command, the directory is now normalized to include trailing slash (or backslash).
- #696: Fix a bug that caused error status to be ignored when publishing a module.
- #700: Fix a bug due to incompatible conventions between SemVer and OCI tags
- #669: Work with a wider variety of ORAS repos (removes _catalog call)
- #726,#729: Fixed a bug where install/loading a tarball doesn't install dependencies from `.modules` subfolder even when it's available
- #731: Issue upgrading from v0.9.x due to refactor of repo classes
- #718: Upload zpm.xml (without the version) as an artifact to provide a more stable URL to latest release artifact on GitHub

### Security
-
Expand Down
55 changes: 55 additions & 0 deletions src/cls/IPM/General/SemanticVersion.cls
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,61 @@ Method Satisfies(pExpression As %IPM.General.SemanticVersionExpression) As %Bool
Quit pExpression.IsSatisfiedBy($this)
}

Method WithBumpMajor() As %IPM.General.SemanticVersion
{
Set tVer = ..%New()
Set tVer.Major = ..Major + 1
Set tVer.Minor = 0
Set tVer.Patch = 0
Set tVer.Prerelease = ""
Set tVer.Build = ""
Quit tVer
}

Method WithBumpMinor() As %IPM.General.SemanticVersion
{
Set tVer = ..%New()
Set tVer.Major = ..Major
Set tVer.Minor = ..Minor + 1
Set tVer.Patch = 0
Set tVer.Prerelease = ""
Set tVer.Build = ""
Quit tVer
}

Method WithBumpPatch() As %IPM.General.SemanticVersion
{
Set tVer = ..%New()
Set tVer.Major = ..Major
Set tVer.Minor = ..Minor
Set tVer.Patch = ..Patch + 1
Set tVer.Prerelease = ""
Set tVer.Build = ""
Quit tVer
}

Method WithPrerelease(pPrerelease As %String) As %IPM.General.SemanticVersion
{
Set tVer = ..%New()
Set tVer.Major = ..Major
Set tVer.Minor = ..Minor
Set tVer.Patch = ..Patch
Set tVer.Prerelease = pPrerelease
Set tVer.Build = ..Build
Quit tVer
}

Method WithBuild(pBuild As %String) As %IPM.General.SemanticVersion
{
Set tVer = ..%New()
Set tVer.Major = ..Major
Set tVer.Minor = ..Minor
Set tVer.Patch = ..Patch
Set tVer.Prerelease = ..Prerelease
Set tVer.Build = pBuild
Quit tVer
}

Storage Default
{
<Data name="SemanticVersionState">
Expand Down
86 changes: 86 additions & 0 deletions src/cls/IPM/General/TempLocalRepoManager.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
Include %IPM.Formatting

Class %IPM.General.TempLocalRepoManager Extends %RegisteredObject
{

Property Root As %String;

Property Repo As %IPM.Repo.Definition;

/// Creates the repository. If anything goes wrong, it will throw an error after cleaning up the repo.
/// Purposedly private and not a classmethod, so that we can only call it through %OnNew.
/// This encourages user to perform clean-up using the return instance from %OnNew.
Method Create(useFirst As %Boolean) [ Internal, Private ]
{
Set count = 0
For {
Set repoName = "ipm-temp-modules-" _ $Increment(count)
If '##class(%IPM.Repo.Definition).ServerDefinitionKeyExists(repoName) {
Quit
}
}
Set ..Repo = ##class(%IPM.Repo.Filesystem.Definition).%New()
Set ..Repo.Name = repoName
Set ..Repo.Root = ..Root
Set ..Repo.Snapshots = 1
Set ..Repo.Prereleases = 1
// Make sure this is the first/last repo to be found by SQL query in %IPM.Repo.Manager:SearchRepositoriesForModule
Set ..Repo.OverriddenSortOrder = $SELECT(useFirst:-1000 ,1:1000)

$$$ThrowOnError(..Repo.BuildCache(1,1,1))
}

ClassMethod SkipCreate(location As %String) As %Boolean [ Internal ]
{
If (location = "") || ('##class(%File).DirectoryExists(location)) {
Return 1
}

/// There is a unique index on the "Root" column, so skip creating the repo if it already exists (e.g., setup by another thread)
Set query = "SELECT COUNT(*) As Total FROM %IPM_Repo_Filesystem.Definition WHERE Root = ?"
Set rs = ##class(%SQL.Statement).%ExecDirect(, query, location)
$$$ThrowSQLIfError(rs.%SQLCODE, rs.%Message)
If rs.%Next() && (rs.%Get("Total") > 0) {
Return 1
}
Return 0
}

Method %OnNew(location As %String, useFirst As %Boolean = 0) As %Status
{
/// If the location is empty or already covered by another repo, skip creating the repo
/// This will still create an intance of this class, but the cleanup will be a no-op
Try {
If ..SkipCreate($Get(location)) {
Return $$$OK
}
} Catch ex {
Return ex.AsStatus()
}

Set ..Root = $Get(location)
Try {
Do ..Create(useFirst)
} Catch ex {
Return $$$ADDSC(ex.AsStatus(), ..CleanUp())
}

Return $$$OK
}

Method CleanUp() As %Status
{
If ('$IsObject(..Repo)) || (..Repo.%Id() = "") {
Quit $$$OK
}

Set sc = ..Repo.%DeleteId(..Repo.%Id())
If $$$ISERR(sc) {
Set msg = $$$FormatText("Failed to clean up repository '%1'. You may need to manually delete it using 'repo -delete -n %1'", ..Repo.Name)
Set msg = $$$FormattedLine($$$Red, msg)
Write !, msg
}
Quit sc
}

}
4 changes: 4 additions & 0 deletions src/cls/IPM/Lifecycle/Base.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,10 @@ Method %Publish(ByRef pParams) As %Status
}
Set tModule = ##class(%IPM.Repo.Remote.ModuleInfo).%New()
Set tModule.Name = $Select(tUseExternalName: ..Module.ExternalName, 1: ..Module.Name)
// Apparently, an empty name can pass the %IPM.DataType.ModuleName:IsValid check
If tModule.Name = "" {
$$$ThrowStatus($$$ERROR($$$GeneralError, "Cannot publish module with empty name."))
}
If '##class(%IPM.DataType.ModuleName).IsValid(tModule.Name) {
$$$ThrowStatus($$$ERROR($$$GeneralError,$$$FormatText("Module name '%1' is invalid for publishing",tModule.Name)))
}
Expand Down
Loading

0 comments on commit 00eac84

Please sign in to comment.