open-component-model / ocm

Open Component Model (Software Bill of Delivery) Toolset
https://ocm.software
Apache License 2.0
34 stars 23 forks source link

Adding local resource that is not on the same drive as the temp directory causes error (Windows) #649

Closed markrexwinkel closed 8 months ago

markrexwinkel commented 8 months ago

What happened:

When adding a Helm Chart resource to component archive using --input arguments, an error occurs:

adding resource helmChart: "name"="postgresql","version"="<componentversion>"...
Error: cannot get resource blob for "postgresql"(resource (by options)[1][1]): cannot synthesize artifact blob:  /Users: CreateFile /Users: The system cannot find the file specified.

What you expected to happen:

The resource should be added to the component archive without errors.

How to reproduce it (as minimally and precisely as possible):

Assuming you are in a directory: E:\t\bugrepo (it is important that the drive is different from the OS drive where the %TEMP% folder is)

# Create component archive
ocm create ca --file ca --scheme ocm.software/v3alpha1 --provider test.com test.com/test 1.0.0

# Pull Helm chart (normally this will be a Helm chart that is build in a pipeline
helm pull oci://registry-1.docker.io/bitnamicharts/postgresql --version 14.0.5

# Add resource (notice the double backslashes, it is a workaround for issue #648 )
ocm add resources --file ca --name postgresql --type helmChart --inputType helm --inputPath E:\\t\\bugrepo\\postgresql-14.0.5.tgz --inputVersion 14.0.5

Anything else we need to know: The problem is the full path for the --inputPath argument. What happens:

You can workaround this error by making sure all paths that are referenced including the component archive itself is on the same drive as the %TEMP% directory.

Environment:

OS: Windows 11 Pro 23H2 ocm: v0.6.0

hilmarf commented 7 months ago

Hi @markrexwinkel,

thanks for your ticket. It's a pleasure reading such good researched issues :-) Meanwhile @mandelsoft and me have created some fixes. Give it a try with the latest release v0.7.0.

Please let us know, if everything works as expected. Feel free to create follow-up tickets, if you find new bugs.

🖖 live long and prosper Hilmar

markrexwinkel commented 7 months ago

Hi @hilmarf,

I have tested it. Thanks for the quick fix!