@@ -21,8 +21,8 @@ foreach($chartInfo in $entity._helm_charts_)
2121 $this.WriteLog (" ~~~ SBOM: ---> Processing License for Helm Chart $ ( $chartInfo.name ) and Version $ ( $chartInfo.version ) " )
2222 $rootArtifact = " $ ( $entity._oci_endpoint_.server ) /helm-charts/vpms/$ ( $chartInfo.name ) :$ ( $chartInfo.version ) "
2323 $this.WriteLog (" ~~~ SBOM: Getting related artifact $ ( $rootArtifact ) " )
24- $discoverCommand = " oras discover -o json --artifact-type 'mend/sbom' $ ( $rootArtifact ) "
25- $discover = (oras discover - o json -- artifact- type ' mend/sbom' $ ($rootArtifact )) -join " `n "
24+ $discoverCommand = " oras discover --format json --artifact-type 'mend/sbom' $ ( $rootArtifact ) "
25+ $discover = (oras discover -- format json -- artifact- type ' mend/sbom' $ ($rootArtifact )) -join " `n "
2626 $discoverExitCode = $LASTEXITCODE
2727 $this.WriteLog (" ~~~ SBOM: oras discover - Exit Code: $ ( $discoverExitCode ) " )
2828
@@ -33,32 +33,32 @@ foreach($chartInfo in $entity._helm_charts_)
3333 $this.WriteLog (" ~~~ SBOM: $ ( $discoverCommand ) successful:" )
3434 $this.WriteLog (" ~~~ SBOM: $ ( $discoverJson ) " )
3535
36- if (-not [bool ]$discoverJson.PSObject.Properties [' manifests ' ])
36+ if (-not [bool ]$discoverJson.PSObject.Properties [' referrers ' ])
3737 {
38- $errorMessage = " ~~~ SBOM: Manifests field for $ ( $rootArtifact ) does not exist! Skipping license upload ..."
38+ $errorMessage = " ~~~ SBOM: Referrers field for $ ( $rootArtifact ) does not exist! Skipping license upload ..."
3939 $this.WriteError ($errorMessage )
4040 return @ { " statusCode" = 500 ; " errorMessage" = $errorMessage } | ConvertTo-Json
4141 }
4242
43- if (($discoverJson.manifests | Measure-Object ).Count -eq 0 )
43+ if (($discoverJson.referrers | Measure-Object ).Count -eq 0 )
4444 {
45- $errorMessage = " ~~~ SBOM: Manifests field for $ ( $rootArtifact ) has zero elements! Skipping license upload ..."
45+ $errorMessage = " ~~~ SBOM: Referrers field for $ ( $rootArtifact ) has zero elements! Skipping license upload ..."
4646 $this.WriteError ($errorMessage )
4747 return @ { " statusCode" = 500 ; " errorMessage" = $errorMessage } | ConvertTo-Json
4848 }
4949 else
5050 {
51- if (($discoverJson.manifests | Measure-Object ).Count -gt 1 )
51+ if (($discoverJson.referrers | Measure-Object ).Count -gt 1 )
5252 {
53- $errorMessage = " ~~~ SBOM: Manifests field for $ ( $rootArtifact ) has more than one element! Only considering first element ..."
53+ $errorMessage = " ~~~ SBOM: Referrers field for $ ( $rootArtifact ) has more than one element! Only considering first element ..."
5454 $this.WriteError ($errorMessage )
5555 return @ { " statusCode" = 500 ; " errorMessage" = $errorMessage } | ConvertTo-Json
5656 }
5757
5858 # Download Artifacts
5959 New-Item - ItemType Directory - Path $downloadDirectory
60- $pullCommand = " oras pull -o $downloadDirectory $rootArtifact @$ ( ( $discover | ConvertFrom-Json ).manifests [0 ].digest) "
61- $pull = (oras pull - o $downloadDirectory $rootArtifact @$ (( $discover | ConvertFrom-Json ).manifests [0 ].digest)) -join " `n "
60+ $pullCommand = " oras pull -o $downloadDirectory $rootArtifact @$ ( $discoverJson .referrers [0 ].digest) "
61+ $pull = (oras pull - o $downloadDirectory $rootArtifact @$ ($discoverJson .referrers [0 ].digest)) -join " `n "
6262 $pullExitCode = $LASTEXITCODE
6363 $this.WriteLog (" ~~~ SBOM: oras pull Exit Code: $ ( $pullExitCode ) " )
6464
0 commit comments