diff --git a/.gitignore b/.gitignore index 0e8bb58..0d53129 100644 --- a/.gitignore +++ b/.gitignore @@ -18,14 +18,10 @@ artifacts local-artifacts airgap-scp.sh -# test artifacts -*.tar* -*.out - # generated dist/ tmp/ bin/ /store/ /registry/ -cmd/hauler/binaries \ No newline at end of file +cmd/hauler/binaries diff --git a/pkg/content/chart/chart_test.go b/pkg/content/chart/chart_test.go index 462f5eb..276c9fc 100644 --- a/pkg/content/chart/chart_test.go +++ b/pkg/content/chart/chart_test.go @@ -16,7 +16,7 @@ import ( ) var ( - chartpath = "../../../testdata/podinfo-6.0.3.tgz" + chartpath = "../../../testdata/rancher-cluster-templates-0.4.4.tgz" ) func TestNewChart(t *testing.T) { @@ -48,13 +48,13 @@ func TestNewChart(t *testing.T) { }, want: v1.Descriptor{ MediaType: consts.ChartLayerMediaType, - Size: 13524, + Size: 13102, Digest: v1.Hash{ Algorithm: "sha256", - Hex: "e30b95a08787de69ffdad3c232d65cfb131b5b50c6fd44295f48a078fceaa44e", + Hex: "4b3bb4e474b54bf9057b298f8f11c239bb561396716d8cd5fc369c407fba2965", }, Annotations: map[string]string{ - ocispec.AnnotationTitle: "podinfo-6.0.3.tgz", + ocispec.AnnotationTitle: "rancher-cluster-templates-0.4.4.tgz", }, }, wantErr: false, @@ -72,18 +72,18 @@ func TestNewChart(t *testing.T) { // TODO: Use a mock helm server name: "should fetch a remote chart", args: args{ - name: "ingress-nginx", - opts: &action.ChartPathOptions{RepoURL: "https://kubernetes.github.io/ingress-nginx", Version: "4.0.16"}, + name: "cert-manager", + opts: &action.ChartPathOptions{RepoURL: "https://charts.jetstack.io", Version: "1.14.4"}, }, want: v1.Descriptor{ MediaType: consts.ChartLayerMediaType, - Size: 38591, + Size: 80674, Digest: v1.Hash{ Algorithm: "sha256", - Hex: "b0ea91f7febc6708ad9971871d2de6e8feb2072110c3add6dd7082d90753caa2", + Hex: "5775fdbc1881d6e510df76d38753af54b86bd14caa8edb28fdbb79527042dede", }, Annotations: map[string]string{ - ocispec.AnnotationTitle: "ingress-nginx-4.0.16.tgz", + ocispec.AnnotationTitle: "cert-manager-v1.14.4.tgz", }, }, wantErr: false, diff --git a/testdata/chart-collection.yaml b/testdata/chart-collection.yaml deleted file mode 100644 index c597211..0000000 --- a/testdata/chart-collection.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -apiVersion: collection.hauler.cattle.io/v1alpha1 -kind: ThickCharts -metadata: - name: mythickchart -spec: - charts: - # charts are also fetched and served as OCI content (currently experimental in helm) - # HELM_EXPERIMENTAL_OCI=1 helm chart pull /loki:2.6.2 -# - name: loki -# repoURL: https://grafana.github.io/helm-charts - -# - name: longhorn -# repoURL: https://charts.longhorn.io - -# - name: cert-manager -# repoURL: https://charts.jetstack.io -# version: v1.6.1 -# extraImages: -# - ref: quay.io/jetstack/cert-manager-cainjector:v1.6.1 - - - name: podinfo - repoURL: https://stefanprodan.github.io/podinfo diff --git a/testdata/contents.yaml b/testdata/contents.yaml deleted file mode 100644 index e150a2c..0000000 --- a/testdata/contents.yaml +++ /dev/null @@ -1,56 +0,0 @@ -apiVersion: content.hauler.cattle.io/v1alpha1 -kind: Files -metadata: - name: myfile -spec: - files: - # hauler can save/redistribute files on disk (be careful! paths are relative) - - path: testdata/contents.yaml - - # when directories are specified, the directory contents will be archived and stored - - path: testdata/ - - # hauler can also fetch remote content, and will "smartly" identify filenames _when possible_ - # filename below = "k3s-images.txt" - - path: "https://github.com/k3s-io/k3s/releases/download/v1.22.2%2Bk3s2/k3s-images.txt" - - # when discovered filenames are not desired, a file name can be specified - - path: https://get.k3s.io - name: k3s-init.sh - ---- -apiVersion: content.hauler.cattle.io/v1alpha1 -kind: Images -metadata: - name: myimage -spec: - images: - # images can be referenced shorthanded without a tag - - name: hello-world - - # or namespaced with a tag - - name: rancher/cowsay:latest - - # or by their digest: - - name: registry@sha256:42043edfae481178f07aa077fa872fcc242e276d302f4ac2026d9d2eb65b955f - - # or fully qualified from any OCI compliant registry registry - - name: ghcr.io/fluxcd/flux-cli:v0.22.0 - ---- -apiVersion: content.hauler.cattle.io/v1alpha1 -kind: Charts -metadata: - name: mychart -spec: - charts: - # charts are also fetched and served as OCI content (currently experimental in helm) - # HELM_EXPERIMENTAL_OCI=1 helm chart pull /loki:2.6.2 - - name: loki - repoURL: https://grafana.github.io/helm-charts -# version: latest # the latest version will be used when version is empty - - # specific versions can also be used - - name: rancher - repoURL: https://releases.rancher.com/server-charts/latest - version: 2.6.2 diff --git a/testdata/haul.tar.zst b/testdata/haul.tar.zst new file mode 100644 index 0000000..70afa7a Binary files /dev/null and b/testdata/haul.tar.zst differ diff --git a/testdata/hauler-manifest.yaml b/testdata/hauler-manifest.yaml new file mode 100644 index 0000000..4681f2f --- /dev/null +++ b/testdata/hauler-manifest.yaml @@ -0,0 +1,26 @@ +apiVersion: content.hauler.cattle.io/v1alpha1 +kind: Images +metadata: + name: hauler-content-images-example +spec: + images: + - name: busybox:latest +--- +apiVersion: content.hauler.cattle.io/v1alpha1 +kind: Charts +metadata: + name: hauler-content-charts-example +spec: + charts: + - name: rancher + repoURL: https://releases.rancher.com/server-charts/stable + version: 2.8.2 +--- +apiVersion: content.hauler.cattle.io/v1alpha1 +kind: Files +metadata: + name: hauler-content-files-example +spec: + files: + - path: https://get.rke2.io + name: install.sh diff --git a/testdata/k3s-collection.yaml b/testdata/k3s-collection.yaml deleted file mode 100644 index 90bf804..0000000 --- a/testdata/k3s-collection.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -apiVersion: collection.hauler.cattle.io/v1alpha1 -kind: K3s -metadata: - name: myk3s -spec: - # version can be exact (as listed on https://github.com/k3s-io/k3s/releases) - version: v1.22.2+k3s2 - - # or can point to a channel, in which case the latest version in the channel is used: https://update.k3s.io/v1-release/channels -# version: stable -# version: latest -# version: v1.22 \ No newline at end of file diff --git a/testdata/podinfo-6.0.3.tgz b/testdata/podinfo-6.0.3.tgz deleted file mode 100644 index 4369425..0000000 Binary files a/testdata/podinfo-6.0.3.tgz and /dev/null differ diff --git a/testdata/rancher-cluster-templates-0.4.4.tgz b/testdata/rancher-cluster-templates-0.4.4.tgz new file mode 100644 index 0000000..991ebc4 Binary files /dev/null and b/testdata/rancher-cluster-templates-0.4.4.tgz differ