project-stacker/stacker

Bug: weird issue with work directory path

Opened this issue · 3 comments

mjf commented

stacker version

v0.40.1-e54a685 liblxc a330126b45c7c3b6fcf0f9ba6c1eda7bdb4e508a

Describe the bug

For example

$ pwd
/home/user/tmp/2023-01-19-stacker-test-13:13:06

Then create the sample hello.stacker.yaml and the hello_stacker.go files from the docs in the directory and continue with the example from the docs...

$ stacker build -f hello.stacker.yaml
preparing image build-hello-stacker...
copying /home/user/tmp/2023-01-19-stacker-test-13:13:06/hello_stacker.go
loading docker://zothub.io/c3/ubuntu/go-devel-amd64:1.19.2
error: couldn't import base layer go-devel-amd64: Invalid image 13:06/.stacker/layer-bases/oci:go-devel-amd64
error: exit status 1

👎

To reproduce

  1. Configuration - none
  2. Client tool used - the stacker utility only
  3. Seen error - see above

Expected behavior

Work directory path doesn't mess up stacker execution.

Screenshots

No response

Additional context

No response

curl -fsSL https://github.com/project-stacker/stacker/releases/download/v1.0.0-rc2/stacker -o stacker

chmod +x

@mjf pls. get the latest stacker like so ^
Also pls share your stacker file so we can try to reproduce the error.

$ ls
hello_stacker.go  hello_stacker.yaml  stacker


$ cat hello_stacker.go 
package main

import "fmt"

func main() {
	fmt.Println("vim-go")
}


$ cat hello_stacker.yaml 
build-hello-stacker:
  from:
    type: docker
    url: docker://zothub.io/c3/ubuntu/go-devel-amd64:1.19.2
  import:
    - path: hello_stacker.go
      dest: /src/
  run: |
    source /etc/profile
    cd /src
    go build -v hello_stacker.go
    go run hello_stacker.go


$ ./stacker build -f hello_stacker.yaml 
preparing image build-hello-stacker...
copying /home/ram/tmp/t/hello_stacker.go
loading docker://zothub.io/c3/ubuntu/go-devel-amd64:1.19.2
Copying blob b900f44d647a [------------------------------------] 0.0b / 180.0MiB
Copying config 3ece5b544e done  
Writing manifest to image destination
Storing signatures
cache miss because layer definition was changed
+ source /etc/profile
+ export 'HOME=/go'
+ export 'GOROOT=/opt/go'
+ export 'PATH=/opt/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
+ mkdir -p /tmp/go/cache
+ export 'GOCACHE=/tmp/go/cache'
+ cd /src
+ go build -v hello_stacker.go
command-line-arguments
+ go run hello_stacker.go
vim-go
filesystem build-hello-stacker built successfully
smoser commented

The problem here is just the ':' in the path (as I think @mjf suspected).

Stacker uses 'oci' repository on disk. The error then is when stacker tries to copy "docker://zothub.io/c3/ubuntu/go-devel-amd64:1.19.2" to local disk (or maybe copying it out). In an "oci url", the format is ":" delimited.

 oci:<path>:tag

And in this case, ':" occurs in the path, so that is confusing things.
I'm not sure if there is an easy path out (involving correctly escaping or quoting) or not.