tinkerbell / actions

Suite of Tinkerbell Actions for use in Tinkerbell Workflows
Apache License 2.0
27 stars 42 forks source link

Document the image2disk action support for the Zstandard decompression and rename the extension to zst #65

Open rgl opened 2 years ago

rgl commented 2 years ago

Document the support for the Zstandard decompression and rename the extension from .zs to .zst in https://github.com/tinkerbell/hub/search?q=zstd.

tstromberg commented 2 years ago

This sounds like a perfect good first issue. Feel free to send over a PR and I'll review it!

rgl commented 2 years ago

while trying to implement this with the workflow:

root@provisioner:~# tink workflow get 2ae17713-1b09-11ec-9f98-0242ac120002 --format json | jq -r .data[].data
version: "0.1"
name: esxi
global_timeout: 1800
tasks:
  - name: esxi-install
    worker: '08:00:27:00:00:02'
    volumes:
      - /dev:/dev
      - /sys/firmware/efi/efivars:/sys/firmware/efi/efivars
      - /worker:/worker
    actions:
      - name: reset-uefi-boot
        image: reset-uefi-boot
      - name: install
        image: image2disk:v1.0.0
        environment:
          IMG_URL: 'http://10.3.0.2:8080/images/esxi-amd64.raw.zs'
          COMPRESSED: true
          DEST_DISK: '/dev/sda'
      - name: reboot
        image: reboot

image2disk:v1.0.0 seems to crash (please note that the image at http://10.3.0.2:8080/images/esxi-amd64.raw.zs really exists):

IMAGE2DISK - Cloud image streamer
INFO[0000] Beginning write of image [esxi-amd64.raw.zs] to disk [/dev/sda]
FATA[0000] nil input provided as reader

by looking at the code at https://github.com/tinkerbell/hub/blob/9dbfd747f8754314e03441bd91aa8093dcc851f4/actions/image2disk/v1/pkg/image/image.go#L148-L155 I'm a bit confused by the defer Close(). isn't this findDecompressor function returning a closed stream? shouldn't the caller be the one calling Close?

I might also be looking at the wrong source code, as there is no v1.0.0 tag in this repository.

nshalman commented 2 years ago

I might also be looking at the wrong source code, as there is no v1.0.0 tag in this repository.

If you're planning on trying to implement the fix, my suggestion would be to work with the latest code in the repo, build the image locally, push it to your image repository for testing, and then we can bump the image version when we have the fix.

Do you need additional help figuring out how to do that?