canonical / rockcraft

Tool to create OCI Images using the language from Snapcraft and Charmcraft.
GNU General Public License v3.0
25 stars 33 forks source link

support project directory with remounted path #583

Open henrymao-zz opened 2 weeks ago

henrymao-zz commented 2 weeks ago

What needs to get done

Mounted path are not accessible at rockcraft packaging time.

In the following example, "debs" in project directory is mounted from another directory. Contents in "debs" are not visible in rockcraft shell, and not accessible during image packing.

#sudo mount --bind ../../target/debs/jammy/ debs
#rockcraft stage --shell
rockcraft-docker-lldp-on-amd64-for-amd64-3099612 ../project# ls debs
rockcraft-docker-lldp-on-amd64-for-amd64-3099612 ../project# exit
exit

#mount | grep debs
/dev/xvda1 on /home/ubuntu/sonic-buildimage/dockers/docker-lldp/debs type ext4 (rw,relatime,discard,errors=remount-ro)
sudo mount --bind ../../target/debs/jammy/ debs

Below is another failure log:

Building my-part                                                                                                                                                                            
:: + ls mounted original rockcraft.yaml                                                                                                                                                     
:: rockcraft.yaml                                                                                                                                                                           
::                                                                                                                                                                                          
:: mounted:                                                                                                                                                                                 
::                                                                                                                                                                                          
:: original:                                                                                                                                                                                
:: myfile                                                                                                                                                                                   
:: + cp mounted/myfile /root/parts/my-part/install/myfile                                                                                                                                   
:: cp: cannot stat 'mounted/myfile': No such file or directory                                                                                                                              
'override-build' in part 'my-part' failed with code 1.                                                                                                                                      
Recommended resolution: Review the scriptlet and make sure it's correct.                                                                                                                    
Failed to execute rockcraft in instance.                                                                                                                                                    
Full execution log: '/home/cris/.local/state/rockcraft/log/rockcraft-20240606-160506.454710.log'                                                                                            
cris@cris-laptop:/tmp/tmp.d7zfXGzS4A $ ls mounted/
myfile

Why it needs to get done

Mounted path are useful to handle large amount of files produced in earlier phases of build.