project-stacker / stacker

Build OCI images natively from a declarative format
https://stackerbuild.io
Apache License 2.0
197 stars 34 forks source link

stacker build fails when container name contains path separators "/" #275

Closed eusebiu-constantin-petu-dbk closed 2 years ago

eusebiu-constantin-petu-dbk commented 2 years ago

We need this for stacker publish to work with ghcr.io besides other things. Uploading an image to ghcr.io requires the repo name to be in the format: ghcr.io/OWNER/REPO

Basically there should be a way to name an image, currently there is no way besides "layer name" in stacker.yaml.

steps to reproduce: test.yaml:

peusebiu/zot:   ## <- see here!
  from:
    type: docker
    url: docker://centos:latest
  run: |
    touch /tmp/zot

logs:

peusebiu@PEUSEBIU-FC130:~/zot$ sudo ../stacker/stacker build -f test.yaml
using storage backend overlay
preparing image peusebiu/zot...
loading docker://centos:latest

Copying blob a1d0c7532777 skipped: already exists  
Copying config 8c1402b22a done  
Writing manifest to image destination
Storing signatures
error: write /proc/5318/attr/current: invalid argument
couldn't find AppArmor profile lxc-container-default-cgns
error: run commands failed: createtemp stacker_peusebiu/zot_run: pattern contains path separator
error: exit status 1
peusebiu@PEUSEBIU-FC130:~/zot$ 
peusebiu@PEUSEBIU-FC130:~/zot$ 

The issue arise when stacker creates the temp file for the run script and its pattern contains '/'

eusebiu-constantin-petu-dbk commented 2 years ago

we can use --url for the repo name, will close this