1 Answer
- Newest
- Most votes
- Most comments
0
Can you please provide a complete example and more details to help identify what may have gone wrong? In particular:
- How are you providing
<file on my computer>
and<my file hash>
? - "The package could not be successfully fetched from CodeArtifact." - What do you mean by this? A smaller than expected file came back, or you saw an error?
I was just able to test this successfully. One possibility is that you provided a file path for the AssetContent
parameter, expecting similar behavior as the aws cli. If you provided a path string (like 'C:\some-file.txt'
), then the content of that string is what will be saved as the asset file, not the contents of the file at that path. That could explain the small asset size. Here is a working example that provides a FileInfo
object to AssetContent
(string
, string[]
, System.IO.FileInfo
or System.IO.Stream
are acceptable types per these docs).
$AssetFilePath = 'C:\some-file.txt'
$AssetFile = ([System.IO.FileInfo]$AssetFilePath)
$AssetSHA256 = (Get-FileHash -Path $AssetFile -Algorithm SHA256).Hash
Publish-CAPackageVersion
-Domain test-domain
-Repository test-repository
-Format generic
-Namespace test-ns
-Package test-generic-package
-PackageVersion 1.0.0
-AssetContent $AssetFile
-AssetName some-file.txt
-AssetSHA256 $AssetSHA256
answered 7 months ago
Relevant content
- asked 2 years ago
- asked 6 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
That did the trick. Thank you so much Brian! I missed that the asset content had to be of type FileInfo.