Skip to content

Commit

Permalink
style: minor style changes and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-shuliu committed Nov 19, 2024
1 parent 26b7ea9 commit 25c60b7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
18 changes: 9 additions & 9 deletions src/cls/IPM/Repo/Oras/ArtifactMetadata.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ Class %IPM.Repo.Oras.ArtifactMetadata Extends (%RegisteredObject, %JSON.Adaptor)
{

/// See https://github.com/opencontainers/image-spec/blob/main/annotations.md
Property "org-opencontainers-image-title" As %String(%JSONFIELDNAME = "org.opencontainers.image.title");
Property ImageTitle As %String(%JSONFIELDNAME = "org.opencontainers.image.title");

Property "org-opencontainers-image-description" As %String(%JSONFIELDNAME = "org.opencontainers.image.description");
Property ImageDescription As %String(%JSONFIELDNAME = "org.opencontainers.image.description");

Property "org-opencontainers-image-version" As %String(%JSONFIELDNAME = "org.opencontainers.image.version");
Property ImageVersion As %String(%JSONFIELDNAME = "org.opencontainers.image.version");

Property "org-opencontainers-image-source" As %String(%JSONFIELDNAME = "org.opencontainers.image.source");
Property ImageSource As %String(%JSONFIELDNAME = "org.opencontainers.image.source");

Property "org-opencontainers-image-created" As %String(%JSONFIELDNAME = "org.opencontainers.image.created");
Property ImageCreated As %String(%JSONFIELDNAME = "org.opencontainers.image.created");

Property "com-intersystems-ipm-allVersions" As %String(%JSONFIELDNAME = "com.intersystems.ipm.allVersions");
Property IPMAllVersions As %String(%JSONFIELDNAME = "com.intersystems.ipm.allVersions");

Property "com-intersystems-ipm-origin" As %String(%JSONFIELDNAME = "com.intersystems.ipm.origin");
Property IPMOrigin As %String(%JSONFIELDNAME = "com.intersystems.ipm.origin");

Property "com-intersystems-ipm-deployed" As %String(%JSONFIELDNAME = "com.intersystems.ipm.deployed");
Property IPMDeployed As %String(%JSONFIELDNAME = "com.intersystems.ipm.deployed");

Property "com-intersystems-ipm-module-v1+xml" As %String(%JSONFIELDNAME = "com.intersystems.ipm.module.v1+xml");
Property IPMModuleV1XML As %String(%JSONFIELDNAME = "com.intersystems.ipm.module.v1+xml");

}
14 changes: 8 additions & 6 deletions src/cls/IPM/Repo/Oras/PackageService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Method ListModules(pSearchCriteria As %IPM.Repo.SearchCriteria) As %ListOfObject
Set client = ..GetClient(..Location, ..Username, ..Password, ..Token, ..TokenBasicAuth)

#; Parse search criteria
// The OCI /v2/_catalog endpoint always returns all packages. We will filter by name and version on the client side.
Set name = $$$lcase(pSearchCriteria.Name)
Set tVersionExpression = pSearchCriteria.VersionExpression
Set tSC = ##class(%IPM.General.SemanticVersionExpression).FromString(pSearchCriteria.VersionExpression, .tVersionExpression)
Expand All @@ -77,6 +78,7 @@ Method ListModules(pSearchCriteria As %IPM.Repo.SearchCriteria) As %ListOfObject
Set request = ..GetHttpRequest()

#; Make GET request
// response is a JSON structure like {"repositories":["package1", "package2", ...]}
Set tSC=request.Get(..PathPrefix _ "/v2/_catalog")
$$$ThrowOnError(tSC)
Set response=request.HttpResponse
Expand Down Expand Up @@ -117,19 +119,19 @@ Method ListModules(pSearchCriteria As %IPM.Repo.SearchCriteria) As %ListOfObject
Do artifactMetadata.%JSONImport(metadata)

Set tModRef = ##class(%IPM.Storage.ModuleInfo).%New()
Set tModRef.Name = artifactMetadata."org-opencontainers-image-title"
Set tModRef.Repository = artifactMetadata."org-opencontainers-image-source"
Set tModRef.VersionString = artifactMetadata."org-opencontainers-image-version"
Set tModRef.Description = artifactMetadata."org-opencontainers-image-description"
Set tModRef.Deployed = artifactMetadata."com-intersystems-ipm-deployed"
Set tModRef.Name = artifactMetadata.ImageTitle
Set tModRef.Repository = artifactMetadata.ImageSource
Set tModRef.VersionString = artifactMetadata.ImageVersion
Set tModRef.Description = artifactMetadata.ImageDescription
Set tModRef.Deployed = artifactMetadata.IPMDeployed
#; If $IsObject(item."platform_versions") {
#; Set tIterPVer = item."platform_versions".%GetIterator()
#; While tIterPVer.%GetNext(.tPVerKey, .platformVersion) {
#; Do tModRef.PlatformVersions.Insert(platformVersion)
#; }
#; }
Set tModRef.AllVersions = allTagsString
Set tModRef.Origin = artifactMetadata."com-intersystems-ipm-origin"
Set tModRef.Origin = artifactMetadata.IPMOrigin
Do tList.Insert(tModRef)

#; If not all versions are requested, return the latest one
Expand Down
18 changes: 9 additions & 9 deletions src/cls/IPM/Repo/Oras/PublishService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ Method PublishModule(pModule As %IPM.Repo.Remote.ModuleInfo) As %Boolean

#; Set metadata
Set metadata = ##class(%IPM.Repo.Oras.ArtifactMetadata).%New()
Set metadata."org-opencontainers-image-title" = pModule.Name
Set metadata."org-opencontainers-image-description" = pModule.Description
Set metadata."org-opencontainers-image-version" = pModule.VersionString
Set metadata."org-opencontainers-image-source" = pModule.Repository
Set metadata."org-opencontainers-image-created" = $zdt($now(),3,2)
Set metadata."com-intersystems-ipm-allVersions" = pModule.AllVersions
Set metadata."com-intersystems-ipm-origin" = pModule.Origin
Set metadata."com-intersystems-ipm-deployed" = pModule.Deployed
Set metadata."com-intersystems-ipm-module-v1+xml" = moduleXML
Set metadata.ImageTitle = pModule.Name
Set metadata.ImageDescription = pModule.Description
Set metadata.ImageVersion = pModule.VersionString
Set metadata.ImageSource = pModule.Repository
Set metadata.ImageCreated = $zdt($now(),3,2)
Set metadata.IPMAllVersions = pModule.AllVersions
Set metadata.IPMOrigin = pModule.Origin
Set metadata.IPMDeployed = pModule.Deployed
Set metadata.IPMModuleV1XML = moduleXML
Do metadata.%JSONExportToString(.metaDataString)

#; Push file
Expand Down

0 comments on commit 25c60b7

Please sign in to comment.