hauler-dev / hauler

Airgap Container Swiss Army Knife
https://hauler.dev
Apache License 2.0
127 stars 30 forks source link

[BUG] Tilde (~) seems to be an invalid character for local files #275

Open mddamato opened 3 months ago

mddamato commented 3 months ago

Environmental Info:

Linux 6aa12afc0914 5.15.49-linuxkit-pr #1 SMP Thu May 25 07:17:40 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Hauler Version:

1.0.4

Describe the Bug:

local files that contain a tilde "~" are not accepted.

Steps to Reproduce:

curl -LO https://rpm.rancher.io/rke2/stable/1.27/centos/8/x86_64/rke2-server-1.27.1~rke2r1-0.el8.x86_64.rpm
apiVersion: content.hauler.cattle.io/v1alpha1
kind: Files
metadata:
  name: hauler-content-files-example
spec:
  files:
    - path: rke2-server-1.27.1~rke2r1-0.el8.x86_64.rpm
      name: packages/rke2-server-1.27.1~rke2r1-0.el8.x86_64.rpm

Expected Behavior:

file downloaded, stored

Actual Behavior:

error message

2024-07-26 16:58:18 ERR could not parse reference: packages/rke2-server-1.27.1~rke2r1-0.el8.x86_64.rpm
dweomer commented 3 months ago

file blob refs have the same naming restrictions as any other oci image. the tilde is a disallowed character as per spec, iirc. see:


that said, this failure mode is cryptic at best

mddamato commented 3 months ago

@dweomer Understood. Shame that the official RKE2 rpms upstream have a tilde in it then.

dweomer commented 3 months ago

@dweomer Understood. Shame that the official RKE2 rpms upstream have a tilde in it then.

I think we can get around this with some annotation hackery.

zackbradys commented 3 months ago

Example RKE2 Manifest: https://github.com/zackbradys/rancher-airgap/blob/main/hauler/rke2/rancher-airgap-rke2.yaml

Script to generate the above RKE2 Manifest: https://github.com/zackbradys/rancher-airgap/blob/main/hauler/scripts/rke2/hauler-rke2.sh

zackbradys commented 2 months ago

Hey @mddamato, were you able to take a look at this again and the referenced examples?

zackbradys commented 1 month ago

Hey @mddamato, checking back on this!

mddamato commented 1 month ago

Removing the tilde works, of course. My problem stems from my effort to maintain the naming convention from upstream.

Example: Sometimes doing a reposync to maintain the metadata/repo database makes sense. If the names of the files are changed then I have to rebuild the indexes.