butane icon indicating copy to clipboard operation
butane copied to clipboard

Cannot transpile config with storage tree of current directory

Open bostrt opened this issue 3 years ago • 1 comments

I'm sure there's another way I can organize my code, but I hit a snag while trying to using ./ as a storage tree value. I'm honestly not sure if this a use-case that fcct intends to support, but figured I would still an issue.

Basically, I have my fcct-test.yaml, Dockerfile, and some "blog" (example) code in same root folder.

The reason I've filed this issue is that technically, -d ./ suggests I can include local files from the current directory but its not being accepted.

$ fcct --version
Fedora CoreOS Config Transpiler 0.6.0

$ ls 
blog-posts/  Dockerfile  fcct-test.yaml
$ cat fcct-test.yaml | fcct -d ./ --pretty --strict
error at $.storage.trees.0, line 26 col 7: local file path traverses outside the files directory
Error translating config: source config is invalid
$ cat fcct-test.yaml 
variant: fcos
version: 1.1.0
systemd:
  units:
    - name: build-blog.service
      enabled: true
      contents: |
        [Unit]
        Description=Build blog container
        After=network-online.target
        Wants=network-online.target
        [Service]
        # Run as non-root user
        User=core
        # Give time for the build to complete
        TimeoutStartSec=10m
        Type=oneshot
        RemainAfterExit=yes
        ExecStartPre=-podman pull docker.io/library/nginx
        ExecStart=-podman build -t localhost/blog:latest /home/core/blog-build/
        ExecStartPost=-podman image prune --force
        [Install]
        WantedBy=multi-user.target
storage:
  trees:
    - local: ./
      path: /home/core/blog-build/

bostrt avatar Jul 16 '20 04:07 bostrt

Yup, this is a bug. It should be legal for storage.trees.local to be exactly equal to FilesDir, but EnsurePathWithinFilesDir() requires it to be a child of FilesDir instead. Thanks for reporting.

bgilbert avatar Dec 24 '21 07:12 bgilbert